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()
Command
public java.lang.String getService()
HorizontalCommand
getService
in interface Command
getService
in interface HorizontalCommand
Service
object, such that
this command is one of the allowed commands for that service.public java.lang.String getInteraction()
HorizontalCommand
getInteraction()
on them yields the same result.getInteraction
in interface HorizontalCommand
String
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.IMTPManager
public void removeParam(java.lang.Object obj)
obj
- The parameter to remove.public void clear()
public void setReturnValue(java.lang.Object rv)
Command
setReturnValue
in interface Command
rv
- The desired return value for this command object.public final java.lang.Object getParam(int index)
Command
public java.lang.Object[] getParams()
Command
public java.lang.Object getReturnValue()
Command
getReturnValue
in interface Command
Command
object.public jade.security.JADEPrincipal getPrincipal()
Command
getPrincipal
in interface Command
public void setPrincipal(jade.security.JADEPrincipal p)
setPrincipal
in interface Command
public jade.security.Credentials getCredentials()
Command
getCredentials
in interface Command
public void setCredentials(jade.security.Credentials creds)
setCredentials
in interface Command