com.sas.services
Class AbstractServiceFactory

com.sas.services.AbstractServiceFactory
All Implemented Interfaces:
ServiceFactoryInterface
Direct Known Subclasses:
DiscoveryServiceFactory, EventBrokerDiscoveryServiceFactory, EventBrokerServiceFactory, SessionServiceFactory, StoredProcessServiceFactory

public abstract class AbstractServiceFactory
implements ServiceFactoryInterface

Abstract foundation service factory.

A concrete subclass must implement getService(ServiceConfigurationInterface, DiscoveryServiceInterface) that will be used to obtain an instance of a service given the specified service configuration.

Since:
1.1

Constructor Summary
protected AbstractServiceFactory(ServiceProfile serviceProfile)
          Constructs a default instance.
 
Method Summary
 RemoteServiceInterface getService(ServiceConfigurationInterface serviceConfiguration)
          Gets a service from the factory and registers it with the local discovery service.
abstract  RemoteServiceInterface getService(ServiceConfigurationInterface serviceConfiguration, DiscoveryServiceInterface discoveryService)
          Gets a service initialized with the specified service configuration.
 ServiceProfile getServiceProfile()
          Gets a profile of a service which can be created by this service factory.
 boolean isSingletonFactory()
          Determines whether or not the service factory allows only one instance of a service per application.
 

Constructor Detail

AbstractServiceFactory

protected AbstractServiceFactory(ServiceProfile serviceProfile)
Constructs a default instance.

Use this constructor if the service manufactured by the service factory does not permit is configuration to be updated in an additive manner.

Parameters:
serviceProfile - The service's profile.
Method Detail

isSingletonFactory

public final boolean isSingletonFactory()
Determines whether or not the service factory allows only one instance of a service per application.

Specified by:
isSingletonFactory in interface ServiceFactoryInterface
Returns:
false if this factory allows creation of multiple services by calling its getService(ServiceConfigurationInterface, DiscoveryServiceInterface) method or true if only one service is allowed per application.

getServiceProfile

public final ServiceProfile getServiceProfile()
Gets a profile of a service which can be created by this service factory.

Specified by:
getServiceProfile in interface ServiceFactoryInterface
Returns:
Service profile.

getService

public final RemoteServiceInterface getService(ServiceConfigurationInterface serviceConfiguration)
                                        throws ServiceException
Gets a service from the factory and registers it with the local discovery service. Gets a service that has been initialized with the specified service configuration.

RemoteServiceInterface is the base interface implemented by all services.

The service obtained using this method will be registered with the local discovery service. Use getService(ServiceConfigurationInterface, DiscoveryServiceInterface) if you wish to register the service with a different discovery service.

Specified by:
getService in interface ServiceFactoryInterface
Parameters:
serviceConfiguration - Service configuration.
Returns:
service implementation
Throws:
ServiceException - if unable to obtain a service based upon the specified configuration.
See Also:
ServiceFactoryInterface.getService(ServiceConfigurationInterface, DiscoveryServiceInterface)

getService

public abstract RemoteServiceInterface getService(ServiceConfigurationInterface serviceConfiguration,
                                                  DiscoveryServiceInterface discoveryService)
                                           throws ServiceException
Description copied from interface: ServiceFactoryInterface
Gets a service initialized with the specified service configuration.

RemoteServiceInterface is the base interface implemented by all services.

Specified by:
getService in interface ServiceFactoryInterface
Parameters:
serviceConfiguration - Service configuration.
discoveryService - This discovery service which may be used to locate other services. A service which can be discovered must register itself with this discovery service.
Returns:
service implementation
Throws:
ServiceException - if unable to obtain a service based upon the specified configuration.
See Also:
ServiceFactoryInterface.getService(ServiceConfigurationInterface)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.