kaos.core.service.directory
Class RMIDomainDirectoryServiceImpl

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by kaos.core.service.directory.RMIDomainDirectoryServiceImpl
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, RMIDomainDirectoryService

public class RMIDomainDirectoryServiceImpl
extends java.rmi.server.UnicastRemoteObject
implements RMIDomainDirectoryService

$Revision: 1.1.1.1 $

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
RMIDomainDirectoryServiceImpl(RMIDomainDirectoryService rmiDirectory, java.lang.String rmiBindingName)
           
 
Method Summary
 void addPolicies(java.util.Vector policies)
          Each element of the Vector is a definition of a policy to be added to the collection of policies of the entity associated with that policy.
 void addPolicy(Msg policy)
          Add policy to the collection of policies of the entity associated with that policy.
 void changePolicies(java.util.Vector policies)
          Each element of the Vector is a definition of a policy to replace its current definition in the collection of policies of the entity associated with that policy.
 void changePolicy(Msg policy)
          Change policy of the entity associated with that policy.
 void deregister(AgentDescription desc)
          Remove the AgentDescription from the collection of domain entities registered in the directory.
 java.util.Map getDomainStructure()
          Obtain a Map containing the structure of the domain.
 java.util.Vector getPolicies()
          Obtain an Vector over all policies.
 java.util.Map getPoliciesByEntities()
          Obtain a Map containing key-value pairs of entity ids to their policies.
 java.util.Vector getPoliciesForEntity(java.lang.String id)
          Obtain an Vector over all policies associated with an entity whose id is specified.
 ServiceProperties getServiceProperties()
          Obtain the properties of the service.
 void modify(AgentDescription desc)
          Replace the AgentDescription in the collection of registered domain entities with the new AgentDescription.
 void register(AgentDescription desc)
          Add the AgentDescription to the collection of domain entities registered in the directory.
 void removePolicies(java.util.Vector policies)
          Each element of the Vector is a definition of a policy to be removed from the collection of policies of the entity associated with that policy.
 void removePolicy(Msg policy)
          Remove policy from the collection of policies of the entity associated with that policy.
 AgentDescription[] search(AgentDescription desc)
          Search the collection of AgentDescriptions for all matching descriptions.
 AgentDescription[] search(AgentDescription desc, int maxResults)
          Search the collection of AgentDescriptions for all matching descriptions.
 void setServiceProperties(ServiceProperties props)
          Set the properties of the service.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RMIDomainDirectoryServiceImpl

public RMIDomainDirectoryServiceImpl(RMIDomainDirectoryService rmiDirectory,
                                     java.lang.String rmiBindingName)
                              throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException
Method Detail

getServiceProperties

public ServiceProperties getServiceProperties()
                                       throws java.rmi.RemoteException,
                                              ServiceException,
                                              ServiceFailure
Obtain the properties of the service.

Returns:
the properties of the service.
Throws:
java.rmi.RemoteException
ServiceException
ServiceFailure

setServiceProperties

public void setServiceProperties(ServiceProperties props)
                          throws java.rmi.RemoteException,
                                 ServiceException,
                                 ServiceFailure
Set the properties of the service.

Parameters:
props - containing a set of the properties of the service.
Throws:
java.rmi.RemoteException
ServiceException
ServiceFailure

deregister

public void deregister(AgentDescription desc)
                throws java.rmi.RemoteException,
                       NotRegisteredException,
                       DirectoryFailure
Remove the AgentDescription from the collection of domain entities registered in the directory.

Specified by:
deregister in interface RMIDomainDirectoryService
Parameters:
desc - the AgentDescription to remove.
Throws:
NotRegisteredException - if the AgentDescription is not registered.
DirectoryFailure - if the directory service is not available.
java.rmi.RemoteException - if communication-related exception occurs.

modify

public void modify(AgentDescription desc)
            throws java.rmi.RemoteException,
                   NotRegisteredException,
                   DirectoryFailure
Replace the AgentDescription in the collection of registered domain entities with the new AgentDescription.

Specified by:
modify in interface RMIDomainDirectoryService
Parameters:
desc - the new AgentDescription to replace the old one.
Throws:
NotRegisteredException - if the AgentDescription is not registered.
DirectoryFailure - if the directory service is not available.
java.rmi.RemoteException - if communication-related exception occurs.

register

public void register(AgentDescription desc)
              throws java.rmi.RemoteException,
                     AlreadyRegisteredException,
                     DirectoryFailure
Add the AgentDescription to the collection of domain entities registered in the directory.

Specified by:
register in interface RMIDomainDirectoryService
Parameters:
desc - the AgentDescription to add.
Throws:
AlreadyRegisteredException - if the AgentDescription is already registered.
DirectoryFailure - if the directory service is not available.
java.rmi.RemoteException - if communication-related exception occurs

search

public AgentDescription[] search(AgentDescription desc)
                          throws java.rmi.RemoteException,
                                 SearchException,
                                 DirectoryFailure
Search the collection of AgentDescriptions for all matching descriptions. Return all results.

Specified by:
search in interface RMIDomainDirectoryService
Parameters:
desc - the AgentDescription to use for matching.
Returns:
AgentDescription[] containing matching descriptions.
Throws:
SearchException - if an exception occurs during searching.
DirectoryFailure - if the directory service is unavailable.
java.rmi.RemoteException - if communication-related exception occurs.

search

public AgentDescription[] search(AgentDescription desc,
                                 int maxResults)
                          throws java.rmi.RemoteException,
                                 SearchException,
                                 DirectoryFailure
Search the collection of AgentDescriptions for all matching descriptions. Match on agent name, if agent name is null, then use agent nickname. Limit the returned results to the specified number. Only _agents table is searched.

Specified by:
search in interface RMIDomainDirectoryService
Parameters:
desc - the AgentDescription to use for matching.
maxResults - the limit of returned results.
Returns:
AgentDescription[] containing the specified number, or less, of matching descriptions.
Throws:
SearchException - if an exception occurs during searching.
DirectoryFailure - if the directory service is not available.
java.rmi.RemoteException - if communication-related exception occurs.

addPolicy

public void addPolicy(Msg policy)
               throws java.rmi.RemoteException
Add policy to the collection of policies of the entity associated with that policy.

Specified by:
addPolicy in interface RMIDomainDirectoryService
Parameters:
policy - The Msg containing policy definition for a given entity.
Throws:
java.rmi.RemoteException

addPolicies

public void addPolicies(java.util.Vector policies)
                 throws java.rmi.RemoteException
Each element of the Vector is a definition of a policy to be added to the collection of policies of the entity associated with that policy.

Specified by:
addPolicies in interface RMIDomainDirectoryService
Parameters:
policies - The Vector of policies to be added to policies of their corresponding entities.
Throws:
java.rmi.RemoteException

removePolicy

public void removePolicy(Msg policy)
                  throws java.rmi.RemoteException
Remove policy from the collection of policies of the entity associated with that policy.

Specified by:
removePolicy in interface RMIDomainDirectoryService
Parameters:
policy - The Msg containing policy definition to be removed.
Throws:
java.rmi.RemoteException

removePolicies

public void removePolicies(java.util.Vector policies)
                    throws java.rmi.RemoteException
Each element of the Vector is a definition of a policy to be removed from the collection of policies of the entity associated with that policy.

Specified by:
removePolicies in interface RMIDomainDirectoryService
Parameters:
policies - The Vector of policies to be removed from policies of their corresponding entities.
Throws:
java.rmi.RemoteException

changePolicy

public void changePolicy(Msg policy)
                  throws java.rmi.RemoteException
Change policy of the entity associated with that policy.

Specified by:
changePolicy in interface RMIDomainDirectoryService
Parameters:
policy - The Msg containing policy definition to be changed for a given entity.
Throws:
java.rmi.RemoteException

changePolicies

public void changePolicies(java.util.Vector policies)
                    throws java.rmi.RemoteException
Each element of the Vector is a definition of a policy to replace its current definition in the collection of policies of the entity associated with that policy.

Specified by:
changePolicies in interface RMIDomainDirectoryService
Parameters:
policies - The Vector of policies to replace their current definitions.
Throws:
java.rmi.RemoteException

getPolicies

public java.util.Vector getPolicies()
                             throws java.rmi.RemoteException
Obtain an Vector over all policies. Each element of the Vector is an instance of a Msg class specifying an individual policy definition.

Specified by:
getPolicies in interface RMIDomainDirectoryService
Returns:
Vector of policy Msgs.
Throws:
java.rmi.RemoteException

getPoliciesByEntities

public java.util.Map getPoliciesByEntities()
                                    throws java.rmi.RemoteException
Obtain a Map containing key-value pairs of entity ids to their policies. The key is the entity GUID, the value is a table containing mappings: policyID -> policyMsg.

Specified by:
getPoliciesByEntities in interface RMIDomainDirectoryService
Returns:
Map of policies for each entitiy, the map is indexed by entity GUIDs.
Throws:
java.rmi.RemoteException

getPoliciesForEntity

public java.util.Vector getPoliciesForEntity(java.lang.String id)
                                      throws java.rmi.RemoteException
Obtain an Vector over all policies associated with an entity whose id is specified.

Specified by:
getPoliciesForEntity in interface RMIDomainDirectoryService
Parameters:
id - The String containing the id of entity whose policies are being requested.
Returns:
Vector of policy Msgs.
Throws:
java.rmi.RemoteException

getDomainStructure

public java.util.Map getDomainStructure()
                                 throws java.rmi.RemoteException
Obtain a Map containing the structure of the domain.

Specified by:
getDomainStructure in interface RMIDomainDirectoryService
Returns:
Map of: hosts -> execution environments -> containers -> agents
Throws:
java.rmi.RemoteException