Package jade.core.behaviours
Class LoaderBehaviour
- java.lang.Object
-
- jade.core.behaviours.Behaviour
-
- jade.core.behaviours.LoaderBehaviour
-
- All Implemented Interfaces:
Serializable,Serializable
public class LoaderBehaviour extends Behaviour
This behaviour serves behaviour-loading requests according to the Behaviour-loading ontology. When an agent runs an instance of this behaviour it becomes able to load and execute completely new behaviours, i.e. behaviours whose code is not included in the classpath of the JVM where the agent lives. Loading behaviour requests must have theACLMessage.REQUESTperformative and must use the BehaviourLoading ontology and the LEAP language.
NOT available in MIDP- Author:
- Giovanni Caire - TILAB
- See Also:
LoadBehaviour,BehaviourLoadingOntology,LEAPCodec, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jade.core.behaviours.Behaviour
Behaviour.RunnableChangedEvent
-
-
Field Summary
-
Fields inherited from class jade.core.behaviours.Behaviour
myAgent, myEvent, NOTIFY_DOWN, NOTIFY_UP, parent, STATE_BLOCKED, STATE_READY, STATE_RUNNING
-
-
Constructor Summary
Constructors Constructor Description LoaderBehaviour()Construct a LoaderBehaviour.LoaderBehaviour(Agent a)Construct a LoaderBehaviour to be executed by a given agent.LoaderBehaviour(Agent a, ClassLoader cl)Construct a LoaderBehaviour to be executed by a given agent and that will use a given class loader to load behaviours whose code is not embedded in the LoadBehaviour request.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanaccept(ACLMessage msg)Suclasses may redefine this method to prevent the behaviour loading operation under specific conditions.voidaction()The action() method is redefined to serve behaviour loading requestsprotected voidaddBehaviour(Behaviour b, ACLMessage request)Add a loaded behaviour to the agent.booleandone()The done() method is redefined to make this behaviour terminate when itsstop()method is called.protected voidgetOutputParameters(Behaviour b, List params)protected voidsetInputParameters(Behaviour b, List params)voidstop()Make this behaviour terminate.-
Methods inherited from class jade.core.behaviours.Behaviour
actionWrapper, block, block, getAgent, getBehaviourName, getDataStore, getExecutionState, getParent, getRestartCounter, handle, handleBlockEvent, handleRestartEvent, isRunnable, onEnd, onStart, reset, restart, root, setAgent, setBehaviourName, setDataStore, setExecutionState
-
-
-
-
Constructor Detail
-
LoaderBehaviour
public LoaderBehaviour()
Construct a LoaderBehaviour.
-
LoaderBehaviour
public LoaderBehaviour(Agent a)
Construct a LoaderBehaviour to be executed by a given agent.
-
LoaderBehaviour
public LoaderBehaviour(Agent a, ClassLoader cl)
Construct a LoaderBehaviour to be executed by a given agent and that will use a given class loader to load behaviours whose code is not embedded in the LoadBehaviour request.
-
-
Method Detail
-
action
public final void action()
The action() method is redefined to serve behaviour loading requests- Specified by:
actionin classBehaviour- See Also:
CompositeBehaviour
-
done
public boolean done()
The done() method is redefined to make this behaviour terminate when itsstop()method is called.
-
stop
public void stop()
Make this behaviour terminate.
-
addBehaviour
protected void addBehaviour(Behaviour b, ACLMessage request)
Add a loaded behaviour to the agent. Subclasses may redefine this method to handle the behaviour addition operation in an application specific way.- Parameters:
b- TheBehaviourto be added.request- TheACLMessagecarrying theLoadBehaviourrequest.
-
accept
protected boolean accept(ACLMessage msg)
Suclasses may redefine this method to prevent the behaviour loading operation under specific conditions. This default implementation always returnstrue
-
-