|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkaos.core.util.MethodCallRequestHandler
kaos.core.csi.request.ActionMethodRequestHandler
kaos.dfra.dlik.DLIKImpl
public class DLIKImpl
Defines the DFRA Logical Interface to KAoS.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_DFRA_CONTEXT
|
static java.lang.String |
DEFAULT_DFRA_ROLE
|
static java.lang.String |
DEFAULT_KAOS_TRANSPORT
|
static java.lang.String |
ROLE_PREFIX_URI
|
static java.lang.String |
ROLE_URI
|
Fields inherited from class kaos.core.csi.request.ActionMethodRequestHandler |
---|
_policyService |
Fields inherited from class kaos.core.util.MethodCallRequestHandler |
---|
_agentDescription, _helper, _mts, _nickName, DEFAULT_NICKNAME, myLocator, myMessageReceiver, myMessageSender |
Fields inherited from interface kaos.dfra.dlik.DLIK |
---|
NEGATIVE_DOMAIN_MODALITY, POSITIVE_DOMAIN_MODALITY |
Method Summary | |
---|---|
void |
addCommandListener(CommandListener listener)
Add the CommandListener to the list of those notified when a remote KAoS command is received. |
void |
assignAgentToRole(java.lang.String agentName,
java.lang.String roleName,
java.lang.String contextName)
Assign an agent to an additional role (does not remove any existing roles). |
protected void |
checkForNullArgument(java.lang.Object arg,
java.lang.String methodName,
java.lang.String argName)
Utility method: if the exp is true, then the arg is null. |
void |
checkPermission(java.lang.String actorGUID,
java.lang.String attemptedActionName,
java.util.HashMap actionProperties,
java.lang.String conceptMappingName)
Check permission for the action described by the given action name and properties. |
void |
deregisterAgent(java.lang.String agentName)
Deregister the agent from KAoS. |
java.util.Properties |
getActionProperties(ActionInfo kaosAction)
Convert a KAoS BasicActionDescription to a Properties object. |
java.util.List |
getActorsInRole(java.lang.String roleName)
Query KAoS for all Actors registered in the given role |
KAoSAgentDescription |
getAgentDescriptionForGUID(java.lang.String agentGUID)
Return a KAoSAgentDescription for an agent, whose GUID is specified. |
java.util.List |
getAgentDescriptionForNickname(java.lang.String agentNickname)
Return a List of KAoSAgentDescriptions of agents, whose nickname is specified. |
java.util.List |
getAgentRoles(java.lang.String agentName)
Gets the list of roles to which the agent is currently assigned. |
java.util.List |
getAgentsWithAttributes(java.util.Hashtable searchAttributes)
Return a List of KAoSAgentDescriptions whose attributes match exactly all specified attributes. |
java.util.List |
getAllAgents()
Return a List of guids of all agents registered in the KAoS Directory Service. |
DomainDescription |
getDomain(java.lang.String domainName)
Return a DomainDescription of the domain, whose name is specified. |
static DLIK |
getInstance()
Retrieve an instance of DLIK. |
java.util.List<ActionInstanceDescription> |
getObligationsForTriggerCondition(java.lang.String actionActorGUID,
java.lang.String triggerActionName,
java.util.HashMap triggerActionProperties,
java.lang.String conceptMappingName)
Based on the specified trigger action actor, name and properties, select all applicable obligation ActionInstanceDescriptions. |
java.util.Vector |
getPoliciesForAgent(java.lang.String agentName)
Get all of the obligations for an agent (all roles, all action types). |
java.util.List<ActionInstanceDescription> |
getPoliciesForAgentAction(java.lang.String agentName,
java.lang.String actionType)
Get all of the obligations of a specific action type for an agent. |
java.util.Vector |
getPoliciesForAgentRole(java.lang.String agentName,
java.lang.String role,
java.lang.String context)
Get the obligations associated with a specific role for an agent (one role, all action types). |
java.util.List |
getTeamLeaders(java.lang.String teamURI)
|
java.util.List |
getTeamsLedBy(java.lang.String agentId)
|
protected void |
handleObjContent(java.lang.Object obj)
Handle a message received that is not a Method call request (see reportIntruder()) |
boolean |
isAgentMemberOfRole(java.lang.String agentName,
java.lang.String roleName,
java.lang.String contextName)
Gets whether the agent is assigned the given role. |
protected void |
logMessage(java.lang.String msg,
java.lang.Exception e,
int logLevel)
|
protected void |
logMessage(java.lang.String msg,
int logLevel)
|
KAoSAgentDescription |
registerAgent(java.lang.String agentName,
java.lang.String roleName,
java.lang.String contextName)
Register an agent with KAoS, in its starting role. |
void |
registerTriggerConditionListener(java.lang.String triggerActionClassName,
TriggerConditionListener listenerRef)
Request registration of the specified TriggerConditionListener in the Guard's registry of trigger listeners. |
void |
removeAgentFromRole(java.lang.String agentName,
java.lang.String roleName,
java.lang.String contextName)
Unassign an agent from a previously assigned Role. |
void |
removeCommandListener(CommandListener listener)
Remove the CommandListener from the list of those notified when a remote KAoS command is received. |
void |
removeTeamLeader(java.lang.String agentId,
java.lang.String teamURI)
|
void |
reportIntruder(double latitude,
double longitude)
Send a message to the KAoS CMDR agent, the message contains the GPS coordinates of an intruder. |
void |
sendMessageTo(java.lang.String receiverName,
java.io.Serializable messageContent)
Send a message to a specified agent that is registered with KAoS. |
void |
setAsTeamLeader(java.lang.String agentId,
java.lang.String teamURI)
|
boolean |
setMapping(java.lang.String mappingName,
java.lang.String fileNameLoc)
Set the ontology mapping, whose name and location are given. |
java.lang.String |
StartScenario()
Method called remotely (by TRIPS voice command) to tell the USF commander to start PhaseI of the demo. |
java.lang.String |
StartScenario(java.util.HashMap map)
|
Methods inherited from class kaos.core.csi.request.ActionMethodRequestHandler |
---|
bindToPolicyService, checkPermissionForAction, executeHashMapBasedAction, getPropertiesFromAID, processAIDRequest, processAIDRequest, processHashMapRequest, processHashMapRequest, processHashMapRequest, processHashMapRequest |
Methods inherited from class kaos.core.util.MethodCallRequestHandler |
---|
bindToTransport, handleMsgContent, initialize, receiveMessage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ROLE_URI
public static final java.lang.String ROLE_PREFIX_URI
public static final java.lang.String DEFAULT_DFRA_ROLE
public static final java.lang.String DEFAULT_DFRA_CONTEXT
public static final java.lang.String DEFAULT_KAOS_TRANSPORT
Method Detail |
---|
public static DLIK getInstance() throws java.lang.Exception
transportName
- String specifying the name of the transport to use for communication with the KAoS Directory Service.
java.lang.Exception
public KAoSAgentDescription registerAgent(java.lang.String agentName, java.lang.String roleName, java.lang.String contextName) throws DirectoryFailure, GuardInstantiationException
registerAgent
in interface DLIK
agentName
- roleName
-
AlreadyRegisteredException
DirectoryFailure
GuardInstantiationException
public void setAsTeamLeader(java.lang.String agentId, java.lang.String teamURI) throws NotRegisteredException, DirectoryFailure, ModificationException
NotRegisteredException
DirectoryFailure
ModificationException
public void removeTeamLeader(java.lang.String agentId, java.lang.String teamURI) throws NotRegisteredException, DirectoryFailure, ModificationException
NotRegisteredException
DirectoryFailure
ModificationException
public java.util.List getTeamLeaders(java.lang.String teamURI) throws DirectoryFailure, QueryFailure
DirectoryFailure
QueryFailure
public java.util.List getTeamsLedBy(java.lang.String agentId) throws DirectoryFailure, QueryFailure
DirectoryFailure
QueryFailure
public void assignAgentToRole(java.lang.String agentName, java.lang.String roleName, java.lang.String contextName) throws AlreadyRegisteredException, DirectoryFailure, GuardInstantiationException
assignAgentToRole
in interface DLIK
agentName
- roleName
-
AlreadyRegisteredException
DirectoryFailure
GuardInstantiationException
public void removeAgentFromRole(java.lang.String agentName, java.lang.String roleName, java.lang.String contextName) throws NotRegisteredException, DirectoryFailure
removeAgentFromRole
in interface DLIK
agentName
- roleName
-
NotRegisteredException
DirectoryFailure
public void deregisterAgent(java.lang.String agentName) throws NotRegisteredException, DirectoryFailure
deregisterAgent
in interface DLIK
agentName
-
NotRegisteredException
DirectoryFailure
public java.util.Vector getPoliciesForAgent(java.lang.String agentName) throws java.net.URISyntaxException
DLIK
getPoliciesForAgent
in interface DLIK
java.net.URISyntaxException
public java.util.Vector getPoliciesForAgentRole(java.lang.String agentName, java.lang.String role, java.lang.String context) throws java.net.URISyntaxException
DLIK
getPoliciesForAgentRole
in interface DLIK
java.net.URISyntaxException
public java.util.List<ActionInstanceDescription> getPoliciesForAgentAction(java.lang.String agentName, java.lang.String actionType) throws java.net.URISyntaxException
DLIK
getPoliciesForAgentAction
in interface DLIK
java.net.URISyntaxException
public java.util.Properties getActionProperties(ActionInfo kaosAction)
DLIK
getActionProperties
in interface DLIK
public boolean isAgentMemberOfRole(java.lang.String agentName, java.lang.String roleName, java.lang.String contextName) throws DirectoryFailure
isAgentMemberOfRole
in interface DLIK
DirectoryFailure
public java.util.List getAgentRoles(java.lang.String agentName)
getAgentRoles
in interface DLIK
public void addCommandListener(CommandListener listener)
addCommandListener
in interface DLIK
listener
- - the CommandListener to addpublic void removeCommandListener(CommandListener listener)
removeCommandListener
in interface DLIK
listener
- - the CommandListener to addpublic void reportIntruder(double latitude, double longitude) throws DirectoryFailure, SearchException, NotLocatableException, TransportFailure
reportIntruder
in interface DLIK
latitude
- longitude
-
DirectoryFailure
SearchException
NotLocatableException
TransportFailure
public void sendMessageTo(java.lang.String receiverName, java.io.Serializable messageContent) throws DirectoryFailure, SearchException, NotLocatableException, TransportFailure
sendMessageTo
in interface DLIK
receiverName
- - name recipient agent used to register with KAoSmessageContent
- - any Serializable
DirectoryFailure
SearchException
NotLocatableException
TransportFailure
protected void handleObjContent(java.lang.Object obj)
handleObjContent
in class MethodCallRequestHandler
public java.lang.String StartScenario() throws java.lang.Exception
java.lang.Exception
- if there are no CommandListeners registered with DLIKpublic java.lang.String StartScenario(java.util.HashMap map) throws java.lang.Exception
java.lang.Exception
public DomainDescription getDomain(java.lang.String domainName) throws DirectoryFailure, NotRegisteredException
getDomain
in interface DLIK
name
- String specifying the name of the domain to lookup.
DirectoryFailure
- if the connection to the DS cannot be established.
NotRegisteredException
- if the requested domain to be looked-up has not been registered in the DS.public KAoSAgentDescription getAgentDescriptionForGUID(java.lang.String agentGUID) throws DirectoryFailure, NotRegisteredException
getAgentDescriptionForGUID
in interface DLIK
agentGUID
- String specifying the guid of the agent to lookup.
DirectoryFailure
- if the connection to the DS cannot be established.
NotRegisteredException
- if the agent to be looked-up has not been registered in the DS.public java.util.List getAgentDescriptionForNickname(java.lang.String agentNickname) throws DirectoryFailure, NotRegisteredException
getAgentDescriptionForNickname
in interface DLIK
agentNickname
- String specifying the agentNickname of the agent(s) to lookup.
DirectoryFailure
- if the connection to the DS cannot be established.
NotRegisteredException
- if no agents with the given nickname have been registered in the DS.public java.util.List getAgentsWithAttributes(java.util.Hashtable searchAttributes) throws DirectoryFailure, NotRegisteredException
getAgentsWithAttributes
in interface DLIK
searchAttributes
- Hashtable containing attribute name => attribute value mappings.
NOTE: the names of defaul tentity attributes are defined in interfaces:
kaos.core.service.directory.KAoSEntityDescription
kaos.core.service.directory.KAoSAgentDescription
DirectoryFailure
- if the connection to the DS cannot be established.
NoSuchActorException
- if no actors matching the query properties could be found.
NotRegisteredException
public java.util.List getAllAgents() throws DirectoryFailure, SearchException
getAllAgents
in interface DLIK
DirectoryFailure
- if the connection to the DS cannot be established.
SearchException
- if search failed.public void checkPermission(java.lang.String actorGUID, java.lang.String attemptedActionName, java.util.HashMap actionProperties, java.lang.String conceptMappingName) throws KAoSSecurityException, java.lang.NullPointerException, ServiceFailure
checkPermission
in interface DLIK
actorGUID
- String containing the GUID of the agent attempting to perform
the action to check permission for.attemptedActionName
- String containing the ontological name of the attempted action.
NOTE: many ontological names of actions and their properties are defined in:
kaos.ontology.vocabulary.ActionConceptsactionProperties
- HashMap containing the ontological names and their values of properties of the attempted action.conceptMappingName
- String containing the mapping of vocabulary between DFRA and KAoS ontologies. Optional.
KAoSSecurityException
- if the attempted action is not allowed.
java.lang.NullPointerException
- if - will be thrown if any of the required
arguments is null (consistent with the semantics of Java checking permission).
ServiceFailure
- if the policy service is not available.public void registerTriggerConditionListener(java.lang.String triggerActionClassName, TriggerConditionListener listenerRef) throws TriggerConditionListenerRegistrationException
registerTriggerConditionListener
in interface DLIK
triggerActionClassName
- String containing the name of the action class the given trigger listener is going to monitor.listenerRef
- TriggerConditionListener, an instance of a listener, which will be monitoring the action, whose
name is given. When Guard receives a policy, whose action matches the triggerActionClassName,
Guard will send an update to the listenerRef.
TriggerConditionListenerRegistrationException
- if the listener registration fails.public java.util.List<ActionInstanceDescription> getObligationsForTriggerCondition(java.lang.String actionActorGUID, java.lang.String triggerActionName, java.util.HashMap triggerActionProperties, java.lang.String conceptMappingName) throws ObligationViolationException, ServiceFailure
getObligationsForTriggerCondition
in interface DLIK
actionActorGUID
- String containing the GUID of the agent performing the trigger action.triggerActionName
- String containing the ontological name of the trigger action.triggeraActionProperties
- HashMap containing the ontological names and their values of properties of the trigger action.conceptMappingName
- String containing the mapping of vocabulary between DFRA and KAoS ontologies.
ObligationViolationException
- if obligation constraints are not satisfied.
ServiceFailure
- if the policy service is not available.public boolean setMapping(java.lang.String mappingName, java.lang.String fileNameLoc)
setMapping
in interface DLIK
mappingName
- The String specifying the name of the mapping.
*** Note *** This name has to be passed to
KAoSActorImpl.setConceptMappingName(mappingName) before specifying
the terms from the mappingName ontology.fileNameLoc
- The String specifying the name and path of the file containing the mapping.
protected void logMessage(java.lang.String msg, int logLevel)
protected void logMessage(java.lang.String msg, java.lang.Exception e, int logLevel)
public java.util.List getActorsInRole(java.lang.String roleName) throws DirectoryFailure, QueryFailure
roleName
-
DirectoryFailure
QueryFailure
protected void checkForNullArgument(java.lang.Object arg, java.lang.String methodName, java.lang.String argName) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- if arg is null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |