wt.services.applicationcontext
Class ACServicesAdapter

java.lang.Object
  extended bywt.services.applicationcontext.ACServicesAdapter
All Implemented Interfaces:
ApplicationContext, ApplicationContextChild, ApplicationContextServices, Externalizable, Serializable

public class ACServicesAdapter
extends Object
implements ApplicationContextServices, Externalizable



Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private  ApplicationContext applicationContext
           
private static String CLASSNAME
           
static long EXTERNALIZATION_VERSION_UID
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
private  ACServices services
           
 
Fields inherited from interface wt.services.applicationcontext.ApplicationContextServices
SERVICE
 
Fields inherited from interface wt.services.applicationcontext.ApplicationContextChild
APPLICATION_CONTEXT
 
Constructor Summary
ACServicesAdapter()
          

Supported API: false
ACServicesAdapter(ACServices services)
          

Supported API: false
 
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.
 ApplicationContext getApplicationContext()
          Gets the object for the association that plays role: applicationContext.
 ApplicationContextServices getApplicationContextServices()
          Conveniance operation used to cast getApplicationContext to ApplicationContextServices.
private  String getMessage(String service_name, Object requestor, Object selector)
           
 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.
 ACServices getServices()
          Gets the object for the association that plays role: services.
 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.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  void servicesValidate(ACServices a_Services)
           
 void setApplicationContext(ApplicationContext a_ApplicationContext)
          Sets the object for the association that plays role: applicationContext.
 void setServices(ACServices a_Services)
          Sets the object for the association that plays role: services.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

services

private ACServices services

applicationContext

private ApplicationContext applicationContext

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values
Constructor Detail

ACServicesAdapter

public ACServicesAdapter()


Supported API: false


ACServicesAdapter

public ACServicesAdapter(ACServices services)
                  throws WTPropertyVetoException


Supported API: false

Parameters:
services -
Throws:
WTPropertyVetoException
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

getServices

public ACServices getServices()
Gets the object for the association that plays role: services.

Supported API: false

Returns:
ACServices

setServices

public void setServices(ACServices a_Services)
                 throws WTPropertyVetoException
Sets the object for the association that plays role: services.

Supported API: false

Parameters:
a_Services -
Throws:
WTPropertyVetoException

servicesValidate

private void servicesValidate(ACServices a_Services)
                       throws WTPropertyVetoException
Parameters:
a_Services -
Throws:
WTPropertyVetoException

getApplicationContextServices

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

Supported API: false

Specified by:
getApplicationContextServices in interface ApplicationContextServices
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

Specified by:
addService in interface ApplicationContextServices
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

Specified by:
hasService in interface ApplicationContextServices
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

Specified by:
addAllServices in interface ApplicationContextServices
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

Specified by:
getService in interface ApplicationContextServices
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

Specified by:
getService in interface ApplicationContextServices
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

Specified by:
getServices in interface ApplicationContextServices
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

Specified by:
getServiceMap in interface ApplicationContextServices
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

Specified by:
getServiceMap in interface ApplicationContextServices
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

Specified by:
getServiceMap in interface ApplicationContextServices
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

Specified by:
getServiceMap in interface ApplicationContextServices
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

Specified by:
getServicesMap in interface ApplicationContextServices
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

Specified by:
getServicesMap in interface ApplicationContextServices
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

Specified by:
getServiceSelectors in interface ApplicationContextServices
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

Specified by:
getServiceImplementationName in interface ApplicationContextServices
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

Specified by:
getServiceImplementationNameMap in interface ApplicationContextServices
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

Specified by:
getServiceImplementationNameMap in interface ApplicationContextServices
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

getApplicationContext

public ApplicationContext getApplicationContext()
Gets the object for the association that plays role: applicationContext.

Supported API: false

Specified by:
getApplicationContext in interface ApplicationContextChild
Returns:
ApplicationContext

setApplicationContext

public void setApplicationContext(ApplicationContext a_ApplicationContext)
                           throws WTPropertyVetoException
Sets the object for the association that plays role: applicationContext.

Supported API: false

Specified by:
setApplicationContext in interface ApplicationContextChild
Parameters:
a_ApplicationContext -
Throws:
WTPropertyVetoException

getMessage

private String getMessage(String service_name,
                          Object requestor,
                          Object selector)