Package jade.core
Class MicroRuntime
- java.lang.Object
-
- jade.core.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 Summary
Fields Modifier and Type Field Description static StringAGENTS_KEYThe configuration property key that maps to the list of agents that have to be activated at boostrap.static StringBE_REQUIRED_SERVICES_KEYstatic StringCONN_MGR_CLASS_KEYstatic StringCONTAINER_NAME_KEYstatic StringDEFAULT_SF_TIMEOUT_KEYThe 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.static StringHOST_KEYThe configuration property key that maps to the host where to connect to the JADE mediator.static StringHTTP_PROTOCOLstatic StringHTTPS_PROTOCOLstatic StringJ2SEstatic StringJVM_KEYstatic StringMIDPstatic StringOWNER_KEYThe key to retrieve the owner of the starting container.static StringPJAVAstatic StringPLATFORM_ADDRESSES_KEYstatic StringPLATFORM_KEYstatic StringPORT_KEYThe configuration property key that maps to the port where to connect to the JADE mediator.static StringPROTO_KEYThe configuration property key that maps to the protocol that must be used to connect to the JADE mediator.static StringREMOTE_CONFIG_HOST_KEYstatic StringREMOTE_CONFIG_PORT_KEYstatic StringSERVICES_KEYThe configuration property key that maps to the list of services that have to be installed.static StringSOCKET_PROTOCOLstatic StringSSL_PROTOCOL
-
Constructor Summary
Constructors Constructor Description MicroRuntime()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddListener(FEListener l)Add a listener that will be notified about Front-End relevant events such as BORN_AGENT and DEAD_AGENT
NOT available in MIDPstatic voiddetach()Disconnect this front-end container from the platform.static AgentControllergetAgent(String localName)Get agent proxy to local agent given its name.static StringgetContainerName()static booleanisRunning()Tells whether a JADE Front End container is currently running within this JVM.static voidkillAgent(String name)Kill an agent.static voidnotifyFailureToSender(ACLMessage msg, String sender, String error)static voidremoveListener(FEListener l)Remove a listener to Front-End relevant events BORN_AGENT and DEAD_AGENT
NOT available in MIDPstatic intsize()static voidstartAgent(String name, String className, Object[] args)Start a new agent.static voidstartAgent(String name, String className, String[] args)Start a new agent.static voidstartJADE(Properties p, Runnable r)Start up the JADE runtime.static voidstopJADE()Shut down the JADE runtime.
-
-
-
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
-
REMOTE_CONFIG_HOST_KEY
public static final String REMOTE_CONFIG_HOST_KEY
- See Also:
- Constant Field Values
-
REMOTE_CONFIG_PORT_KEY
public static final String REMOTE_CONFIG_PORT_KEY
- See Also:
- Constant Field Values
-
SOCKET_PROTOCOL
public static final String SOCKET_PROTOCOL
- See Also:
- Constant Field Values
-
SSL_PROTOCOL
public static final String SSL_PROTOCOL
- See Also:
- Constant Field Values
-
HTTP_PROTOCOL
public static final String HTTP_PROTOCOL
- See Also:
- Constant Field Values
-
HTTPS_PROTOCOL
public static final String HTTPS_PROTOCOL
- See Also:
- Constant Field Values
-
CONN_MGR_CLASS_KEY
public static final String CONN_MGR_CLASS_KEY
- See Also:
- Constant Field Values
-
CONTAINER_NAME_KEY
public static final String CONTAINER_NAME_KEY
- See Also:
- Constant Field Values
-
PLATFORM_KEY
public static final String PLATFORM_KEY
- See Also:
- Constant Field Values
-
PLATFORM_ADDRESSES_KEY
public static final String PLATFORM_ADDRESSES_KEY
- See Also:
- Constant Field Values
-
BE_REQUIRED_SERVICES_KEY
public static final String BE_REQUIRED_SERVICES_KEY
- See Also:
- Constant Field Values
-
JVM_KEY
public static final String JVM_KEY
- See Also:
- Constant Field Values
-
J2SE
public static final String J2SE
- See Also:
- Constant Field Values
-
PJAVA
public static final String PJAVA
- See Also:
- Constant Field Values
-
MIDP
public static final String MIDP
- See Also:
- Constant Field Values
-
-
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- ARunnableobject, whoserun()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,
trueis returned. Otherwise, the method returnsfalse.
-
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.
-
size
public static int size() throws ControllerException- Throws:
ControllerException
-
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)
-
-