wt.services.applicationcontext
Interface ApplicationContextServices

All Superinterfaces:
ApplicationContext, ApplicationContextChild
All Known Implementing Classes:
ACServicesAdapter, ApplicationContextServicesSupport

public interface ApplicationContextServices
extends ApplicationContext

An application context which provides access to services. Access to services is provided by keeping a map from logical service types to ApplicationContextServiceProvider objects. Each ApplicationContextServiceProvider is registered to manufacture one or more services. Manufacturing instances of logical services is delegated to the providers.

Supported API: false

Extendable: false


Field Summary
static String SERVICE
          Label for the attribute.
 
Fields inherited from interface wt.services.applicationcontext.ApplicationContextChild
APPLICATION_CONTEXT
 
Method Summary
 boolean addAllServices(ApplicationContextServiceProvider serviceProvider)
          Create map entries for all service classes which the passed service provider can manufacture.
 boolean addService(String serviceName, ApplicationContextServiceProvider serviceProvider)
          Add an entry which maps the serviceClass argument to the serviceProvider object.
 ApplicationContextServices getApplicationContextServices()
          Conveniance operation used to cast getApplicationContext to ApplicationContextServices.
 Object getService(ApplicationContextChild contextChild, Object requestor, Class serviceClass, Object selector)
          Get a service based on the context, the requesting object, the selector, and the logical service class.
 Object getService(ApplicationContextChild contextChild, Object requestor, String serviceName, Object selector)
          Get a service based on the context, the requesting object, the selector, and the logical service name.
 String getServiceImplementationName(ApplicationContextChild childContext, Object requestor, String serviceName, Object selector)
          Get the name of the service implementation.
 Map getServiceImplementationNameMap(ApplicationContextChild childContext, ACRequestor requestor, String serviceName, Object selector)
          Get the name of the service implementation.
 Map getServiceImplementationNameMap(ApplicationContextChild childContext, Object[] requestors, String serviceName, Object selector)
          Get the name of the service implementation.
 Map getServiceMap(ApplicationContextChild contextChild, ACRequestor requestor, Class serviceClass, Object selector)
          Get a service based on the context, the requesting object, the selector, and the logical service class.
 Map getServiceMap(ApplicationContextChild contextChild, ACRequestor requestor, String serviceName, Object selector)
          Get a service based on the context, the requesting object, the selector, and the logical service name.
 Map getServiceMap(ApplicationContextChild contextChild, Object[] requestors, Class serviceClass, Object selector)
          Get a service based on the context, the requesting object, the selector, and the logical service class.
 Map getServiceMap(ApplicationContextChild contextChild, Object[] requestors, String serviceName, Object selector)
          Get a service based on the context, the requesting object, the selector, and the logical service name.
 Object[] getServices(ApplicationContextChild contextChild, Object requestor, String serviceName, Object selector)
          Get all available services based on the context, the requesting object, the selector, and the logical service name.
 Enumeration getServiceSelectors(ApplicationContextChild contextChild, String serviceName, Object requestor)
          A service selector is an optional qualifier which can be used to help identify which version of a service is desired.
 Map getServicesMap(ApplicationContextChild contextChild, ACRequestor requestor, String serviceName, Object selector)
          Get all available services based on the context, the requesting object, the selector, and the logical service name.
 Map getServicesMap(ApplicationContextChild contextChild, Object[] requestors, String serviceName, Object selector)
          Get all available services based on the context, the requesting object, the selector, and the logical service name.
 boolean hasService(String serviceName)
          Returns true if there is a mapping from the serviceClass to a service provider.
 
Methods inherited from interface wt.services.applicationcontext.ApplicationContextChild
getApplicationContext, setApplicationContext
 

Field Detail

SERVICE

public static final String SERVICE
Label for the attribute.

Supported API: false

See Also:
Constant Field Values
Method Detail

getApplicationContextServices

public ApplicationContextServices getApplicationContextServices()
Conveniance operation used to cast getApplicationContext to ApplicationContextServices.

Supported API: false

Returns:
ApplicationContextServices

addService

public boolean addService(String serviceName,
                          ApplicationContextServiceProvider serviceProvider)
Add an entry which maps the serviceClass argument to the serviceProvider object. Return false if the entry already exists.

Supported API: false

Parameters:
serviceName -
serviceProvider -
Returns:
boolean

hasService

public boolean hasService(String serviceName)
Returns true if there is a mapping from the serviceClass to a service provider.

Supported API: false

Parameters:
serviceName -
Returns:
boolean

addAllServices

public boolean addAllServices(ApplicationContextServiceProvider serviceProvider)
Create map entries for all service classes which the passed service provider can manufacture.

Supported API: false

Parameters:
serviceProvider -
Returns:
boolean

getService

public Object getService(ApplicationContextChild contextChild,
                         Object requestor,
                         String serviceName,
                         Object selector)
                  throws UnableToCreateServiceException,
                         ServiceNotFoundException
Get a service based on the context, the requesting object, the selector, and the logical service name. If the requestor is an instance of Class, it is treated specially: the requestor is treated as an instance of that class, rather than an instance of Class.

Supported API: false

Parameters:
contextChild - The context child making the service request.
requestor - The target of the service request.
serviceName - The logical name of the service.
selector - An optional selector to further identify the service.
Returns:
Object
Throws:
UnableToCreateServiceException
ServiceNotFoundException

getService

public Object getService(ApplicationContextChild contextChild,
                         Object requestor,
                         Class serviceClass,
                         Object selector)
                  throws UnableToCreateServiceException,
                         ServiceNotFoundException
Get a service based on the context, the requesting object, the selector, and the logical service class. If the requestor is an instance of Class, it is treated specially: the requestor is treated as an instance of that class, rather than an instance of Class.

Supported API: false

Parameters:
contextChild -
requestor -
serviceClass -
selector - An optional selector to further identify the service.
Returns:
Object
Throws:
UnableToCreateServiceException
ServiceNotFoundException

getServices

public Object[] getServices(ApplicationContextChild contextChild,
                            Object requestor,
                            String serviceName,
                            Object selector)
                     throws UnableToCreateServiceException,
                            ServiceNotFoundException
Get all available services based on the context, the requesting object, the selector, and the logical service name. If the requestor is an instance of Class, it is treated specially: the requestor is treated as an instance of that class, rather than an instance of Class.

Supported API: false

Parameters:
contextChild - The context child making the service request.
requestor - The target of the service request.
serviceName - The logical name of the service.
selector - An optional selector to further identify the service.
Returns:
Object[]
Throws:
UnableToCreateServiceException
ServiceNotFoundException

getServiceMap

public Map getServiceMap(ApplicationContextChild contextChild,
                         Object[] requestors,
                         String serviceName,
                         Object selector)
                  throws UnableToCreateServiceException,
                         ServiceNotFoundException
Get a service based on the context, the requesting object, the selector, and the logical service name. If the requestor is an instance of Class, it is treated specially: the requestor is treated as an instance of that class, rather than an instance of Class.

Supported API: false

Parameters:
contextChild - The context child making the service request.
requestors - The target of the service request.
serviceName - The logical name of the service.
selector - An optional selector to further identify the service.
Returns:
Map
Throws:
UnableToCreateServiceException
ServiceNotFoundException

getServiceMap

public Map getServiceMap(ApplicationContextChild contextChild,
                         Object[] requestors,
                         Class serviceClass,
                         Object selector)
                  throws UnableToCreateServiceException,
                         ServiceNotFoundException
Get a service based on the context, the requesting object, the selector, and the logical service class. If the requestor is an instance of Class, it is treated specially: the requestor is treated as an instance of that class, rather than an instance of Class.

Supported API: false

Parameters:
contextChild -
requestors -
serviceClass -
selector - An optional selector to further identify the service.
Returns:
Map
Throws:
UnableToCreateServiceException
ServiceNotFoundException

getServiceMap

public Map getServiceMap(ApplicationContextChild contextChild,
                         ACRequestor requestor,
                         Class serviceClass,
                         Object selector)
                  throws UnableToCreateServiceException,
                         ServiceNotFoundException
Get a service based on the context, the requesting object, the selector, and the logical service class. If the requestor is an instance of Class, it is treated specially: the requestor is treated as an instance of that class, rather than an instance of Class.

Supported API: false

Parameters:
contextChild -
requestor -
serviceClass -
selector - An optional selector to further identify the service.
Returns:
Map
Throws:
UnableToCreateServiceException
ServiceNotFoundException

getServiceMap

public Map getServiceMap(ApplicationContextChild contextChild,
                         ACRequestor requestor,
                         String serviceName,
                         Object selector)
                  throws UnableToCreateServiceException,
                         ServiceNotFoundException
Get a service based on the context, the requesting object, the selector, and the logical service name. If the requestor is an instance of Class, it is treated specially: the requestor is treated as an instance of that class, rather than an instance of Class.

Supported API: false

Parameters:
contextChild - The context child making the service request.
requestor -
serviceName - The logical name of the service.
selector - An optional selector to further identify the service.
Returns:
Map
Throws:
UnableToCreateServiceException
ServiceNotFoundException

getServicesMap

public Map getServicesMap(ApplicationContextChild contextChild,
                          Object[] requestors,
                          String serviceName,
                          Object selector)
                   throws UnableToCreateServiceException,
                          ServiceNotFoundException
Get all available services based on the context, the requesting object, the selector, and the logical service name. If the requestor is an instance of Class, it is treated specially: the requestor is treated as an instance of that class, rather than an instance of Class.

Supported API: false

Parameters:
contextChild - The context child making the service request.
requestors - The target of the service request.
serviceName - The logical name of the service.
selector - An optional selector to further identify the service.
Returns:
Map
Throws:
UnableToCreateServiceException
ServiceNotFoundException

getServicesMap

public Map getServicesMap(ApplicationContextChild contextChild,
                          ACRequestor requestor,
                          String serviceName,
                          Object selector)
                   throws UnableToCreateServiceException,
                          ServiceNotFoundException
Get all available services based on the context, the requesting object, the selector, and the logical service name. If the requestor is an instance of Class, it is treated specially: the requestor is treated as an instance of that class, rather than an instance of Class.

Supported API: false

Parameters:
contextChild - The context child making the service request.
requestor -
serviceName - The logical name of the service.
selector - An optional selector to further identify the service.
Returns:
Map
Throws:
UnableToCreateServiceException
ServiceNotFoundException

getServiceSelectors

public Enumeration getServiceSelectors(ApplicationContextChild contextChild,
                                       String serviceName,
                                       Object requestor)
A service selector is an optional qualifier which can be used to help identify which version of a service is desired. An application can determine which selectors are available for a service within a certain context.

Supported API: false

Parameters:
contextChild -
serviceName -
requestor -
Returns:
Enumeration

getServiceImplementationName

public String getServiceImplementationName(ApplicationContextChild childContext,
                                           Object requestor,
                                           String serviceName,
                                           Object selector)
                                    throws ServiceNotFoundException
Get the name of the service implementation. Usually this is the fully qualified class name, but it may be any string (implying that a service can't be instantiated).

Supported API: false

Parameters:
childContext - The context child requesting the service implementation name. May be used to determine which specific service implementation should be provided.
requestor - The requestor or target of the service. Used to help determine which specific service implementation should be provided.
serviceName - The logical name of the service.
selector - An optional selector to further identify the service.
Returns:
String
Throws:
ServiceNotFoundException

getServiceImplementationNameMap

public Map getServiceImplementationNameMap(ApplicationContextChild childContext,
                                           Object[] requestors,
                                           String serviceName,
                                           Object selector)
                                    throws ServiceNotFoundException
Get the name of the service implementation. Usually this is the fully qualified class name, but it may be any string (implying that a service can't be instantiated).

Supported API: false

Parameters:
childContext - The context child requesting the service implementation name. May be used to determine which specific service implementation should be provided.
requestors - The requestor or target of the service. Used to help determine which specific service implementation should be provided.
serviceName - The logical name of the service.
selector - An optional selector to further identify the service.
Returns:
Map
Throws:
ServiceNotFoundException

getServiceImplementationNameMap

public Map getServiceImplementationNameMap(ApplicationContextChild childContext,
                                           ACRequestor requestor,
                                           String serviceName,
                                           Object selector)
                                    throws ServiceNotFoundException
Get the name of the service implementation. Usually this is the fully qualified class name, but it may be any string (implying that a service can't be instantiated).

Supported API: false

Parameters:
childContext - The context child requesting the service implementation name. May be used to determine which specific service implementation should be provided.
requestor -
serviceName - The logical name of the service.
selector - An optional selector to further identify the service.
Returns:
Map
Throws:
ServiceNotFoundException