|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx gov.nasa.arc.brahms.common.rt.ConceptCtx gov.nasa.arc.brahms.common.rt.ActiveInstanceCtx gov.nasa.arc.brahms.vm.rt.VMActiveInstanceCtx gov.nasa.arc.brahms.vm.rt.VMAgentCtx gov.nasa.arc.brahms.vm.rt.VMExternalAgentCtx
public class VMExternalAgentCtx
The VMExternalAgentCtx is the runtime class for the external agents with extensions for it to function in the Brahms virtual machine. The agent's behavior itself is defined in Java. This context therefor only manages the interfaces between the virtual machine and the external agent.
IAgentCtx
,
Serialized FormField Summary |
---|
Fields inherited from class gov.nasa.arc.brahms.vm.rt.VMActiveInstanceCtx |
---|
m_bInitialized, m_llCIMessageQueue, m_llReceivedMessageConversationIds, m_oBeliefSet, m_oEngine, m_oIncomingMessageLock |
Fields inherited from interface gov.nasa.arc.brahms.common.rt.IRuntimeConstants |
---|
ABORTED, ACTIVE, ACTIVITY, AVAILABLE, COMPLETED, CONSEQUENCE, DETECTABLE, ENDED, ENGINE, EXTERNAL_AGENT, FROM, IMPASSED, INITIAL, INTERRUPTED, JAVA_PROPERTY, sABORTED, sACTIVE, sAVAILABLE, sCOMPLETED, sENDED, sIMPASSED, sINTERRUPTED, sUNAVAILABLE, TO, TRANSFER, UNAVAILABLE |
Constructor Summary | |
---|---|
VMExternalAgentCtx(Agent agt)
Constructor, creates a new context for the specified agent. |
Method Summary | |
---|---|
void |
deregisterThreadListener()
Deregisters the thread listener to detect when this agent's thread of execution is terminated and under what circumstances. |
IExternalAgent |
getExternalImplementation()
Returns the implementation for the external agent. |
void |
initialize(gov.nasa.arc.brahms.vm.controller.VMController vmc,
long time)
Initializes the concept for use in a virtual machine controller by the specified virtual machine controller. |
boolean |
isAcceptingFacts()
Indicates whether this actor is interested in being notified of fact assertions/retractions. |
void |
pause()
Pauses the external agent. |
void |
postEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
The only events that can come in are events for beliefs communicated to this external agent or facts asserted in or retracted from the world state. |
void |
process(long time)
In simulation mode the Scheduler determines when an agent can process events up to what time. |
protected void |
processEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Processes the specified event. |
protected void |
processInformMessage(gov.nasa.ci.api.communication.ICommunicativeAct msg)
Processes the specified message as an inform message. |
protected void |
processNotUnderstoodMessage(gov.nasa.ci.api.communication.ICommunicativeAct msg)
Processes the specified message as a Not-Understood message. |
protected void |
processRequestMessage(gov.nasa.ci.api.communication.ICommunicativeAct msg)
Processes the specified message as a request message. |
void |
registerThreadListener()
Registers a thread listener to detect when this agent's thread of execution is terminated and under what circumstances. |
void |
reset()
Resets the concept removing its context and any references and additional components created to use this concept in a virtual machine. |
void |
resume()
Resumes the external agent. |
void |
run()
The run method implemented for the thread used to keep the external agent alive |
protected void |
sendNotUnderstoodMessage(gov.nasa.ci.api.communication.ICommunicativeAct msg,
java.lang.String message)
This method sends a Not Understood message to the sender to inform it of the fact that this agent does not understand the contents it was sent. |
void |
start()
Starts the external agent. |
void |
stop()
Stops the external agent. |
Methods inherited from class gov.nasa.arc.brahms.vm.rt.VMAgentCtx |
---|
createEngine, getMatchingStrategy |
Methods inherited from class gov.nasa.arc.brahms.common.rt.ConceptCtx |
---|
addAttribute, addRelation, getAttribute, getRelation, initAttributeRelationCache, removeAttribute, removeRelation, resetAttributeRelationCache, toString |
Methods inherited from class gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx |
---|
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setContextFor, setEndTime, setID, setStartTime |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IBrahmsObjectCtx |
---|
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setEndTime, setID, setStartTime |
Methods inherited from interface gov.nasa.arc.brahms.vm.engine.IPriorityWorkManager |
---|
getCurrentWork |
Constructor Detail |
---|
public VMExternalAgentCtx(Agent agt)
agt
- the Agent for which to create a contextMethod Detail |
---|
public void initialize(gov.nasa.arc.brahms.vm.controller.VMController vmc, long time) throws VMException
initialize
in interface IRuntimeConceptCtx
initialize
in class VMActiveInstanceCtx
vmc
- the VMController controlling the virtual machine in which this
concept is to be used.time
- the time at which the initialization is performed
VMException
- if an error occurs in initializing the conceptpublic IExternalAgent getExternalImplementation()
public boolean isAcceptingFacts()
isAcceptingFacts
in class VMActiveInstanceCtx
public void start() throws VMException
start
in class VMActiveInstanceCtx
VMException
- if an error occurs in starting the external agent.public void pause() throws VMException
pause
in class VMActiveInstanceCtx
VMException
- if an error occurs in pausing the external agent.public void resume() throws VMException
resume
in class VMActiveInstanceCtx
VMException
- if an error occurs in resuming the external agent.public void stop() throws VMException
stop
in class VMActiveInstanceCtx
VMException
- if an error occurs in stopping the external agent.public void postEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt) throws VMException
postEvent
in class VMActiveInstanceCtx
evt
- the DiscreteEvent to be added to the event queue
VMException
- if an error occurs in adding the event to the queuepublic void run()
run
in interface java.lang.Runnable
public void process(long time) throws VMException
Note: In real time mode the active instance processes any events as fast as possible without waiting for approval from the Scheduler. This method is considered irrelevant for the real time mode.
process
in class VMActiveInstanceCtx
time
- the time of the events that can be processed,
up to and including the specified time
VMException
- if an error occurs in the continuation
of the processingpublic void reset() throws VMException
reset
in interface IRuntimeConceptCtx
reset
in class VMActiveInstanceCtx
VMException
- if in error occurs in resetting the active instancepublic void registerThreadListener()
registerThreadListener
in class VMActiveInstanceCtx
public void deregisterThreadListener()
deregisterThreadListener
in class VMActiveInstanceCtx
protected void processEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
evt
- the DiscreteEvent to be processedprotected void processInformMessage(gov.nasa.ci.api.communication.ICommunicativeAct msg) throws MessageFormatException
msg
- the inform ICommunicativeAct to be processed
MessageFormatException
- if the contents of the message was not formatted as
expected.protected void processRequestMessage(gov.nasa.ci.api.communication.ICommunicativeAct msg) throws MessageFormatException
msg
- the request ICommunicativeAct to be processed
MessageFormatException
- if the contents of the message was not formatted as
expected.protected void processNotUnderstoodMessage(gov.nasa.ci.api.communication.ICommunicativeAct msg) throws MessageFormatException
msg
- the inform ICommunicativeAct to be processed
MessageFormatException
- if the contents of the message was not formatted as
expected.protected void sendNotUnderstoodMessage(gov.nasa.ci.api.communication.ICommunicativeAct msg, java.lang.String message)
msg
- the ICommunicativeAct for which to send a not understood replymessage
- the message explaining the reason for the not understood message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |