org.sr.server
Interface IServiceLocator

All Known Implementing Classes:
AbstractServiceLocator, EJB2ServiceLocator, EJB3ServiceLocator, POJOServiceLocator, SpringServiceLocator

public interface IServiceLocator

  Service Locators are access points to services. They stores service & operation definitions and and also offers access methods to service instances. Another responsibility of a locator is controlling an instance's life cycles.
  Locators shouldn't be accessed and used directly. ServicesRegistry initializes and uses Locators internally as they defined in the configuration files. Active instances of Locators can be accessed by their names by using ServicesRegistry.getServiceLocator method.
  In order use a locator actively you need register that locator in the configuration.All the services that you want to access by using that locator need to be named that locator as their locator attribute.An example usage of config file could be as follow:
<Config>
 <Locators>
  <Locator class="org.sr.server.spring.SpringServiceLocator" name="SpringLocator"/>
 </Locators>
 <Services>
  <Service name="springEchoBean" target="echoSpringService" instance="singleton" locator="SpringLocator">
   <Operation pattern=".*" authenticationRequired="false" transportLayerSecurity="false"/>
  </Service>
 </Services>
 ...
</Config>


  Simple Remoting offers only limited number of locators. You can expand locators implementing concrete classes of this interface.

Author:
Serhat Dirik

Field Summary
static java.lang.String SESSION_KEY_PREFIX
           
 
Method Summary
 java.lang.String getLocatorName()
          Gives the assigned locator name .Locators normally named in the config file
 org.sr.common.entitydef.OperationDefinition getOperationDefinition(java.lang.String serviceName, java.lang.String methodName)
          Gives the operation definition of given operation name.
 java.lang.Object getServiceByName(java.lang.String serviceName, ICallerContextInfo<?> context)
           
 org.sr.common.entitydef.ServiceDefinition getServiceDefinition(java.lang.String serviceName)
           
 java.util.Collection<org.sr.common.entitydef.ServiceDefinition> getServiceDefinitions()
           
 void registerService(org.sr.common.entitydef.ServiceDefinition serviceDefinition)
           
 void setLocatorName(java.lang.String locatorName)
          Sets the name of the locator
 void unRegisterService(java.lang.String serviceName)
           
 

Field Detail

SESSION_KEY_PREFIX

static final java.lang.String SESSION_KEY_PREFIX
See Also:
Constant Field Values
Method Detail

getLocatorName

java.lang.String getLocatorName()
Gives the assigned locator name .Locators normally named in the config file

Returns:
name of the locator

setLocatorName

void setLocatorName(java.lang.String locatorName)
Sets the name of the locator

Parameters:
locatorName -

getOperationDefinition

org.sr.common.entitydef.OperationDefinition getOperationDefinition(java.lang.String serviceName,
                                                                   java.lang.String methodName)
                                                                   throws ServiceNotFoundException,
                                                                          ServiceOperationNotFoundException
Gives the operation definition of given operation name. In the config file operations might be defined by using patterns instead of using full names. This method compares

Parameters:
serviceName -
methodName -
Returns:
Throws:
ServiceNotFoundException
ServiceOperationNotFoundException

getServiceDefinition

org.sr.common.entitydef.ServiceDefinition getServiceDefinition(java.lang.String serviceName)
                                                               throws ServiceNotFoundException
Throws:
ServiceNotFoundException

getServiceDefinitions

java.util.Collection<org.sr.common.entitydef.ServiceDefinition> getServiceDefinitions()

registerService

void registerService(org.sr.common.entitydef.ServiceDefinition serviceDefinition)
                     throws ServiceRegistrationException
Throws:
ServiceRegistrationException

unRegisterService

void unRegisterService(java.lang.String serviceName)

getServiceByName

java.lang.Object getServiceByName(java.lang.String serviceName,
                                  ICallerContextInfo<?> context)
                                  throws ServiceNotFoundException,
                                         SessionNotFoundException,
                                         ServicePreparationException
Throws:
ServiceNotFoundException
SessionNotFoundException
ServicePreparationException