net.spy.memcached.protocol.ascii
Class ConcatenationOperationImpl

java.lang.Object
  extended by net.spy.memcached.compat.SpyObject
      extended by net.spy.memcached.protocol.BaseOperationImpl
          extended by net.spy.memcached.protocol.ascii.ConcatenationOperationImpl
All Implemented Interfaces:
ConcatenationOperation, KeyedOperation, Operation

public class ConcatenationOperationImpl
extends BaseOperationImpl
implements ConcatenationOperation

Operation for ascii concatenations.


Field Summary
protected static byte[] CRLF
           
protected  byte[] data
           
protected  int exp
           
protected  int flags
           
protected  String key
           
protected  String type
           
 
Fields inherited from class net.spy.memcached.protocol.BaseOperationImpl
callback, CANCELLED
 
Constructor Summary
ConcatenationOperationImpl(ConcatenationType t, String k, byte[] d, OperationCallback cb)
           
 
Method Summary
 long getCasValue()
          Get the CAS value sent with this operation.
 byte[] getData()
           
 int getExpiration()
           
 int getFlags()
           
 Collection<String> getKeys()
           
protected  net.spy.memcached.protocol.ascii.OperationReadType getReadType()
           
 ConcatenationType getStoreType()
          Get the concatenation type for this operation.
 void handleLine(String line)
           
 void initialize()
          Initialize this operation.
protected  OperationStatus matchStatus(String line, OperationStatus... statii)
          Match the status line provided against one of the given OperationStatus objects.
 void readFromBuffer(ByteBuffer data)
          Read data from the given byte buffer and dispatch to the appropriate read mechanism.
protected  void setArguments(ByteBuffer bb, Object... args)
          Set some arguments for an operation into the given byte buffer.
protected  void setReadType(net.spy.memcached.protocol.ascii.OperationReadType to)
          Set the read type of this operation.
protected  void wasCancelled()
          This is called on each subclass whenever an operation was cancelled.
 
Methods inherited from class net.spy.memcached.protocol.BaseOperationImpl
cancel, getBuffer, getCallback, getException, getHandlingNode, getState, handleError, handleRead, hasErrored, isCancelled, setBuffer, setCallback, setHandlingNode, transitionState, writeComplete
 
Methods inherited from class net.spy.memcached.compat.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.spy.memcached.ops.ConcatenationOperation
getData
 
Methods inherited from interface net.spy.memcached.ops.KeyedOperation
getKeys
 
Methods inherited from interface net.spy.memcached.ops.Operation
cancel, getBuffer, getCallback, getException, getHandlingNode, getState, handleRead, hasErrored, initialize, isCancelled, readFromBuffer, setHandlingNode, writeComplete
 

Field Detail

type

protected final String type

key

protected final String key

flags

protected final int flags

exp

protected final int exp

data

protected final byte[] data

CRLF

protected static final byte[] CRLF
Constructor Detail

ConcatenationOperationImpl

public ConcatenationOperationImpl(ConcatenationType t,
                                  String k,
                                  byte[] d,
                                  OperationCallback cb)
Method Detail

getCasValue

public long getCasValue()
Description copied from interface: ConcatenationOperation
Get the CAS value sent with this operation.

Specified by:
getCasValue in interface ConcatenationOperation

getStoreType

public ConcatenationType getStoreType()
Description copied from interface: ConcatenationOperation
Get the concatenation type for this operation.

Specified by:
getStoreType in interface ConcatenationOperation

handleLine

public void handleLine(String line)

initialize

public void initialize()
Description copied from interface: Operation
Initialize this operation. This is used to prepare output byte buffers and stuff.

Specified by:
initialize in interface Operation
Specified by:
initialize in class BaseOperationImpl

wasCancelled

protected void wasCancelled()
Description copied from class: BaseOperationImpl
This is called on each subclass whenever an operation was cancelled.

Overrides:
wasCancelled in class BaseOperationImpl

getKeys

public Collection<String> getKeys()

getFlags

public int getFlags()

getExpiration

public int getExpiration()

getData

public byte[] getData()

matchStatus

protected final OperationStatus matchStatus(String line,
                                            OperationStatus... statii)
Match the status line provided against one of the given OperationStatus objects. If none match, return a failure status with the given line.

Parameters:
line - the current line
statii - several status objects
Returns:
the appropriate status object

getReadType

protected final net.spy.memcached.protocol.ascii.OperationReadType getReadType()

setReadType

protected final void setReadType(net.spy.memcached.protocol.ascii.OperationReadType to)
Set the read type of this operation.


setArguments

protected final void setArguments(ByteBuffer bb,
                                  Object... args)
Set some arguments for an operation into the given byte buffer.


readFromBuffer

public void readFromBuffer(ByteBuffer data)
                    throws IOException
Description copied from interface: Operation
Read data from the given byte buffer and dispatch to the appropriate read mechanism.

Specified by:
readFromBuffer in interface Operation
Specified by:
readFromBuffer in class BaseOperationImpl
Throws:
IOException