kaos.core.service.directory
Class TableBasedKAoSDirectory

java.lang.Object
  extended by kaos.core.service.directory.TableBasedKAoSDirectory

public class TableBasedKAoSDirectory
extends java.lang.Object

$Revision: 1.63 $


Constructor Summary
TableBasedKAoSDirectory()
           
 
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.
 AgentDescription createAgentDescription()
          Create an empty AgentDescription suitable for attribute population and use.
 void deregister(AgentDescription desc)
          Remove the AgentDescription from the collection of domain entities registered in the directory.
 java.util.List getAllAgentsInDirectory()
           
 java.util.Vector getAllAgentsInDomain(java.lang.String domainName)
           
 java.util.Vector getAllDomainsInDirectory()
           
 java.util.List getAllGuardsInDirectory()
          Get a List of descriptions of all guards in the directory.
 java.util.Vector getApplicablePoliciesForEntity(java.lang.String entityId)
          Obtain the set of policies directly and indirectly applicable to a specified entity (post-deconfliction and DAML->XML conversion) This method returns all policies applicable to the entity (e.g., if you specified the id of an agent, it would return the policies for the agent, plus policies for the agent container, exec env, host, domain, which apply to the agent)
 java.util.Vector getApplicablePoliciesForEntity(java.lang.String entityId, java.lang.String scope)
          Obtain the set of policies directly and indirectly applicable to a specified entity (post-deconfliction and DAML->XML conversion) This method returns all policies applicable to the entity (e.g., if you specified the id of an agent, it would return the policies for the agent, plus policies for the agent container, exec env, host, domain, which apply to the agent)
 java.util.Vector getConditionalPolicies()
           
 DomainDescription getDomainDescription(java.lang.String domainName)
          Get the description of a domain
 java.util.List getDomainDescriptionsForGuard(java.lang.String guardGUID)
          Obtain a List containing DomainDescriptions of all domains the guard, whose GUID is specified, registered in.
 java.util.Vector getDomainNames()
          Obtain a List of the names of all registered domains.
 java.util.Map getDomainStructure(java.lang.String domainName)
          Obtain a Map containing the structure of a domain.
 java.util.Vector getGuardDescriptionsForEntity(java.lang.String entityID)
          method to return a vector of guard descriptions of the guards for the given entity
 java.util.Map getGuardInfo(java.lang.String guardId)
           
 java.util.Enumeration getGuards()
           
 java.util.Vector getGuardsForEntity(java.lang.String entityId)
          returns the ids of guards for a particular entity for domain: returns all guards in the domain for host: returns guards for all guarded entities under that host for execEnv: returns guards for all guarded entities under that execEnv for container: returns guards for the container for agent: returns guards for the agent
 java.util.List getPolicies()
          Obtain an Vector over all policies.
 java.util.Map getPoliciesByEntities()
          Obtain a table of all original policies (pre-deconfliction and DAML->XML conversion) in the system, indexed by the id(s) of the entity(s) to which they apply
 java.util.Vector getPoliciesForEntity(java.lang.String id)
          Obtain the original (pre-deconfliction and DAML->XML conversion) policies directly applicable to the specified entity This method does not return all policies applicable to the entity (e.g., if you specified the id of an agent, it would only return policies for that agent, *not* including policies for the agent container, exec env, host, domain, which apply to the agent)
 Msg getPolicy(java.lang.String policyId)
          Obtain a policy based on id
 java.util.Vector getRootDomains()
          Obtain an Vector of the names of the root domains (domains with no parent)
 ServiceProperties getServiceProperties()
          Obtain the properties of the service.
 java.util.Vector getSubdomains(java.lang.String domainName)
          Obtain a Vector of the names of subdomains of a particular domain (returns immediate children only)
 boolean isEntityInDomain(java.lang.String domainName, java.lang.String id)
          Search for the domain entity with the specified id.
 void modify(AgentDescription desc)
          Replace the AgentDescription in the collection of registered domain entities with the new AgentDescription.
 void modifyEntityProperties(java.lang.String entityGUID, java.util.List properties)
          Modify properties of the entity identified by the given entityGUID.
 void printDomainStatus()
           
 void register(AgentDescription desc)
          Add the AgentDescription to the collection of domain entities registered in the directory.
 void removeExecEnv(java.lang.String execEnvID)
          Retrieve a Hashtable containing information about a VM with the specified id from the _executionEnvs table and remove it.
 void removePolicies(java.util.List 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 setConditionalPolicies(java.util.Vector condPols)
           
 void setServiceProperties(ServiceProperties props)
          Set the properties of the service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableBasedKAoSDirectory

public TableBasedKAoSDirectory()
Method Detail

getServiceProperties

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

Returns:
the properties of the service.
Throws:
ServiceException
ServiceFailure

setServiceProperties

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

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

createAgentDescription

public AgentDescription createAgentDescription()
Create an empty AgentDescription suitable for attribute population and use.

This method may return null.

Returns:
a new AgentDescription

deregister

public void deregister(AgentDescription desc)
                throws NotRegisteredException,
                       DirectoryFailure
Remove the AgentDescription from the collection of domain entities registered in the directory. Checks if the AgentDescription is an instance of DomainDescription. If so, the domain Name for that description is removed.

Parameters:
desc - the AgentDescription to remove.
Throws:
NotRegisteredException - if the AgentDescription is not registered.
DirectoryFailure - if the directory service is not available.

modify

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

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.

register

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

Parameters:
desc - the AgentDescription to add.
Throws:
AlreadyRegisteredException - if the AgentDescription is already registered.
DirectoryFailure - if the directory service is not available.

search

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

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.

search

public AgentDescription[] search(AgentDescription desc,
                                 int maxResults)
                          throws 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.

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.

modifyEntityProperties

public void modifyEntityProperties(java.lang.String entityGUID,
                                   java.util.List properties)
                            throws NotRegisteredException,
                                   ModificationException
Modify properties of the entity identified by the given entityGUID.

Parameters:
entityGUID - String containing the entity GUID.
properties - List of Properties to be modified. Each Property contains the name, value, value description, modification type (add/remove/set, etc), modification result. Refer to the Property and ModificationResult interfaces for detailed description.
Throws:
DirectoryFailure - if the connection to the DS cannot be established.
NotRegisteredException - if the entity whose properties are to be modified has not been registered in the DS.
ModificationException - if one or more property update failed.

getAllAgentsInDirectory

public java.util.List getAllAgentsInDirectory()
Returns:
Vector of AgentDescriptions of all agents in the directory.

getAllGuardsInDirectory

public java.util.List getAllGuardsInDirectory()
Get a List of descriptions of all guards in the directory.

Returns:
List of KAoSGuardDescription of all guards in the directory.

getAllAgentsInDomain

public java.util.Vector getAllAgentsInDomain(java.lang.String domainName)
Parameters:
domainName - name of the domain
Returns:
Vector of AgentDescriptions of all agents in the domain.

getAllDomainsInDirectory

public java.util.Vector getAllDomainsInDirectory()
Returns:
Vector of AgentDescriptions of all agents in the directory.

isEntityInDomain

public boolean isEntityInDomain(java.lang.String domainName,
                                java.lang.String id)
Search for the domain entity with the specified id.

Parameters:
domainName - name of the domain to query
id - The id of an entity to be searched in this domain directory.
Returns:
true if the entity whose id is specified is found; otherwise return false.
Throws:
java.lang.NullPointerException - if the id is null.

getDomainStructure

public java.util.Map getDomainStructure(java.lang.String domainName)
Obtain a Map containing the structure of a domain.

Parameters:
domainName - name of the domain
Returns:
Map of: hosts -> execution environments -> containers -> agents

removeExecEnv

public void removeExecEnv(java.lang.String execEnvID)
Retrieve a Hashtable containing information about a VM with the specified id from the _executionEnvs table and remove it.

Parameters:
execEnvID - the id of the VM to be removed from the _executionEnvs table.

getGuardInfo

public java.util.Map getGuardInfo(java.lang.String guardId)

getGuards

public java.util.Enumeration getGuards()

getGuardDescriptionsForEntity

public java.util.Vector getGuardDescriptionsForEntity(java.lang.String entityID)
method to return a vector of guard descriptions of the guards for the given entity

Parameters:
entityID - A String indicating the guid of the entity.
Returns:
A Vector containing the guard descriptions (if any)

getDomainNames

public java.util.Vector getDomainNames()
Obtain a List of the names of all registered domains.

Returns:
Vector of Strings of the names of domains registered in this Directory.

getRootDomains

public java.util.Vector getRootDomains()
Obtain an Vector of the names of the root domains (domains with no parent)

Returns:
Vector of Strings of the names of domains

getSubdomains

public java.util.Vector getSubdomains(java.lang.String domainName)
Obtain a Vector of the names of subdomains of a particular domain (returns immediate children only)

Returns:
Vector of Strings of the names of domains

getDomainDescription

public DomainDescription getDomainDescription(java.lang.String domainName)
Get the description of a domain

Parameters:
domainName - the name of the domain

getDomainDescriptionsForGuard

public java.util.List getDomainDescriptionsForGuard(java.lang.String guardGUID)
Obtain a List containing DomainDescriptions of all domains the guard, whose GUID is specified, registered in.

Parameters:
guardGUID - GUID of the guard registered in all domains, whose descriptions are requested
Returns:
List of DomainDescriptions

addPolicy

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

Parameters:
policy - The Msg containing policy definition for a given entity.

addPolicies

public 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.

Parameters:
policies - The Vector of policies to be added to policies of their corresponding entities.

removePolicy

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

Parameters:
policy - The Msg containing policy definition to be removed.

removePolicies

public void removePolicies(java.util.List 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.

Parameters:
policies - The List of policies to be removed from policies of their corresponding entities.

changePolicy

public void changePolicy(Msg policy)
Change policy of the entity associated with that policy.

Parameters:
policy - The Msg containing policy definition to be changed for a given entity.

changePolicies

public 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.

Parameters:
policies - The Vector of policies to replace their current definitions.

getPolicy

public Msg getPolicy(java.lang.String policyId)
Obtain a policy based on id

Returns:
the requested policy

getPolicies

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

Returns:
List of policy Msgs.

getPoliciesByEntities

public java.util.Map getPoliciesByEntities()
Obtain a table of all original policies (pre-deconfliction and DAML->XML conversion) in the system, indexed by the id(s) of the entity(s) to which they apply

Returns:
Map of Map of policies key = String representing entity id value = Map of policies that are directly applicable to the entity (see comments for getPoliciesForEntity for the meaning of "directly applicable") key = String representing policy id value = PolicyMsg

getPoliciesForEntity

public java.util.Vector getPoliciesForEntity(java.lang.String id)
Obtain the original (pre-deconfliction and DAML->XML conversion) policies directly applicable to the specified entity This method does not return all policies applicable to the entity (e.g., if you specified the id of an agent, it would only return policies for that agent, *not* including policies for the agent container, exec env, host, domain, which apply to the agent)

Parameters:
entityId - id of the entity
Returns:
Vector of PolicyMsg

getApplicablePoliciesForEntity

public java.util.Vector getApplicablePoliciesForEntity(java.lang.String entityId)
Obtain the set of policies directly and indirectly applicable to a specified entity (post-deconfliction and DAML->XML conversion) This method returns all policies applicable to the entity (e.g., if you specified the id of an agent, it would return the policies for the agent, plus policies for the agent container, exec env, host, domain, which apply to the agent)

Parameters:
entityId - id of the entity
Returns:
Vector of PolicyMsg

getApplicablePoliciesForEntity

public java.util.Vector getApplicablePoliciesForEntity(java.lang.String entityId,
                                                       java.lang.String scope)
Obtain the set of policies directly and indirectly applicable to a specified entity (post-deconfliction and DAML->XML conversion) This method returns all policies applicable to the entity (e.g., if you specified the id of an agent, it would return the policies for the agent, plus policies for the agent container, exec env, host, domain, which apply to the agent)

Parameters:
entityId - id of the entity
Returns:
Vector of PolicyMsg

getConditionalPolicies

public java.util.Vector getConditionalPolicies()

setConditionalPolicies

public void setConditionalPolicies(java.util.Vector condPols)

getGuardsForEntity

public java.util.Vector getGuardsForEntity(java.lang.String entityId)
returns the ids of guards for a particular entity for domain: returns all guards in the domain for host: returns guards for all guarded entities under that host for execEnv: returns guards for all guarded entities under that execEnv for container: returns guards for the container for agent: returns guards for the agent


printDomainStatus

public void printDomainStatus()