|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--springs.context.Context | +--springs.context.Context_RMIImpl
Note: While the initial RMI specifications clearly defined the client's programming model, they left considerable leeway about the server side. As a result, various RMI implementations export objects differently. For instance, if an object extends UnicastRemoteObject, the RMI runtime in the JDK will automatically export that object. How that exporting occurs, however, is beyond a developer's control and is specific to an RMI implementation. By the same token, how an object is unexported depends on an RMI implementation as well. Source: http://www.javaworld.com/javaworld/jw-12-2003/jw-1219-jiniology_p.html
Field Summary | |
private static springs.context.ContextManager_RMIImpl |
_contextManager
The local Context Manager. |
Fields inherited from class springs.context.Context |
_accessService, _agentInfos, _context, _contextAddress, CONTEXT_ADDRESS_REGION_NAME_SERVER, CONTEXT_LOG_FILENAME, LOCALHOST, LOCALHOST_IP, START_CLASS_SERVER |
Constructor Summary | |
private |
Context_RMIImpl(java.lang.String name,
int port)
Constructor. |
Method Summary | |
java.lang.Object |
callAgentMethod(java.lang.String agentName,
java.lang.String methodName,
boolean cacheRef,
java.lang.String caller)
This method invokes a method of the agent. |
java.lang.Object |
callAgentMethod(java.lang.String agentName,
java.lang.String methodName,
java.lang.Object[] args,
boolean cacheRef,
java.lang.String caller)
This method invokes a method of the agent. |
java.lang.Object |
callAgentMethod(java.lang.String agentName,
java.lang.String methodName,
java.lang.Object[] args,
java.lang.String caller)
This method invokes a method of the agent, and caches the reference. |
java.lang.Object |
callAgentMethod(java.lang.String agentName,
java.lang.String methodName,
java.lang.String caller)
This method invokes a method of the agent, and caches the reference. |
springs.communication.FutureResult |
callAgentMethodAsynchronously(java.lang.String agentName,
java.lang.String methodName,
boolean cacheRef,
java.lang.String caller)
This method invokes a method of the agent asynchronously. |
springs.communication.FutureResult |
callAgentMethodAsynchronously(java.lang.String agentName,
java.lang.String methodName,
java.lang.Object[] args,
boolean cacheRef,
java.lang.String caller)
This method invokes a method of the agent asynchronously. |
springs.communication.FutureResult |
callAgentMethodAsynchronously(java.lang.String agentName,
java.lang.String methodName,
java.lang.Object[] args,
java.lang.String caller)
This method invokes a method of the agent asynchronously, and caches the reference. |
springs.communication.FutureResult |
callAgentMethodAsynchronously(java.lang.String agentName,
java.lang.String methodName,
java.lang.String caller)
This method invokes a method of the agent asynchronously, and caches the reference. |
void |
checkpoint(springs.agent.SpringsAgent agent)
Checkpoints the agent. |
private static void |
checkRMISpringsAgent(springs.agent.SpringsAgent agent)
Checks that the agent given is an RMI SpringsAgent. |
java.lang.Object |
clone()
|
static void |
create(java.lang.String name,
int portNumber,
int portClassServer,
java.lang.String addressRNS)
Starts a context. |
static void |
create(java.lang.String name,
int portNumber,
java.lang.String addressRNS)
Starts a context. |
static void |
create(java.lang.String name,
java.lang.String addressRNS)
Starts a context. |
static void |
createAgent(springs.context.ContextAddress contextAddress,
springs.agent.SpringsAgent agent,
java.lang.String agentName)
|
void |
createAgent(springs.agent.SpringsAgent agent,
java.lang.String agentName)
Creates an agent. |
static void |
createAgent(springs.agent.SpringsAgent agent,
java.lang.String agentName,
springs.context.ContextManager cm,
boolean isMoving,
springs.context.ContextAddress contextAddress)
|
void |
createAgent(java.lang.String targetContext,
springs.agent.SpringsAgent agent,
java.lang.String agentName)
Creates an agent. |
void |
deleteAgent(springs.agent.SpringsAgent agent)
Deletes the given agent from the system. |
springs.context.ContextManager |
getContextManager(springs.context.ContextAddress contextAddress)
Obtains the context manager at a certain address. |
private static springs.context.ContextManager |
getContextManagerStatic(springs.context.ContextAddress contextAddress)
Obtains the context manager at a certain address. |
static springs.context.Context |
instance()
Gets an instance to the context. |
boolean |
isSuspended(springs.agent.SpringsAgent agent)
Obtains if the agent is suspended. |
void |
moveAgent(springs.agent.SpringsAgent agent,
springs.context.ContextAddress contextAddress)
Moves an agent. |
private void |
performMovement(springs.context.ContextAddress contextAddress,
springs.agent.SpringsAgent agent)
Performs the movement of the agent. |
static void |
registerAgent(springs.agent.SpringsAgent agent,
springs.context.ContextAddress localContextAddress,
boolean isMoving)
Registers an agent. |
void |
releaseReference(java.lang.String agentName)
Releases a reference to the given agent, so that it must not be automatically updated anymore |
void |
removeAgent(springs.agent.SpringsAgent agent,
boolean isMoving)
Removes an agent. |
void |
sendAgent(springs.agent.SpringsAgent agent,
springs.context.ContextAddress contextAddress,
boolean isMoving)
Sends an agent. |
springs.communication.FutureResult |
sendAsynchronousMessage(java.lang.String agentName,
springs.communication.Message message,
boolean cacheRef,
java.lang.String caller)
This method sends a message to the agent, asynchronously. |
java.lang.Object |
sendMessage(java.lang.String agentName,
springs.communication.Message message,
boolean asynchronous,
boolean cacheRef,
java.lang.String caller)
This method sends a message to the agent. |
java.lang.Object |
sendMessage(java.lang.String agentName,
springs.communication.Message message,
boolean cacheRef,
java.lang.String caller)
This method sends a message to the agent, synchronously. |
protected void |
start(java.lang.String addressRNS)
Starts a context. |
private void |
start(java.lang.String addressRNS,
boolean startClassServer,
int portClassServer)
Starts a context. |
protected void |
start(java.lang.String addressRNS,
int portClassServer)
Starts a context. |
void |
suspend(springs.agent.SpringsAgent agent)
Suspends the agent execution. |
private void |
unexport(springs.agent.SpringsAgent agent)
Unexports an agent. |
void |
updateReferencesTo(springs.agent.SpringsAgent agent,
boolean isToRemove)
Updates the remote references to the given agent. |
void |
updateReferencesToWithThread(springs.agent.SpringsAgent agent,
boolean isToRemove)
Updates the remote references to the given agent, using an . |
void |
updateRemoteReferences(java.util.Hashtable contextsToReferences)
Updates the remote references to local agents. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static springs.context.ContextManager_RMIImpl _contextManager
ContextManager_RMIImpl
Constructor Detail |
private Context_RMIImpl(java.lang.String name, int port)
name
- the name of the context.port
- the port number.Method Detail |
public static springs.context.Context instance()
Context
public static void create(java.lang.String name, int portNumber, java.lang.String addressRNS) throws ContextStartingException
name
- the name of the context.portNumber
- the port number for the context.addressRNS
- the address of the Region Name Server. If any, pass null.
ContextStartingException
- if error.String
,
ContextStartingException
public static void create(java.lang.String name, java.lang.String addressRNS) throws ContextStartingException
name
- the name of the context.addressRNS
- the address of the Region Name Server. If any, pass null.
ContextStartingException
- if error.Context
,
String
,
ContextStartingException
public static void create(java.lang.String name, int portNumber, int portClassServer, java.lang.String addressRNS) throws ContextStartingException
name
- the name of the context.portNumber
- the port number for the context.portClassServer
- the port where to launch the class server.addressRNS
- the address of the Region Name Server. If any, pass null.
ContextStartingException
- if error.String
,
ContextStartingException
private void start(java.lang.String addressRNS, boolean startClassServer, int portClassServer) throws ContextStartingException
addressRNS
- the address of the Region Name Server. If any, pass null.startClassServer
- a boolean indicating whether a class server must be started.portClassServer
- the port where to launch the class server.
ContextStartingException
- if the context cannot be started.String
,
ContextStartingException
protected void start(java.lang.String addressRNS) throws ContextStartingException
Context
start
in class Context
addressRNS
- the address of the Region Name Server. If any, pass null.
ContextStartingException
- if the context cannot be started.String
,
ContextStartingException
protected void start(java.lang.String addressRNS, int portClassServer) throws ContextStartingException
Context
start
in class Context
addressRNS
- the address of the Region Name Server. If any, pass null.portClassServer
- the port where to launch the class server.
ContextStartingException
- if the context cannot be started.String
,
ContextStartingException
public static void createAgent(springs.agent.SpringsAgent agent, java.lang.String agentName, springs.context.ContextManager cm, boolean isMoving, springs.context.ContextAddress contextAddress) throws CreationException
CreationException
public void createAgent(java.lang.String targetContext, springs.agent.SpringsAgent agent, java.lang.String agentName) throws CreationException
Context
createAgent
in class Context
targetContext
- the name of the target context.agent
- the agent.agentName
- the name of the agent.
CreationException
- if error.CreationException
public static void createAgent(springs.context.ContextAddress contextAddress, springs.agent.SpringsAgent agent, java.lang.String agentName) throws CreationException
CreationException
public void createAgent(springs.agent.SpringsAgent agent, java.lang.String agentName) throws CreationException
ContextInterfaceForAgents
createAgent
in interface ContextInterfaceForAgents
agent
- the agent.agentName
- the name of the agent.
CreationException
SpringsAgent
,
String
,
CreationException
public void removeAgent(springs.agent.SpringsAgent agent, boolean isMoving) throws RemovalException
Context
removeAgent
in class Context
agent
- the agent.isMoving
- a boolean indicating if the agent is sent because of a movement from another
context.
RemovalException
SpringsAgent
,
RemovalException
public void deleteAgent(springs.agent.SpringsAgent agent) throws RemovalException
deleteAgent
in interface ContextInterfaceForAgents
agent
- the agent
throws
- RemovalException if error.
RemovalException
SpringsAgent
,
RemovalException
public void sendAgent(springs.agent.SpringsAgent agent, springs.context.ContextAddress contextAddress, boolean isMoving) throws AgentMovementException
ContextInterfaceForAgents
sendAgent
in interface ContextInterfaceForAgents
agent
- the agent.contextAddress
- the target context.isMoving
- a boolean indicating if the agent is sent because of a movement from another
context.
AgentMovementException
- if the agent cannot be moved to the target address.SpringsAgent
,
ContextAddress
,
AgentMovementException
public void moveAgent(springs.agent.SpringsAgent agent, springs.context.ContextAddress contextAddress) throws AgentMovementException
ContextInterfaceForAgents
moveAgent
in interface ContextInterfaceForAgents
agent
- the agent.contextAddress
- the target context.
AgentMovementException
- if the agent cannot be moved to the target address.SpringsAgent
,
ContextAddress
,
AgentMovementException
private void performMovement(springs.context.ContextAddress contextAddress, springs.agent.SpringsAgent agent) throws AgentMovementException
contextAddress
- the context address.agent
- the agent.
AgentMovementException
- if the agent could not be moved.ContextAddress
,
SpringsAgent
,
AgentMovementException
public void updateRemoteReferences(java.util.Hashtable contextsToReferences) throws CommunicationException
Context
updateRemoteReferences
in class Context
contextsToReferences
- a table that maps from contexts to information about how
to update the references.
CommunicationException
- if error.Hashtable
,
CommunicationException
public void releaseReference(java.lang.String agentName) throws ContextException
Context
releaseReference
in class Context
agentName
- the name of the agent.
ContextException
- if error.AgentReference
,
String
,
ContextException
public java.lang.Object callAgentMethod(java.lang.String agentName, java.lang.String methodName, java.lang.Object[] args, java.lang.String caller) throws MethodCallException, CommunicationException
ContextInterfaceForAgents
callAgentMethod
in interface ContextInterfaceForAgents
agentName
- the name of the target agent.methodName
- the name of the method.args
- the arguments to the method.caller
- the name of the caller agent.
CommunicationException
- if there is a communication error.
MethodCallException
- if the invocation fails.MethodCallException
,
CommunicationException
,
String
,
Object
public java.lang.Object callAgentMethod(java.lang.String agentName, java.lang.String methodName, java.lang.Object[] args, boolean cacheRef, java.lang.String caller) throws MethodCallException, CommunicationException
ContextInterfaceForAgents
callAgentMethod
in interface ContextInterfaceForAgents
agentName
- the name of the target agent.methodName
- the name of the method.args
- the arguments to the method.cacheRef
- a boolean indicating whether the reference to the agent should be cached.caller
- the name of the caller agent.
MethodCallException
- if the invocation fails.
CommunicationException
- if there is a communication error.MethodCallException
,
CommunicationException
,
String
,
Object
public java.lang.Object callAgentMethod(java.lang.String agentName, java.lang.String methodName, boolean cacheRef, java.lang.String caller) throws MethodCallException, CommunicationException
ContextInterfaceForAgents
callAgentMethod
in interface ContextInterfaceForAgents
agentName
- the name of the target agent.methodName
- the name of the method.cacheRef
- a boolean indicating whether the reference to the agent should be cached.caller
- the name of the caller agent.
CommunicationException
- if there is a communication error.
MethodCallException
- if the invocation fails.CommunicationException
,
MethodCallException
,
String
,
Object
public java.lang.Object callAgentMethod(java.lang.String agentName, java.lang.String methodName, java.lang.String caller) throws MethodCallException, CommunicationException
ContextInterfaceForAgents
callAgentMethod
in interface ContextInterfaceForAgents
agentName
- the name of the target agent.methodName
- the name of the method.caller
- the name of the caller agent.
MethodCallException
- if the invocation fails.
CommunicationException
- if there is a communication error.CommunicationException
,
MethodCallException
,
String
,
Object
public springs.communication.FutureResult callAgentMethodAsynchronously(java.lang.String agentName, java.lang.String methodName, java.lang.Object[] args, boolean cacheRef, java.lang.String caller) throws AgentReferenceException
ContextInterfaceForAgents
callAgentMethodAsynchronously
in interface ContextInterfaceForAgents
agentName
- the name of the target agent.methodName
- the name of the method.args
- the arguments to the method.cacheRef
- a boolean indicating whether the reference to the agent should be cached.caller
- the name of the caller agent.
AgentReferenceException
- if error.FutureResult
,
AgentReferenceException
,
String
,
Object
public springs.communication.FutureResult callAgentMethodAsynchronously(java.lang.String agentName, java.lang.String methodName, java.lang.Object[] args, java.lang.String caller) throws AgentReferenceException
ContextInterfaceForAgents
callAgentMethodAsynchronously
in interface ContextInterfaceForAgents
agentName
- the name of the target agent.methodName
- the name of the method.args
- the arguments to the method.caller
- the name of the caller agent.
AgentReferenceException
- if error.FutureResult
,
AgentReferenceException
,
String
,
Object
public springs.communication.FutureResult callAgentMethodAsynchronously(java.lang.String agentName, java.lang.String methodName, boolean cacheRef, java.lang.String caller) throws AgentReferenceException
ContextInterfaceForAgents
callAgentMethodAsynchronously
in interface ContextInterfaceForAgents
agentName
- the name of the target agent.methodName
- the name of the method.cacheRef
- a boolean indicating whether the reference to the agent should be cached.caller
- the name of the caller agent.
AgentReferenceException
- if error.FutureResult
,
AgentReferenceException
,
String
,
Object
public springs.communication.FutureResult callAgentMethodAsynchronously(java.lang.String agentName, java.lang.String methodName, java.lang.String caller) throws AgentReferenceException
ContextInterfaceForAgents
callAgentMethodAsynchronously
in interface ContextInterfaceForAgents
agentName
- the name of the target agent.methodName
- the name of the method.caller
- the name of the caller agent.
AgentReferenceException
- if error.FutureResult
,
AgentReferenceException
,
String
,
Object
public java.lang.Object sendMessage(java.lang.String agentName, springs.communication.Message message, boolean cacheRef, java.lang.String caller) throws CommunicationException
ContextInterfaceForAgents
sendMessage
in interface ContextInterfaceForAgents
agentName
- the name of the target agent.message
- the message.cacheRef
- a boolean indicating whether the reference to the agent should be cached.caller
- the name of the caller agent.
CommunicationException
- if there is a communication error.Message
,
if there is a communication error.
public springs.communication.FutureResult sendAsynchronousMessage(java.lang.String agentName, springs.communication.Message message, boolean cacheRef, java.lang.String caller) throws CommunicationException
ContextInterfaceForAgents
sendAsynchronousMessage
in interface ContextInterfaceForAgents
agentName
- the name of the target agent.message
- the message.cacheRef
- a boolean indicating whether the reference to the agent should be cached.caller
- the name of the caller agent.
CommunicationException
- if there is a communication error.FutureResult
,
Message
public java.lang.Object sendMessage(java.lang.String agentName, springs.communication.Message message, boolean asynchronous, boolean cacheRef, java.lang.String caller) throws CommunicationException
ContextInterfaceForAgents
sendMessage
in interface ContextInterfaceForAgents
agentName
- the name of the target agent.message
- the message.asynchronous
- a boolean indicating whether the message should be sent asynchronously
or not.cacheRef
- a boolean indicating whether the reference to the agent should be cached.caller
- the name of the caller agent.
CommunicationException
- if there is a communication error.Message
public springs.context.ContextManager getContextManager(springs.context.ContextAddress contextAddress) throws CommunicationException
Context
getContextManager
in class Context
contextAddress
- the context address.
CommunicationException
- if error.ContextAddress
,
ContextManager
,
CommunicationException
public boolean isSuspended(springs.agent.SpringsAgent agent)
ContextInterfaceForAgents
isSuspended
in interface ContextInterfaceForAgents
agent
- the agent.
SpringsAgent
public void suspend(springs.agent.SpringsAgent agent)
ContextInterfaceForAgents
suspend
in interface ContextInterfaceForAgents
agent
- the agent.SpringsAgent
public void checkpoint(springs.agent.SpringsAgent agent)
ContextInterfaceForAgents
checkpoint
in interface ContextInterfaceForAgents
agent
- the agent.SpringsAgent
private static springs.context.ContextManager getContextManagerStatic(springs.context.ContextAddress contextAddress) throws CommunicationException
contextAddress
- the context address.
CommunicationException
- if error.ContextAddress
,
ContextManager
,
CommunicationException
private void unexport(springs.agent.SpringsAgent agent) throws java.lang.Exception
agent
- the agent.
java.lang.Exception
- if error.SpringsAgent
,
Exception
private static void checkRMISpringsAgent(springs.agent.SpringsAgent agent) throws java.lang.IllegalArgumentException
agent
- the agent.
java.lang.IllegalArgumentException
- if the agent is not an RMI SpringsAgent.SpringsAgent
public static void registerAgent(springs.agent.SpringsAgent agent, springs.context.ContextAddress localContextAddress, boolean isMoving) throws CreationException, AlreadyExistingAgentException
agent
- the agent.localContextAddress
- the address of the local context.isMoving
- a boolean indicating whether the agent is moving or not.
CreationException
- if error.
AlreadyExistingAgentException
- if the agent cannot be registered because it already
exist at the context.SpringsAgent
,
ContextAddress
,
CreationException
,
AlreadyExistingAgentException
public void updateReferencesToWithThread(springs.agent.SpringsAgent agent, boolean isToRemove) throws CommunicationException
agent
- the agent.isToRemove
- a boolean indicating whether the reference should be removed.
CommunicationException
- if error.SpringsAgent
,
CommunicationException
public void updateReferencesTo(springs.agent.SpringsAgent agent, boolean isToRemove) throws CommunicationException
agent
- the agent.isToRemove
- a boolean indicating whether the reference should be removed.
CommunicationException
- if error.SpringsAgent
,
CommunicationException
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- as required by the singleton pattern.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |