# HG changeset patch # User one # Date 1381815809 -32400 # Node ID 87ec5dd0dc2707b5c3796f4ca716acfe9aea2d66 # Parent 19e278488b429d5657704cb9191ee3b2e57f6d12 Rename from alice.jungle.datasegment.store.operation to alice.jungle.datasegment.store.container diff -r 19e278488b42 -r 87ec5dd0dc27 src/alice/jungle/datasegment/store/container/DefaultNodeOperationContainer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/jungle/datasegment/store/container/DefaultNodeOperationContainer.java Tue Oct 15 14:43:29 2013 +0900 @@ -0,0 +1,85 @@ +package alice.jungle.datasegment.store.container; + +import java.io.IOException; +import java.nio.ByteBuffer; + +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.AppendChildAtOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DeleteAttributeOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DeleteChildAtOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.PutAttributeOperation; + +import org.msgpack.MessagePack; +import org.msgpack.annotation.Message; +import org.msgpack.template.OrdinalEnumTemplate; +import org.msgpack.type.Value; + +import alice.codesegment.SingletonMessage; + +@Message +public class DefaultNodeOperationContainer { + + public int pos; + public String key; + public Value value; + public Value commandValue; + + public static void main(String[] args) throws IOException { + String key = "hoge"; + ByteBuffer b = ByteBuffer.wrap("messagepack value".getBytes()); + PutAttributeOperation op = new PutAttributeOperation(key, b); + DefaultNodeOperationContainer container = new DefaultNodeOperationContainer(); + container.unconvert(op); + NodeOperation convertedOp = container.convert(); + System.out.println("pos : "+convertedOp.getPosition()); + System.out.println("Command : "+convertedOp.getCommand()); + System.out.println("key : "+convertedOp.getKey()); + System.out.println("value : "+new String(convertedOp.getValue().array())); + + } + + public DefaultNodeOperationContainer() { + + } + + public void unconvert(NodeOperation op) throws IOException { +// MessagePack msgpack = new MessagePack(); + MessagePack msgpack = SingletonMessage.getInstance(); + pos = op.getPosition(); + key = op.getKey(); + value = null; + if (op.getValue() != null) { + ByteBuffer b = op.getValue(); + byte[] bytes = b.array(); + Value v = msgpack.unconvert(bytes); + value = v; + } + Command c = op.getCommand(); + msgpack.register(Command.class, new OrdinalEnumTemplate(Command.class)); + Value cValue = msgpack.unconvert(c); + commandValue = cValue; + } + + public NodeOperation convert() throws IOException{ +// MessagePack msgpack = new MessagePack(); + MessagePack msgpack = SingletonMessage.getInstance(); + msgpack.register(Command.class, new OrdinalEnumTemplate(Command.class)); + Command c = msgpack.convert(commandValue, Command.class); + ByteBuffer b = null; + if (value != null) { + b = ByteBuffer.wrap(msgpack.convert(value, byte[].class)); + } + if (c == Command.PUT_ATTRIBUTE) { + return new PutAttributeOperation(key, b); + } else if (c == Command.APPEND_CHILD) { + return new AppendChildAtOperation(pos); + } else if (c == Command.DELETE_CHILD) { + return new DeleteChildAtOperation(pos); + } else if (c == Command.DELETE_ATTRIBUTE){ + return new DeleteAttributeOperation(key); + } + return null; + } + +} diff -r 19e278488b42 -r 87ec5dd0dc27 src/alice/jungle/datasegment/store/container/DefaultNodePathContainer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/jungle/datasegment/store/container/DefaultNodePathContainer.java Tue Oct 15 14:43:29 2013 +0900 @@ -0,0 +1,58 @@ +package alice.jungle.datasegment.store.container; + +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; + +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath; + +import org.msgpack.MessagePack; +import org.msgpack.annotation.Message; +import org.msgpack.template.IntegerTemplate; +import org.msgpack.template.ListTemplate; +import org.msgpack.type.Value; + +@Message +public class DefaultNodePathContainer { + + public Value pathValue; + + public static void main(String[] args) throws IOException { + DefaultNodePath p = new DefaultNodePath(); + p = p.add(1).add(2).add(3); + DefaultNodePathContainer pathContainer = new DefaultNodePathContainer(); + pathContainer.unconvert(p); + NodePath convertedPath = pathContainer.convert(); + for (int i : convertedPath) { + System.out.println(i); + } + } + + public DefaultNodePathContainer() { + + } + + public void unconvert(NodePath path) throws IOException { + MessagePack msgpack = new MessagePack(); + List list = new LinkedList(); + for(Integer i : path) { + list.add(i); + } + /* Remove first Element(-1). */ + list.remove(0); + Value v = msgpack.unconvert(list); + pathValue = v; + } + + public DefaultNodePath convert() throws IOException { + MessagePack msgpack = new MessagePack(); + msgpack.register(List.class, new ListTemplate(IntegerTemplate.getInstance())); + List convertedList = (List)msgpack.convert(pathValue, List.class); + DefaultNodePath path = new DefaultNodePath(); + for (int i: convertedList) { + path = path.add(i); + } + return path; + } +} diff -r 19e278488b42 -r 87ec5dd0dc27 src/alice/jungle/datasegment/store/container/DefaultTreeOperationContainer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/jungle/datasegment/store/container/DefaultTreeOperationContainer.java Tue Oct 15 14:43:29 2013 +0900 @@ -0,0 +1,100 @@ +package alice.jungle.datasegment.store.container; + +import java.io.IOException; +import java.nio.ByteBuffer; + +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DefaultTreeOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.PutAttributeOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.TreeOperation; + +import org.msgpack.MessagePack; +import org.msgpack.annotation.Message; +import org.msgpack.type.Value; + +import alice.codesegment.SingletonMessage; + +@Message +public class DefaultTreeOperationContainer { + + Value pathValue; + Value opValue; + + public static void main(String[] args) throws IOException { + String key = "hoge"; + ByteBuffer b = ByteBuffer.wrap("messagepack value".getBytes()); + PutAttributeOperation op = new PutAttributeOperation(key, b); + + DefaultNodePath p = new DefaultNodePath(); + p = p.add(1).add(2).add(3); + DefaultTreeOperation treeOp = new DefaultTreeOperation(p, op); + + DefaultTreeOperationContainer treeOperationContainer = new DefaultTreeOperationContainer(); + treeOperationContainer.unconvert(treeOp); + + TreeOperation treeOperation = treeOperationContainer.convert(); + NodePath nodePath = treeOperation.getNodePath(); + NodeOperation nodeOp = treeOperation.getNodeOperation(); + Command c = nodeOp.getCommand(); + String str = ""; + switch (c) { + case PUT_ATTRIBUTE: + String k = nodeOp.getKey(); + ByteBuffer value = nodeOp.getValue(); + if (value.limit() < 100) { + str = String.format("key:%s,value:%s", k, + new String(value.array())); + } else { + str = String.format("key:%s,value:%d", k, value.limit()); + } + break; + case DELETE_ATTRIBUTE: + str = String.format("key:%s", nodeOp.getKey()); + break; + case APPEND_CHILD: + str = String.format("pos:%d", nodeOp.getPosition()); + break; + case DELETE_CHILD: + str = String.format("pos:%d", nodeOp.getPosition()); + break; + } + System.out.println(String.format("[%s:%s:%s]", c, nodePath, str)); + for (int i: nodePath ) { + System.out.println(i); + } + } + + public DefaultTreeOperationContainer() { + + } + + public void unconvert(DefaultTreeOperation _op) throws IOException { + NodeOperation nodeOp = _op.getNodeOperation(); + NodePath nodePath = _op.getNodePath(); + DefaultNodeOperationContainer opContainer = new DefaultNodeOperationContainer(); + opContainer.unconvert(nodeOp); + DefaultNodePathContainer pathContainer = new DefaultNodePathContainer(); + pathContainer.unconvert(nodePath); + unconvert(opContainer, pathContainer); + } + + public void unconvert(DefaultNodeOperationContainer _op, + DefaultNodePathContainer _path) throws IOException { +// MessagePack msgpack = new MessagePack(); + MessagePack msgpack = SingletonMessage.getInstance(); + pathValue = msgpack.unconvert(_path); + opValue = msgpack.unconvert(_op); + } + + public TreeOperation convert() throws IOException { +// MessagePack msgpack = new MessagePack(); + MessagePack msgpack = SingletonMessage.getInstance(); + DefaultNodePathContainer pathContainer = msgpack.convert(pathValue, DefaultNodePathContainer.class); + DefaultNodeOperationContainer opContainer = msgpack.convert(opValue, DefaultNodeOperationContainer.class); + return new DefaultTreeOperation(pathContainer.convert(), opContainer.convert()); + } + +} diff -r 19e278488b42 -r 87ec5dd0dc27 src/alice/jungle/datasegment/store/container/DefaultTreeOperationLogContainer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/jungle/datasegment/store/container/DefaultTreeOperationLogContainer.java Tue Oct 15 14:43:29 2013 +0900 @@ -0,0 +1,124 @@ +package alice.jungle.datasegment.store.container; + +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; + +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.DefaultTreeOperationLog; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DefaultTreeOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.TreeOperation; + +import org.msgpack.MessagePack; +import org.msgpack.annotation.Message; +import org.msgpack.template.ListTemplate; +import org.msgpack.template.ValueTemplate; +import org.msgpack.type.Value; + +import alice.codesegment.SingletonMessage; + +@Message +public class DefaultTreeOperationLogContainer { + + Value logValue; + String treeName; + String uuid; + String updaterName; + String revision; + int position; + long timestamp; + + public DefaultTreeOperationLogContainer() { + logValue = null; + treeName = ""; + uuid = ""; + updaterName = ""; + revision = ""; + position = 0; + timestamp = Long.MAX_VALUE; + } + + public void setTreeName(String _treeName) { + treeName = _treeName; + } + + public String getTreeName() { + return treeName; + } + + public void setUUID(String _uuid) { + uuid = _uuid; + } + + public String getUUID() { + return uuid; + } + + public void setUpdaterName(String _updaterName) { + updaterName = _updaterName; + } + + public String getServerName() { + return updaterName; + } + + public void setRevision(String _revision) { + revision = _revision; + } + + public String getRevision() { + return revision; + } + + public void setPosition(int p) { + position = p; + } + + public int getPosition() { + return position; + } + + public void setTimeStamp(long t) { + timestamp = t; + } + + public long getTimeStamp() { + return timestamp; + } + + public void unconvert(Iterable _log) throws IOException { + MessagePack msgpack = SingletonMessage.getInstance(); + List list = new LinkedList(); + for(TreeOperation op : _log) { + NodeOperation nOp = op.getNodeOperation(); + NodePath nodePath = op.getNodePath(); + DefaultTreeOperation treeOp = new DefaultTreeOperation(nodePath, nOp); + DefaultTreeOperationContainer container = new DefaultTreeOperationContainer(); + container.unconvert(treeOp); + Value v = msgpack.unconvert(container); + list.add(v); + } + Value listValue = msgpack.unconvert(list); + logValue = listValue; + } + + public DefaultTreeOperationLog convert() throws IOException { + MessagePack msgpack = SingletonMessage.getInstance(); + msgpack.register(List.class, new ListTemplate(ValueTemplate.getInstance())); + List listValue = msgpack.convert(logValue, List.class); + List logList = new LinkedList(); + for(Value v: listValue) { + DefaultTreeOperationContainer container = msgpack.convert(v, DefaultTreeOperationContainer.class); + logList.add(container.convert()); + } + DefaultTreeOperationLog log = new DefaultTreeOperationLog(logList, logList.size()); + return log; + } + + public String getHashLogString() { + return treeName + revision + updaterName; + } + + +} diff -r 19e278488b42 -r 87ec5dd0dc27 src/alice/jungle/datasegment/store/operations/DefaultNodeOperationContainer.java --- a/src/alice/jungle/datasegment/store/operations/DefaultNodeOperationContainer.java Tue Oct 15 14:38:46 2013 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -package alice.jungle.datasegment.store.operations; - -import java.io.IOException; -import java.nio.ByteBuffer; - -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.AppendChildAtOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DeleteAttributeOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DeleteChildAtOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.PutAttributeOperation; - -import org.msgpack.MessagePack; -import org.msgpack.annotation.Message; -import org.msgpack.template.OrdinalEnumTemplate; -import org.msgpack.type.Value; - -import alice.codesegment.SingletonMessage; - -@Message -public class DefaultNodeOperationContainer { - - public int pos; - public String key; - public Value value; - public Value commandValue; - - public static void main(String[] args) throws IOException { - String key = "hoge"; - ByteBuffer b = ByteBuffer.wrap("messagepack value".getBytes()); - PutAttributeOperation op = new PutAttributeOperation(key, b); - DefaultNodeOperationContainer container = new DefaultNodeOperationContainer(); - container.unconvert(op); - NodeOperation convertedOp = container.convert(); - System.out.println("pos : "+convertedOp.getPosition()); - System.out.println("Command : "+convertedOp.getCommand()); - System.out.println("key : "+convertedOp.getKey()); - System.out.println("value : "+new String(convertedOp.getValue().array())); - - } - - public DefaultNodeOperationContainer() { - - } - - public void unconvert(NodeOperation op) throws IOException { -// MessagePack msgpack = new MessagePack(); - MessagePack msgpack = SingletonMessage.getInstance(); - pos = op.getPosition(); - key = op.getKey(); - value = null; - if (op.getValue() != null) { - ByteBuffer b = op.getValue(); - byte[] bytes = b.array(); - Value v = msgpack.unconvert(bytes); - value = v; - } - Command c = op.getCommand(); - msgpack.register(Command.class, new OrdinalEnumTemplate(Command.class)); - Value cValue = msgpack.unconvert(c); - commandValue = cValue; - } - - public NodeOperation convert() throws IOException{ -// MessagePack msgpack = new MessagePack(); - MessagePack msgpack = SingletonMessage.getInstance(); - msgpack.register(Command.class, new OrdinalEnumTemplate(Command.class)); - Command c = msgpack.convert(commandValue, Command.class); - ByteBuffer b = null; - if (value != null) { - b = ByteBuffer.wrap(msgpack.convert(value, byte[].class)); - } - if (c == Command.PUT_ATTRIBUTE) { - return new PutAttributeOperation(key, b); - } else if (c == Command.APPEND_CHILD) { - return new AppendChildAtOperation(pos); - } else if (c == Command.DELETE_CHILD) { - return new DeleteChildAtOperation(pos); - } else if (c == Command.DELETE_ATTRIBUTE){ - return new DeleteAttributeOperation(key); - } - return null; - } - -} diff -r 19e278488b42 -r 87ec5dd0dc27 src/alice/jungle/datasegment/store/operations/DefaultNodePathContainer.java --- a/src/alice/jungle/datasegment/store/operations/DefaultNodePathContainer.java Tue Oct 15 14:38:46 2013 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -package alice.jungle.datasegment.store.operations; - -import java.io.IOException; -import java.util.LinkedList; -import java.util.List; - -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath; - -import org.msgpack.MessagePack; -import org.msgpack.annotation.Message; -import org.msgpack.template.IntegerTemplate; -import org.msgpack.template.ListTemplate; -import org.msgpack.type.Value; - -@Message -public class DefaultNodePathContainer { - - public Value pathValue; - - public static void main(String[] args) throws IOException { - DefaultNodePath p = new DefaultNodePath(); - p = p.add(1).add(2).add(3); - DefaultNodePathContainer pathContainer = new DefaultNodePathContainer(); - pathContainer.unconvert(p); - NodePath convertedPath = pathContainer.convert(); - for (int i : convertedPath) { - System.out.println(i); - } - } - - public DefaultNodePathContainer() { - - } - - public void unconvert(NodePath path) throws IOException { - MessagePack msgpack = new MessagePack(); - List list = new LinkedList(); - for(Integer i : path) { - list.add(i); - } - /* Remove first Element(-1). */ - list.remove(0); - Value v = msgpack.unconvert(list); - pathValue = v; - } - - public DefaultNodePath convert() throws IOException { - MessagePack msgpack = new MessagePack(); - msgpack.register(List.class, new ListTemplate(IntegerTemplate.getInstance())); - List convertedList = (List)msgpack.convert(pathValue, List.class); - DefaultNodePath path = new DefaultNodePath(); - for (int i: convertedList) { - path = path.add(i); - } - return path; - } -} diff -r 19e278488b42 -r 87ec5dd0dc27 src/alice/jungle/datasegment/store/operations/DefaultTreeOperationContainer.java --- a/src/alice/jungle/datasegment/store/operations/DefaultTreeOperationContainer.java Tue Oct 15 14:38:46 2013 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -package alice.jungle.datasegment.store.operations; - -import java.io.IOException; -import java.nio.ByteBuffer; - -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DefaultTreeOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.PutAttributeOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.TreeOperation; - -import org.msgpack.MessagePack; -import org.msgpack.annotation.Message; -import org.msgpack.type.Value; - -import alice.codesegment.SingletonMessage; - -@Message -public class DefaultTreeOperationContainer { - - Value pathValue; - Value opValue; - - public static void main(String[] args) throws IOException { - String key = "hoge"; - ByteBuffer b = ByteBuffer.wrap("messagepack value".getBytes()); - PutAttributeOperation op = new PutAttributeOperation(key, b); - - DefaultNodePath p = new DefaultNodePath(); - p = p.add(1).add(2).add(3); - DefaultTreeOperation treeOp = new DefaultTreeOperation(p, op); - - DefaultTreeOperationContainer treeOperationContainer = new DefaultTreeOperationContainer(); - treeOperationContainer.unconvert(treeOp); - - TreeOperation treeOperation = treeOperationContainer.convert(); - NodePath nodePath = treeOperation.getNodePath(); - NodeOperation nodeOp = treeOperation.getNodeOperation(); - Command c = nodeOp.getCommand(); - String str = ""; - switch (c) { - case PUT_ATTRIBUTE: - String k = nodeOp.getKey(); - ByteBuffer value = nodeOp.getValue(); - if (value.limit() < 100) { - str = String.format("key:%s,value:%s", k, - new String(value.array())); - } else { - str = String.format("key:%s,value:%d", k, value.limit()); - } - break; - case DELETE_ATTRIBUTE: - str = String.format("key:%s", nodeOp.getKey()); - break; - case APPEND_CHILD: - str = String.format("pos:%d", nodeOp.getPosition()); - break; - case DELETE_CHILD: - str = String.format("pos:%d", nodeOp.getPosition()); - break; - } - System.out.println(String.format("[%s:%s:%s]", c, nodePath, str)); - for (int i: nodePath ) { - System.out.println(i); - } - } - - public DefaultTreeOperationContainer() { - - } - - public void unconvert(DefaultTreeOperation _op) throws IOException { - NodeOperation nodeOp = _op.getNodeOperation(); - NodePath nodePath = _op.getNodePath(); - DefaultNodeOperationContainer opContainer = new DefaultNodeOperationContainer(); - opContainer.unconvert(nodeOp); - DefaultNodePathContainer pathContainer = new DefaultNodePathContainer(); - pathContainer.unconvert(nodePath); - unconvert(opContainer, pathContainer); - } - - public void unconvert(DefaultNodeOperationContainer _op, - DefaultNodePathContainer _path) throws IOException { -// MessagePack msgpack = new MessagePack(); - MessagePack msgpack = SingletonMessage.getInstance(); - pathValue = msgpack.unconvert(_path); - opValue = msgpack.unconvert(_op); - } - - public TreeOperation convert() throws IOException { -// MessagePack msgpack = new MessagePack(); - MessagePack msgpack = SingletonMessage.getInstance(); - DefaultNodePathContainer pathContainer = msgpack.convert(pathValue, DefaultNodePathContainer.class); - DefaultNodeOperationContainer opContainer = msgpack.convert(opValue, DefaultNodeOperationContainer.class); - return new DefaultTreeOperation(pathContainer.convert(), opContainer.convert()); - } - -} diff -r 19e278488b42 -r 87ec5dd0dc27 src/alice/jungle/datasegment/store/operations/DefaultTreeOperationLogContainer.java --- a/src/alice/jungle/datasegment/store/operations/DefaultTreeOperationLogContainer.java Tue Oct 15 14:38:46 2013 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -package alice.jungle.datasegment.store.operations; - -import java.io.IOException; -import java.util.LinkedList; -import java.util.List; - -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.DefaultTreeOperationLog; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DefaultTreeOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.TreeOperation; - -import org.msgpack.MessagePack; -import org.msgpack.annotation.Message; -import org.msgpack.template.ListTemplate; -import org.msgpack.template.ValueTemplate; -import org.msgpack.type.Value; - -import alice.codesegment.SingletonMessage; - -@Message -public class DefaultTreeOperationLogContainer { - - Value logValue; - String treeName; - String uuid; - String updaterName; - String revision; - int position; - long timestamp; - - public DefaultTreeOperationLogContainer() { - logValue = null; - treeName = ""; - uuid = ""; - updaterName = ""; - revision = ""; - position = 0; - timestamp = Long.MAX_VALUE; - } - - public void setTreeName(String _treeName) { - treeName = _treeName; - } - - public String getTreeName() { - return treeName; - } - - public void setUUID(String _uuid) { - uuid = _uuid; - } - - public String getUUID() { - return uuid; - } - - public void setUpdaterName(String _updaterName) { - updaterName = _updaterName; - } - - public String getServerName() { - return updaterName; - } - - public void setRevision(String _revision) { - revision = _revision; - } - - public String getRevision() { - return revision; - } - - public void setPosition(int p) { - position = p; - } - - public int getPosition() { - return position; - } - - public void setTimeStamp(long t) { - timestamp = t; - } - - public long getTimeStamp() { - return timestamp; - } - - public void unconvert(Iterable _log) throws IOException { - MessagePack msgpack = SingletonMessage.getInstance(); - List list = new LinkedList(); - for(TreeOperation op : _log) { - NodeOperation nOp = op.getNodeOperation(); - NodePath nodePath = op.getNodePath(); - DefaultTreeOperation treeOp = new DefaultTreeOperation(nodePath, nOp); - DefaultTreeOperationContainer container = new DefaultTreeOperationContainer(); - container.unconvert(treeOp); - Value v = msgpack.unconvert(container); - list.add(v); - } - Value listValue = msgpack.unconvert(list); - logValue = listValue; - } - - public DefaultTreeOperationLog convert() throws IOException { - MessagePack msgpack = SingletonMessage.getInstance(); - msgpack.register(List.class, new ListTemplate(ValueTemplate.getInstance())); - List listValue = msgpack.convert(logValue, List.class); - List logList = new LinkedList(); - for(Value v: listValue) { - DefaultTreeOperationContainer container = msgpack.convert(v, DefaultTreeOperationContainer.class); - logList.add(container.convert()); - } - DefaultTreeOperationLog log = new DefaultTreeOperationLog(logList, logList.size()); - return log; - } - - public String getHashLogString() { - return treeName + revision + updaterName; - } - - -} diff -r 19e278488b42 -r 87ec5dd0dc27 src/alice/jungle/persistence/AliceJournal.java --- a/src/alice/jungle/persistence/AliceJournal.java Tue Oct 15 14:38:46 2013 +0900 +++ b/src/alice/jungle/persistence/AliceJournal.java Tue Oct 15 14:43:29 2013 +0900 @@ -2,8 +2,8 @@ import java.nio.ByteBuffer; -import alice.jungle.datasegment.store.operations.DefaultNodeOperationContainer; -import alice.jungle.datasegment.store.operations.DefaultTreeOperationContainer; +import alice.jungle.datasegment.store.container.DefaultNodeOperationContainer; +import alice.jungle.datasegment.store.container.DefaultTreeOperationContainer; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeList; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeListReader; diff -r 19e278488b42 -r 87ec5dd0dc27 src/jungle/app/bbs/JungleManager.java --- a/src/jungle/app/bbs/JungleManager.java Tue Oct 15 14:38:46 2013 +0900 +++ b/src/jungle/app/bbs/JungleManager.java Tue Oct 15 14:43:29 2013 +0900 @@ -4,7 +4,7 @@ import java.nio.ByteBuffer; import java.util.Iterator; -import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; +import alice.jungle.datasegment.store.container.DefaultTreeOperationLogContainer; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.Jungle; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTreeEditor; diff -r 19e278488b42 -r 87ec5dd0dc27 src/jungle/app/bbs/NetworkJungleBulletinBoard.java --- a/src/jungle/app/bbs/NetworkJungleBulletinBoard.java Tue Oct 15 14:38:46 2013 +0900 +++ b/src/jungle/app/bbs/NetworkJungleBulletinBoard.java Tue Oct 15 14:43:29 2013 +0900 @@ -6,7 +6,7 @@ import java.util.concurrent.atomic.AtomicInteger; import alice.jungle.core.NetworkDefaultJungle; -import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; +import alice.jungle.datasegment.store.container.DefaultTreeOperationLogContainer; import alice.jungle.transaction.NetworkDefaultJungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.Jungle; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree; diff -r 19e278488b42 -r 87ec5dd0dc27 src/jungle/app/bbs/codesegment/ChildLogCheckCodeSegment.java --- a/src/jungle/app/bbs/codesegment/ChildLogCheckCodeSegment.java Tue Oct 15 14:38:46 2013 +0900 +++ b/src/jungle/app/bbs/codesegment/ChildLogCheckCodeSegment.java Tue Oct 15 14:43:29 2013 +0900 @@ -10,7 +10,7 @@ import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.jungle.datasegment.HashSetDataSegment; -import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; +import alice.jungle.datasegment.store.container.DefaultTreeOperationLogContainer; public class ChildLogCheckCodeSegment extends CodeSegment { diff -r 19e278488b42 -r 87ec5dd0dc27 src/jungle/app/bbs/codesegment/LogUpdateCodeSegment.java --- a/src/jungle/app/bbs/codesegment/LogUpdateCodeSegment.java Tue Oct 15 14:38:46 2013 +0900 +++ b/src/jungle/app/bbs/codesegment/LogUpdateCodeSegment.java Tue Oct 15 14:43:29 2013 +0900 @@ -10,7 +10,7 @@ import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.jungle.datasegment.HashSetDataSegment; -import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; +import alice.jungle.datasegment.store.container.DefaultTreeOperationLogContainer; public class LogUpdateCodeSegment extends CodeSegment { diff -r 19e278488b42 -r 87ec5dd0dc27 src/jungle/test/alice/CopyAttrJungle2.java --- a/src/jungle/test/alice/CopyAttrJungle2.java Tue Oct 15 14:38:46 2013 +0900 +++ b/src/jungle/test/alice/CopyAttrJungle2.java Tue Oct 15 14:43:29 2013 +0900 @@ -13,7 +13,7 @@ import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; -import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; +import alice.jungle.datasegment.store.container.DefaultTreeOperationLogContainer; public class CopyAttrJungle2 extends CodeSegment { diff -r 19e278488b42 -r 87ec5dd0dc27 src/jungle/test/codesegment/log/practice/StartCodeSegment.java --- a/src/jungle/test/codesegment/log/practice/StartCodeSegment.java Tue Oct 15 14:38:46 2013 +0900 +++ b/src/jungle/test/codesegment/log/practice/StartCodeSegment.java Tue Oct 15 14:43:29 2013 +0900 @@ -14,7 +14,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.PutAttributeOperation; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.TreeOperation; import alice.codesegment.CodeSegment; -import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; +import alice.jungle.datasegment.store.container.DefaultTreeOperationLogContainer; public class StartCodeSegment extends CodeSegment { diff -r 19e278488b42 -r 87ec5dd0dc27 src/jungle/test/codesegment/log/practice/TestCodeSegment.java --- a/src/jungle/test/codesegment/log/practice/TestCodeSegment.java Tue Oct 15 14:38:46 2013 +0900 +++ b/src/jungle/test/codesegment/log/practice/TestCodeSegment.java Tue Oct 15 14:43:29 2013 +0900 @@ -23,7 +23,7 @@ import alice.datasegment.CommandType; import alice.datasegment.Receiver; import alice.jungle.core.NetworkDefaultJungle; -import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; +import alice.jungle.datasegment.store.container.DefaultTreeOperationLogContainer; import alice.jungle.transaction.NetworkDefaultJungleTreeEditor; import alice.test.topology.aquarium.FishPoint; diff -r 19e278488b42 -r 87ec5dd0dc27 src/jungle/test/codesegment/operation/StartJungleCodeSegment.java --- a/src/jungle/test/codesegment/operation/StartJungleCodeSegment.java Tue Oct 15 14:38:46 2013 +0900 +++ b/src/jungle/test/codesegment/operation/StartJungleCodeSegment.java Tue Oct 15 14:43:29 2013 +0900 @@ -10,7 +10,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.PutAttributeOperation; import jungle.app.bbs.JungleManager; import alice.codesegment.CodeSegment; -import alice.jungle.datasegment.store.operations.DefaultTreeOperationContainer; +import alice.jungle.datasegment.store.container.DefaultTreeOperationContainer; public class StartJungleCodeSegment { diff -r 19e278488b42 -r 87ec5dd0dc27 src/jungle/test/codesegment/operation/TestPutAttributeCodeSegment.java --- a/src/jungle/test/codesegment/operation/TestPutAttributeCodeSegment.java Tue Oct 15 14:38:46 2013 +0900 +++ b/src/jungle/test/codesegment/operation/TestPutAttributeCodeSegment.java Tue Oct 15 14:43:29 2013 +0900 @@ -24,8 +24,8 @@ import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; -import alice.jungle.datasegment.store.operations.DefaultTreeOperationContainer; -import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; +import alice.jungle.datasegment.store.container.DefaultTreeOperationContainer; +import alice.jungle.datasegment.store.container.DefaultTreeOperationLogContainer; import alice.jungle.transaction.NetworkDefaultJungleTreeEditor; public class TestPutAttributeCodeSegment extends CodeSegment { diff -r 19e278488b42 -r 87ec5dd0dc27 src/jungle/test/core/practice/LogReadCodeSegment.java --- a/src/jungle/test/core/practice/LogReadCodeSegment.java Tue Oct 15 14:38:46 2013 +0900 +++ b/src/jungle/test/core/practice/LogReadCodeSegment.java Tue Oct 15 14:43:29 2013 +0900 @@ -18,7 +18,7 @@ import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; -import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; +import alice.jungle.datasegment.store.container.DefaultTreeOperationLogContainer; public class LogReadCodeSegment extends CodeSegment { diff -r 19e278488b42 -r 87ec5dd0dc27 src/jungle/test/core/practice/LogSendTest.java --- a/src/jungle/test/core/practice/LogSendTest.java Tue Oct 15 14:38:46 2013 +0900 +++ b/src/jungle/test/core/practice/LogSendTest.java Tue Oct 15 14:43:29 2013 +0900 @@ -3,7 +3,7 @@ import java.io.IOException; import java.nio.ByteBuffer; -import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; +import alice.jungle.datasegment.store.container.DefaultTreeOperationLogContainer; import alice.jungle.transaction.NetworkDefaultJungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree;