kaos.core.csi.query
Class QueryRegistrationImpl

java.lang.Object
  extended by kaos.core.csi.query.QueryRegistrationImpl
All Implemented Interfaces:
QueryRegistration

public class QueryRegistrationImpl
extends java.lang.Object
implements QueryRegistration

Defines the operations to query the different aspects of domain and actor registrations

Author:
KAoS Team $Revision: 1.22 $

Method Summary
 KAoSAgentDescription getActor(java.lang.String actorGUID)
          Returns description of the actor identified by the given name
 java.util.List getActorsFulfilling(java.lang.String actorConstraints)
          Returns description of the actors fulfilling constraints expressed as the KIF statement
 java.util.List getActorsWithAttributes(java.util.Map attributes)
          Returns descriptions of the actors whose KAoSAgentDescription contains all specified attributes and their values.
 java.util.List getAllAgents()
          Return all agent ids stored in the KAoS directory.
 DomainDescription getDomain(java.lang.String name)
          Returns description of the domain identified by the given name
 java.util.List getGroupLeaders(java.lang.String groupURI)
          Get the list of KAoSAgentDescriptions for the Actors assigned as leaders for the given Group.
 java.util.List getGroupMembers(java.lang.String groupURI)
          Get the list of KAoSAgentDescriptions for the Actors assigned as members for the given Group.
 java.util.List getGroupsLedBy(java.lang.String actorId)
          Get the URI's for all Groups led by the given Actor
static QueryRegistration getInstance(java.lang.String transportName)
          Retrieve an instance of Registration.
 java.util.Vector<java.lang.String> getRootDomains()
          Returns the id of all domains that have no parent domain
 java.util.Vector getSubdomains(java.lang.String domain)
          Get the vector of subdomains assigned to this domain.
 java.util.Set getValuesForProperty(java.lang.String property, java.lang.String subject)
          Returns the set of values for the given property of the specified subject.
protected  void logMessage(java.lang.String msg, java.lang.Exception e, int logLevel)
           
protected  void logMessage(java.lang.String msg, int logLevel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static QueryRegistration getInstance(java.lang.String transportName)
                                     throws java.lang.Exception
Retrieve an instance of Registration.

Parameters:
transportName - String specifying the name of the transport to use for communication with the KAoS Directory Service.
Returns:
a singleton, Registration.
Throws:
java.lang.Exception

getDomain

public DomainDescription getDomain(java.lang.String name)
                            throws DirectoryFailure
Returns description of the domain identified by the given name

Specified by:
getDomain in interface QueryRegistration
Parameters:
name - String specifying the name of the domain to lookup
Returns:
DomainDescription identified by the given name
Throws:
DirectoryFailure - if the connection to the DS cannot be established.
DirectoryFailure - if the domain with the given name has not been registered in the DS

getRootDomains

public java.util.Vector<java.lang.String> getRootDomains()
                                                  throws DirectoryFailure
Description copied from interface: QueryRegistration
Returns the id of all domains that have no parent domain

Specified by:
getRootDomains in interface QueryRegistration
Returns:
List of String identifying by the root domains
Throws:
DirectoryFailure

getActor

public KAoSAgentDescription getActor(java.lang.String actorGUID)
                              throws DirectoryFailure,
                                     SearchException
Returns description of the actor identified by the given name

Specified by:
getActor in interface QueryRegistration
Parameters:
actorGUID - String specifying the GUID of the actor to lookup
Returns:
KAoSAgentDescription identified by the given name
Throws:
DirectoryFailure - if the connection to the DS cannot be established.
SearchException - if the actor with the given name has not been registered in the DS

getAllAgents

public java.util.List getAllAgents()
                            throws SearchException,
                                   DirectoryFailure
Return all agent ids stored in the KAoS directory.

Specified by:
getAllAgents in interface QueryRegistration
Returns:
List of all agent unique IDs in the agent directory, or null, if there aren't any.
Throws:
SearchException - if an exception is thrown during the search.
DirectoryFailure - if the directory cannot be found/is not available.

getActorsFulfilling

public java.util.List getActorsFulfilling(java.lang.String actorConstraints)
                                   throws DirectoryFailure,
                                          NoSuchActorException,
                                          QueryFailure
Returns description of the actors fulfilling constraints expressed as the KIF statement

Specified by:
getActorsFulfilling in interface QueryRegistration
Parameters:
actorConstraints - String specifying the GUID of the actor to lookup An example of a Constraints statement: Give me all agents that have as capability 'take picture' with a cost of less than $1,- with a reliability of 75% or better and where the average number of processed messages in the past hour is less than 20.
Returns:
KAoSAgentDescription identified by the given name
Throws:
DirectoryFailure - if the connection to the DS cannot be established.
NoSuchActorException - - if no actors matching the query properties could be found
QueryFailure - if query failed

getActorsWithAttributes

public java.util.List getActorsWithAttributes(java.util.Map attributes)
                                       throws DirectoryFailure,
                                              QueryFailure
Returns descriptions of the actors whose KAoSAgentDescription contains all specified attributes and their values.

Specified by:
getActorsWithAttributes in interface QueryRegistration
Parameters:
attributes - Map containing attribute names and their values to match the attributes in the DS.
Returns:
List containing KAoSAgentDescriptions matching the attributes.
Throws:
DirectoryFailure - if the connection to the DS cannot be established.
QueryFailure - if query failed

getValuesForProperty

public java.util.Set getValuesForProperty(java.lang.String property,
                                          java.lang.String subject)
                                   throws DirectoryFailure,
                                          QueryFailure
Returns the set of values for the given property of the specified subject.

Specified by:
getValuesForProperty in interface QueryRegistration
Parameters:
property - - URI identifying the ontology property of interest
subject - - identifier for the individual for which to get the property values
Returns:
Set all values for the specified property of the given subject
Throws:
DirectoryFailure
QueryFailure

getGroupMembers

public java.util.List getGroupMembers(java.lang.String groupURI)
                               throws DirectoryFailure,
                                      QueryFailure
Get the list of KAoSAgentDescriptions for the Actors assigned as members for the given Group.

Specified by:
getGroupMembers in interface QueryRegistration
Parameters:
groupURI - - URI for the Group individual for which the members will be returned
Returns:
List for each Actor assigned as a member for the given Group
Throws:
DirectoryFailure
QueryFailure

getGroupLeaders

public java.util.List getGroupLeaders(java.lang.String groupURI)
                               throws DirectoryFailure,
                                      QueryFailure
Get the list of KAoSAgentDescriptions for the Actors assigned as leaders for the given Group.

Specified by:
getGroupLeaders in interface QueryRegistration
Parameters:
groupURI - - URI for the Group individual for which the leaders will be returned
Returns:
List for each Actor assigned as a leader for the given Group
Throws:
DirectoryFailure
QueryFailure

getGroupsLedBy

public java.util.List getGroupsLedBy(java.lang.String actorId)
                              throws DirectoryFailure,
                                     QueryFailure
Get the URI's for all Groups led by the given Actor

Specified by:
getGroupsLedBy in interface QueryRegistration
Parameters:
actorId - - id of the Actor (Agent)
Returns:
List URI of each Group led by the given Actor
Throws:
DirectoryFailure
QueryFailure

getSubdomains

public java.util.Vector getSubdomains(java.lang.String domain)
                               throws DirectoryFailure
Get the vector of subdomains assigned to this domain.

Specified by:
getSubdomains in interface QueryRegistration
Parameters:
domain - - Domain name string
Returns:
Vector for each Actor assigned as a leader for the given Group
Throws:
DirectoryFailure

logMessage

protected void logMessage(java.lang.String msg,
                          int logLevel)

logMessage

protected void logMessage(java.lang.String msg,
                          java.lang.Exception e,
                          int logLevel)