changeset 192:3202a2a427b1 default tip

bug fix
author tatsuki
date Tue, 20 Jan 2015 09:30:59 +0900
parents 5d0734fd859d
children
files .project .settings/org.eclipse.jdt.core.prefs lib/commons-collections-3.2.1.jar lib/functionaljava.jar lib/guava-12.0-sources.jar lib/guava-12.0.jar settings.gradle src/main/java/alice/jungle/datasegment/transformer/NetworkAppendChildAt.java src/main/java/alice/jungle/transaction/JungleUpdater.java src/main/java/app/bbs/DistributeApp.java src/main/java/app/bbs/NetworkBulletinBoard.java src/main/java/app/bbs/NetworkJungleBulletinBoard.java src/main/java/app/bbs/ShowMessageWithTimeStampServlet.java src/main/java/app/bbs/codesegment/StartBBSCodeSegment.java
diffstat 14 files changed, 633 insertions(+), 648 deletions(-) [+]
line wrap: on
line diff
--- a/.project	Thu Jan 15 09:23:23 2015 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-  <name>jungle-network</name>
-  <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
-  <projects/>
-  <buildSpec>
-    <buildCommand>
-      <name>org.eclipse.jdt.core.javabuilder</name>
-    </buildCommand>
-    <buildCommand>
-      <name>org.eclipse.m2e.core.maven2Builder</name>
-    </buildCommand>
-  </buildSpec>
-  <natures>
-    <nature>org.eclipse.m2e.core.maven2Nature</nature>
-    <nature>org.eclipse.jdt.core.javanature</nature>
-  </natures>
-</projectDescription>
\ No newline at end of file
--- a/.settings/org.eclipse.jdt.core.prefs	Thu Jan 15 09:23:23 2015 +0900
+++ b/.settings/org.eclipse.jdt.core.prefs	Tue Jan 20 09:30:59 2015 +0900
@@ -1,13 +1,15 @@
+#
+#Thu Jan 15 09:34:36 JST 2015
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.source=1.8
 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.8
Binary file lib/commons-collections-3.2.1.jar has changed
Binary file lib/functionaljava.jar has changed
Binary file lib/guava-12.0-sources.jar has changed
Binary file lib/guava-12.0.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/settings.gradle	Tue Jan 20 09:30:59 2015 +0900
@@ -0,0 +1,1 @@
+rootProject.name = 'jungle-network'
--- a/src/main/java/alice/jungle/datasegment/transformer/NetworkAppendChildAt.java	Thu Jan 15 09:23:23 2015 +0900
+++ b/src/main/java/alice/jungle/datasegment/transformer/NetworkAppendChildAt.java	Tue Jan 20 09:30:59 2015 +0900
@@ -1,6 +1,5 @@
 package alice.jungle.datasegment.transformer;
 
-import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.LoggingNode;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog;
@@ -8,13 +7,8 @@
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error;
-import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair;
-
 import org.msgpack.annotation.Message;
 
-import fj.data.List;
-import fj.data.TreeMap;
-
 
 /*
  * This code same AppendChildAt. 
--- a/src/main/java/alice/jungle/transaction/JungleUpdater.java	Thu Jan 15 09:23:23 2015 +0900
+++ b/src/main/java/alice/jungle/transaction/JungleUpdater.java	Tue Jan 20 09:30:59 2015 +0900
@@ -54,10 +54,12 @@
 				NodeOperation nodeOp, int pos) {
 			String key = "";
 			Command c = nodeOp.getCommand();
+			System.out.println("path = " + path.toString());
 		switch (c) {
 		case PUT_ATTRIBUTE:
 			key = nodeOp.getKey();
 			ByteBuffer value = nodeOp.getValue();
+			System.out.println("key = " + key + " : " + "value = " + new String(value.array()));
 			return editor.putAttribute(path, key, value);
 		case DELETE_ATTRIBUTE:
 			key = nodeOp.getKey();
--- a/src/main/java/app/bbs/DistributeApp.java	Thu Jan 15 09:23:23 2015 +0900
+++ b/src/main/java/app/bbs/DistributeApp.java	Tue Jan 20 09:30:59 2015 +0900
@@ -1,6 +1,5 @@
 package app.bbs;
 
-import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.TreeMapOrd;
 import alice.jungle.remote.RemoteConfig;
 import alice.topology.node.TopologyNode;
 import app.bbs.codesegment.StartBBSCodeSegment;
@@ -8,8 +7,8 @@
 public class DistributeApp {
     public static void main(String[] args) throws Exception {
         RemoteConfig conf = new RemoteConfig(args);
+        System.out.println(System.getProperty("java.version"));
         if (conf.getManagerHostName() == null) {
-          System.out.println(System.getProperty("java.version"));
             // String localHostName ="localhost";
             // HostMessage host = new HostMessage(localHostName, conf.localPort);
             StartBBSCodeSegment cs1 = new StartBBSCodeSegment(args, conf.bbsPort);
--- a/src/main/java/app/bbs/NetworkBulletinBoard.java	Thu Jan 15 09:23:23 2015 +0900
+++ b/src/main/java/app/bbs/NetworkBulletinBoard.java	Tue Jan 20 09:30:59 2015 +0900
@@ -1,7 +1,6 @@
 package app.bbs;
 
 
-import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs.BoardMessage;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs.BulletinBoard;
 
 
@@ -9,7 +8,6 @@
 	public void init();
 	public int getRequestNum();
 	public long getRenewTime(String boardName);
-	public Iterable<BoardMessage> getFolder(String _boardName, String nodeNum);
 	public void createFolder(String boardName, String author, String msg,String key, String _nodeNum);
 	public void createAttribute(String boardName, String uuid, String author, String msg, String key);
 	public void editAttribute(String boardName, String path, String id, String message);
--- a/src/main/java/app/bbs/NetworkJungleBulletinBoard.java	Thu Jan 15 09:23:23 2015 +0900
+++ b/src/main/java/app/bbs/NetworkJungleBulletinBoard.java	Tue Jan 20 09:30:59 2015 +0900
@@ -4,6 +4,7 @@
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.concurrent.atomic.AtomicInteger;
+
 import alice.jungle.core.NetworkDefaultJungle;
 import alice.jungle.persistent.AliceJournal;
 import alice.jungle.persistent.NetworkJournal;
@@ -13,6 +14,7 @@
 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.bbs.BoardMessage;
+import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs.GetAttributeImp;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Children;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeList;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeListReader;
@@ -33,669 +35,673 @@
 import junit.framework.Assert;
 
 public class NetworkJungleBulletinBoard implements NetworkBulletinBoard {
-	private final Jungle jungle;
-	private final NetworkJournal journal;
-	private final String LOG_DIR;
-	private Boolean persistentFlag;
-	private AtomicInteger requestCounter;
-	private long renewTime;
+  protected final Jungle jungle;
+  private final NetworkJournal journal;
+  private final String LOG_DIR;
+  private Boolean persistentFlag;
+  private AtomicInteger requestCounter;
+  private long renewTime;
 
-	private NetworkJungleBulletinBoard(String _uuid, NetworkJournal _journal) {
-		journal = _journal;
-		jungle = new NetworkDefaultJungle(journal, _uuid,
-				new DefaultTreeEditor(new DefaultTraverser()));
-		BulletinBoardJungleManager.setJungle(jungle);
-		persistentFlag = false;
-		requestCounter = BulletinBoardJungleManager.getRequestCounter();
-		LOG_DIR = "./log";
-		renewTime = 0;
-	}
+  private NetworkJungleBulletinBoard(String _uuid, NetworkJournal _journal) {
+    journal = _journal;
+    jungle = new NetworkDefaultJungle(journal, _uuid, new DefaultTreeEditor(new DefaultTraverser()));
+    BulletinBoardJungleManager.setJungle(jungle);
+    persistentFlag = false;
+    requestCounter = BulletinBoardJungleManager.getRequestCounter();
+    LOG_DIR = "./log";
+    renewTime = 0;
+  }
 
-	public NetworkJungleBulletinBoard(String _uuid) {
-		this(_uuid, new AliceJournal());
-		jungle.createNewTree("boards");
-	}
+  public NetworkJungleBulletinBoard(String _uuid) {
+    this(_uuid, new AliceJournal());
+    jungle.createNewTree("boards");
+  }
 
-	public static NetworkBulletinBoard NewPersistentJungle(String _uuid) {
-		NetworkJungleBulletinBoard board = new NetworkJungleBulletinBoard(
-				_uuid, new PersistentJournal());
-		board.persistentFlag = true;
-		return board;
-	}
+  public static NetworkBulletinBoard NewPersistentJungle(String _uuid) {
+    NetworkJungleBulletinBoard board = new NetworkJungleBulletinBoard(_uuid, new PersistentJournal());
+    board.persistentFlag = true;
+    return board;
+  }
 
-	public void init() {
-		if (!persistentFlag) {
-			return;
-		}
-		checkAndCreateLogDirectory();
-		try {
-			commitLogRecover();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-	}
+  public void init() {
+    if (!persistentFlag) {
+      return;
+    }
+    checkAndCreateLogDirectory();
+    try {
+      commitLogRecover();
+    } catch (IOException e) {
+      e.printStackTrace();
+    }
+  }
 
-	public void checkAndCreateLogDirectory() {
-		File logFile = new File(LOG_DIR);
-		if (!logFile.exists()) {
-			logFile.mkdir();
-			return;
-		}
-		if (logFile.isFile()) {
-			logFile.delete();
-			logFile.mkdir();
-		}
-	}
+  public void checkAndCreateLogDirectory() {
+    File logFile = new File(LOG_DIR);
+    if (!logFile.exists()) {
+      logFile.mkdir();
+      return;
+    }
+    if (logFile.isFile()) {
+      logFile.delete();
+      logFile.mkdir();
+    }
+  }
 
-	public void commitLogRecover() throws IOException {
-		File[] logFiles = new File(LOG_DIR).listFiles();
-		for (File logFile : logFiles) {
-			commitLogRecover(logFile);
-			logFile.delete();
-		}
-		if (jungle.getTreeByName("boards") == null) {
-			jungle.createNewTree("boards");
-		}
-	}
+  public void commitLogRecover() throws IOException {
+    File[] logFiles = new File(LOG_DIR).listFiles();
+    for (File logFile : logFiles) {
+      commitLogRecover(logFile);
+      logFile.delete();
+    }
+    if (jungle.getTreeByName("boards") == null) {
+      jungle.createNewTree("boards");
+    }
+  }
 
-	private void commitLogRecover(File logFile) throws IOException {
-		journal.setInputFile(logFile);
-		ChangeListReader reader = journal.getReader();
-		if (reader == null)
-			return;
-		for (ChangeList chList : reader) {
-			String treeName = chList.getTreeName();
-			JungleTree tree = jungle.getTreeByName(treeName);
-			if (tree == null) {
-				tree = jungle.createNewTree(treeName);
-			}
-			JungleTreeEditor editor = tree.getLocalTreeEditor();
-			Either<Error, JungleTreeEditor> either = JungleUpdater.edit(editor,
-					chList);
-			editor = either.b();
-			if (either.isA()) {
-				throw new IOException("Failed commit log recovery");
-			}
-			editor.success();
-		}
-	}
+  private void commitLogRecover(File logFile) throws IOException {
+    journal.setInputFile(logFile);
+    ChangeListReader reader = journal.getReader();
+    if (reader == null)
+      return;
+    for (ChangeList chList : reader) {
+      String treeName = chList.getTreeName();
+      JungleTree tree = jungle.getTreeByName(treeName);
+      if (tree == null) {
+        tree = jungle.createNewTree(treeName);
+      }
+      JungleTreeEditor editor = tree.getLocalTreeEditor();
+      Either<Error, JungleTreeEditor> either = JungleUpdater.edit(editor, chList);
+      editor = either.b();
+      if (either.isA()) {
+        throw new IOException("Failed commit log recovery");
+      }
+      editor.success();
+    }
+  }
 
-	public Iterable<String> getBoards() {
-		JungleTree tree = jungle.getTreeByName("boards");
-		TreeNode node = tree.getRootNode();
-		Children chs = node.getChildren();
+  public Iterable<String> getBoards() {
+    JungleTree tree = jungle.getTreeByName("boards");
+    TreeNode node = tree.getRootNode();
+    Children chs = node.getChildren();
+
+    IterableConverter.Converter<String, TreeNode> converter = new IterableConverter.Converter<String, TreeNode>() {
+      public String conv(TreeNode _b) {
+        ByteBuffer e = _b.getAttributes().get("name");
+        System.out.println(new String(e.array()));
+        return new String(e.array());
+      }
+    };
 
-		IterableConverter.Converter<String, TreeNode> converter = new IterableConverter.Converter<String, TreeNode>() {
-			public String conv(TreeNode _b) {
-				ByteBuffer e = _b.getAttributes().get("name");
-				System.out.println(new String(e.array()));
-				return new String(e.array());
-			}
-		};
+    return new IterableConverter<String, TreeNode>(chs, converter);
+  }
 
-		return new IterableConverter<String, TreeNode>(chs, converter);
-	}
+  public long getRenewTime(String _boardName) {
+    return renewTime;
+  }
 
-	public long getRenewTime(String _boardName) {
-		return renewTime;
-	}
+  public void createBoards(final String _name, final String _author, final String _initMessage, final String _editKey) {
+    requestCounter.incrementAndGet();
+    if (null == jungle.createNewTree(_name)) {
+      throw new IllegalStateException();
+    }
 
-	public void createBoards(final String _name, final String _author, final String _initMessage, final String _editKey) {
-		requestCounter.incrementAndGet();
-		if (null == jungle.createNewTree(_name)) {
-			throw new IllegalStateException();
-		}
+    JungleTree tree = jungle.getTreeByName("boards");
+    JungleTreeEditor editor = tree.getTreeEditor();
+    DefaultNodePath root = new DefaultNodePath();
+    Either<Error, JungleTreeEditor> either = editor.addNewChildAt(root, 0);
+    if (either.isA()) {
+      throw new IllegalStateException();
+    }
+    editor = either.b();
 
-		JungleTree tree = jungle.getTreeByName("boards");
-		JungleTreeEditor editor = tree.getTreeEditor();
-		DefaultNodePath root = new DefaultNodePath();
-		Either<Error, JungleTreeEditor> either = editor.addNewChildAt(root, 0);
-		if (either.isA()) {
-			throw new IllegalStateException();
-		}
-		editor = either.b();
+    either = editor.putAttribute(root.add(0), "name", ByteBuffer.wrap(_name.getBytes()));
+    if (either.isA()) {
+      throw new IllegalStateException();
+    }
+    editor = either.b();
+    final long timestamp = System.currentTimeMillis();
+    ByteBuffer tBuffer = ByteBuffer.allocate(16);
+    tBuffer.putLong(timestamp);
+    either = editor.putAttribute(root.add(0), "timestamp", tBuffer);
+    if (either.isA()) {
+      throw new IllegalStateException();
+    }
+    either = either.b().success();
+    if (either.isA()) {
+      throw new IllegalStateException();
+    }
 
-		either = editor.putAttribute(root.add(0), "name",
-				ByteBuffer.wrap(_name.getBytes()));
-		if (either.isA()) {
-			throw new IllegalStateException();
-		}
-		editor = either.b();
-		final long timestamp = System.currentTimeMillis();
-		ByteBuffer tBuffer = ByteBuffer.allocate(16);
-		tBuffer.putLong(timestamp);
-		either = editor.putAttribute(root.add(0), "timestamp", tBuffer);
-		if (either.isA()) {
-			throw new IllegalStateException();
-		}
-		either = either.b().success();
-		if (either.isA()) {
-			throw new IllegalStateException();
-		}
+    tree = jungle.getTreeByName(_name);
+    editor = tree.getTreeEditor();
+    either = editor.addNewChildAt(root, 0);
+    if (either.isA()) {
+      throw new IllegalStateException();
+    }
+    editor = either.b();
+
+    NodeEditor e = new NodeEditor() {
+      ByteBuffer tBuffer2 = ByteBuffer.allocate(16);
 
-		tree = jungle.getTreeByName(_name);
-		editor = tree.getTreeEditor();
-		either = editor.addNewChildAt(root, 0);
-		if (either.isA()) {
-			throw new IllegalStateException();
-		}
-		editor = either.b();
+      public Either<Error, LoggingNode> edit(TreeNode node) {
+        LoggingNode logNode = wrap(node, new DefaultOperationLog());
+        logNode = logNode.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
+        logNode = logNode.getAttributes().put("mes", ByteBuffer.wrap(_initMessage.getBytes())).b();
+        logNode = logNode.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
+        tBuffer2.putLong(timestamp);
+        logNode = logNode.getAttributes().put("timestamp", tBuffer2).b();
+        return DefaultEither.newB(logNode);
+      }
 
-		NodeEditor e = new NodeEditor() {
-			ByteBuffer tBuffer2 = ByteBuffer.allocate(16);
+      @Override
+      public LoggingNode wrap(TreeNode node, OperationLog op) {
+        return new LoggingNode(node, op);
+      }
+    };
 
-			public Either<Error,LoggingNode> edit(TreeNode node) {
-				LoggingNode logNode = wrap(node , new DefaultOperationLog());
-				logNode = logNode.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
-				logNode = logNode.getAttributes().put("mes", ByteBuffer.wrap(_initMessage.getBytes())).b();
-				logNode = logNode.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
-				tBuffer2.putLong(timestamp);
-				logNode = logNode.getAttributes().put("timestamp", tBuffer2).b();
-				return DefaultEither.newB(logNode);
-			}
-			@Override
-			public LoggingNode wrap(TreeNode node, OperationLog op) {
-				return new LoggingNode(node, op);
-			}
-		};
+    either = editor.edit(root.add(0), e);
+    if (either.isA()) {
+      throw new IllegalStateException();
+    }
+    either.b().success();
+
+  }
+
+  public void createFolder(final String _board, final String _author, final String _message, final String _editKey,
+      String _nodeNum) {
+    JungleTree tree = jungle.getTreeByName(_board);
+    if (tree == null) {
+      throw new IllegalStateException();
+    }
 
-		either = editor.edit(root.add(0), e);
-		if (either.isA()) {
-			throw new IllegalStateException();
-		}
-		either.b().success();
+    DefaultNodePath path = new DefaultNodePath();
+    try {
+      for (int count = 0; _nodeNum.substring(count, count + 1) != null; count++) {
+        if (!_nodeNum.substring(count, count + 1).equals("/"))
+          path = path.add(Integer.parseInt(_nodeNum.substring(count, count + 1)));
+      }
+    } catch (Exception _e) {
+    }
+    requestCounter.incrementAndGet();
+    Either<Error, JungleTreeEditor> either;
+    final long timestamp = System.currentTimeMillis();
+    final ByteBuffer tBuffer = ByteBuffer.allocate(16);
+    tBuffer.putLong(timestamp);
 
-	}
-
-	public void createFolder(final String _board, final String _author, final String _message, final String _editKey, String _nodeNum) {
-		JungleTree tree = jungle.getTreeByName(_board);
-		if (tree == null) {
-			throw new IllegalStateException();
-		}
+    do {
+      TreeNode node = tree.getRootNode();
+      DefaultTraverser traverser = new DefaultTraverser();
+      // TraversableNodeWrapper<Node> traversable = new
+      // TraversableNodeWrapper<Node>(node);
+      DefaultEvaluator evaluator = new DefaultEvaluator(path);
+      Either<Error, Traversal> ret = traverser.traverse(node, evaluator);
+      if (ret.isA()) {
+        Assert.fail();
+      }
 
-		DefaultNodePath path = new DefaultNodePath();
-		try {
-			for (int count = 0; _nodeNum.substring(count, count + 1) != null; count++) {
-				if (!_nodeNum.substring(count, count + 1).equals("/"))
-					path = path.add(Integer.parseInt(_nodeNum.substring(count,
-							count + 1)));
-			}
-		} catch (Exception _e) {
-		}
-		requestCounter.incrementAndGet();
-		Either<Error, JungleTreeEditor> either;
-		final long timestamp = System.currentTimeMillis();
-		final ByteBuffer tBuffer = ByteBuffer.allocate(16);
-		tBuffer.putLong(timestamp);
+      Traversal traversal = ret.b();
+      TreeNode target = traversal.destination();
+      int size = target.getChildren().size();
+      JungleTreeEditor editor = tree.getTreeEditor();
+      either = editor.addNewChildAt(path, size);
+      if (either.isA()) {
+        throw new IllegalStateException();
+      }
+      editor = either.b();
+
+      NodeEditor e = new NodeEditor() {
+
+        public Either<Error, LoggingNode> edit(TreeNode node) {
+          LoggingNode logNode = wrap(node, new DefaultOperationLog());
+          logNode = logNode.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
+          logNode = logNode.getAttributes().put("timestamp", tBuffer).b();
+          return DefaultEither.newB(logNode);
+        }
 
-		do {
-			TreeNode node = tree.getRootNode();
-			DefaultTraverser traverser = new DefaultTraverser();
-			// TraversableNodeWrapper<Node> traversable = new
-			// TraversableNodeWrapper<Node>(node);
-			DefaultEvaluator evaluator = new DefaultEvaluator(path);
-			Either<Error, Traversal> ret = traverser.traverse(node,
-					evaluator);
-			if (ret.isA()) {
-				Assert.fail();
-			}
+        @Override
+        public LoggingNode wrap(TreeNode node, OperationLog op) {
+          return new LoggingNode(node, op);
+        }
 
-			Traversal traversal = ret.b();
-			TreeNode target = traversal.destination();
-			int size = target.getChildren().size();
-			JungleTreeEditor editor = tree.getTreeEditor();
-			either = editor.addNewChildAt(path, size);
-			if (either.isA()) {
-				throw new IllegalStateException();
-			}
-			editor = either.b();
-
-			NodeEditor e = new NodeEditor() {
+      };
+      path = path.add(size);
+      either = editor.edit(path, e);
+      if (either.isA()) {
+        throw new IllegalStateException();
+      }
+      editor = either.b();
+      either = editor.success();
+    } while (either.isA());
 
-				public Either<Error,LoggingNode> edit(TreeNode node) {
-					LoggingNode logNode = wrap(node , new DefaultOperationLog());
-					logNode = logNode.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
-					logNode = logNode.getAttributes().put("timestamp", tBuffer).b();
-					return DefaultEither.newB(logNode);
-				}
+  }
 
-				@Override
-				public LoggingNode wrap(TreeNode node, OperationLog op) {
-					return new LoggingNode(node, op);
-				}
+  public void createBoardMessage(final String _board, final String _author, final String _message, final String _editKey) {
+    requestCounter.incrementAndGet();
+    JungleTree tree = jungle.getTreeByName(_board);
+    if (tree == null) {
+      throw new IllegalStateException();
+    }
 
-			};
-			path = path.add(size);
-			either = editor.edit(path, e);
-			if (either.isA()) {
-				throw new IllegalStateException();
-			}
-			editor = either.b();
-			either = editor.success();
-		} while (either.isA());
+    Either<Error, JungleTreeEditor> either;
+    final long timestamp = System.currentTimeMillis();
+    final ByteBuffer tBuffer = ByteBuffer.allocate(16);
+    tBuffer.putLong(timestamp);
+    do {
 
-	}
+      TreeNode node = tree.getRootNode();
+      int size = node.getChildren().size();
+      DefaultNodePath path = new DefaultNodePath();
 
-	public void createBoardMessage(final String _board, final String _author, final String _message, final String _editKey) {
-		requestCounter.incrementAndGet();
-		JungleTree tree = jungle.getTreeByName(_board);
-		if (tree == null) {
-			throw new IllegalStateException();
-		}
+      JungleTreeEditor editor = tree.getTreeEditor();
+      either = editor.addNewChildAt(path, size);
+      if (either.isA()) {
+        throw new IllegalStateException();
+      }
+      editor = either.b();
 
-		Either<Error, JungleTreeEditor> either;
-		final long timestamp = System.currentTimeMillis();
-		final ByteBuffer tBuffer = ByteBuffer.allocate(16);
-		tBuffer.putLong(timestamp);
-		do {
-
-			TreeNode node = tree.getRootNode();
-			int size = node.getChildren().size();
-			DefaultNodePath path = new DefaultNodePath();
+      NodeEditor e = new NodeEditor() {
+        public Either<Error, LoggingNode> edit(TreeNode node) {
+          LoggingNode logNode = wrap(node, new DefaultOperationLog());
+          logNode = logNode.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
+          logNode = logNode.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
+          logNode = logNode.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
+          logNode = logNode.getAttributes().put("timestamp", tBuffer).b();
+          return DefaultEither.newB(logNode);
+        }
 
-			JungleTreeEditor editor = tree.getTreeEditor();
-			either = editor.addNewChildAt(path, size);
-			if (either.isA()) {
-				throw new IllegalStateException();
-			}
-			editor = either.b();
+        @Override
+        public LoggingNode wrap(TreeNode node, OperationLog op) {
+          return new LoggingNode(node, op);
+        }
+      };
+      path = path.add(size);
+      either = editor.edit(path, e);
+      if (either.isA()) {
+        throw new IllegalStateException();
+      }
+      editor = either.b();
+      either = editor.success();
+    } while (either.isA());
 
-			NodeEditor e = new NodeEditor() {
-				public Either<Error,LoggingNode> edit(TreeNode node) {
-					LoggingNode logNode = wrap(node , new DefaultOperationLog());
-					logNode = logNode.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
-					logNode = logNode.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
-					logNode = logNode.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
-					logNode = logNode.getAttributes().put("timestamp", tBuffer).b();
-					return DefaultEither.newB(logNode);
-				}
+  }
 
-				@Override
-				public LoggingNode wrap(TreeNode node, OperationLog op) {
-					return new LoggingNode(node, op);
-				}
-			};
-			path = path.add(size);
-			either = editor.edit(path, e);
-			if (either.isA()) {
-				throw new IllegalStateException();
-			}
-			editor = either.b();
-			either = editor.success();
-		} while (either.isA());
-
-	}
+  public void editMessage(String _board, String _nodeNum, final String _author, final String _message,
+      final String _editKey) {
+    requestCounter.incrementAndGet();
+    final long timestamp = System.currentTimeMillis();
+    final ByteBuffer tBuffer = ByteBuffer.allocate(16);
+    tBuffer.putLong(timestamp);
+    JungleTree tree = jungle.getTreeByName(_board);
+    Either<Error, JungleTreeEditor> either = null;
 
-	public void editMessage(String _board, String _nodeNum,final String _author, final String _message, final String _editKey) {
-		requestCounter.incrementAndGet();
-		final long timestamp = System.currentTimeMillis();
-		final ByteBuffer tBuffer = ByteBuffer.allocate(16);
-		tBuffer.putLong(timestamp);
-		JungleTree tree = jungle.getTreeByName(_board);
-		Either<Error, JungleTreeEditor> either = null;
+    do {
+      DefaultNodePath path = new DefaultNodePath();
+      try {
+        for (int count = 0; _nodeNum.substring(count, count + 1) != null; count++) {
+          if (!_nodeNum.substring(count, count + 1).equals("/"))
+            path = path.add(Integer.parseInt(_nodeNum.substring(count, count + 1)));
+        }
+      } catch (Exception _e) {
+      }
+      JungleTreeEditor editor = tree.getTreeEditor();
+      NodeEditor e = new NodeEditor() {
+        public Either<Error, LoggingNode> edit(TreeNode node) {
+          LoggingNode logNode = wrap(node, new DefaultOperationLog());
+          System.out.println(new String(node.getAttributes().get("mes").array()));
+          logNode = logNode.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
+          logNode = logNode.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
+          logNode = logNode.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
+          logNode = logNode.getAttributes().put("timestamp", tBuffer).b();
+          System.out.println(new String(node.getAttributes().get("mes").array()));
+          return DefaultEither.newB(logNode);
+        }
 
-		do {
-			DefaultNodePath path = new DefaultNodePath();
-			try {
-				for (int count = 0; _nodeNum.substring(count, count + 1) != null; count++) {
-					if (!_nodeNum.substring(count, count + 1).equals("/"))
-						path = path.add(Integer.parseInt(_nodeNum.substring(count, count + 1)));
-				}
-			} catch (Exception _e) {
-			}
-			JungleTreeEditor editor = tree.getTreeEditor();
-			NodeEditor e = new NodeEditor() {
-				public Either<Error,LoggingNode> edit(TreeNode node) {
-					LoggingNode logNode = wrap(node , new DefaultOperationLog());
-					System.out.println(new String(node.getAttributes().get("mes").array()));
-					logNode = logNode.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
-					logNode = logNode.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
-					logNode = logNode.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
-					logNode = logNode.getAttributes().put("timestamp", tBuffer).b();
-					System.out.println(new String(node.getAttributes().get("mes").array()));
-					return DefaultEither.newB(logNode);
-				}
+        @Override
+        public LoggingNode wrap(TreeNode node, OperationLog op) {
+          return new LoggingNode(node, op);
+        }
+      };
+      either = editor.edit(path, e);
+      if (either.isA()) {
+        throw new IllegalStateException();
+      }
+      editor = either.b();
+      either = editor.success();
+    } while (either.isA());
+    renewTime = timestamp;
+  }
 
-				@Override
-				public LoggingNode wrap(TreeNode node, OperationLog op) {
-					return new LoggingNode(node, op);
-				}
-			};
-			either = editor.edit(path, e);
-			if (either.isA()) {
-				throw new IllegalStateException();
-			}
-			editor = either.b();
-			either = editor.success();
-		} while (either.isA());
-		renewTime = timestamp;
-	}
+  public void createAttribute(String _board, String _uuid, final String _author, final String _message,
+      final String _editKey) {
+    requestCounter.incrementAndGet();
+    final long timestamp = System.currentTimeMillis();
+    final ByteBuffer tBuffer = ByteBuffer.allocate(16);
+    tBuffer.putLong(timestamp);
+    JungleTree tree = jungle.getTreeByName(_board);
+    Either<Error, JungleTreeEditor> either = null;
+    DefaultNodePath path = new DefaultNodePath();
+    do {
+      try {
+        for (int count = 0; _uuid.substring(count, count + 1) != null; count++) {
+          if (!_uuid.substring(count, count + 1).equals("/"))
+            path = path.add(Integer.parseInt(_uuid.substring(count, count + 1)));
+        }
+      } catch (Exception _e) {
+      }
 
-	public void createAttribute(String _board, String _uuid, final String _author, final String _message, final String _editKey) {
-		requestCounter.incrementAndGet();
-		final long timestamp = System.currentTimeMillis();
-		final ByteBuffer tBuffer = ByteBuffer.allocate(16);
-		tBuffer.putLong(timestamp);
-		JungleTree tree = jungle.getTreeByName(_board);
-		Either<Error, JungleTreeEditor> either = null;
-		DefaultNodePath path = new DefaultNodePath();
-		do {
-			try {
-				for (int count = 0; _uuid.substring(count, count + 1) != null; count++) {
-					if (!_uuid.substring(count, count + 1).equals("/"))
-						path = path.add(Integer.parseInt(_uuid.substring(count,
-								count + 1)));
-				}
-			} catch (Exception _e) {
-			}
+      JungleTreeEditor editor = tree.getTreeEditor();
+      NodeEditor e = new NodeEditor() {
+        String str;
 
-			JungleTreeEditor editor = tree.getTreeEditor();
-			NodeEditor e = new NodeEditor() {
-				String str;
+        public Either<Error, LoggingNode> edit(TreeNode node) {
+          LoggingNode logNode = wrap(node, new DefaultOperationLog());
+          str = "0";
+          int count = 0;
+          for (; logNode.getAttributes().get("mes" + String.valueOf(count)) != null; count++) {
+          }
+          str = String.valueOf(count);
+          logNode = logNode.getAttributes().put("mes" + str, ByteBuffer.wrap(_message.getBytes())).b();
+          logNode = logNode.getAttributes().put("timestamp" + str, tBuffer).b();
+          return DefaultEither.newB(logNode);
+        }
 
-				public Either<Error,LoggingNode> edit(TreeNode node) {
-					LoggingNode logNode = wrap(node , new DefaultOperationLog());
-					str = "0";
-					int count = 0;
-					for (; logNode.getAttributes().get("mes" + String.valueOf(count)) != null; count++) {
-					}
-					str = String.valueOf(count);
-					logNode = logNode.getAttributes().put("mes" + str,ByteBuffer.wrap(_message.getBytes())).b();
-					logNode = logNode.getAttributes().put("timestamp" + str, tBuffer).b();
-					return DefaultEither.newB(logNode);
-				}
+        @Override
+        public LoggingNode wrap(TreeNode node, OperationLog op) {
+          return new LoggingNode(node, op);
+        }
+      };
+      either = editor.edit(path, e);
+      if (either.isA()) {
+        throw new IllegalStateException();
+      }
+      editor = either.b();
+      either = editor.success();
+    } while (either.isA());
+  }
 
-				@Override
-				public LoggingNode wrap(TreeNode node, OperationLog op) {
-					return new LoggingNode(node, op);
-				}
-			};
-			either = editor.edit(path, e);
-			if (either.isA()) {
-				throw new IllegalStateException();
-			}
-			editor = either.b();
-			either = editor.success();
-		} while (either.isA());
-	}
+  public void editAttribute(String boardName, String _path, final String id, final String _message) {
+    requestCounter.incrementAndGet();
+    final long timestamp = System.currentTimeMillis();
+    final ByteBuffer tBuffer = ByteBuffer.allocate(16);
+    tBuffer.putLong(timestamp);
+    JungleTree tree = jungle.getTreeByName(boardName);
+    Either<Error, JungleTreeEditor> either = null;
+    DefaultNodePath path = new DefaultNodePath();
+    do {
+      try {
+        for (int count = 0; _path.substring(count, count + 1) != null; count++) {
+          if (!_path.substring(count, count + 1).equals("/"))
+            path = path.add(Integer.parseInt(_path.substring(count, count + 1)));
+        }
+      } catch (Exception _e) {
+      }
 
-	public void editAttribute(String boardName, String _path, final String id, final String _message) {
-		requestCounter.incrementAndGet();
-		final long timestamp = System.currentTimeMillis();
-		final ByteBuffer tBuffer = ByteBuffer.allocate(16);
-		tBuffer.putLong(timestamp);
-		JungleTree tree = jungle.getTreeByName(boardName);
-		Either<Error, JungleTreeEditor> either = null;
-		DefaultNodePath path = new DefaultNodePath();
-		do {
-			try {
-				for (int count = 0; _path.substring(count, count + 1) != null; count++) {
-					if (!_path.substring(count, count + 1).equals("/"))
-						path = path.add(Integer.parseInt(_path.substring(count,
-								count + 1)));
-				}
-			} catch (Exception _e) {
-			}
+      JungleTreeEditor editor = tree.getTreeEditor();
+      NodeEditor e = new NodeEditor() {
+        public Either<Error, LoggingNode> edit(TreeNode node) {
+          LoggingNode logNode = wrap(node, new DefaultOperationLog());
+          // EnableNodeWrapper<T> node = _e.getWrap();
+          logNode = logNode.getAttributes().put("mes" + id, ByteBuffer.wrap(_message.getBytes())).b();
+          logNode = logNode.getAttributes().put("timestamp" + id, tBuffer).b();
+          return DefaultEither.newB(logNode);
+        }
 
-			JungleTreeEditor editor = tree.getTreeEditor();
-			NodeEditor e = new NodeEditor() {
-				public Either<Error,LoggingNode> edit(TreeNode node) {
-					LoggingNode logNode = wrap(node , new DefaultOperationLog());
-					// EnableNodeWrapper<T> node = _e.getWrap();
-					logNode = logNode.getAttributes().put("mes" + id,ByteBuffer.wrap(_message.getBytes())).b();
-					logNode = logNode.getAttributes().put("timestamp" + id, tBuffer).b();
-					return DefaultEither.newB(logNode);
-				}
+        @Override
+        public LoggingNode wrap(TreeNode node, OperationLog op) {
+          return new LoggingNode(node, op);
+        }
+      };
+      either = editor.edit(path, e);
+      if (either.isA()) {
+        throw new IllegalStateException();
+      }
+      editor = either.b();
+      either = editor.success();
+    } while (either.isA());
+  }
 
-				@Override
-				public LoggingNode wrap(TreeNode node, OperationLog op) {
-					return new LoggingNode(node, op);
-				}
-			};
-			either = editor.edit(path, e);
-			if (either.isA()) {
-				throw new IllegalStateException();
-			}
-			editor = either.b();
-			either = editor.success();
-		} while (either.isA());
-	}
+  public void deleteNode(String _board, String _path, String _id) {
+    requestCounter.incrementAndGet();
+    int id = Integer.parseInt(_id);
+    final long timestamp = System.currentTimeMillis();
+    final ByteBuffer tBuffer = ByteBuffer.allocate(16);
+    tBuffer.putLong(timestamp);
+    JungleTree tree = jungle.getTreeByName(_board);
+    Either<Error, JungleTreeEditor> either = null;
+    DefaultNodePath path = new DefaultNodePath();
+    do {
+      try {
+        for (int count = 0; _path.substring(count, count + 1) != null; count++) {
+          if (!_path.substring(count, count + 1).equals("/"))
+            path = path.add(Integer.parseInt(_path.substring(count, count + 1)));
+        }
+      } catch (Exception _e) {
+      }
 
-	public void deleteNode(String _board, String _path, String _id) {
-		requestCounter.incrementAndGet();
-		int id = Integer.parseInt(_id);
-		final long timestamp = System.currentTimeMillis();
-		final ByteBuffer tBuffer = ByteBuffer.allocate(16);
-		tBuffer.putLong(timestamp);
-		JungleTree tree = jungle.getTreeByName(_board);
-		Either<Error, JungleTreeEditor> either = null;
-		DefaultNodePath path = new DefaultNodePath();
-		do {
-			try {
-				for (int count = 0; _path.substring(count, count + 1) != null; count++) {
-					if (!_path.substring(count, count + 1).equals("/"))
-						path = path.add(Integer.parseInt(_path.substring(count,count + 1)));
-				}
-			} catch (Exception _e) {
-			}
-
-			JungleTreeEditor editor = tree.getTreeEditor();
+      JungleTreeEditor editor = tree.getTreeEditor();
 
-			either = editor.deleteChildAt(path, id);
-			if (either.isA()) {
-				throw new IllegalStateException();
-			}
-			editor = either.b();
-			either = editor.success();
-		} while (either.isA());
+      either = editor.deleteChildAt(path, id);
+      if (either.isA()) {
+        throw new IllegalStateException();
+      }
+      editor = either.b();
+      either = editor.success();
+    } while (either.isA());
 
-	}
+  }
 
-	public void deleteAttribute(String _board, String _path, final String id) {
-		requestCounter.incrementAndGet();
-		final long timestamp = System.currentTimeMillis();
-		final ByteBuffer tBuffer = ByteBuffer.allocate(16);
-		tBuffer.putLong(timestamp);
-		JungleTree tree = jungle.getTreeByName(_board);
-		Either<Error, JungleTreeEditor> either = null;
-		DefaultNodePath path = new DefaultNodePath();
-		do {
-			try {
-				for (int count = 0; _path.substring(count, count + 1) != null; count++) {
-					if (!_path.substring(count, count + 1).equals("/"))
-						path = path.add(Integer.parseInt(_path.substring(count,
-								count + 1)));
-				}
-			} catch (Exception _e) {
-				System.out.println("屑");
-			}
+  public void deleteAttribute(String _board, String _path, final String id) {
+    requestCounter.incrementAndGet();
+    final long timestamp = System.currentTimeMillis();
+    final ByteBuffer tBuffer = ByteBuffer.allocate(16);
+    tBuffer.putLong(timestamp);
+    JungleTree tree = jungle.getTreeByName(_board);
+    Either<Error, JungleTreeEditor> either = null;
+    DefaultNodePath path = new DefaultNodePath();
+    do {
+      try {
+        for (int count = 0; _path.substring(count, count + 1) != null; count++) {
+          if (!_path.substring(count, count + 1).equals("/"))
+            path = path.add(Integer.parseInt(_path.substring(count, count + 1)));
+        }
+      } catch (Exception _e) {
+        System.out.println("屑");
+      }
 
-			JungleTreeEditor editor = tree.getTreeEditor();
-			NodeEditor e = new NodeEditor() {
-				public Either<Error,LoggingNode> edit(TreeNode node) {
-					LoggingNode logNode = wrap(node , new DefaultOperationLog());
-					logNode = logNode.getAttributes().delete("mes" + id).b();
-					logNode = logNode.getAttributes().delete("timestamp" + id).b();
-					int count = Integer.parseInt(id);
-					for (; logNode.getAttributes().get("mes" + String.valueOf(count + 1)) != null;) {
-						logNode = logNode.getAttributes().put("mes" + count,node.getAttributes().get("mes"+ String.valueOf(count + 1))).b();
-						logNode = logNode.getAttributes().put("timestamp" + count, tBuffer).b();
-						count++;
-					}
-					if (count != Integer.parseInt(id)) {
-						logNode = logNode.getAttributes().delete("timestamp" + count).b();
-						logNode = logNode.getAttributes().delete("mes" + count).b();
-					}
+      JungleTreeEditor editor = tree.getTreeEditor();
+      NodeEditor e = new NodeEditor() {
+        public Either<Error, LoggingNode> edit(TreeNode node) {
+          LoggingNode logNode = wrap(node, new DefaultOperationLog());
+          logNode = logNode.getAttributes().delete("mes" + id).b();
+          logNode = logNode.getAttributes().delete("timestamp" + id).b();
+          int count = Integer.parseInt(id);
+          for (; logNode.getAttributes().get("mes" + String.valueOf(count + 1)) != null;) {
+            logNode = logNode.getAttributes()
+                .put("mes" + count, node.getAttributes().get("mes" + String.valueOf(count + 1))).b();
+            logNode = logNode.getAttributes().put("timestamp" + count, tBuffer).b();
+            count++;
+          }
+          if (count != Integer.parseInt(id)) {
+            logNode = logNode.getAttributes().delete("timestamp" + count).b();
+            logNode = logNode.getAttributes().delete("mes" + count).b();
+          }
+
+          return DefaultEither.newB(logNode);
+        }
 
-					return DefaultEither.newB(logNode);
-				}
+        @Override
+        public LoggingNode wrap(TreeNode node, OperationLog op) {
+          return new LoggingNode(node, op);
+        }
+      };
+      either = editor.edit(path, e);
+      if (either.isA()) {
+        throw new IllegalStateException();
+      }
+      editor = either.b();
+      either = editor.success();
+    } while (either.isA());
+  }
 
-				@Override
-				public LoggingNode wrap(TreeNode node, OperationLog op) {
-					return new LoggingNode(node, op);
-				}
-			};
-			either = editor.edit(path, e);
-			if (either.isA()) {
-				throw new IllegalStateException();
-			}
-			editor = either.b();
-			either = editor.success();
-		} while (either.isA());
-	}
+  public void editMatrixMessage(String _board, String _uuid, final String _author, final String _message,
+      final String _editKey) {
+    requestCounter.incrementAndGet();
+    final long timestamp = System.currentTimeMillis();
+    final ByteBuffer tBuffer = ByteBuffer.allocate(16);
+    tBuffer.putLong(timestamp);
+    JungleTree tree = jungle.getTreeByName(_board);
+    Either<Error, JungleTreeEditor> either = null;
+    do {
+      DefaultNodePath path = new DefaultNodePath();
+      path = path.add(Integer.parseInt(_uuid));
 
-	public void editMatrixMessage(String _board, String _uuid,
-			final String _author, final String _message, final String _editKey) {
-		requestCounter.incrementAndGet();
-		final long timestamp = System.currentTimeMillis();
-		final ByteBuffer tBuffer = ByteBuffer.allocate(16);
-		tBuffer.putLong(timestamp);
-		JungleTree tree = jungle.getTreeByName(_board);
-		Either<Error, JungleTreeEditor> either = null;
-		do {
-			DefaultNodePath path = new DefaultNodePath();
-			path = path.add(Integer.parseInt(_uuid));
+      JungleTreeEditor editor = tree.getTreeEditor();
+      NodeEditor e = new NodeEditor() {
+        public Either<Error, LoggingNode> edit(TreeNode node) {
+          LoggingNode logNode = wrap(node, new DefaultOperationLog());
+          logNode = logNode.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
+          logNode = logNode.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
+          logNode = logNode.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
+          logNode = logNode.getAttributes().put("timestamp", tBuffer).b();
+          return DefaultEither.newB(logNode);
+        }
 
-			JungleTreeEditor editor = tree.getTreeEditor();
-			NodeEditor e = new NodeEditor() {
-				public Either<Error,LoggingNode> edit(TreeNode node) {
-					LoggingNode logNode = wrap(node , new DefaultOperationLog());
-					logNode = logNode.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
-					logNode = logNode.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
-					logNode = logNode.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
-					logNode = logNode.getAttributes().put("timestamp", tBuffer).b();
-					return DefaultEither.newB(logNode);
-				}
+        @Override
+        public LoggingNode wrap(TreeNode node, OperationLog op) {
+          return new LoggingNode(node, op);
+        }
+      };
+      either = editor.edit(path, e);
+      if (either.isA()) {
+        throw new IllegalStateException();
+      }
+      editor = either.b();
+      either = editor.success();
+    } while (either.isA());
+    renewTime = timestamp;
+  }
+
+  public Iterable<BoardMessage> getFolder(String _boardName, String _nodeNum) {
 
-				@Override
-				public LoggingNode wrap(TreeNode node, OperationLog op) {
-					return new LoggingNode(node, op);
-				}
-			};
-			either = editor.edit(path, e);
-			if (either.isA()) {
-				throw new IllegalStateException();
-			}
-			editor = either.b();
-			either = editor.success();
-		} while (either.isA());
-		renewTime = timestamp;
-	}
+    DefaultNodePath path = new DefaultNodePath();
+    try {
+      for (int count = 0; _nodeNum.substring(count, count + 1) != null; count++) {
+        if (!_nodeNum.substring(count, count + 1).equals("/"))
+          path = path.add(Integer.parseInt(_nodeNum.substring(count, count + 1)));
+      }
+    } catch (Exception _e) {
+    }
+    requestCounter.incrementAndGet();
+    JungleTree tree = jungle.getTreeByName(_boardName);
+    TreeNode node = tree.getRootNode();
 
-	public Iterable<BoardMessage> getMessages(String _boardName) {
-		requestCounter.incrementAndGet();
-		JungleTree tree = jungle.getTreeByName(_boardName);
-		TreeNode node = tree.getRootNode();
-		Children chs = node.getChildren();
-		final AtomicInteger counter = new AtomicInteger(0);
-		IterableConverter.Converter<BoardMessage, TreeNode> converter = new IterableConverter.Converter<BoardMessage, TreeNode>() {
-			public BoardMessage conv(TreeNode _b) {
-				String uuid = Integer.toString(counter.get());
-				String author = new String(_b.getAttributes().get("author").array());
-				String message = new String(_b.getAttributes().get("mes").array());
-				counter.incrementAndGet();
-				return new BoardMessageImpl(author, message, uuid);
-			}
-		};
-		return new IterableConverter<BoardMessage, TreeNode>(chs, converter);
-	}
+    DefaultTraverser traverser = new DefaultTraverser();
+    // TraversableNodeWrapper<Node> traversable = new
+    // TraversableNodeWrapper<Node>(node);
+    DefaultEvaluator evaluator = new DefaultEvaluator(path);
+    Either<Error, Traversal> ret = traverser.traverse(node, evaluator);
+    if (ret.isA()) {
+      Assert.fail();
+    }
 
-	public Iterable<BoardMessage> getFolder(String _boardName, String _nodeNum) {
+    Traversal traversal = ret.b();
+    TreeNode target = traversal.destination();
+    Children chs = target.getChildren();
 
-		DefaultNodePath path = new DefaultNodePath();
-		try {
-			for (int count = 0; _nodeNum.substring(count, count + 1) != null; count++) {
-				if (!_nodeNum.substring(count, count + 1).equals("/"))
-					path = path.add(Integer.parseInt(_nodeNum.substring(count,count + 1)));
-			}
-		} catch (Exception _e) {
-		}
-		requestCounter.incrementAndGet();
-		JungleTree tree = jungle.getTreeByName(_boardName);
-		TreeNode node = tree.getRootNode();
+    final AtomicInteger counter = new AtomicInteger(0);
+    IterableConverter.Converter<BoardMessage, TreeNode> converter = new IterableConverter.Converter<BoardMessage, TreeNode>() {
+      public BoardMessage conv(TreeNode _b) {
+        String uuid = Integer.toString(counter.get());
+        String message = new String(_b.getAttributes().get("mes").array());
+        counter.incrementAndGet();
+        return new BoardMessageImpl(null, message, uuid);
+      }
+    };
+    return new IterableConverter<BoardMessage, TreeNode>(chs, converter);
+  }
 
-		DefaultTraverser traverser = new DefaultTraverser();
-		// TraversableNodeWrapper<Node> traversable = new
-		// TraversableNodeWrapper<Node>(node);
-		DefaultEvaluator evaluator = new DefaultEvaluator(path);
-		Either<Error, Traversal> ret = traverser.traverse(node,
-				evaluator);
-		if (ret.isA()) {
-			Assert.fail();
-		}
+  public boolean compare(TreeNode compareNode, String compareAttribute) {
+    String labName = compareNode.getAttributes().getString("mes");
+    if (labName.equals(compareAttribute))
+      return true;
 
-		Traversal traversal = ret.b();
-		TreeNode target = traversal.destination();
-		Children chs = target.getChildren();
+    int loopCount = 0;
+    for (loopCount = 0; compareNode.getAttributes().getString("mes" + loopCount) != null; loopCount++) {
+      labName = compareNode.getAttributes().getString("mes" + loopCount);
+      if (labName.equals(compareAttribute))
+        return true;
+    }
+
+    return false;
+  }
+
+  public int getRequestNum() {
+    return requestCounter.get();
+  }
 
-		final AtomicInteger counter = new AtomicInteger(0);
-		IterableConverter.Converter<BoardMessage, TreeNode> converter = new IterableConverter.Converter<BoardMessage, TreeNode>() {
-			public BoardMessage conv(TreeNode _b) {
-				String uuid = Integer.toString(counter.get());
-				String message = new String(_b.getAttributes().get("mes")
-						.array());
-				counter.incrementAndGet();
-				return new BoardMessageImpl(null, message, uuid);
-			}
-		};
-		return new IterableConverter<BoardMessage, TreeNode>(chs, converter);
-	}
+  private static class BoardMessageImpl implements BoardMessage {
+    private final String author;
+    private final String message;
+    private final String uuid;
 
+    public BoardMessageImpl(String _author, String _message, String _uuid) {
+      author = _author;
+      message = _message;
+      uuid = _uuid;
+    }
 
-	
-	public boolean compare(TreeNode compareNode, String compareAttribute) {
-		String labName = compareNode.getAttributes().getString("mes");
-		if (labName.equals(compareAttribute))
-			return true;
+    public String getAuthor() {
+      return author;
+    }
 
-		int loopCount = 0;
-		for (loopCount = 0 ;compareNode.getAttributes().getString("mes" + loopCount) != null; loopCount++ ) {
-			labName = compareNode.getAttributes().getString("mes" + loopCount);
-			if (labName.equals(compareAttribute))
-				return true;
-		}
-		
-		return false;
-	}
-	
-	public int getRequestNum() {
-		return requestCounter.get();
-	}
+    public String getMessage() {
+      return message;
+    }
+
+    public String getUUID() {
+      return uuid;
+    }
+
+  }
 
-	private static class BoardMessageImpl implements BoardMessage {
-		private final String author;
-		private final String message;
-		private final String uuid;
+  public String sanitize(String str) {
+    if (str == null) {
+      return str;
+    }
+    str = str.replaceAll("&", "&amp;");
+    str = str.replaceAll("<", "&lt;");
+    str = str.replaceAll(">", "&gt;");
+    str = str.replaceAll("\"", "&quot;");
+    str = str.replaceAll("'", "&#39;");
+    return str;
+  }
 
-		public BoardMessageImpl(String _author, String _message, String _uuid) {
-			author = _author;
-			message = _message;
-			uuid = _uuid;
-		}
+  @Override
+  public GetAttributeImp getAttribute(String _bname, String _nodeNum, String revisionStr) {
 
-		public String getAuthor() {
-			return author;
-		}
-
-		public String getMessage() {
-			return message;
-		}
-
-		public String getUUID() {
-			return uuid;
-		}
+    DefaultNodePath path = new DefaultNodePath();
+    try {
+      for (int count = 0; _nodeNum.substring(count, count + 1) != null; count++) {
+        if (!_nodeNum.substring(count, count + 1).equals("/"))
+          path = path.add(Integer.parseInt(_nodeNum.substring(count, count + 1)));
+      }
+    } catch (Exception _e) {
+    }
+    JungleTree tree = jungle.getTreeByName(_bname);
+    System.out.println(tree.revision());
+    Long revision = Long.parseLong(revisionStr);
+    JungleTree oldTree = tree.getOldTree(revision).b();
+    System.out.println(oldTree.revision());
+    TreeNode node = oldTree.getRootNode();
 
-	}
+    DefaultTraverser traverser = new DefaultTraverser();
+    DefaultEvaluator evaluator = new DefaultEvaluator(path);
+    Either<Error, Traversal> ret = traverser.traverse(node, evaluator);
+    if (ret.isA()) {
+      Assert.fail();
+    }
 
-	public String sanitize(String str) {
-		if (str == null) {
-			return str;
-		}
-		str = str.replaceAll("&", "&amp;");
-		str = str.replaceAll("<", "&lt;");
-		str = str.replaceAll(">", "&gt;");
-		str = str.replaceAll("\"", "&quot;");
-		str = str.replaceAll("'", "&#39;");
-		return str;
-	}
+    Traversal traversal = ret.b();
+    TreeNode target = traversal.destination();
+    return new GetAttributeImp(target);
+  }
 }
--- a/src/main/java/app/bbs/ShowMessageWithTimeStampServlet.java	Thu Jan 15 09:23:23 2015 +0900
+++ b/src/main/java/app/bbs/ShowMessageWithTimeStampServlet.java	Tue Jan 20 09:30:59 2015 +0900
@@ -8,7 +8,10 @@
 
 import org.eclipse.jetty.util.thread.ThreadPool;
 
+import fj.data.List;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs.BoardMessage;
+import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs.GetAttributeImp;
+import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath;
 
 public class ShowMessageWithTimeStampServlet extends HttpServlet {
 	/**
@@ -50,12 +53,13 @@
 		_pw.write("<p>Message<br/> <input type='textarea' name='msg'/> </p>\n");
 		_pw.write("<p><input type='submit' value='submit'/></p>\n");
 		
-		for (BoardMessage msg : bbs.getMessages(_bname)) {//フォルダの表示
-			_pw.write("<hr/>");
-			_pw.write("<p> Author <b>" + bbs.sanitize(msg.getAuthor()) + "</b></p>");
-			_pw.write("<small><a href=" + editMessagePath + "?bname=" + bbs.sanitize(_bname)
-					+ "&uuid=" + msg.getUUID() + ">"+ bbs.sanitize(msg.getMessage()) +"</a></small><br>");
-		}
+     GetAttributeImp attribute = bbs.getAttribute(_bname, "[-1]","0");
+    List<String> keys = attribute.getKeys();
+    
+    for(String key : keys){
+      String mesage = attribute.getMessage(key);
+      _pw.write("<p>" + key + " = " + mesage + "</p>\n");
+    }
 
 		_pw.write("</body></html>");
 		_pw.flush();
--- a/src/main/java/app/bbs/codesegment/StartBBSCodeSegment.java	Thu Jan 15 09:23:23 2015 +0900
+++ b/src/main/java/app/bbs/codesegment/StartBBSCodeSegment.java	Tue Jan 20 09:30:59 2015 +0900
@@ -6,7 +6,6 @@
 import javax.servlet.Servlet;
 
 import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.handler.HandlerCollection;
 import org.eclipse.jetty.servlet.ServletHandler;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.eclipse.jetty.util.thread.ThreadPool;
@@ -104,9 +103,7 @@
         serv.setHandler(context);
         try {
             serv.start();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
+        } catch (Exception e) { }
         new LogUpdateCodeSegment();
     }