kaos.core.service.directory
Class KAoSAgentDirectoryServiceProxy

java.lang.Object
  extended by kaos.core.service.util.MethodCallProxy
      extended by kaos.core.service.directory.DirectoryServiceProxy
          extended by kaos.core.service.directory.KAoSAgentDirectoryServiceProxy
All Implemented Interfaces:
KAoSObserver, OntologyService, PolicyAdvice, PolicyChecking, PolicyManagement, AuthenticationInterface, DirectoryEventNotifier, DirectoryService, MsgSender, DomainDirectoryService, DefinedPolicyTemplateInterface, OntologyRepositoryService, QueryKAoSOntologyService, GuardSynchronization, PolicyAnalyzes, PolicyModification, PolicySetDirectory, XMLRepository
Direct Known Subclasses:
CorbaAgentDirectoryServiceProxy, CougaarAgentDirectoryServiceProxy, GridAgentDirectoryServiceProxy, TCPAgentDirectoryServiceProxy

public abstract class KAoSAgentDirectoryServiceProxy
extends DirectoryServiceProxy
implements MsgSender, KAoSObserver

Author:
KAoS Team $Revision: 1.88 $ KAoSAgentDirectoryServiceProxy is an extension of DirectoryServiceProxy which binds it to a MessageTransportService

Nested Class Summary
 
Nested classes/interfaces inherited from class kaos.core.service.util.MethodCallProxy
MethodCallProxy.OperationWaiter
 
Nested classes/interfaces inherited from interface kaos.core.csi.policy.PolicyManagement
PolicyManagement.OntologyPolicyIncorrect, PolicyManagement.PrecedenceUndeterminedException
 
Nested classes/interfaces inherited from interface kaos.policy.management.PolicyAnalyzes
PolicyAnalyzes.PriorityConditionNotMet
 
Field Summary
protected  java.lang.String _directoryName
           
protected  java.lang.Object _lock
           
protected  MessageTransportService _mts
           
protected  Locator _myLocator
           
protected  java.lang.String _nickName
           
protected static java.lang.String _NICKNAME_ROOT
           
protected  Locator _remoteDirectoryLocator
           
protected  MessageSender _sender
           
protected  boolean _succeeded
           
static java.lang.String CONNECT_TO_LOCAL_DS
           
static java.lang.String USE_COORDINATOR
           
 
Fields inherited from class kaos.core.service.directory.DirectoryServiceProxy
_serviceProps, localOntologyInterfaces
 
Fields inherited from class kaos.core.service.util.MethodCallProxy
_msgSender, _waiters
 
Constructor Summary
KAoSAgentDirectoryServiceProxy()
           
KAoSAgentDirectoryServiceProxy(ServiceProperties serviceProps)
           
 
Method Summary
protected abstract  MessageTransportService acquireMessageTransportService()
           
protected abstract  Locator acquireRemoteDirectoryLocator()
          Return a Locator that will be used to communicate with the Domain Manager.
protected  Locator bindToMessageTransportService(MessageTransportService mts)
          Private methods.
protected  void checkDeregisterResult(MethodCallResultMsg result, AgentDescription desc)
          DirectoryFailure - as a result of registration, deregistration or modify request NotRegisteredException - as a result of deregistration or modify request IllegalArgumentexception - as a result of registration, deregistration or modify request
protected  void checkRegisterResult(MethodCallResultMsg result, AgentDescription desc)
          Extends superclass
 void cleanupVM()
          This is a call back from for the Runtime when the VM shutdown is in progress.
 boolean equals(java.lang.Object obj)
           
 Locator getDSLocator()
          Protected methods.
 java.lang.String getID()
          Return the unique identifier of this observer.
 int hashCode()
           
 boolean initialize(java.lang.String domainManagerName)
          Initialize variables and Message Transport Service infrastructure for sending/receiving messages.
protected  JasBean obtainEntityEnv()
          Specify transport specific parameters that will be passed to the MessageTransportSystem.
 void receiveMessage(TransportMessage msg)
          Receive a TransportMessage message from the MessageReceiver.
protected  void registerForVMShutDown()
          Register as the shutdown hook with the runtime system.
 void sendMessage(Msg msgOut)
           
protected  void sendMessage(TransportMessage transMsg)
           
 void sendMessageToKPAT(java.lang.String message)
           
 void update(java.lang.String observableID, java.lang.String updateType, java.lang.Object updateCondition, java.lang.Object update)
          Receive an update from the KAoSObservable when the KAoSObservable has a change or event to report.
 
Methods inherited from class kaos.core.service.directory.DirectoryServiceProxy
addAuthenticationObject, addDefinedPolicyTemplate, addEntityOntologicalType, addEventListener, addFilteredNamespace, addPolicies, addPolicy, addPolicy, addPolicySet, addPolicySets, addPolicyUpdateListener, addRemoteEventListener, analyzeWorkflow, analyzeWorkflow, areClassesDisjoint, askQuery, changeComponentEnabledStatus, changedPriority, changePolicies, changePolicy, changePolicy, changePolicySet, changePolicySets, checkDeepPermission, checkModifyResult, checkPermission, checkSearchResult, createAgentDescription, createMessageToSend, declareInstance, deleteAllLogs, deleteLogsforActionType, deleteLogsforActor, deleteSpecifiedLogs, deregister, editAuthenticationObject, editDefinedPolicyTemplate, findConflictingPolicies, findPolicies, findPoliciesMadeRedundant, findPoliciesMakingRedundant, findPolicyDecision, getActions, getAgentDescriptionForAgentID, getAllAgentsInDirectory, getAllAgentsInDomain, getAllAuthenticationObjects, getAllDefinedPolicyTemplate, getAllDomainsInDirectory, getAllGuardsInDirectory, getAllLogs, getAllNamespaces, getAllowableValuesForActionProperties, getAllowableValuesForActionProperties, getAllowableValuesForActionProperty, getAllPolicies, getAllPoliciesFor, getAllSchema, getClassesDefInNamespace, getClassesOfActors, getClassesOfActorsCapableOfPerformingActions, getClassesOfGroups, getClassesOfPlaces, getClassesOfTargets, getComponentEnabledStatus, getConstructedOntologyStructure, getConstructedOntologyStructures, getDirectPoliciesFor, getDomainDescription, getDomainDescriptionsForGuard, getDomainNames, getDomainStructure, getFilteredNamespaces, getForbiddenValuesForActionProperty, getGuardDescriptionsForEntity, getGuardStateFor, getImmediateSubClassesOf, getIndividualActors, getIndividualGroups, getIndividualPlaces, getIndividualTargets, getInstancesDefInNamespace, getInstancesOf, getListOfLoadedOntologies, getLogsforActionType, getLogsforActor, getNamspacesImportedByNamespace, getObligationsForTriggerCondition, getOntologyDefinitionForConcept, getPolicies, getPoliciesByEntities, getPolicy, getPolicyInformation, getPolicySet, getPolicySets, getPolicyUpdateCount, getPropertiesApplicableTo, getPropertiesDefInNamespace, getRangeOnPropertyForClass, getRepositoryTableInformation, getResourcesWithValueForProperty, getRootDomains, getSchema, getServiceProperties, getSpecifiedLogs, getSubClassesOf, getSubdomains, getSubPropertiesOf, getSuperClassesOf, getSuperPropertiesOf, getUltimateOntologyTypesOfIndividual, getUniqueValueForProperty, getValuesForProperty, harmonizePolicy, init, initiateActionClassTargets, instancesSetSynchronizationRequest, invokeKAoSExtensionComponentMethod, invokeMethod, isEntityInDomain, isFullyOverlappedBySecondPolicy, isFullyOverlappedByUnionOfPolicies, isGuardLoggingActive, isMadeFullyRedundantByPolicyUnion, isMadeFullyRedundantBySecond, isMadeParitallyRedundantBySecond, isPartiallyOverlappedBySecondPolicy, isPolicyInConflict, isPolicyMakingRedundantSomeOtherPolicy, isPolicyRedundant, isSynchronizationNeeded, isUsernameRegistered, loadOntologies, loadOntology, loadOntology, loadOntology, loadSchema, modify, modifyEntityProperties, policiesSynchronizationRequest, putConstructedOntologyStructures, putMultipleSchema, putSchema, register, removeAllPolicies, removeAuthenticationObject, removeConstructedOntologyStructure, removeConstructedOntologyStructures, removeDefinedPolicyTemplate, removeEventListener, removeExecEnv, removeFilteredNamespace, removePolicies, removePolicy, removePolicy, removePolicyInformation, removePolicySet, removePolicySets, removePolicyUpdateListener, removeRemoteEventListener, removeSchema, search, search, setGuardLoggingState, setServiceProperties, splitPolicy, subclassesSetSynchronizationRequest, subpropertiesSetSynchronizationRequest, superclassesSetSynchronizationRequest, superpropertiesSetSynchronizationRequest, testTrue, updateInForceValue, updatePolicies
 
Methods inherited from class kaos.core.service.util.MethodCallProxy
getResult, getResult, notifyWaitersOfError, sendRequestNoWait
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_COORDINATOR

public static final java.lang.String USE_COORDINATOR
See Also:
Constant Field Values

CONNECT_TO_LOCAL_DS

public static final java.lang.String CONNECT_TO_LOCAL_DS
See Also:
Constant Field Values

_NICKNAME_ROOT

protected static final java.lang.String _NICKNAME_ROOT
See Also:
Constant Field Values

_succeeded

protected boolean _succeeded

_lock

protected java.lang.Object _lock

_mts

protected MessageTransportService _mts

_directoryName

protected java.lang.String _directoryName

_nickName

protected java.lang.String _nickName

_sender

protected MessageSender _sender

_myLocator

protected Locator _myLocator

_remoteDirectoryLocator

protected Locator _remoteDirectoryLocator
Constructor Detail

KAoSAgentDirectoryServiceProxy

public KAoSAgentDirectoryServiceProxy()

KAoSAgentDirectoryServiceProxy

public KAoSAgentDirectoryServiceProxy(ServiceProperties serviceProps)
Method Detail

acquireRemoteDirectoryLocator

protected abstract Locator acquireRemoteDirectoryLocator()
Return a Locator that will be used to communicate with the Domain Manager. The Locator must be supported by DomainManager's platform and this KAoSAgentDirectoryServiceProxy platform. Since the instance of the created Locator will contain transport-specific params, this method must be implemented by a subclass.


acquireMessageTransportService

protected abstract MessageTransportService acquireMessageTransportService()

obtainEntityEnv

protected JasBean obtainEntityEnv()
Specify transport specific parameters that will be passed to the MessageTransportSystem.


initialize

public boolean initialize(java.lang.String domainManagerName)
Initialize variables and Message Transport Service infrastructure for sending/receiving messages. Register this KAoSAgentDirectoryServiceProxy with the VM shutdown mechanism, so in the event of VM shut down all registered entities and execution environments (this VM and containers) will be unregistered from the domain.

Parameters:
domainManagerName - the name of the DomainManager this Directory will be a proxy of.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

sendMessageToKPAT

public void sendMessageToKPAT(java.lang.String message)
                       throws java.lang.Exception
Throws:
java.lang.Exception

cleanupVM

public void cleanupVM()
This is a call back from for the Runtime when the VM shutdown is in progress. Before the VM terminates, all registered entities and the VM/containers should be deregistered from the Domain Manager's registry.


getDSLocator

public Locator getDSLocator()
Protected methods. /


registerForVMShutDown

protected void registerForVMShutDown()
Register as the shutdown hook with the runtime system. Just before the VM exits, deregister all agents still running in this VM and the VM itself from the domain directory.


bindToMessageTransportService

protected Locator bindToMessageTransportService(MessageTransportService mts)
                                         throws java.lang.Exception
Private methods.

Throws:
java.lang.Exception

sendMessage

public void sendMessage(Msg msgOut)
                 throws java.lang.Exception
Specified by:
sendMessage in interface MsgSender
Overrides:
sendMessage in class MethodCallProxy
Throws:
java.lang.Exception

sendMessage

protected void sendMessage(TransportMessage transMsg)
                    throws TransportFailure,
                           NotLocatableException,
                           java.lang.Exception
Specified by:
sendMessage in interface MsgSender
Overrides:
sendMessage in class MethodCallProxy
Throws:
TransportFailure
NotLocatableException
java.lang.Exception

checkRegisterResult

protected void checkRegisterResult(MethodCallResultMsg result,
                                   AgentDescription desc)
                            throws AlreadyRegisteredException,
                                   DirectoryFailure
Extends superclass

Overrides:
checkRegisterResult in class DirectoryServiceProxy
Throws:
AlreadyRegisteredException
DirectoryFailure

checkDeregisterResult

protected void checkDeregisterResult(MethodCallResultMsg result,
                                     AgentDescription desc)
                              throws NotRegisteredException,
                                     DirectoryFailure
DirectoryFailure - as a result of registration, deregistration or modify request NotRegisteredException - as a result of deregistration or modify request IllegalArgumentexception - as a result of registration, deregistration or modify request

Overrides:
checkDeregisterResult in class DirectoryServiceProxy
Throws:
NotRegisteredException
DirectoryFailure

getID

public java.lang.String getID()
Return the unique identifier of this observer.

Specified by:
getID in interface KAoSObserver
Returns:
String containing the unique ID of this observer.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

receiveMessage

public void receiveMessage(TransportMessage msg)
Receive a TransportMessage message from the MessageReceiver. Unwrap the TransportMessage to get the MethodCallResultMsg from the DomainManager. Notify the correct waiter object, blocking a Thread that invoked the Directory operation, whose results were just received in this receiveMessage call. Based on the result, the notification will unblock the waiting Thread, which will either deliver the DomainManager's reply to the correct invoker, or throw an exception, if the the DomainManager threw one as a reply.

Overrides:
receiveMessage in class MethodCallProxy
Parameters:
msg - the TransportMessage containing DomainManager's reply to one of: register/deregister/modify/search/removeExecEnv requests.

update

public void update(java.lang.String observableID,
                   java.lang.String updateType,
                   java.lang.Object updateCondition,
                   java.lang.Object update)
            throws NotificationException
Receive an update from the KAoSObservable when the KAoSObservable has a change or event to report.

Specified by:
update in interface KAoSObserver
Parameters:
observableID - String identifying the KAoSObservable sending the update.
updateType - String indicating type of update.
update - Object containing the update.
updateCondition - String describing the condition of the update.
Throws:
NotificationException - when the update fails.