Package jade.core

Class MicroRuntime


  • public class MicroRuntime
    extends Object
    This class is used to start up the JADE runtime as a split (front-end) container. Though JADE supports split containers on all Java editions, the split container deployment is better suited for small, resource constrained devices (MIDP and PJava).
    Author:
    Giovanni Caire - TILAB
    • Field Detail

      • AGENTS_KEY

        public static final String AGENTS_KEY
        The configuration property key that maps to the list of agents that have to be activated at boostrap.
        See Also:
        Constant Field Values
      • SERVICES_KEY

        public static final String SERVICES_KEY
        The configuration property key that maps to the list of services that have to be installed.
        See Also:
        Constant Field Values
      • OWNER_KEY

        public static final String OWNER_KEY
        The key to retrieve the owner of the starting container. This information is the base for using a split container in a JADE platform with some form of security as it is automatically propagated to the back-end. For instance to connect a split-container to a platform using JADE-S Front-End: In the startup peroperties specify - owner = : Back-End: In the leap property file of the JICPMediatorManager that will host the BackEnd specify - services = ....... - jade_security_authentication_logincallback = cmdline
        See Also:
        Constant Field Values
      • HOST_KEY

        public static final String HOST_KEY
        The configuration property key that maps to the host where to connect to the JADE mediator.
        See Also:
        Constant Field Values
      • PORT_KEY

        public static final String PORT_KEY
        The configuration property key that maps to the port where to connect to the JADE mediator.
        See Also:
        Constant Field Values
      • PROTO_KEY

        public static final String PROTO_KEY
        The configuration property key that maps to the protocol that must be used to connect to the JADE mediator. Possible values are: socket, ssl, http, https
        See Also:
        Constant Field Values
      • DEFAULT_SF_TIMEOUT_KEY

        public static final String DEFAULT_SF_TIMEOUT_KEY
        The configuration property key that specifies how much time by default a command that is being delivered during a temporary disconnection must be stored waiting for the FE to reconnect. After that time the command fails (in case of a message delivery command, a FAILURE is sent back to the sender).
        0 means store and forward disabled -1 means infinite timeout
        See Also:
        Constant Field Values
    • Constructor Detail

      • MicroRuntime

        public MicroRuntime()
    • Method Detail

      • startJADE

        public static void startJADE​(Properties p,
                                     Runnable r)
        Start up the JADE runtime. This method launches a JADE Front End container. Since JADE supports only one container in the split-container deployment, if a Front End is already running this method does nothing.
        Parameters:
        p - A property bag, containing name-value pairs used to configure the container during boot.
        r - A Runnable object, whose run() method will be executed just after container termination.
      • stopJADE

        public static void stopJADE()
        Shut down the JADE runtime. This method stops the JADE Front End container currently running in this JVM, if one such container exists.
      • isRunning

        public static boolean isRunning()
        Tells whether a JADE Front End container is currently running within this JVM.
        Returns:
        If the JADE runtime is currently running, true is returned. Otherwise, the method returns false.
      • getContainerName

        public static String getContainerName()
      • startAgent

        public static void startAgent​(String name,
                                      String className,
                                      String[] args)
                               throws Exception
        Start a new agent. This method starts a new agent within the active Front End container.
        Parameters:
        name - The local name (i.e. without the platform ID) of the agent to create.
        className - The fully qualified name of the class implementing the agent to start.
        args - The creation arguments for the agent.
        Throws:
        Exception - If the underlying agent creation process fails.
      • startAgent

        public static void startAgent​(String name,
                                      String className,
                                      Object[] args)
                               throws Exception
        Start a new agent. This method starts a new agent within the active Front End container.
        Parameters:
        name - The local name (i.e. without the platform ID) of the agent to create.
        className - The fully qualified name of the class implementing the agent to start.
        args - The creation arguments for the agent.
        Throws:
        Exception - If the underlying agent creation process fails.
      • killAgent

        public static void killAgent​(String name)
                              throws NotFoundException
        Kill an agent. This method terminates an agent running within the active Front End container.
        Parameters:
        name - The local name (i.e. without the platform ID) of the agent to kill.
        Throws:
        NotFoundException - If no agent with the given local name are running within the active Front End.
      • getAgent

        public static AgentController getAgent​(String localName)
                                        throws ControllerException
        Get agent proxy to local agent given its name.
        NOT available in MIDP
        Parameters:
        localAgentName - The short local name of the desired agent.
        Throws:
        ControllerException - If any problems occur obtaining this proxy.
      • addListener

        public static void addListener​(FEListener l)
        Add a listener that will be notified about Front-End relevant events such as BORN_AGENT and DEAD_AGENT
        NOT available in MIDP
        Parameters:
        l - The listener that will be notified about Front-End relevant events
      • removeListener

        public static void removeListener​(FEListener l)
        Remove a listener to Front-End relevant events BORN_AGENT and DEAD_AGENT
        NOT available in MIDP
        Parameters:
        l - The listener to be removed
      • detach

        public static void detach()
        Disconnect this front-end container from the platform. That is, though the local front-end container and its agent(s) remain active, the back-end is shut down and, of course, the FE-2-BE connection is closed --> Therefore the rest of the platform does not see the local container and its agent(s) anymore. The local container automatically re-connects to the platform (and local agents are registered with the AMS again) as soon as a message to a remote agent is sent.
      • notifyFailureToSender

        public static void notifyFailureToSender​(ACLMessage msg,
                                                 String sender,
                                                 String error)