springs.context
Interface ContextManager

All Superinterfaces:
java.rmi.Remote
All Known Implementing Classes:
ContextManager_RMIImpl

public interface ContextManager
extends java.rmi.Remote

An interface for a context manager. Performs the creation of agents and can be contacted remotely.

Author:
Sergio Ilarri Artigas

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 cn)
          Removes a context from the list of contexts in the system.
 void updateReferences(java.util.Vector referenceUpdates)
          Receives an update of references.
 

Method Detail

createAgent

public void createAgent(springs.agent.SpringsAgent agent,
                        boolean isMoving)
                 throws CreationException,
                        java.rmi.RemoteException
Creates an agent.

Parameters:
agent - the agent.
isMoving - a boolean indicating if the agent is sent because of a movement from another context.
Throws:
CreationException,RemoteException - if error.
CreationException
java.rmi.RemoteException
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,
                                                  java.rmi.RemoteException
Obtains a reference to the given agent.

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.
Throws:
AgentNotFoundException,RemoteException - if error.
AgentNotFoundException
java.rmi.RemoteException
See Also:
AgentReference, String, ContextAddress, AgentNotFoundException, RemoteException

receiveContexts

public void receiveContexts(java.util.Hashtable contexts)
                     throws java.rmi.RemoteException
Receives information about the contexts in the system.

Parameters:
contexts - a table consisting of pairs .
java.rmi.RemoteException
See Also:
Hashtable, RemoteException

removeContext

public void removeContext(java.lang.String cn)
                   throws java.rmi.RemoteException
Removes a context from the list of contexts in the system.

Parameters:
cn - the name of the context.
java.rmi.RemoteException
See Also:
String, RemoteException

addContext

public void addContext(springs.context.ContextAddress context)
                throws java.rmi.RemoteException
Adds a context to the list of contexts in the system.

Parameters:
context - the context.
java.rmi.RemoteException
See Also:
ContextAddress, RemoteException

ping

public int ping()
         throws java.rmi.RemoteException
Pings the context.

Returns:
the number of agents that are being tracked by the context.
java.rmi.RemoteException
See Also:
RemoteException

updateReferences

public void updateReferences(java.util.Vector referenceUpdates)
                      throws java.rmi.RemoteException
Receives an update of references.

Returns:
referenceUpdates the updates.
java.rmi.RemoteException
See Also:
Vector, RemoteException