Mercurial > hg > Database > jungle-network
changeset 94:47e337fc4086
Implemented getLocalTreeEditor
author | one |
---|---|
date | Fri, 15 Nov 2013 12:36:36 +0900 |
parents | 75cf01a430a6 |
children | dcd767b76f8d |
files | src/alice/jungle/transaction/LocalTreeEditor.java src/alice/jungle/transaction/NetworkDefaultJungleTree.java |
diffstat | 2 files changed, 9 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/jungle/transaction/LocalTreeEditor.java Fri Nov 15 12:23:59 2013 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -package alice.jungle.transaction; - -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTreeEditor; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Node; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeListWriter; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.ChangeSet; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.TreeEditor; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.AtomicReservableReference; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.TreeContext; - -/** Edit tree without exporting logs. **/ -public class LocalTreeEditor<T extends TreeNode<T>> implements JungleTree { - private final AtomicReservableReference<TreeContext<T>> repository; - private final String uuid; - private final String treeName; - private final ChangeListWriter writer; - private final TreeEditor editor; - - public LocalTreeEditor(String _treeName, TreeContext<T> _tc,String _uuid,ChangeListWriter _writer,TreeEditor _editor) - { - treeName = _treeName; - repository = new AtomicReservableReference<TreeContext<T>>(_tc); - uuid = _uuid; - writer = _writer; - editor = _editor; - } - - @Override - public JungleTreeEditor getTreeEditor() - { - TreeContext<T> tc = repository.get(); - NetworkTransactionManager<T> txManager = new NetworkTransactionManager<T>(treeName, writer,tc,repository,uuid); - T root = tc.getTreeNode(); - return NetworkDefaultJungleTreeEditor.NewLocalJungleTreeEditor(treeName,root,txManager, editor); - } - - @Override - public Node getRootNode() - { - TreeContext<T> tc = repository.get(); - ChangeSet cs = tc.getChangeSet(); - return cs.getRoot(); - } - - -}
--- a/src/alice/jungle/transaction/NetworkDefaultJungleTree.java Fri Nov 15 12:23:59 2013 +0900 +++ b/src/alice/jungle/transaction/NetworkDefaultJungleTree.java Fri Nov 15 12:36:36 2013 +0900 @@ -36,6 +36,15 @@ } @Override + public JungleTreeEditor getLocalTreeEditor() + { + TreeContext<T> tc = repository.get(); + NetworkTransactionManager<T> txManager = new NetworkTransactionManager<T>(treeName, writer,tc,repository,uuid); + T root = tc.getTreeNode(); + return NetworkDefaultJungleTreeEditor.NewLocalJungleTreeEditor(treeName,root,txManager, editor); + } + + @Override public Node getRootNode() { TreeContext<T> tc = repository.get();