Package jade.core

Class GenericCommand

  • All Implemented Interfaces:
    Command, HorizontalCommand, VerticalCommand, Serializable, Serializable

    public class GenericCommand
    extends 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 Detail

      • GenericCommand

        public GenericCommand​(String name,
                              String service,
                              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.
        svc - The name of the service this command belongs to.
        interaction - The identifier of the service interation this command belongs to.
    • Method Detail

      • getName

        public 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 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 Command
        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 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​(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:
        IMTPManager
      • removeParam

        public void removeParam​(Object obj)
        Remove a parameter from this command object.
        Parameters:
        obj - The parameter to remove.
      • clear

        public void clear()
      • setReturnValue

        public void setReturnValue​(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 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 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 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 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:
      • getCredentials

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