|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.crankuptheamps.client.Command
public class Command
Command is an encapsulation of a single AMPS command sent by the client.
Using Command you can build valid commands to be executed either
synchronously or asynchronously via the Client
execute() and
executeAsync() methods.
Command is designed to be used as a "builder" enabling AMPS commands
to be built easily, for example:
Client client = new Client(...);
for(Message m : client.execute(new Command("sow").setTopic("topic"))) { ... }
Constructor Summary | |
---|---|
Command()
Create a new Command with no command type or arguments set. |
|
Command(int command_)
Create a Command with the Command field set. |
|
Command(String command_)
Create a Command with the Command field set. |
Method Summary | |
---|---|
Command |
addAckType(int ackType)
Adds an additional ackType to the ackTypes already set for this Command. |
int |
getAckType()
Get the ackType for this command. |
int |
getBatchSize()
Get the batchSize for this command. |
String |
getBookmark()
Get the bookmark for this command. |
long |
getClientSequenceNumber()
Get the client sequence number for this command. |
int |
getCommand()
Return the command type for this command. |
CommandId |
getCommandId()
|
String |
getCorrelationId()
Returns the correlation Id for this command |
String |
getData()
Get the data for this command. |
int |
getExpiration()
Get the expiration from this command. |
String |
getFilter()
Get the filter for this command. |
String |
getOptions()
Get the options for this command. |
String |
getOrderBy()
Get the orderBy clause for this command. |
CommandId |
getQueryId()
Get the queryId for this command. |
String |
getSOWKeys()
Returns the SOW keys on this command. |
CommandId |
getSubId()
Get the subId for this command. |
long |
getTimeout()
Get the timeout for this command. |
String |
getTopic()
Get the topic for this command. |
int |
getTopN()
Get the topN value for this command. |
boolean |
hasExpiration()
Returns true if this command has an expiration set. |
boolean |
isSow()
Returns true if this command queries a SOW. |
boolean |
isSubscribe()
Returns true if this command creates a subscription. |
boolean |
needsSequenceNumber()
Returns true if this command can be associated with a client sequence number. |
protected CommandId |
prepare(Client client_)
Binds self to a given client, preparing a message from that client to be sent. |
Command |
reset(int command_)
Resets this command with a new Command type and re-initializes all other fields. |
Command |
reset(String command_)
Resets this command with a new Command type and re-initializes all other fields. |
Command |
setAckType(int ackType)
Set the ackType for this command. |
Command |
setBatchSize(int batchSize)
Set the batchSize for this command. |
Command |
setBookmark(String bookmark)
Set the bookmark for this command. |
protected Command |
setClientSequenceNumber(long seqNumber)
Sets the client sequence number for this command. |
Command |
setCommand(int command)
Set the command type for this command. |
Command |
setCommandId(CommandId commandId)
Set the commandId for this command. |
Command |
setCorrelationId(String correlationId_)
Sets the correlation Id for this command |
Command |
setData(byte[] data,
int offset,
int length)
Set the data for this command. |
Command |
setData(String data)
Set the data for this command. |
Command |
setExpiration(int expiration)
Set the expiration for this command. |
Command |
setFilter(String filter)
Set the filter for this command. |
Command |
setOptions(String options)
Set the options for this command. |
Command |
setOrderBy(String orderBy)
Set the orderBy clause for this command. |
Command |
setQueryId(CommandId queryId)
Set the queryId for this command. |
Command |
setSOWKeys(String sowKeys)
The SowKeys for a command are a comma-separated list of the keys that AMPS assigns to SOW messages. |
Command |
setSubId(CommandId subId)
Set the subId for this command. |
Command |
setSubId(String subId)
Set the subId for this command. |
Command |
setTimeout(long timeout)
Set the timeout for this command. |
Command |
setTopic(byte[] topic,
int offset,
int length)
Set the topic for this command from raw bytes. |
Command |
setTopic(String topic)
Set the topic for this command. |
Command |
setTopN(int topN)
Set the topN value for this command. |
void |
unsetExpiration()
Clears any expiration value set on self. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Command()
public Command(int command_)
command_
- A Message.Command
value indicating the AMPS command.public Command(String command_)
command_
- A string indicating the AMPS command.Method Detail |
---|
public String getSOWKeys()
public Command setSOWKeys(String sowKeys)
Message.getSowKey()
method
on a message.
sowKeys
- the sow keys to setpublic boolean isSubscribe()
public boolean isSow()
public boolean needsSequenceNumber()
public Command reset(int command_)
command_
- A Message.Command
value indicating the AMPS command.public Command reset(String command_)
command_
- A string value indicating the AMPS command.public CommandId getCommandId()
public Command setCommandId(CommandId commandId)
commandId
- the commandId to setpublic CommandId getQueryId()
public Command setQueryId(CommandId queryId)
queryId
- the queryId to setpublic int getCommand()
public Command setCommand(int command)
command
- the command to setpublic String getTopic()
public Command setTopic(String topic)
topic
- the topic to setpublic Command setTopic(byte[] topic, int offset, int length)
topic
- The raw bytes to be used for the topic.offset
- The offset into topic where the topic data beginslength
- The length of the topic.public String getFilter()
public Command setFilter(String filter)
filter
- the filter to setpublic String getOrderBy()
public Command setOrderBy(String orderBy)
orderBy
- the orderBy to setpublic CommandId getSubId()
public Command setSubId(CommandId subId)
subId
- the subId to setpublic Command setSubId(String subId)
subId
- the subId to setpublic String getBookmark()
public Command setBookmark(String bookmark)
bookmark
- the bookmark to setpublic String getOptions()
public Command setOptions(String options)
options
- the options to setpublic int getAckType()
public Command setAckType(int ackType)
ackType
- the ackType to setpublic Command addAckType(int ackType)
ackType
- the ackType to addpublic String getData()
public Command setData(String data)
data
- the data to setpublic Command setData(byte[] data, int offset, int length)
data
- The raw bytes to be used for the data.offset
- The offset into data where the data begins.length
- The length of the data.public long getTimeout()
public Command setTimeout(long timeout)
timeout
- the timeout to setpublic int getTopN()
public Command setTopN(int topN)
topN
- the topN to setpublic int getBatchSize()
public Command setBatchSize(int batchSize)
batchSize
- the batchSize to setpublic int getExpiration()
hasExpiration()
to check if an
expiration is set.
public boolean hasExpiration()
public Command setExpiration(int expiration)
expiration
- the expiration to setpublic void unsetExpiration()
protected CommandId prepare(Client client_)
client_
- The client to bind against
protected Command setClientSequenceNumber(long seqNumber)
public long getClientSequenceNumber()
public Command setCorrelationId(String correlationId_)
public String getCorrelationId()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |