org.spicefactory.cinnamon.service.factory
Class SpringServiceFactory

java.lang.Object
  extended by org.spicefactory.cinnamon.service.factory.AbstractMethodInvocationServiceFactory
      extended by org.spicefactory.cinnamon.service.factory.SpringServiceFactory
All Implemented Interfaces:
ServiceFactory

public class SpringServiceFactory
extends AbstractMethodInvocationServiceFactory

ServiceFactory for Spring managed beans as Cinnamon services. This implementation locates services in Springs root WebApplicationContext, matching service names with bean names. The scope attribute of the Cinnamon service configuration will be ignored, Spring is responsible for appropiate lifecycle management of service beans.

Author:
Jens Halm

Constructor Summary
SpringServiceFactory()
          Creates a new factory instance.
 
Method Summary
 Object getTargetInstance(ServiceRequest request)
          Returns the target instance that should be invoked for the given request.
 void init(Map<String,String> initMap, Map<String,Object> applicationMap, CinnamonConfig config)
          Initializes the ServiceFactory.
 
Methods inherited from class org.spicefactory.cinnamon.service.factory.AbstractMethodInvocationServiceFactory
addServiceConfig, getApplicationMap, getConfig, getInitMap, getMethodCandidates, getServiceInvoker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringServiceFactory

public SpringServiceFactory()
Creates a new factory instance.

Method Detail

init

public void init(Map<String,String> initMap,
                 Map<String,Object> applicationMap,
                 CinnamonConfig config)
Description copied from interface: ServiceFactory
Initializes the ServiceFactory. Will only be called once by the framework at application startup.

Specified by:
init in interface ServiceFactory
Overrides:
init in class AbstractMethodInvocationServiceFactory
Parameters:
initMap - the initialisation parameters (taken from ServletConfig in a web application)
applicationMap - the application attributes (taken from ServletContext in a web application)
config - the Cinnamon configuration

getTargetInstance

public 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