Mercurial > hg > Members > nobuyasu > jungle-network
comparison src/jungle/test/bbs/codesegment/ChildLogCheckCodeSegment.java @ 50:459b50f1a6ee
add ChildLogCheckCodeSegment.
author | one |
---|---|
date | Fri, 12 Jul 2013 20:39:02 +0900 |
parents | |
children | 9e782b4eb06e |
comparison
equal
deleted
inserted
replaced
49:a89c3539bff2 | 50:459b50f1a6ee |
---|---|
1 package jungle.test.bbs.codesegment; | |
2 | |
3 import java.io.IOException; | |
4 | |
5 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree; | |
6 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTreeEditor; | |
7 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.DefaultTreeOperationLog; | |
8 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; | |
9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; | |
10 import jungle.test.bbs.JungleManager; | |
11 import alice.codesegment.CodeSegment; | |
12 import alice.datasegment.CommandType; | |
13 import alice.datasegment.Receiver; | |
14 import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; | |
15 | |
16 public class ChildLogCheckCodeSegment extends CodeSegment { | |
17 | |
18 Receiver childLog = ids.create(CommandType.TAKE); | |
19 | |
20 public ChildLogCheckCodeSegment() { | |
21 childLog.setKey("childLog"); | |
22 } | |
23 | |
24 public void run() { | |
25 DefaultTreeOperationLogContainer container = childLog.asClass(DefaultTreeOperationLogContainer.class); | |
26 DefaultTreeOperationLog log = null; | |
27 try { | |
28 log = container.convert(); | |
29 } catch (IOException e) { | |
30 e.printStackTrace(); | |
31 } | |
32 JungleTree tree = JungleManager.getJungle().getTreeByName("boards"); | |
33 JungleTreeEditor editor = tree.getTreeEditor(); | |
34 Either<Error, JungleTreeEditor> either = JungleManager.edit(editor, log); | |
35 if(either.isA()) { | |
36 throw new IllegalStateException(); | |
37 } | |
38 editor = either.b(); | |
39 either = editor.success(); | |
40 if(either.isA()) { | |
41 throw new IllegalStateException(); | |
42 } | |
43 ods.put("log", container); | |
44 new ChildLogCheckCodeSegment(); | |
45 } | |
46 | |
47 | |
48 } |