diff src/main/java/app/bbs/NetworkJungleBulletinBoard.java @ 177:6f104ab4eb81

fit jungle core but editMessage is not work
author tatsuki
date Mon, 01 Sep 2014 00:04:32 +0900
parents ac7d1070f449
children d6944d788121
line wrap: on
line diff
--- a/src/main/java/app/bbs/NetworkJungleBulletinBoard.java	Wed Jul 30 22:17:23 2014 +0900
+++ b/src/main/java/app/bbs/NetworkJungleBulletinBoard.java	Mon Sep 01 00:04:32 2014 +0900
@@ -16,13 +16,14 @@
 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.core.Children;
-import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Node;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeList;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeListReader;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultTreeEditor;
-import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TraversableNodeWrapper;
-import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.EditableNode;
+import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode;
+import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.DefaultOperationLog;
+import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.OperationLog;
+import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.PutAttributeOperation;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.NodeEditor;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.DefaultEvaluator;
 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.DefaultTraverser;
@@ -43,7 +44,8 @@
 
 	private NetworkJungleBulletinBoard(String _uuid, NetworkJournal _journal) {
 		journal = _journal;
-		jungle = new NetworkDefaultJungle(journal, _uuid, new DefaultTreeEditor(new DefaultTraverser()));
+		jungle = new NetworkDefaultJungle(journal, _uuid,
+				new DefaultTreeEditor(new DefaultTraverser()));
 		BulletinBoardJungleManager.setJungle(jungle);
 		persistentFlag = false;
 		requestCounter = BulletinBoardJungleManager.getRequestCounter();
@@ -57,7 +59,8 @@
 	}
 
 	public static NetworkBulletinBoard NewPersistentJungle(String _uuid) {
-		NetworkJungleBulletinBoard board = new NetworkJungleBulletinBoard( _uuid, new PersistentJournal());
+		NetworkJungleBulletinBoard board = new NetworkJungleBulletinBoard(
+				_uuid, new PersistentJournal());
 		board.persistentFlag = true;
 		return board;
 	}
@@ -109,7 +112,8 @@
 				tree = jungle.createNewTree(treeName);
 			}
 			JungleTreeEditor editor = tree.getLocalTreeEditor();
-			Either<Error, JungleTreeEditor> either = JungleUpdater.edit(editor, chList);
+			Either<Error, JungleTreeEditor> either = JungleUpdater.edit(editor,
+					chList);
 			editor = either.b();
 			if (either.isA()) {
 				throw new IOException("Failed commit log recovery");
@@ -120,18 +124,18 @@
 
 	public Iterable<String> getBoards() {
 		JungleTree tree = jungle.getTreeByName("boards");
-		Node node = tree.getRootNode();
-		Children<Node> chs = node.getChildren();
+		TreeNode node = tree.getRootNode();
+		Children<TreeNode> chs = node.getChildren();
 
-		IterableConverter.Converter<String, Node> converter = new IterableConverter.Converter<String, Node>() {
-			public String conv(Node _b) {
+		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, Node>(chs, converter);
+		return new IterableConverter<String, TreeNode>(chs, converter);
 	}
 
 	public long getRenewTime(String _boardName) {
@@ -153,7 +157,8 @@
 		}
 		editor = either.b();
 
-		either = editor.putAttribute(root.add(0), "name",ByteBuffer.wrap(_name.getBytes()));
+		either = editor.putAttribute(root.add(0), "name",
+				ByteBuffer.wrap(_name.getBytes()));
 		if (either.isA()) {
 			throw new IllegalStateException();
 		}
@@ -179,14 +184,26 @@
 		editor = either.b();
 
 		NodeEditor e = new NodeEditor() {
-			public <T extends EditableNode<T>> Either<Error, T> edit(T _e) {
-				_e = _e.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
-				_e = _e.getAttributes().put("mes", ByteBuffer.wrap(_initMessage.getBytes())).b();
-				_e = _e.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
-				ByteBuffer tBuffer2 = ByteBuffer.allocate(16);
+			ByteBuffer tBuffer2 = ByteBuffer.allocate(16);
+
+			public <T extends TreeNode> Either<Error, TreeNode> edit(T _e) {
+				TreeNode node = _e;
+				node = node.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
+				node = node.getAttributes().put("mes", ByteBuffer.wrap(_initMessage.getBytes())).b();
+				node = node.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
 				tBuffer2.putLong(timestamp);
-				_e = _e.getAttributes().put("timestamp", tBuffer2).b();
-				return DefaultEither.newB(_e);
+				node = node.getAttributes().put("timestamp", tBuffer2).b();
+				return DefaultEither.newB(node);
+			}
+
+			@Override
+			public OperationLog getLog() {
+				OperationLog op = new DefaultOperationLog();
+				op = op.add(new PutAttributeOperation("author", ByteBuffer.wrap(_author.getBytes())));
+				op = op.add(new PutAttributeOperation("mes", ByteBuffer.wrap(_initMessage.getBytes())));
+				op = op.add(new PutAttributeOperation("key", ByteBuffer.wrap(_editKey.getBytes())));
+				op = op.add(new PutAttributeOperation("timestamp", tBuffer2));
+				return op;
 			}
 		};
 
@@ -203,12 +220,13 @@
 		if (tree == null) {
 			throw new IllegalStateException();
 		}
-		
+
 		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)));
+					path = path.add(Integer.parseInt(_nodeNum.substring(count,
+							count + 1)));
 			}
 		} catch (Exception _e) {
 		}
@@ -217,20 +235,22 @@
 		final long timestamp = System.currentTimeMillis();
 		final ByteBuffer tBuffer = ByteBuffer.allocate(16);
 		tBuffer.putLong(timestamp);
-		
+
 		do {
-			Node node = tree.getRootNode();
+			TreeNode node = tree.getRootNode();
 			DefaultTraverser traverser = new DefaultTraverser();
-			TraversableNodeWrapper<Node> traversable = new TraversableNodeWrapper<Node>(node);
+			// TraversableNodeWrapper<Node> traversable = new
+			// TraversableNodeWrapper<Node>(node);
 			DefaultEvaluator evaluator = new DefaultEvaluator(path);
-			Either<Error, Traversal<TraversableNodeWrapper<Node>>> ret = traverser.traverse(traversable, evaluator);
+			Either<Error, Traversal<TreeNode>> ret = traverser.traverse(node,
+					evaluator);
 			if (ret.isA()) {
 				Assert.fail();
 			}
 
-			Traversal<TraversableNodeWrapper<Node>> traversal = ret.b();
-			TraversableNodeWrapper<Node> target = traversal.destination();
-			int size = target.getWrapped().getChildren().size();
+			Traversal<TreeNode> traversal = ret.b();
+			TreeNode target = traversal.destination();
+			int size = target.getChildren().size();
 			JungleTreeEditor editor = tree.getTreeEditor();
 			either = editor.addNewChildAt(path, size);
 			if (either.isA()) {
@@ -239,10 +259,20 @@
 			editor = either.b();
 
 			NodeEditor e = new NodeEditor() {
-				public <T extends EditableNode<T>> Either<Error, T> edit(T _e) {
-					_e = _e.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
-					_e = _e.getAttributes().put("timestamp", tBuffer).b();
-					return DefaultEither.newB(_e);
+
+				public <T extends TreeNode> Either<Error, TreeNode> edit(T _e) {
+					TreeNode node = _e;
+					node = node.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
+					node = node.getAttributes().put("timestamp", tBuffer).b();
+					return DefaultEither.newB(node);
+				}
+
+				@Override
+				public OperationLog getLog() {
+					OperationLog op = new DefaultOperationLog();
+					op = op.add(new PutAttributeOperation("mes", ByteBuffer.wrap(_message.getBytes())));
+					op = op.add(new PutAttributeOperation("timestamp", tBuffer));
+					return op;
 				}
 			};
 			path = path.add(size);
@@ -268,8 +298,8 @@
 		final ByteBuffer tBuffer = ByteBuffer.allocate(16);
 		tBuffer.putLong(timestamp);
 		do {
-			
-			Node node = tree.getRootNode();
+
+			TreeNode node = tree.getRootNode();
 			int size = node.getChildren().size();
 			DefaultNodePath path = new DefaultNodePath();
 
@@ -281,12 +311,23 @@
 			editor = either.b();
 
 			NodeEditor e = new NodeEditor() {
-				public <T extends EditableNode<T>> Either<Error, T> edit(T _e) {
-					_e = _e.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
-					_e = _e.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
-					_e = _e.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
-					_e = _e.getAttributes().put("timestamp", tBuffer).b();
-					return DefaultEither.newB(_e);
+				public <T extends TreeNode> Either<Error, TreeNode> edit(T _e) {
+					TreeNode node = _e;
+					node = node.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
+					node = node.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
+					node = node.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
+					node = node.getAttributes().put("timestamp", tBuffer).b();
+					return DefaultEither.newB(node);
+				}
+
+				@Override
+				public OperationLog getLog() {
+					OperationLog op = new DefaultOperationLog();
+					op = op.add(new PutAttributeOperation("author", ByteBuffer.wrap(_author.getBytes())));
+					op = op.add(new PutAttributeOperation("mes", ByteBuffer.wrap(_message.getBytes())));
+					op = op.add(new PutAttributeOperation("key", ByteBuffer.wrap(_editKey.getBytes())));
+					op = op.add(new PutAttributeOperation("timestamp", tBuffer));
+					return op;
 				}
 			};
 			path = path.add(size);
@@ -300,31 +341,44 @@
 
 	}
 
-	public void editMessage(String _board, String _nodeNum, final String _author, final String _message, final String _editKey) {
+	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)));
+						path = path.add(Integer.parseInt(_nodeNum.substring(count, count + 1)));
 				}
 			} catch (Exception _e) {
 			}
 			JungleTreeEditor editor = tree.getTreeEditor();
 			NodeEditor e = new NodeEditor() {
-				public <T extends EditableNode<T>> Either<Error, T> edit(T _e) {
-					_e = _e.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
-					_e = _e.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
-					_e = _e.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
-					_e = _e.getAttributes().put("timestamp", tBuffer).b();
-					return DefaultEither.newB(_e);
+				public <T extends TreeNode> Either<Error, TreeNode> edit(T _e) {
+					TreeNode node = _e;
+					System.out.println(new String(node.getAttributes().get("mes").array()));
+					node = node.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
+					node = node.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
+					node = node.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
+					node = node.getAttributes().put("timestamp", tBuffer).b();
+					System.out.println(new String(node.getAttributes().get("mes").array()));
+					return DefaultEither.newB(node);
+				}
+
+				@Override
+				public OperationLog getLog() {
+					OperationLog op = new DefaultOperationLog();
+					op = op.add(new PutAttributeOperation("author", ByteBuffer.wrap(_author.getBytes())));
+					op = op.add(new PutAttributeOperation("mes", ByteBuffer.wrap(_message.getBytes())));
+					op = op.add(new PutAttributeOperation("key", ByteBuffer.wrap(_editKey.getBytes())));
+					op = op.add(new PutAttributeOperation("timestamp", tBuffer));
+					return op;
 				}
 			};
 			either = editor.edit(path, e);
@@ -349,22 +403,34 @@
 			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)));
+						path = path.add(Integer.parseInt(_uuid.substring(count,
+								count + 1)));
 				}
 			} catch (Exception _e) {
 			}
-			
+
 			JungleTreeEditor editor = tree.getTreeEditor();
 			NodeEditor e = new NodeEditor() {
-				public <T extends EditableNode<T>> Either<Error, T> edit(T _e) {
-					String str = "0";
+				String str;
+
+				public <T extends TreeNode> Either<Error, TreeNode> edit(T _e) {
+					TreeNode node = _e;
+					str = "0";
 					int count = 0;
-						for (; _e.getAttributes().get("mes" + String.valueOf(count)) != null; count++) {
-						}
+					for (; _e.getAttributes().get("mes" + String.valueOf(count)) != null; count++) {
+					}
 					str = String.valueOf(count);
-					_e = _e.getAttributes().put("mes" + str, ByteBuffer.wrap(_message.getBytes())).b();
-					_e = _e.getAttributes().put("timestamp" + str, tBuffer).b();
-					return DefaultEither.newB(_e);
+					node = node.getAttributes().put("mes" + str,ByteBuffer.wrap(_message.getBytes())).b();
+					node = node.getAttributes().put("timestamp" + str, tBuffer).b();
+					return DefaultEither.newB(node);
+				}
+
+				@Override
+				public OperationLog getLog() {
+					OperationLog op = new DefaultOperationLog();
+					op = op.add(new PutAttributeOperation("mes" + str,ByteBuffer.wrap(_message.getBytes())));
+					op = op.add(new PutAttributeOperation("timestamp" + str,tBuffer));
+					return op;
 				}
 			};
 			either = editor.edit(path, e);
@@ -388,18 +454,28 @@
 			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)));
+						path = path.add(Integer.parseInt(_path.substring(count,
+								count + 1)));
 				}
 			} catch (Exception _e) {
 			}
-			
+
 			JungleTreeEditor editor = tree.getTreeEditor();
 			NodeEditor e = new NodeEditor() {
-				public <T extends EditableNode<T>> Either<Error, T> edit(T _e) {
+				public <T extends TreeNode> Either<Error, TreeNode> edit(T _e) {
+					TreeNode node = _e;
 					// EnableNodeWrapper<T> node = _e.getWrap();
-					_e = _e.getAttributes().put("mes" + id, ByteBuffer.wrap(_message.getBytes())).b();
-					_e = _e.getAttributes().put("timestamp" + id, tBuffer).b();
-					return DefaultEither.newB(_e);
+					node = node.getAttributes().put("mes" + id,ByteBuffer.wrap(_message.getBytes())).b();
+					node = node.getAttributes().put("timestamp" + id, tBuffer).b();
+					return DefaultEither.newB(node);
+				}
+
+				@Override
+				public OperationLog getLog() {
+					OperationLog op = new DefaultOperationLog();
+					op = op.add(new PutAttributeOperation("mes"+ id, ByteBuffer.wrap(_message.getBytes())));
+					op = op.add(new PutAttributeOperation("timestamp"+ id, tBuffer));
+					return op;
 				}
 			};
 			either = editor.edit(path, e);
@@ -410,8 +486,7 @@
 			either = editor.success();
 		} while (either.isA());
 	}
-	
-	
+
 	public void deleteNode(String _board, String _path, String _id) {
 		requestCounter.incrementAndGet();
 		int id = Integer.parseInt(_id);
@@ -425,11 +500,11 @@
 			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)));
+						path = path.add(Integer.parseInt(_path.substring(count,count + 1)));
 				}
 			} catch (Exception _e) {
 			}
-			
+
 			JungleTreeEditor editor = tree.getTreeEditor();
 
 			either = editor.deleteChildAt(path, id);
@@ -439,9 +514,10 @@
 			editor = either.b();
 			either = editor.success();
 		} while (either.isA());
-		
+
 	}
-	public void deleteAttribute(String _board, String _path ,final String id) {
+
+	public void deleteAttribute(String _board, String _path, final String id) {
 		requestCounter.incrementAndGet();
 		final long timestamp = System.currentTimeMillis();
 		final ByteBuffer tBuffer = ByteBuffer.allocate(16);
@@ -453,29 +529,36 @@
 			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)));
+						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 <T extends EditableNode<T>> Either<Error, T> edit(T _e) {
-					_e = _e.getAttributes().delete("mes" + id ).b();
-					_e = _e.getAttributes().delete("timestamp" + id ).b();
+				public <T extends TreeNode> Either<Error, TreeNode> edit(T _e) {
+					TreeNode node = _e;
+					node = node.getAttributes().delete("mes" + id).b();
+					node = node.getAttributes().delete("timestamp" + id).b();
 					int count = Integer.parseInt(id);
-						for (; _e.getAttributes().get("mes" + String.valueOf(count + 1)) != null;) {
-							_e = _e.getAttributes().put("mes" + count, _e.getAttributes().get("mes" + String.valueOf(count + 1))).b();
-							_e = _e.getAttributes().put("timestamp" + count, tBuffer).b();
-							count++;
-						}
-					if(count != Integer.parseInt(id)){
-						_e = _e.getAttributes().delete("timestamp" + count ).b();
-						_e = _e.getAttributes().delete("mes" + count ).b();						
+					for (; node.getAttributes().get("mes" + String.valueOf(count + 1)) != null;) {
+						node = node.getAttributes().put("mes" + count,_e.getAttributes().get("mes"+ String.valueOf(count + 1))).b();
+						node = node.getAttributes().put("timestamp" + count, tBuffer).b();
+						count++;
+					}
+					if (count != Integer.parseInt(id)) {
+						node = node.getAttributes().delete("timestamp" + count).b();
+						node = node.getAttributes().delete("mes" + count).b();
 					}
 
-					return DefaultEither.newB(_e);
+					return DefaultEither.newB(node);
+				}
+
+				@Override
+				public OperationLog getLog() {
+					return new DefaultOperationLog();
 				}
 			};
 			either = editor.edit(path, e);
@@ -486,10 +569,9 @@
 			either = editor.success();
 		} while (either.isA());
 	}
-		
 
-	
-	public void editMatrixMessage(String _board, String _uuid, final String _author, final String _message, final String _editKey) {
+	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);
@@ -502,12 +584,23 @@
 
 			JungleTreeEditor editor = tree.getTreeEditor();
 			NodeEditor e = new NodeEditor() {
-				public <T extends EditableNode<T>> Either<Error, T> edit(T _e) {
-					_e = _e.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
-					_e = _e.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
-					_e = _e.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
-					_e = _e.getAttributes().put("timestamp", tBuffer).b();
-					return DefaultEither.newB(_e);
+				public <T extends TreeNode> Either<Error, TreeNode> edit(T _e) {
+					TreeNode node = _e;
+					node = node.getAttributes().put("author", ByteBuffer.wrap(_author.getBytes())).b();
+					node = node.getAttributes().put("mes", ByteBuffer.wrap(_message.getBytes())).b();
+					node = node.getAttributes().put("key", ByteBuffer.wrap(_editKey.getBytes())).b();
+					node = node.getAttributes().put("timestamp", tBuffer).b();
+					return DefaultEither.newB(node);
+				}
+
+				@Override
+				public OperationLog getLog() {
+					OperationLog op = new DefaultOperationLog();
+					op = op.add(new PutAttributeOperation("author", ByteBuffer.wrap(_author.getBytes())));
+					op = op.add(new PutAttributeOperation("mes", ByteBuffer.wrap(_message.getBytes())));
+					op = op.add(new PutAttributeOperation("key", ByteBuffer.wrap(_editKey.getBytes())));
+					op = op.add(new PutAttributeOperation("timestamp", tBuffer));
+					return op;
 				}
 			};
 			either = editor.edit(path, e);
@@ -523,19 +616,19 @@
 	public Iterable<BoardMessage> getMessages(String _boardName) {
 		requestCounter.incrementAndGet();
 		JungleTree tree = jungle.getTreeByName(_boardName);
-		Node node = tree.getRootNode();
-		Children<Node> chs = node.getChildren();
+		TreeNode node = tree.getRootNode();
+		Children<TreeNode> chs = node.getChildren();
 		final AtomicInteger counter = new AtomicInteger(0);
-		IterableConverter.Converter<BoardMessage, Node> converter = new IterableConverter.Converter<BoardMessage, Node>() {
-			public BoardMessage conv(Node _b) {
+		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 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, Node>(chs, converter);
+		return new IterableConverter<BoardMessage, TreeNode>(chs, converter);
 	}
 
 	public Iterable<BoardMessage> getFolder(String _boardName, String _nodeNum) {
@@ -550,32 +643,34 @@
 		}
 		requestCounter.incrementAndGet();
 		JungleTree tree = jungle.getTreeByName(_boardName);
-		Node node = tree.getRootNode();
+		TreeNode node = tree.getRootNode();
 
 		DefaultTraverser traverser = new DefaultTraverser();
-		TraversableNodeWrapper<Node> traversable = new TraversableNodeWrapper<Node>(node);
+		// TraversableNodeWrapper<Node> traversable = new
+		// TraversableNodeWrapper<Node>(node);
 		DefaultEvaluator evaluator = new DefaultEvaluator(path);
-		Either<Error, Traversal<TraversableNodeWrapper<Node>>> ret = traverser.traverse(traversable, evaluator);
+		Either<Error, Traversal<TreeNode>> ret = traverser.traverse(node,
+				evaluator);
 		if (ret.isA()) {
 			Assert.fail();
 		}
 
-		Traversal<TraversableNodeWrapper<Node>> traversal = ret.b();
-		TraversableNodeWrapper<Node> target = traversal.destination();
-		Children<Node> chs = target.getWrapped().getChildren();
+		Traversal<TreeNode> traversal = ret.b();
+		TreeNode target = traversal.destination();
+		Children<TreeNode> chs = target.getChildren();
 
 		final AtomicInteger counter = new AtomicInteger(0);
-		IterableConverter.Converter<BoardMessage, Node> converter = new IterableConverter.Converter<BoardMessage, Node>() {
-			public BoardMessage conv(Node _b) {
+		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());
+				String message = new String(_b.getAttributes().get("mes")
+						.array());
 				counter.incrementAndGet();
 				return new BoardMessageImpl(null, message, uuid);
 			}
 		};
-		return new IterableConverter<BoardMessage, Node>(chs, converter);
+		return new IterableConverter<BoardMessage, TreeNode>(chs, converter);
 	}
-	
 
 	public getAttributeImp getAttribute(String _boardName, String _nodeNum) {
 
@@ -583,25 +678,28 @@
 		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)));
+					path = path.add(Integer.parseInt(_nodeNum.substring(count,
+							count + 1)));
 			}
 		} catch (Exception _e) {
 		}
 		requestCounter.incrementAndGet();
 		JungleTree tree = jungle.getTreeByName(_boardName);
-		Node node = tree.getRootNode();
+		TreeNode node = tree.getRootNode();
 
 		DefaultTraverser traverser = new DefaultTraverser();
-		TraversableNodeWrapper<Node> traversable = new TraversableNodeWrapper<Node>(node);
+		// TraversableNodeWrapper<Node> traversable = new
+		// TraversableNodeWrapper<Node>(node);
 		DefaultEvaluator evaluator = new DefaultEvaluator(path);
-		Either<Error, Traversal<TraversableNodeWrapper<Node>>> ret = traverser.traverse(traversable, evaluator);
+		Either<Error, Traversal<TreeNode>> ret = traverser.traverse(node,
+				evaluator);
 		if (ret.isA()) {
 			Assert.fail();
 		}
 
-		Traversal<TraversableNodeWrapper<Node>> traversal = ret.b();
-		TraversableNodeWrapper<Node> target = traversal.destination();
-		return new getAttributeImp(target.getWrapped());
+		Traversal<TreeNode> traversal = ret.b();
+		TreeNode target = traversal.destination();
+		return new getAttributeImp(target);
 	}
 
 	public int getRequestNum() {
@@ -632,18 +730,17 @@
 		}
 
 	}
-	
-	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 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;
+	}
 
 }