|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectthings.thinger.service.command.Command
public abstract class Command
A command. It is an entity with a String object. The string is the text associated with the command. It's up to the command processor to decide what to do with it. The numeric defined the actual command. Parameters should be passed through the attributes.
Since commands are Entities, they have an Id and a creators Id.
Note that the Command validates PARAMETERs, where the CommandResponse will validate the RESPONSEs. This means it is possible for a responder to flood a CommandResponse. Later we may abstract Command enough to let a specific implementation handle the RESPONSE validation too.
Version History
EPG - Initial - 12 FEB 06
Nested Class Summary | |
---|---|
static class |
Command.CheckType
Are we checking a command or a response. |
static class |
Command.DataType
The type of the parameter. |
static class |
Command.Occurrence
The occurence of a parameter. |
static class |
Command.Requirement
The requirement for a parameter. |
Constructor Summary | |
---|---|
Command()
Default constructor. |
|
Command(CommandRegistry imposedRegistry)
Default constructor. |
Method Summary | |
---|---|
abstract void |
accept()
This will be called when the command is called. |
static void |
checkDataForm(AttributeReader attributes,
Command.CheckType type,
CommandDefinition definition)
Validate data for occurence and type. |
static void |
checkRequiredData(AttributeReader attributes,
Command.CheckType type,
CommandDefinition definition)
Validate data for required items. |
void |
DECLARE_NAME(java.lang.String theName,
java.lang.String className)
Declare the name of the command. |
void |
DECLARE_PARAMETER(java.lang.String parameterName,
Command.Requirement theRequirement,
Command.Occurrence theOccurence,
Command.DataType theDataType)
Declare a parameter. |
void |
DECLARE_RESPONSE(java.lang.String responseName,
Command.Requirement theRequirement,
Command.Occurrence theOccurence,
Command.DataType theDataType)
Declare a response. |
abstract void |
declare()
Command declaration. |
void |
DONE()
Set the response as done. |
void |
FLUSH()
Force the response to flush. |
NVImmutable |
GET_PARAMETER(java.lang.String name)
Get a parameter. |
SystemInterface |
GET_SYSTEM_INTERFACE()
Get the system interface. |
CommandDefinition |
getDefinition()
Get the command definition. |
AttributeReader |
getInstanceData()
Get the instance data for the command. |
void |
instantiateCommand()
Instantiate a new instance. |
static Command |
instantiateResponse(java.lang.String commandName,
CommandResponder responder)
Create a new instance object and instantiate. |
abstract java.lang.String |
named()
Return the official name of this command. |
void |
RESPOND(NV item)
Set a response. |
void |
RESPOND(java.lang.String name,
java.lang.String... value)
Set a response. |
void |
SET_PARAMETER(java.lang.String name,
java.lang.String... value)
Set a parameter. |
void |
validateReceiptList(ReceiptList result)
Validate this is a valid receipt list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Command()
public Command(CommandRegistry imposedRegistry)
imposedRegistry
- This will set which registry to use.Method Detail |
---|
public final void DECLARE_NAME(java.lang.String theName, java.lang.String className) throws SystemException
theName
- The name.className
- The class name. Chose to do this since you can't trust 'this'.
SystemException
- For any missuse.public final void DECLARE_PARAMETER(java.lang.String parameterName, Command.Requirement theRequirement, Command.Occurrence theOccurence, Command.DataType theDataType) throws SystemException
parameterName
- The parameter name.theRequirement
- The requirement for the item.theOccurence
- The occurence for the item.theDataType
- The data type for the item.
SystemException
public void DECLARE_RESPONSE(java.lang.String responseName, Command.Requirement theRequirement, Command.Occurrence theOccurence, Command.DataType theDataType) throws SystemException
responseName
- The response name.theRequirement
- The requirement for the item.theOccurence
- The occurence for the item.theDataType
- The data type for the item.
SystemException
public void SET_PARAMETER(java.lang.String name, java.lang.String... value) throws SystemException
name
- the name of the parameter.value
- the values associated with the parameter. It can be one or more.
SystemException
public SystemInterface GET_SYSTEM_INTERFACE() throws SystemException
SystemException
public NVImmutable GET_PARAMETER(java.lang.String name) throws SystemException
name
- the name of the parameter
SystemException
public void RESPOND(java.lang.String name, java.lang.String... value) throws SystemException
name
- the name of the response item.value
- the values associated with the response. It can be one or more.
SystemException
public void RESPOND(NV item) throws SystemException
item
- the NV item with name/values associated with the response. It can be one or more.
SystemException
NV
public void FLUSH() throws SystemException
SystemException
public void DONE() throws SystemException
SystemException
public abstract java.lang.String named()
public abstract void declare() throws SystemException
SystemException
public abstract void accept() throws SystemException
SystemException
public void instantiateCommand() throws SystemException
SystemException
- As a fault.public static Command instantiateResponse(java.lang.String commandName, CommandResponder responder) throws SystemException
commandName
- The command class name.responder
- the responder.
SystemException
- As a fault.public AttributeReader getInstanceData() throws SystemException
SystemException
public CommandDefinition getDefinition() throws SystemException
SystemException
public static void checkRequiredData(AttributeReader attributes, Command.CheckType type, CommandDefinition definition) throws SystemException
SYSTEM_COMMAND_FAULT_INSTANCE_USED_BEFORE_READY : Null attributes.
SYSTEM_COMMAND_ERROR_INSTANCE_MISSING_REQUIRED_PARAMETER : Missing required parameter.
attributes
- Attributes to check.type
- Are we checking the parameters or the responses?definition
- The command definition to check against.
SystemException
public static void checkDataForm(AttributeReader attributes, Command.CheckType type, CommandDefinition definition) throws SystemException
SYSTEM_COMMAND_FAULT_INSTANCE_USED_BEFORE_READY : Null attributes.
SYSTEM_COMMAND_ERROR_INSTANCE_MISSING_REQUIRED_PARAMETER : Missing required parameter.
attributes
- Attributes to check.type
- Are we checking the parameters or the responses?definition
- The command definition to check against.
SystemException
public void validateReceiptList(ReceiptList result) throws SystemException
result
- The receipt list to examine.
SystemException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |