|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xenonsoft.bridgetown.soa.impl.AbstractServiceAssembler
Abstract service assembly class
| Field Summary | |
protected AssemblyConfig |
assembly
The root of the assembly configuration |
protected IBeanPropertyValueResolver |
beanPropertyValueResolver
the property value resolver |
protected java.lang.ClassLoader |
classLoader
The class loader for this assembly factory |
protected IContextCacheContainer |
instanceCache
A special container for storing object instance in a context caches |
protected IProxyBeanBuilder |
proxyBeanBuilder
the proxy bean builder |
| Constructor Summary | |
AbstractServiceAssembler()
Default no-arguments constructor sets the class loader to the current thread context class loader. |
|
| Method Summary | |
protected void |
checkFactory()
Implements a basic check for the factory for subclassers |
protected void |
configureServiceBeanProperties(java.lang.Object serviceBean,
ServiceConfig serviceConfig)
Given a service bean and a service configuration, set the properties of the bean from the loaded configuration. |
protected void |
configureServiceBeanReferences(java.lang.Object serviceBean,
ServiceConfig serviceConfig)
Given a service bean and a service configuration, set the references of the bean from the loaded configuration. |
boolean |
containsContext(java.lang.String contextName)
Implements / overrides containsContext |
boolean |
containsService(java.lang.String contextName,
java.lang.String serviceName)
Implements / overrides containsContext |
protected void |
createBeanBuilder()
Creates the bean builder for the application assembler. |
protected java.lang.Object |
createRetrieveServiceBean(ServiceConfig serviceConfig,
java.lang.Class interfaceClass)
Refactored method to create either a prototype service bean or retrieve the a singleton service bean from the cache. |
protected java.lang.Object |
createServiceBean(ServiceConfig serviceConfig)
Creates the service bean from the supplied service configuration |
protected java.lang.Object |
createServiceBean(ServiceConfig serviceConfig,
java.lang.Class interfaceClass)
Create the service bean from the supplied service configuration |
protected java.lang.Object |
createServiceBean(java.lang.String contextName,
java.lang.Class interfaceClass)
Returns the service implementation for a registered interface class name |
void |
dispose()
Dispose the services registered with the assembly |
protected void |
fixupServiceBeanReferences(ServiceConfig serviceConfig)
Given a service configuration, for all properties verify any associated references. |
AssemblyConfig |
getAssemblyConfig()
Returns the assembly configuration |
IBeanPropertyValueResolver |
getBeanPropertyValueResolver()
Gets the beanPropertyValueResolver |
java.lang.Class[] |
getClassListFromNameList(java.lang.String[] classNames,
java.lang.String message)
Given a primitive array of fully qualified class (and/or interface) names, create the corresponding Class array from the current
class loader. |
java.lang.ClassLoader |
getClassLoader()
Implements / overrides getClassLoader |
ContextConfig |
getContextConfig(java.lang.String contextName)
A convenience method to retrieve the context configuration by name. |
java.lang.String[] |
getContextNameList()
Implements / overrides getContextNameList |
IProxyBeanBuilder |
getProxyBeanBuilder()
Gets the proxy bean builder |
ServiceConfig |
getServiceConfig(java.lang.String contextName,
java.lang.String serviceId)
A convenience method to retrieve the service configuration by identifier and context name. |
java.lang.String[] |
getServiceNameList(java.lang.String contextName)
Implements / overrides getServiceNameList |
ServicesConfig |
getServicesConfig(java.lang.String contextName)
A convenience method to retrieve the services configurations by context name. |
protected void |
invokeServiceBeanMethod(java.lang.Object serviceBean,
ServiceConfig serviceConfig,
MethodConfig methodConfig)
Invoke the supplied service bean's specific method in order to perform Method Dependency Injection Internally this method uses the ConvertUtils and MethodUtils from Commons BeanUtils. |
protected void |
invokeServiceBeanMethods(java.lang.Object serviceBean,
ServiceConfig serviceConfig)
Invoke the all the methods registered with the supplied service bean in order to perform Method Dependency Injection Internally this method uses the ConvertUtils and MethodUtils from Commons BeanUtils. |
void |
load(IConfigLoader configLoader)
Loads the configuration for this service assembly |
void |
merge(IConfigLoader configLoader,
boolean override)
Merge the supplied reference service assembly into the current existing configuration. |
protected java.lang.Object |
recursiveCreateServiceBean(ServiceConfig serviceConfig,
java.lang.Class[] interfaceClassList)
Creates the service bean from the supplied service configuration. |
protected java.lang.Object |
resolveValueReferences(int depth,
ValueReferenceConfig valueRef,
ServiceConfig serviceConfig,
java.lang.String nodeText)
Resolve references for a value reference. |
void |
setBeanPropertyValueResolver(IBeanPropertyValueResolver beanPropertyValueResolver)
Sets the beanPropertyValueResolver |
void |
setClassLoader(java.lang.ClassLoader classLoader)
Implements / overrides setClassLoader |
void |
setProxyBeanBuilder(IProxyBeanBuilder proxyBeanBuilder)
Sets the proxy bean builder |
void |
start()
Start the services registered with the assembly Here is the default wiring injection algorithm Phase 1 - Create the beans Phase 2 - Fix up the references to dependencies For all contexts (Property dependency injection) Phase 3 - Wire the references to dependencies For all contexts Phase 4 - Call the startable interface for each service, if it applies Phase 5 - Call the methods associated for each service, if it applies (Method dependency injection) |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.xenonsoft.bridgetown.soa.IServiceObjectFactory |
getName, getName, getService |
| Field Detail |
protected AssemblyConfig assembly
protected IContextCacheContainer instanceCache
protected transient java.lang.ClassLoader classLoader
protected IProxyBeanBuilder proxyBeanBuilder
protected IBeanPropertyValueResolver beanPropertyValueResolver
| Constructor Detail |
public AbstractServiceAssembler()
| Method Detail |
protected void createBeanBuilder()
public java.lang.ClassLoader getClassLoader()
getClassLoader in interface IServiceAssemblerIServiceAssembler.getClassLoader()public void setClassLoader(java.lang.ClassLoader classLoader)
setClassLoader in interface IServiceAssemblerclassLoader - IServiceAssembler.setClassLoader(java.lang.ClassLoader)public IProxyBeanBuilder getProxyBeanBuilder()
public void setProxyBeanBuilder(IProxyBeanBuilder proxyBeanBuilder)
proxyBeanBuilder - the new value for proxyBeanBuilderpublic IBeanPropertyValueResolver getBeanPropertyValueResolver()
getBeanPropertyValueResolver in interface IServiceAssemblerpublic void setBeanPropertyValueResolver(IBeanPropertyValueResolver beanPropertyValueResolver)
setBeanPropertyValueResolver in interface IServiceAssemblerbeanPropertyValueResolver - The beanPropertyValueResolver to set.public void load(IConfigLoader configLoader)
load in interface IServiceAssemblerconfigLoader - the configuration loader
AssemblyConfigException - if the factory cannot read the assembly configuration
AssemblyFactoryException - if the factory cannot create the service assemblymerge(IConfigLoader, boolean)
public void merge(IConfigLoader configLoader,
boolean override)
Here are the cases for a merge algorithm
load( IConfigLoader )
merge in interface IServiceAssemblerconfigLoader - the configuration loaderoverride - true if the configuration context should
override the existing configuration
AssemblyConfigException - if the factory cannot read the assembly configuration
AssemblyFactoryException - if the factory cannot create the service assemblyload(IConfigLoader)public void start()
Here is the default wiring injection algorithm
start in interface IStartablepublic void dispose()
dispose in interface IDisposable
protected java.lang.Object createRetrieveServiceBean(ServiceConfig serviceConfig,
java.lang.Class interfaceClass)
serviceConfig - the service configurationinterfaceClass - the interface class (optional)
IServiceObjectFactory.getName(String contextName, String beanName, Class interfaceClass ),
contextName, Class interfaceClass )
protected java.lang.Object createServiceBean(java.lang.String contextName,
java.lang.Class interfaceClass)
contextName - the context nameinterfaceClass - the interface class name
AssemblyFactoryException - - if the service cannot be instantiated, if it
reports an error, or cannot be syntactically created with violating
class encapsulation, or simply has not been defined at all.protected java.lang.Object createServiceBean(ServiceConfig serviceConfig)
serviceConfig - the configuration
AssemblyFactoryException - - if the service cannot be instantiatedcreateServiceBean( ServiceConfig serviceConfig, Class interfaceClass )
protected java.lang.Object createServiceBean(ServiceConfig serviceConfig,
java.lang.Class interfaceClass)
serviceConfig - the configurationinterfaceClass - the optional interface class that the service must implement
AssemblyFactoryException - - if the service cannot be instantiated
protected java.lang.Object recursiveCreateServiceBean(ServiceConfig serviceConfig,
java.lang.Class[] interfaceClassList)
null no checking is done.
serviceConfig - the configurationinterfaceClassList - the optional array list of interface
classes that the service must implement
AssemblyFactoryException - - if the service cannot be instantiated
public java.lang.Class[] getClassListFromNameList(java.lang.String[] classNames,
java.lang.String message)
Class array from the current
class loader. In other words for an array class names load the
classes (and/or interfaces) and return that array.
classNames - the array of class namesmessage - additionally message to add
if a ClassNotFoundException occurs
null
or empty then return null
protected void configureServiceBeanProperties(java.lang.Object serviceBean,
ServiceConfig serviceConfig)
serviceBean - the beanserviceConfig - the configuration
AssemblyFactoryException - - if the properties of the service cannot be configured correctlyprotected void fixupServiceBeanReferences(ServiceConfig serviceConfig)
AssemblyFactoryException - - if the references of the service cannot be configured correctly
protected java.lang.Object resolveValueReferences(int depth,
ValueReferenceConfig valueRef,
ServiceConfig serviceConfig,
java.lang.String nodeText)
depth - the depth countvalueRef - the value reference that may have a value or a referenceserviceConfig - the service configurationnodeText - the relevant information about the configuration point
AssemblyFactoryException - - if the references of the service cannot be configured correctly
MaximumWireExceededException - - if the maximum recursive limit
protected void configureServiceBeanReferences(java.lang.Object serviceBean,
ServiceConfig serviceConfig)
serviceBean - the beanserviceConfig - the service configuration
AssemblyFactoryException - - if the references of the service cannot be configured correctly
protected void invokeServiceBeanMethods(java.lang.Object serviceBean,
ServiceConfig serviceConfig)
Internally this method uses the ConvertUtils and MethodUtils from Commons BeanUtils.
serviceBean - the beanserviceConfig - the configuration
AssemblyFactoryException - - if the references of the service cannot be configured correctlyinvokeServiceBeanMethod(Object, ServiceConfig, MethodConfig)
protected void invokeServiceBeanMethod(java.lang.Object serviceBean,
ServiceConfig serviceConfig,
MethodConfig methodConfig)
Internally this method uses the ConvertUtils and MethodUtils from Commons BeanUtils.
serviceBean - the beanserviceConfig - the service configurationmethodConfig - the method configuration
AssemblyFactoryException - - if the references of the service cannot be configured correctlypublic AssemblyConfig getAssemblyConfig()
getAssemblyConfig in interface IServiceAssemblerIServiceAssembler.getAssemblyConfig()protected void checkFactory()
AssemblyFactoryException - if the factory is in an illegal state.
public boolean containsService(java.lang.String contextName,
java.lang.String serviceName)
containsService in interface IServiceObjectFactorycontextName - serviceName -
com.xenonsoft.bridgetown.soa.IServiceAssembler#containsContext(java.lang.String, java.lang.String)public boolean containsContext(java.lang.String contextName)
containsContext in interface IServiceObjectFactorycontextName -
IServiceObjectFactory.containsContext(java.lang.String)public java.lang.String[] getContextNameList()
getContextNameList in interface IServiceObjectFactoryIServiceObjectFactory.getContextNameList()public java.lang.String[] getServiceNameList(java.lang.String contextName)
getServiceNameList in interface IServiceObjectFactorycontextName -
IServiceObjectFactory.getServiceNameList(java.lang.String)public ContextConfig getContextConfig(java.lang.String contextName)
contextName - the context configuration
null if the named
context configuration can be found
public ServiceConfig getServiceConfig(java.lang.String contextName,
java.lang.String serviceId)
contextName - the context configurationserviceId - the service bean identifier
null if the named
service context element does not exist in the
services context.
UnknownContextException - if the context does not exist with the assembly.public ServicesConfig getServicesConfig(java.lang.String contextName)
contextName - the context configuration
UnknownContextException - if the context does not exist with the assembly.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||