Mercurial > hg > Database > jungle-network
diff src/main/java/alice/jungle/operations/NetworkPutAttributeOperation.java @ 105:f9e29a52efd3
Move some files
author | one |
---|---|
date | Tue, 26 Nov 2013 06:43:10 +0900 |
parents | src/alice/jungle/operations/NetworkPutAttributeOperation.java@0055d917c796 |
children | b6d2db67febe |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/alice/jungle/operations/NetworkPutAttributeOperation.java Tue Nov 26 06:43:10 2013 +0900 @@ -0,0 +1,67 @@ +package alice.jungle.operations; + +import java.nio.ByteBuffer; + +import org.msgpack.annotation.Message; + +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.EditableNode; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.PutAttribute; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; +@Message +public class NetworkPutAttributeOperation implements NodeOperation +{ + +/* MessagePack cannot handle final. + * + * private final String key; + * private final ByteBuffer value; + */ + private String key; + private ByteBuffer value; + + public NetworkPutAttributeOperation() + { + key = null; + value = null; + } + + public NetworkPutAttributeOperation(String _key,ByteBuffer _value) + { + key = _key; + value = _value; + } + + @Override + public Command getCommand() + { + return Command.PUT_ATTRIBUTE; + } + + @Override + public <T extends EditableNode<T>> Either<Error, T> invoke(T _target) + { + PutAttribute putAttribute = new PutAttribute(key,value); + return putAttribute.edit(_target); + } + + @Override + public int getPosition() + { + return -1; + } + + @Override + public String getKey() + { + return key; + } + + @Override + public ByteBuffer getValue() + { + return value; + } +}