org.spicefactory.cinnamon.service.factory
Class PlainJavaServiceFactory
java.lang.Object
org.spicefactory.cinnamon.service.factory.AbstractMethodInvocationServiceFactory
org.spicefactory.cinnamon.service.factory.PlainJavaServiceFactory
- All Implemented Interfaces:
- ServiceFactory
public class PlainJavaServiceFactory
- extends AbstractMethodInvocationServiceFactory
ServiceFactory for plain Java objects as Cinnamon services. This implementation locates target instances
in the request, session or application Map
respectively, depending on the scope attribute of the particular service configuration.
If a service is not found in
the corresponding Map a new instance will be created and stored in the Map.
Java classes to be used with this ServiceFactory must have a no-arg default constructor.
- Author:
- Jens Halm
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PlainJavaServiceFactory
public PlainJavaServiceFactory()
- Creates a new factory instance.
addServiceConfig
public void addServiceConfig(ServiceConfig config)
- Description copied from interface:
ServiceFactory
- Add a configuration for a service that should be handled by this factory.
This method will be invoked once at application startup for every service configuration
associated with this factory and before any ServiceInvoker will be requested from this
factory.
- Specified by:
addServiceConfig in interface ServiceFactory- Overrides:
addServiceConfig in class AbstractMethodInvocationServiceFactory
- Parameters:
config - a configuration for a service that should be handled by this factory
getTargetInstance
protected Object getTargetInstance(ServiceRequest request)
- Description copied from class:
AbstractMethodInvocationServiceFactory
- Returns the target instance that should be invoked for the given request.
Usually the properties for the service name and operation name in the given request instance
are considered when deciding how to locate the target service.
- Specified by:
getTargetInstance in class AbstractMethodInvocationServiceFactory
- Parameters:
request - the service request
- Returns:
- the instance that should be invoked for the given request