org.sr.server.spring
Class SpringServiceLocator

java.lang.Object
  extended by org.sr.server.AbstractServiceLocator
      extended by org.sr.server.spring.SpringServiceLocator
All Implemented Interfaces:
org.springframework.context.ApplicationContextAware, IServiceLocator

public class SpringServiceLocator
extends AbstractServiceLocator
implements IServiceLocator, org.springframework.context.ApplicationContextAware

This class is a Service Locator implementation for Spring beans.This locator access spring beans instances by using spring application context, so the target attribute of services need to show the spring bean names of the target objects.In order to use this locator you should also define this locator as spring bean in spring configuration.

Sample SR Configuration

<Config>
 <Locators>
  <Locator class="org.sr.server.spring.SpringServiceLocator" name="SpringLocator"/>
 </Locators>
 <Services>
  <Service name="echoBean" target="echoSpringService" locator="SpringLocator">
   <Operation pattern=".*" />
  </Service>
 <Services>
</Config>

Sample Spring Configuration

<beans>
<bean id="echoSpringService" class="test.bean.EchoBean"></bean>
<bean class="org.sr.server.spring.SpringServiceLocator"/>
</beans>

Author:
Serhat Dirik

Field Summary
 
Fields inherited from interface org.sr.server.IServiceLocator
SESSION_KEY_PREFIX
 
Constructor Summary
SpringServiceLocator()
           
 
Method Summary
 java.lang.Object getServiceByName(java.lang.String serviceName, ICallerContextInfo<?> context)
           
 void setApplicationContext(org.springframework.context.ApplicationContext arg0)
           
 
Methods inherited from class org.sr.server.AbstractServiceLocator
getLocatorName, getOperationDefinition, getServiceDefinition, getServiceDefinitions, registerService, setLocatorName, unRegisterService
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sr.server.IServiceLocator
getLocatorName, getOperationDefinition, getServiceDefinition, getServiceDefinitions, registerService, setLocatorName, unRegisterService
 

Constructor Detail

SpringServiceLocator

public SpringServiceLocator()
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext arg0)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

getServiceByName

public java.lang.Object getServiceByName(java.lang.String serviceName,
                                         ICallerContextInfo<?> context)
                                  throws ServiceNotFoundException,
                                         SessionNotFoundException,
                                         ServicePreparationException
Specified by:
getServiceByName in interface IServiceLocator
Throws:
ServiceNotFoundException
SessionNotFoundException
ServicePreparationException