org.nuin.agent.service
Interface ServiceFactory

All Known Implementing Classes:
DefaultServiceFactory

public interface ServiceFactory

Interface that defines the service factory for generating instances of agent services that can be invoked from the agent's interpreter loop.

Version:
Release 0.4.0 (build 50) ($Id: ServiceFactory.java,v 1.8 2004/11/03 00:29:43 ian_dickinson Exp $)
Author:
Ian Dickinson, HP Labs (email)

Field Summary
static java.lang.String FACTORY_METHOD
          The name of the factory method used to get the ServiceMaker instance from a service class
 
Method Summary
 WebService createNewRESTService(KsSymbol serviceName, KsSymbol serviceType, Agent owner, KsSymbol baseURL, Resource config)
          Answer a new instance of an agent servie that is provisioned as a REST-style web service, where the service is invoked as a base URL and a series of HTTP GET encoded arguments.
 AgentService createNewService(KsSymbol serviceType, Agent owner, Resource configRoot)
           Answer a new instance of the service of the given type, named with a UUID.
 AgentService createNewService(KsSymbol serviceName, KsSymbol serviceType, Agent owner, Resource configRoot)
           Answer a new instance of the service of the given type.
 WebService createNewWebService(KsSymbol serviceType, Agent owner, KsSymbol wsdlURI, Resource config)
          Answer a new instance of an agent service that is provisioned as a web service, using the given WSDL document to define the web service end point.
 WebService createNewWebService(KsSymbol serviceName, KsSymbol serviceType, Agent owner, KsSymbol wsdlURI, Resource config)
          Answer a new instance of an agent service that is provisioned as a web service, using the given WSDL document to define the web service end point.
 ServiceRegistry createServiceRegistry(Agent owner)
          Answer a new service registry.
 ServiceRegistry getGlobalServiceRegistry()
          Answer a reference to the shared service registry.
 ServiceMaker getServiceMaker(java.lang.String className)
          Answer the factory ServiceMake instance for the service class denoted by the given class name.
 void registerServiceType(KsSymbol serviceType, ServiceMaker maker)
          Register the given service maker as the means of creating services of the given type.
 

Field Detail

FACTORY_METHOD

static final java.lang.String FACTORY_METHOD
The name of the factory method used to get the ServiceMaker instance from a service class

See Also:
Constant Field Values
Method Detail

createNewService

AgentService createNewService(KsSymbol serviceType,
                              Agent owner,
                              Resource configRoot)

Answer a new instance of the service of the given type, named with a UUID.

Parameters:
serviceType - Symbol denoting the type of service to instantiate
owner - The owner of the new service, or null to create a global service
configRoot - Optional RDF resource that specifies additional configuration information for the service. Use null if no configuration data is needed or available
Returns:
Service instance that corresponds to the given type

createNewService

AgentService createNewService(KsSymbol serviceName,
                              KsSymbol serviceType,
                              Agent owner,
                              Resource configRoot)

Answer a new instance of the service of the given type.

Parameters:
serviceName - Symbol denoting the name of the service
serviceType - Symbol denoting the type of service to instantiate
owner - The owner of the new service, or null to create a global service
configRoot - Optional RDF resource that specifies additional configuration information for the service. Use null if no configuration data is needed or available
Returns:
Service instance that corresponds to the given type

createNewWebService

WebService createNewWebService(KsSymbol serviceType,
                               Agent owner,
                               KsSymbol wsdlURI,
                               Resource config)

Answer a new instance of an agent service that is provisioned as a web service, using the given WSDL document to define the web service end point. This factory method assumes that the given WSDL file defines exactly one service.

Parameters:
serviceType - Optional service type for the service (defaults to nuin:webService)
owner - The optional owner of the service; use null for a global service
wsdlURI - The URI of the WSDL document that defines the web-service endpoint
config - Optional configuration resource
Returns:
A new web service instance
Throws:
NuinException - if the given WSDL file does not contain exactly one service definition

createNewWebService

WebService createNewWebService(KsSymbol serviceName,
                               KsSymbol serviceType,
                               Agent owner,
                               KsSymbol wsdlURI,
                               Resource config)

Answer a new instance of an agent service that is provisioned as a web service, using the given WSDL document to define the web service end point.

Parameters:
serviceName - Symbol denoting the name of the service
serviceType - Optional service type for the service (defaults to nuin:webService)
owner - The optional owner of the service; use null for a global service
wsdlURI - The URI of the WSDL document that defines the web-service endpoint
Returns:
A new web service instance
Throws:
NuinException - if the given WSDL file does not contain a description of the named service

createNewRESTService

WebService createNewRESTService(KsSymbol serviceName,
                                KsSymbol serviceType,
                                Agent owner,
                                KsSymbol baseURL,
                                Resource config)

Answer a new instance of an agent servie that is provisioned as a REST-style web service, where the service is invoked as a base URL and a series of HTTP GET encoded arguments.

Parameters:
serviceName - Optional symbol denoting the name of the service
serviceType - Optional symbol denoting the service type
owner - The agent that owns this service instance; use null for a global service
baseURL - Symbol denoting the base URL of the REST service
config - Optional configuration resource
Returns:
A new web service instance
Throws:
ServiceException - if the service is not correctly specified

registerServiceType

void registerServiceType(KsSymbol serviceType,
                         ServiceMaker maker)

Register the given service maker as the means of creating services of the given type.

Parameters:
serviceType - A symbol denoting a service type
maker - A factory object that can create new services instances of type serviceType

getGlobalServiceRegistry

ServiceRegistry getGlobalServiceRegistry()

Answer a reference to the shared service registry.

Returns:
The global registry of shared services

createServiceRegistry

ServiceRegistry createServiceRegistry(Agent owner)

Answer a new service registry.

Parameters:
owner - The agent that will own the service registry
Returns:
A new service registry instance.

getServiceMaker

ServiceMaker getServiceMaker(java.lang.String className)

Answer the factory ServiceMake instance for the service class denoted by the given class name.

Parameters:
className - The name of the service class
Returns:
A ServiceMaker instance defined as a static factory on the named class.


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