jade.core
Class GenericCommand

java.lang.Object
  |
  +--jade.core.GenericCommand
All Implemented Interfaces:
Command, HorizontalCommand, Serializable, java.io.Serializable, VerticalCommand

public class GenericCommand
extends java.lang.Object
implements HorizontalCommand, VerticalCommand

A generic implementation of the 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.

Author:
Giovanni Rimassa - FRAMeTech s.r.l.
See Also:
Serialized Form

Constructor Summary
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.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericCommand

public 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.

Parameters:
name - The name of this command.
interaction - The identifier of the service interation this command belongs to.
Method Detail

getName

public java.lang.String getName()
Description copied from interface: Command
Query the name of this command object.

Specified by:
getName in interface Command
Returns:
A string containing the name of the given command.

getService

public java.lang.String getService()
Description copied from interface: HorizontalCommand
Access the service object this command belongs to. A command object belongs exactly to one single service.

Specified by:
getService in interface HorizontalCommand
Returns:
The name of a Service object, such that this command is one of the allowed commands for that service.

getInteraction

public java.lang.String getInteraction()
Description copied from interface: HorizontalCommand
Query the interaction this command object is a part of. A command object is part of exactly one single interaction. Some services can generate interactions made by many commands, which can be grouped together because calling getInteraction() on them yields the same result.

Specified by:
getInteraction in interface HorizontalCommand
Returns:
A String serving as a service-unique identifier for the interaction of this command object.

addParam

public void addParam(java.lang.Object obj)
Add a new parameter to this command object.

Parameters:
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.
See Also:
jade.core.IMTPManager

removeParam

public void removeParam(java.lang.Object obj)
Remove a parameter from this command object.

Parameters:
obj - The parameter to remove.

clear

public void clear()

setReturnValue

public void setReturnValue(java.lang.Object rv)
Description copied from interface: Command
Assign a return value to this command, so that the original command issuer can retrieve it.

Specified by:
setReturnValue in interface Command
Parameters:
rv - The desired return value for this command object.

getParam

public final java.lang.Object getParam(int index)
Description copied from interface: Command
Obtain the parameter list, as an array of Java objects.

Specified by:
getParam in interface Command
Returns:
The parameters associated with this command object.

getParams

public java.lang.Object[] getParams()
Description copied from interface: Command
Obtain the parameter list, as an array of Java objects.

Specified by:
getParams in interface Command
Returns:
The parameters associated with this command object.

getReturnValue

public java.lang.Object getReturnValue()
Description copied from interface: Command
Obtain the return value for this command.

Specified by:
getReturnValue in interface Command
Returns:
The value that is to be returned back to the issuer of this Command object.

getPrincipal

public jade.security.JADEPrincipal getPrincipal()
Description copied from interface: Command
Get the JADEPrincipal of the actor, respnsible for this Command object.

Specified by:
getPrincipal in interface Command
Returns:

setPrincipal

public void setPrincipal(jade.security.JADEPrincipal p)
Specified by:
setPrincipal in interface Command

getCredentials

public jade.security.Credentials getCredentials()
Description copied from interface: Command
Get the credentials that the actor of this command wants to use while processing this command.

Specified by:
getCredentials in interface Command
Returns:

setCredentials

public void setCredentials(jade.security.Credentials creds)
Specified by:
setCredentials in interface Command


JADE