springs.context
Class ContextManager_RMIImpl

java.lang.Object
  |
  +--springs.context.ContextManager_RMIImpl
All Implemented Interfaces:
ContextManager, java.rmi.Remote

public class ContextManager_RMIImpl
extends java.lang.Object
implements ContextManager, java.rmi.Remote

An implementation of a ContextManager using RMI.

Author:
Sergio Ilarri Artigas

Constructor Summary
ContextManager_RMIImpl()
          Constructor.
 
Method Summary
 void addContext(springs.context.ContextAddress context)
          Adds a context to the list of contexts in the system.
 void createAgent(springs.agent.SpringsAgent agent, boolean isMoving)
          Creates an agent.
 springs.access.AgentReference getReference(java.lang.String agentName, springs.context.ContextAddress addressPetitioner, boolean addAsObserver)
          Obtains a reference to the given agent.
 int ping()
          Pings the context.
 void receiveContexts(java.util.Hashtable contexts)
          Receives information about the contexts in the system.
 void removeContext(java.lang.String contextName)
          Removes a context from the list of contexts in the system.
 void updateReferences(java.util.Vector referenceUpdates)
          Receives an update of references.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextManager_RMIImpl

public ContextManager_RMIImpl()
                       throws java.rmi.RemoteException
Constructor.

Method Detail

createAgent

public void createAgent(springs.agent.SpringsAgent agent,
                        boolean isMoving)
                 throws CreationException
Description copied from interface: ContextManager
Creates an agent.

Specified by:
createAgent in interface ContextManager
Parameters:
agent - the agent.
isMoving - a boolean indicating if the agent is sent because of a movement from another context.
CreationException
See Also:
SpringsAgent, String, Vector, CreationException, RemoteException

getReference

public springs.access.AgentReference getReference(java.lang.String agentName,
                                                  springs.context.ContextAddress addressPetitioner,
                                                  boolean addAsObserver)
                                           throws AgentNotFoundException
Description copied from interface: ContextManager
Obtains a reference to the given agent.

Specified by:
getReference in interface ContextManager
Parameters:
agentName - the name of the agent.
addressPetitioner - the address of the context that requests the reference.
addAsObserver - a boolean indicating whether the agent must be added as an observer.
AgentNotFoundException
See Also:
AgentReference, String, ContextAddress, AgentNotFoundException, RemoteException

updateReferences

public void updateReferences(java.util.Vector referenceUpdates)
Description copied from interface: ContextManager
Receives an update of references.

Specified by:
updateReferences in interface ContextManager
Returns:
referenceUpdates the updates.
See Also:
Vector, RemoteException

receiveContexts

public void receiveContexts(java.util.Hashtable contexts)
Description copied from interface: ContextManager
Receives information about the contexts in the system.

Specified by:
receiveContexts in interface ContextManager
Parameters:
contexts - a table consisting of pairs .
See Also:
Hashtable, RemoteException

addContext

public void addContext(springs.context.ContextAddress context)
                throws java.rmi.RemoteException
Description copied from interface: ContextManager
Adds a context to the list of contexts in the system.

Specified by:
addContext in interface ContextManager
Parameters:
context - the context.
java.rmi.RemoteException
See Also:
ContextAddress, RemoteException

removeContext

public void removeContext(java.lang.String contextName)
                   throws java.rmi.RemoteException
Description copied from interface: ContextManager
Removes a context from the list of contexts in the system.

Specified by:
removeContext in interface ContextManager
Parameters:
contextName - the name of the context.
java.rmi.RemoteException
See Also:
String, RemoteException

ping

public int ping()
Description copied from interface: ContextManager
Pings the context.

Specified by:
ping in interface ContextManager
Returns:
the number of agents that are being tracked by the context.
See Also:
RemoteException