public class GenericCommand extends java.lang.Object implements HorizontalCommand, VerticalCommand
Command interface,
operating at the meta-level to provide a generic transformation of
method invocations.
Generic commands can be used both as vertical and horizontal commands.
Objects of this class can also be recycled to build command
pools, since every information they hold can be rewritten.| Constructor and Description |
|---|
GenericCommand(java.lang.String name,
java.lang.String service,
java.lang.String interaction)
Creates a new generic command, with the given name and
belonging to the given service and interaction.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addParam(java.lang.Object obj)
Add a new parameter to this command object.
|
void |
clear() |
jade.security.Credentials |
getCredentials()
Get the credentials that the actor of this command
wants to use while processing this command.
|
java.lang.String |
getInteraction()
Query the interaction this command object is a part of.
|
java.lang.String |
getName()
Query the name of this command object.
|
java.lang.Object |
getParam(int index)
Obtain the parameter list, as an array of Java objects.
|
java.lang.Object[] |
getParams()
Obtain the parameter list, as an array of Java objects.
|
jade.security.JADEPrincipal |
getPrincipal()
Get the JADEPrincipal of the actor, respnsible for this Command object.
|
java.lang.Object |
getReturnValue()
Obtain the return value for this command.
|
java.lang.String |
getService()
Access the service object this command belongs to.
|
void |
removeParam(java.lang.Object obj)
Remove a parameter from this command object.
|
void |
setCredentials(jade.security.Credentials creds) |
void |
setPrincipal(jade.security.JADEPrincipal p) |
void |
setReturnValue(java.lang.Object rv)
Assign a return value to this command, so that the original
command issuer can retrieve it.
|
public GenericCommand(java.lang.String name,
java.lang.String service,
java.lang.String interaction)
name - The name of this command.svc - The name of the service this command belongs to.interaction - The identifier of the service interation this command belongs to.public java.lang.String getName()
Commandpublic java.lang.String getService()
HorizontalCommandgetService in interface CommandgetService in interface HorizontalCommandService object, such that
this command is one of the allowed commands for that service.public java.lang.String getInteraction()
HorizontalCommandgetInteraction() on them yields the same result.getInteraction in interface HorizontalCommandString serving as a service-unique
identifier for the interaction of this command object.public void addParam(java.lang.Object obj)
obj - The parameter to add. The actual type of
obj must be such that can be delivered over the
network by the concrete platform IMTP.jade.core.IMTPManagerpublic void removeParam(java.lang.Object obj)
obj - The parameter to remove.public void clear()
public void setReturnValue(java.lang.Object rv)
CommandsetReturnValue in interface Commandrv - The desired return value for this command object.public final java.lang.Object getParam(int index)
Commandpublic java.lang.Object[] getParams()
Commandpublic java.lang.Object getReturnValue()
CommandgetReturnValue in interface CommandCommand object.public jade.security.JADEPrincipal getPrincipal()
CommandgetPrincipal in interface Commandpublic void setPrincipal(jade.security.JADEPrincipal p)
setPrincipal in interface Commandpublic jade.security.Credentials getCredentials()
CommandgetCredentials in interface Commandpublic void setCredentials(jade.security.Credentials creds)
setCredentials in interface Command