diff src/jungle/test/bbs/codesegment/ChildLogCheckCodeSegment.java @ 51:9e782b4eb06e

add HashSetConvertDataSegment
author one
date Sat, 13 Jul 2013 15:59:47 +0900
parents 459b50f1a6ee
children 61b2de3f7730
line wrap: on
line diff
--- a/src/jungle/test/bbs/codesegment/ChildLogCheckCodeSegment.java	Fri Jul 12 20:39:02 2013 +0900
+++ b/src/jungle/test/bbs/codesegment/ChildLogCheckCodeSegment.java	Sat Jul 13 15:59:47 2013 +0900
@@ -16,12 +16,16 @@
 public class ChildLogCheckCodeSegment extends CodeSegment {
 	
 	Receiver childLog = ids.create(CommandType.TAKE);
+	Receiver host = ids.create(CommandType.PEEK);
 	
 	public ChildLogCheckCodeSegment() {
-		childLog.setKey("childLog");
+		host.setKey("host");
+		childLog.setKey("local","childLog");
 	}
 	
 	public void run() {
+		System.out.println("--ChildLogCheckCodeSegment--");
+		String hostName = host.asString();
 		DefaultTreeOperationLogContainer container = childLog.asClass(DefaultTreeOperationLogContainer.class);		
 		DefaultTreeOperationLog log = null;
 		try {
@@ -29,7 +33,13 @@
 		} catch (IOException e) {
 			e.printStackTrace();
 		}
-		JungleTree tree = JungleManager.getJungle().getTreeByName("boards");
+		String treeName = container.getTreeName();
+		if (JungleManager.getJungle().getTreeByName(treeName) == null) {
+			if(null == JungleManager.getJungle().createNewTree(treeName)){
+				throw new IllegalStateException();
+			}
+		}
+		JungleTree tree = JungleManager.getJungle().getTreeByName(treeName);
 		JungleTreeEditor editor = tree.getTreeEditor();
 		Either<Error, JungleTreeEditor> either = JungleManager.edit(editor, log);
 		if(either.isA()) {
@@ -42,6 +52,10 @@
 		}		
 		ods.put("log", container);
 		new ChildLogCheckCodeSegment();
+		if(!hostName.equals("node0")) {
+			
+			ods.put("parent", "childLog", container);
+		}
 	}