|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface to a Springs agent.
Field Summary | |
static java.lang.String |
METHOD_MESSAGE_RECEPTION
|
Method Summary | |
void |
addTaskToSchedule(java.lang.String method)
Add a task consisting of calling a certain method. |
void |
addTaskToSchedule(java.lang.String targetURL,
int targetPort)
Adds a task to travel to another context. |
void |
addTaskToSchedule(java.lang.String targetURL,
int targetPort,
java.lang.String callbackMethod)
Adds a task to travel to another context. |
void |
addTaskToSchedule(java.lang.String targetURL,
int targetPort,
java.lang.String callbackMethod,
java.lang.Object[] args)
Adds a task to travel to another context. |
void |
addTaskToSchedule(java.lang.String method,
java.lang.Object[] args)
Add a task consisting of calling a certain method. |
void |
afterCreation()
Method called just after creating the agent on a certain context. |
void |
afterRemoval()
Method called just after removing the agent from a certain context. |
boolean |
atHome()
Gets if the agent is at home. |
void |
beforeCreation()
Method called just before creating the agent on a certain context. |
void |
beforeRemoval()
Method called just before removing the agent from a certain context. |
java.lang.Object |
callAgentMethod(java.lang.String targetAgent,
java.lang.String methodName)
This method invokes a method of the agent. |
java.lang.Object |
callAgentMethod(java.lang.String targetAgent,
java.lang.String methodName,
java.lang.Object[] args)
This method invokes a method of the agent. |
springs.communication.FutureResult |
callAgentMethodAsynchronously(java.lang.String targetAgent,
java.lang.String methodName)
This method invokes a method of the agent asynchronously. |
springs.communication.FutureResult |
callAgentMethodAsynchronously(java.lang.String targetAgent,
java.lang.String methodName,
java.lang.Object[] args)
This method invokes a method of the agent asynchronously. |
void |
callback()
It executes the callback method after a travel to a new computer. |
void |
checkpoint()
Checkpoints the agent. |
springs.context.ContextAddress |
getAddress()
Gets the address of the agent. |
long |
getAgentInitializationTime()
Gets the millis elapsed in the initialization of the agent. |
boolean |
getAgentMoving()
Gets whether the agent is moving. |
java.lang.String |
getCodebase()
Gets the codebase for the agent, used if the agent travels to another context and some of the classes it uses there are not available. |
springs.context.ContextInterfaceForAgents |
getContextInterfaceForAgents()
Gets an interface to the local context. |
java.lang.String |
getContextName()
Gets the name of the agent's context. |
springs.context.ContextAddress |
getHomeAddress()
Gets the home address of the agent. |
java.lang.String |
getHostname()
Gets the hostname of the agent. |
java.util.Vector |
getLocationServers()
Gets the locationServers for the agent. |
long |
getMillisStay()
|
long |
getMillisWhenCreated()
|
java.lang.String |
getName()
Gets the name of the agent. |
java.lang.String |
getNameWithContext()
Gets the name of the agent, with information about the context. |
int |
getNumObservers()
Gets the number of observers of the agent. |
java.util.Vector |
getObservers()
Gets the observers of the agent. |
java.util.Vector |
getObserversAddresses()
Obtains the addresses of the observers of this agent. |
int |
getPort()
Gets the port of the agent. |
springs.agent.Schedule |
getSchedule()
Return the agent's schedule. |
int |
getSequenceNumberForAddressUpdateMessages()
Obtains a relative indicator used to timestamp messages that update the address of the agent. |
java.lang.String |
getURL()
Gets the URL of the agent. |
void |
goHome()
Moves the agent to its home context (the context where it was created the first time). |
void |
goHome(java.lang.String callbackMethod)
Moves the agent to its home context (the context where it was created the first time). |
void |
goHome(java.lang.String callbackMethod,
java.lang.Object[] args)
Moves the agent to its home context (the context where it was created the first time). |
java.lang.Object |
handleMessage(springs.communication.Message msg)
Handles the reception of a message. |
void |
increaseSequenceNumberForAddressUpdateMessages(int increase)
Increases the relative indicator used to timestamp messages that update the address of the agent. |
void |
initialization()
This method is executed only the first time the agent is created. |
void |
initializationAfterMovement()
This method is executed every time after a movement of the agent. |
boolean |
isSuspended()
Obtains if the agent is suspended. |
boolean |
justCreatedForTheFirstTime()
Checks if the agent has just been created for the first time. |
void |
main()
Default callback method. |
boolean |
moreTasksInSchedule()
Checks if the agent has more tasks in its schedule. |
void |
moveTo(springs.context.ContextAddress contextAddress)
Moves the agent to another context. |
void |
moveTo(springs.context.ContextAddress contextAddress,
java.lang.String callbackMethod)
Moves the agent to another context. |
void |
moveTo(springs.context.ContextAddress contextAddress,
java.lang.String callbackMethod,
java.lang.Object[] args)
Moves the agent to another context. |
void |
moveTo(java.lang.String contextName)
Moves the agent to another context. |
void |
moveTo(java.lang.String contextName,
java.lang.String callbackMethod)
Moves the agent to another context. |
void |
moveTo(java.lang.String contextName,
java.lang.String callbackMethod,
java.lang.Object[] args)
Moves the agent to another context. |
void |
moveToURL(java.lang.String url)
Moves the agent to another context. |
void |
moveToURL(java.lang.String url,
int port)
Moves the agent to another context. |
void |
moveToURL(java.lang.String url,
int port,
java.lang.String callbackMethod)
Moves the agent to another context. |
void |
moveToURL(java.lang.String url,
int port,
java.lang.String callbackMethod,
java.lang.Object[] args)
Moves the agent to another context. |
void |
postArrival()
It executes after the agent has arrived at the destination. |
void |
postDeparture()
It executes on the original stale object at the source, and is typically defined to perform activities such as removing the stale object from persistence. |
void |
preArrival()
This method is executed on the copy of the object at the destination. |
void |
preDeparture(java.lang.String originContext,
java.lang.String targetContext)
This method is executed on the original object at the source. |
java.lang.Object |
receiveMethodCall(java.lang.String methodName,
java.lang.Object[] args)
|
void |
recordEndStay()
|
void |
recordStartStay()
|
void |
remove()
Removes the agent. |
void |
removeObserver(java.lang.String observer)
|
springs.communication.FutureResult |
sendAsynchronousMessage(java.lang.String targetAgent,
springs.communication.Message message)
This method sends a message to the agent, asynchronously. |
java.lang.Object |
sendMessage(java.lang.String targetAgent,
springs.communication.Message message)
This method sends a message to the agent, synchronously. |
java.lang.Object |
sendMessage(java.lang.String targetAgent,
springs.communication.Message message,
boolean asynchronous)
This method sends a message to the agent. |
void |
setAgentInitializationTime(long millis)
Sets the millis elapsed in the initialization of the agent. |
void |
setAgentMoving(boolean moving)
Sets whether the agent is moving. |
void |
setCacheReferences(boolean cacheRefs)
Sets whether references to agents should be cached. |
void |
setCodebase(java.lang.String codebase)
Sets the codebase for the agent, that it will be used if the agent travels to another context and some of the classes it uses there are not available. |
void |
setContextInterfaceForAgents(springs.context.ContextInterfaceForAgents contextInterface)
Sets the interface to the agent's context. |
void |
setHomeAddress(springs.context.ContextAddress homeAddress)
Sets the home address of the agent. |
void |
setLocationServers(java.util.Vector locationServers)
Sets the location servers for the agent. |
void |
setName(java.lang.String name)
Sets the name of the agent. |
void |
start()
Starts the agent execution. |
void |
suspend()
Suspends the agent execution. |
springs.agent.Task |
takeNextTask()
Obtains the next task to be executed by the agent, from the schedule. |
Field Detail |
public static final java.lang.String METHOD_MESSAGE_RECEPTION
Method Detail |
public long getMillisWhenCreated()
public void recordStartStay()
public void recordEndStay()
public long getMillisStay()
public void setAgentInitializationTime(long millis)
millis
- the millis.public long getAgentInitializationTime()
public void setLocationServers(java.util.Vector locationServers)
public java.util.Vector getLocationServers()
Vector
public java.util.Vector getObservers()
Vector
public int getNumObservers()
public void increaseSequenceNumberForAddressUpdateMessages(int increase)
increase
- the increase.public int getSequenceNumberForAddressUpdateMessages()
public void initialization() throws java.lang.Exception
java.lang.Exception
- if error.Exception
public void initializationAfterMovement() throws java.lang.Exception
java.lang.Exception
- if error.Exception
public boolean justCreatedForTheFirstTime()
public void setCodebase(java.lang.String codebase) throws java.net.MalformedURLException
codebase
- the codebase.
java.net.MalformedURLException
- if the format of the codebase is incorrect.MalformedURLException
public java.lang.String getCodebase()
String
public springs.context.ContextInterfaceForAgents getContextInterfaceForAgents()
ContextInterfaceForAgents
public void setContextInterfaceForAgents(springs.context.ContextInterfaceForAgents contextInterface)
contextInterface
- an interface to the agent's context.ContextInterfaceForAgents
public void setHomeAddress(springs.context.ContextAddress homeAddress)
homeAddress
- the home address of the agent.ContextAddress
public springs.context.ContextAddress getHomeAddress()
ContextAddress
public springs.context.ContextAddress getAddress()
ContextAddress
public java.lang.String getURL()
String
public java.lang.String getContextName()
String
public java.lang.String getHostname()
String
public int getPort()
ContextAddress
public java.lang.String getName()
String
public java.lang.String getNameWithContext()
String
public void setName(java.lang.String name)
name
- the name.String
public boolean atHome()
public void setCacheReferences(boolean cacheRefs)
cacheRefs
- a boolean indicating that.public boolean getAgentMoving()
public void setAgentMoving(boolean moving)
moving
- a boolean indicating whether the agent is moving or not.public void moveTo(springs.context.ContextAddress contextAddress) throws AgentMovementException
contextAddress
- the address of the target context.
AgentMovementException
- if the agent cannot be moved to the target address.ContextAddress
,
AgentMovementException
public void moveTo(springs.context.ContextAddress contextAddress, java.lang.String callbackMethod) throws AgentMovementException
contextAddress
- the address of the target context.callbackMethod
- the method to execute on arrival.
AgentMovementException
- if the agent cannot be moved to the target address.ContextAddress
,
AgentMovementException
,
String
public void moveTo(springs.context.ContextAddress contextAddress, java.lang.String callbackMethod, java.lang.Object[] args) throws AgentMovementException
contextAddress
- the address of the target context.callbackMethod
- the method to execute on arrival.args
- the arguments of the callback method.
AgentMovementException
- if the agent cannot be moved to the target address.ContextAddress
,
AgentMovementException
,
String
,
Object
public void moveToURL(java.lang.String url) throws AgentMovementException
url
- the URL of the target context, including the port number.
AgentMovementException
- if the agent cannot move to the target address.ContextAddress
,
AgentMovementException
public void moveToURL(java.lang.String url, int port) throws AgentMovementException
url
- the URL of the target context.port
- the port of the target context.
AgentMovementException
- if the agent cannot move to the target address.ContextAddress
,
AgentMovementException
public void moveToURL(java.lang.String url, int port, java.lang.String callbackMethod) throws AgentMovementException
url
- the URL of the target context.port
- the port of the target context.callbackMethod
- the method to execute on arrival.
AgentMovementException
- if the agent cannot move to the target address.ContextAddress
,
AgentMovementException
,
String
public void moveToURL(java.lang.String url, int port, java.lang.String callbackMethod, java.lang.Object[] args) throws AgentMovementException
url
- the URL of the target context.port
- the port of the target context.callbackMethod
- the method to execute on arrival.args
- the arguments of the callback method.
AgentMovementException
- if the agent cannot move to the target address.ContextAddress
,
AgentMovementException
,
String
,
Object
public void moveTo(java.lang.String contextName) throws AgentMovementException
contextName
- the name of the context.
AgentMovementException
- if the agent cannot move to the target context.String
,
AgentMovementException
public void moveTo(java.lang.String contextName, java.lang.String callbackMethod) throws AgentMovementException
contextName
- the name of the context.callbackMethod
- the method to execute on arrival.
AgentMovementException
- if the agent cannot move to the target context.String
,
AgentMovementException
public void moveTo(java.lang.String contextName, java.lang.String callbackMethod, java.lang.Object[] args) throws AgentMovementException
contextName
- the name of the context.callbackMethod
- the method to execute on arrival.args
- the arguments of the callback method.
AgentMovementException
- if the agent cannot move to the target context.String
,
AgentMovementException
public void goHome() throws AgentMovementException
AgentMovementException
- if the agent cannot move to the target address.AgentMovementException
public void goHome(java.lang.String callbackMethod) throws AgentMovementException
callbackMethod
- the method to execute on arrival.
AgentMovementException
- if the agent cannot move to the target address.String
,
AgentMovementException
public void goHome(java.lang.String callbackMethod, java.lang.Object[] args) throws AgentMovementException
callbackMethod
- the method to execute on arrival.args
- the arguments of the callback method.
AgentMovementException
- if the agent cannot move to the target address.String
,
Object
,
AgentMovementException
public void callback() throws MethodCallException
MethodCallException
- if the callback method cannot be invoked.MethodCallException
public java.lang.Object handleMessage(springs.communication.Message msg)
msg
- the message.
Object
,
Message
public void removeObserver(java.lang.String observer)
public java.lang.Object receiveMethodCall(java.lang.String methodName, java.lang.Object[] args) throws MethodCallException
MethodCallException
public void main()
public void start()
public void remove() throws RemovalException
RemovalException
- if error.RemovalException
public java.util.Vector getObserversAddresses()
Vector
public void beforeCreation()
public void afterCreation()
public void beforeRemoval()
public void afterRemoval()
public void postArrival()
public void postDeparture()
public void preArrival()
public void preDeparture(java.lang.String originContext, java.lang.String targetContext)
originContext
- the origin context.targetContext
- the target context.String
public void suspend()
public boolean isSuspended()
public void checkpoint()
public void addTaskToSchedule(java.lang.String targetURL, int targetPort)
targetURL
- the target URL.targetPort
- the target port.String
public void addTaskToSchedule(java.lang.String targetURL, int targetPort, java.lang.String callbackMethod)
targetURL
- the target URL.targetPort
- the target port.callbackMethod
- the callback method.String
public void addTaskToSchedule(java.lang.String targetURL, int targetPort, java.lang.String callbackMethod, java.lang.Object[] args)
targetURL
- the target URL.targetPort
- the target port.callbackMethod
- the callback method.args
- the arguments for the callback method.String
,
Object
public void addTaskToSchedule(java.lang.String method)
method
- the method.String
public void addTaskToSchedule(java.lang.String method, java.lang.Object[] args)
method
- the method.args
- the arguments for the method.String
,
Object
public boolean moreTasksInSchedule()
public springs.agent.Task takeNextTask()
Task
public springs.agent.Schedule getSchedule()
Schedule
public java.lang.Object callAgentMethod(java.lang.String targetAgent, java.lang.String methodName, java.lang.Object[] args) throws MethodCallException, CommunicationException
targetAgent
- the name of the target agent.methodName
- the name of the method.args
- the arguments to the method.
MethodCallException
- if the invocation fails.
CommunicationException
- if there is a communication error.MethodCallException
,
CommunicationException
,
String
,
Object
public java.lang.Object callAgentMethod(java.lang.String targetAgent, java.lang.String methodName) throws MethodCallException, CommunicationException
targetAgent
- the name of the target agent.methodName
- the name of the method.
MethodCallException
- if the invocation fails.
CommunicationException
- if there is a communication error.CommunicationException
,
MethodCallException
,
String
,
Object
public springs.communication.FutureResult callAgentMethodAsynchronously(java.lang.String targetAgent, java.lang.String methodName, java.lang.Object[] args) throws AgentReferenceException
targetAgent
- the name of the target agent.methodName
- the name of the method.args
- the arguments to the method.
AgentReferenceException
- if error.FutureResult
,
AgentReferenceException
,
String
,
Object
public springs.communication.FutureResult callAgentMethodAsynchronously(java.lang.String targetAgent, java.lang.String methodName) throws AgentReferenceException
targetAgent
- the name of the target agent.methodName
- the name of the method.
AgentReferenceException
- if error.FutureResult
,
AgentReferenceException
,
String
,
Object
public java.lang.Object sendMessage(java.lang.String targetAgent, springs.communication.Message message) throws CommunicationException
targetAgent
- the name of the target agent.message
- the message.
CommunicationException
- if there is a communication error.Message
,
if there is a communication error.
public springs.communication.FutureResult sendAsynchronousMessage(java.lang.String targetAgent, springs.communication.Message message) throws CommunicationException
targetAgent
- the name of the target agent.message
- the message.
CommunicationException
- if there is a communication error.FutureResult
,
Message
public java.lang.Object sendMessage(java.lang.String targetAgent, springs.communication.Message message, boolean asynchronous) throws CommunicationException
targetAgent
- the name of the target agent.message
- the message.asynchronous
- a boolean indicating whether the message should be sent asynchronously
or not.
CommunicationException
- if there is a communication error.Message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |