context.arch.service
Class Service

java.lang.Object
  |
  +--context.arch.service.Service
Direct Known Subclasses:
DisplayChoiceService, InheritedService

public abstract class Service
extends java.lang.Object

This class implements a service object.

See Also:
Services

Field Summary
static java.lang.String ASYNCHRONOUS
          Tag to indicate service function is ASYNCHRONOUS
protected  CommunicationsHandler comm
           
static java.lang.String EXECUTED
          Tag to indicate the status of a service request is executed
static java.lang.String EXECUTING
          Tag to indicate the status of a service request is executing
static java.lang.String FAILED
          Tag to indicate the status of a service request is failed
protected  PendingOut pending
           
static java.lang.String SERVICE_REQUEST
          Tag for a service request
static java.lang.String SERVICE_REQUEST_REPLY
          Tag to indicate message is a service reply
static java.lang.String SERVICE_RESULT
          Tag for a service result
static java.lang.String SERVICE_RESULT_REPLY
          Tag for a service result reply
static java.lang.String STATUS
          Tag to indicate the status of a service request
static java.lang.String SYNCHRONOUS
          Tag to indicate service function is SYNCHRONOUS
 
Constructor Summary
Service(CommunicationsHandler comm)
          Basic constructor that creates a service object.
Service(CommunicationsHandler comm, java.lang.String name, FunctionDescriptions functions)
          Basic constructor that creates a service object.
 
Method Summary
abstract  DataObject execute(ServiceInput serviceInput)
          This abstract method defines what should occur when the service is executed.
 FunctionDescriptions getFunctionDescriptions()
          Returns the descriptions of the service functions
 java.lang.String getName()
          Returns the service name
 ServiceDescription getServiceDescription()
          Returns the ServiceDescription object
protected  DataObject sendServiceResult(ServiceInput input, AttributeNameValues atts)
          This method is called to send a the results of an asynchronous service execution to a requesting component.
 void setFunctionDescriptions(FunctionDescriptions functions)
          Sets the descriptions of the service functions
 void setName(java.lang.String name)
          Sets the service name
 DataObject toDataObject()
          Creates a ServiceDescription object and returns the DataObject version of it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_REQUEST

public static final java.lang.String SERVICE_REQUEST
Tag for a service request

SERVICE_REQUEST_REPLY

public static final java.lang.String SERVICE_REQUEST_REPLY
Tag to indicate message is a service reply

SERVICE_RESULT

public static final java.lang.String SERVICE_RESULT
Tag for a service result

SERVICE_RESULT_REPLY

public static final java.lang.String SERVICE_RESULT_REPLY
Tag for a service result reply

SYNCHRONOUS

public static final java.lang.String SYNCHRONOUS
Tag to indicate service function is SYNCHRONOUS

ASYNCHRONOUS

public static final java.lang.String ASYNCHRONOUS
Tag to indicate service function is ASYNCHRONOUS

STATUS

public static final java.lang.String STATUS
Tag to indicate the status of a service request

EXECUTING

public static final java.lang.String EXECUTING
Tag to indicate the status of a service request is executing

EXECUTED

public static final java.lang.String EXECUTED
Tag to indicate the status of a service request is executed

FAILED

public static final java.lang.String FAILED
Tag to indicate the status of a service request is failed

comm

protected CommunicationsHandler comm

pending

protected PendingOut pending
Constructor Detail

Service

public Service(CommunicationsHandler comm)
Basic constructor that creates a service object. It creates a pending queue to keep track of requests in the case that this service is an asynchronous service.
Parameters:
comm - Object that implements the CommunicationsHandler interface
See Also:
CommunicationsHandler, PendingOut

Service

public Service(CommunicationsHandler comm,
               java.lang.String name,
               FunctionDescriptions functions)
Basic constructor that creates a service object. It creates a pending queue to keep track of requests in the case that this service is an asynchronous service. It sets the service name and descriptions of the service functions.
Parameters:
comm - Object that implements the CommunicationsHandler interface
See Also:
CommunicationsHandler, PendingOut
Method Detail

execute

public abstract DataObject execute(ServiceInput serviceInput)
This abstract method defines what should occur when the service is executed.
Parameters:
serviceInput - Object that contains all the information necessary to execute the service.
Returns:
Result of the service request

sendServiceResult

protected DataObject sendServiceResult(ServiceInput input,
                                       AttributeNameValues atts)
This method is called to send a the results of an asynchronous service execution to a requesting component.
Parameters:
input - Object containing information on the requesting component
atts - AttributeNameValues containing the service results
Returns:
result of sending the service results
See Also:
CommunicationsHandler.userRequest(DataObject,String,String,int)

setName

public void setName(java.lang.String name)
Sets the service name
Parameters:
name - Name of the service

getName

public java.lang.String getName()
Returns the service name
Returns:
name of the service

setFunctionDescriptions

public void setFunctionDescriptions(FunctionDescriptions functions)
Sets the descriptions of the service functions
Parameters:
functions - Descriptions of the service functions

getFunctionDescriptions

public FunctionDescriptions getFunctionDescriptions()
Returns the descriptions of the service functions
Returns:
descriptions of the service functions

getServiceDescription

public ServiceDescription getServiceDescription()
Returns the ServiceDescription object
Returns:
ServiceDescription object

toDataObject

public DataObject toDataObject()
Creates a ServiceDescription object and returns the DataObject version of it
Returns:
Service object converted to an DataObject