org.nuin.agent.service
Interface AgentService

All Known Subinterfaces:
AcquaintanceModelService, AgentDirectoryService, MessageService, RESTWebService, ServiceRegistry, WebService, WSDLWebService
All Known Implementing Classes:
AbstractService, AbstractWebService, ActionsLibrary, DefaultAcquaintanceModelService, DefaultIOService, DefaultServiceRegistry, EventDispatcherService, GlobalServiceRegistry, LocalMessageService, RDQLQueryService, RESTWebServiceImp, WSDLWebServiceImpl

public interface AgentService

General super-type defining plug-in services that an agent can invoke from the script.

Version:
Release 0.4.0 (build 50) ($Id: AgentService.java,v 1.10 2004/11/01 22:00:36 ian_dickinson Exp $)
Author:
Ian Dickinson, HP Labs (email)

Method Summary
 boolean commits()
          Answer true if performing an action in this service commits the agent to a course of action that cannot be undone if the script backtracks.
 Agent getOwner()
          Answer the agent that owns this service instance, or null for a global service.
 KsSymbol getPrimaryServiceType()
           Answer the main type of service this service instance corresponds to, as a symbol.
 KsSymbol getServiceName()
           Answer the service identifier
 boolean isAlwaysGlobal()
          Answer true if instances of this service should always be registered in the global service registry, even if created by a given agent.
 java.util.Iterator listServiceTypes()
          Answer an iterator over all of the symbols denoting the type of this service
 ActionResult performAction(KsAction action, Intention intent, KsVar output)
          Perform the given action on this service, returning the status of the action (which may only be partially completed).
 void setOwner(Agent owner)
          Set the agent that is the owner of this registry
 

Method Detail

getPrimaryServiceType

KsSymbol getPrimaryServiceType()

Answer the main type of service this service instance corresponds to, as a symbol. Typically, this is the most-specific or most salient service type. To see all of the types of this service, see listServiceTypes().

Returns:
The primary service type, as a symbol

listServiceTypes

java.util.Iterator listServiceTypes()

Answer an iterator over all of the symbols denoting the type of this service

Returns:
An iterator over KsSymbols

getServiceName

KsSymbol getServiceName()

Answer the service identifier

Returns:
A unique identifier for this service, as a symbol

getOwner

Agent getOwner()

Answer the agent that owns this service instance, or null for a global service.

Returns:
The owner of the service

setOwner

void setOwner(Agent owner)

Set the agent that is the owner of this registry

Parameters:
owner - The owning agent

performAction

ActionResult performAction(KsAction action,
                           Intention intent,
                           KsVar output)

Perform the given action on this service, returning the status of the action (which may only be partially completed). If this service cannot perform the named action, throw an unnkown action exception.

Parameters:
action - Expression denoting the action to perform
intent - The intention that provides the execution context for this service action (including variable bindings)
output - Optional variable that can be bound to the output of the service, or null if no output is expected
Returns:
An action result denoting the status of the action (succeeded, failed or ongoing)
Throws:
UnknownActionExpression - if the action name is not recognised

commits

boolean commits()

Answer true if performing an action in this service commits the agent to a course of action that cannot be undone if the script backtracks.

Returns:
True if the action commits the interpreter to course of action

isAlwaysGlobal

boolean isAlwaysGlobal()

Answer true if instances of this service should always be registered in the global service registry, even if created by a given agent. This would be the case, for example, for some message services (e.g. LocalMessageService which rely on there being a single global instance to route messages between agents. By default, services are not forced into the global registry, and it is to be expected that global services are rare.

Returns:
True if the service is always registered in the global service registry, rather than the agent-specific service registry.


Copyright ©2002-2006 Hewlett-Packard Development Company, LP. All Rights Reserved.