|
ADK CVS | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objecttryllian.are.ExecutionEnvironment
The primary point of contact between an agent and the ARE. Provides everything that an agent without special access to the ARE can use from the ARE directly. However, in order to use the ExecutionEnvironment, the caller must be registered as an agent.
That includes sending messages and requesting TimeSliceEvents in order to do things pro-actively.
All other contact with the ARE by agents without special privileges is done by contacting system agents with messages.
This class does not have public constructors, instances can only be obtained
with the static get() method.
| Method Summary | |
OutgoingMessage |
createOutgoingMessage()
Returns a fresh instance of OutgoingMessage to the caller, that can use it to send an message to another agent. |
static ExecutionEnvironment |
get()
Returns the ExecutionEnvironment for the calling agent. |
AddressHelper |
getAddressHelper()
Returns an AddressHelper. |
AddressURI |
getCurrentAgentAddress()
Returns the current address of the calling agent. |
java.util.Date |
getCurrentAgentCreationDate()
Returns the creation date of the DNA file of the calling agent. |
IDReference |
getCurrentAgentIDReference()
Returns the IDReference of the calling agent. |
javax.naming.Context |
getJNDIContext()
Returns the JNDI Initial Context which can be used for all kinds of lookups. |
void |
replaceAgentEventListener(AgentEventListener newListener)
Replaces the AgentEventListener that is the main execution entry point for this agent; other information about the agent is unaffected. |
void |
requestAbortAgent()
This is a very forceful method; normally agents should kill themselves by asking their place to die; death will then happen gracefully; all Routines of the agent can exit gracefully, a pre-mortem persisted version of the agent can be made, etc.. |
void |
requestHeartbeats(boolean flag)
Request notification of each system heart beat. |
void |
scheduleRoutine(Routine target)
Schedules a Routine for running. |
void |
send(OutgoingMessage message)
Sends a message. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static ExecutionEnvironment get()
This method is not very efficient: you should not call it regularly in an agent, rather you should call in in the constructor of the agent or in the constructor of a library class for agents, if objects of that class are not often constructed. Otherwise, pass the instance of ExecutionEnvironment that you requested earlier as an argument to methods or constructors that are often used.
It is allowed for the ExecutionEnvironment, in cooperation with the core of the ARE, to slow down agents that call this method too frequently, by giving them events less frequently or scheduling them on lower-priority threads.
public void replaceAgentEventListener(AgentEventListener newListener)
public void requestHeartbeats(boolean flag)
flag - true if the caller wants to receive notifications,
false if it does not want them (anymore)public OutgoingMessage createOutgoingMessage()
public AddressURI getCurrentAgentAddress()
java.security.AccessControlException - is the caller has no permission to call
this method, i.e. because it is not an agent in the ARE.public IDReference getCurrentAgentIDReference()
java.security.AccessControlException - is the caller has no permission to call
this method because it is not an agent in the ARE.public java.util.Date getCurrentAgentCreationDate()
public void scheduleRoutine(Routine target)
Please note that in the current setup, an agent can have at most one Routine scheduled at any moment. Attempts to schedule a Routine while another Routine is scheduled or running results in a SecurityException.
java.security.AccessControlException - when the agent does not have the right
to schedule this Routine.
public void send(OutgoingMessage message)
throws NoSuchAgentException,
java.lang.IllegalArgumentException
OutgoingMessage is
sent to the receiver.
message - the message to send. The receiver field must be set, or an
IllegalArgumentException will be thrown. The message should not
be null.
XXX: define further exceptions (no such recipient, etc.)
java.lang.IllegalArgumentException - if the message is not (yet) in a state in which it can be sent, for
example because some important information is missing, such as the
receiver. Or, equally possible, the recipient habitat is
not compatible with our habitat. Or the message contains
stuff that cannot be sent to the recipient habitat, like
Unicode null characters.
NoSuchAgentException - if the intended receiver should be on this platform, but could not
be found.public void requestAbortAgent()
public javax.naming.Context getJNDIContext()
throws javax.naming.NamingException
javax.naming.NamingExceptionpublic AddressHelper getAddressHelper()
|
Copyright 2005, Tryllian Solutions B.V. | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||