Mercurial > hg > Database > jungle-network
view src/alice/jungle/codesegment/LogUpdateCodeSegment.java @ 40:7e94de2d6bc0
add PutAnotherLogCodeSegment, PutHostLogCodeSegment
author | one |
---|---|
date | Tue, 09 Jul 2013 17:32:06 +0900 |
parents | 10359a815068 |
children | 4419ac56cbfd |
line wrap: on
line source
package alice.jungle.codesegment; import java.io.IOException; 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.store.impl.logger.DefaultTreeOperationLog; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; import jungle.test.bbs.JungleManager; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; public class LogUpdateCodeSegment extends CodeSegment { public Receiver arg1 = ids.create(CommandType.TAKE); public LogUpdateCodeSegment() { } public void run() { DefaultTreeOperationLogContainer container = arg1.asClass(DefaultTreeOperationLogContainer.class); DefaultTreeOperationLog log = null; try { log = container.convert(); } catch (IOException e) { e.printStackTrace(); } JungleManager jm = new JungleManager(); JungleTree tree = jm.getJungle().getTreeByName("boards"); JungleTreeEditor editor = tree.getTreeEditor(); Either<Error, JungleTreeEditor> either = jm.edit(editor, log); if(either.isA()) { throw new IllegalStateException(); } editor = either.b(); editor.success(); } }