org.sr.server
Class ServicesRegistry

java.lang.Object
  extended by org.sr.server.ServicesRegistry

public class ServicesRegistry
extends java.lang.Object

 Service Registery keeps records of all service & interceptor definitions and locators within the system. The preferenced way of registiration is usage of configuration files, but users may need to register their components programatically. This class offers methods for both ways. We need to remind that a certain order of registration need to be followed, for those who prefers to register entities programatically. Locators and interceptors registration need to be done before services registration.


Sample Configuration

<Config>
 <Locators>
  <Locator class="org.sr.server.spring.SpringServiceLocator" name="SpringLocator"/>
 </Locators>
 <Interceptors>
  <Interceptor name="testInterceptor" class="test.interceptor.TestInterceptor" sequence="1">
   <ServiceTarget pattern=".*">
    <OperationTarget pattern=".*"/>
   </ServiceTarget>
  </Interceptor>
 </Interceptors>
 <Services>
  <Service name="echoBean" target="test.bean.EchoBean" lifeContext="singleton">
   <Operation pattern=".*" authenticationRequired="false" transportLayerSecurity="false"/>
    <Property key="deneme" value="deneme"/>
  </Service>
 <Services>
</Config>

Author:
Serhat Dirik

Field Summary
static java.lang.String DEFAULT_SERVICE_LOCATOR
           
 
Constructor Summary
ServicesRegistry()
           
 
Method Summary
static IServiceLocator getDefaultServiceLocator()
          Registery keeps one locator (POJOServiceLocator) as default one to access service instances which are not specified their locator in their definitions.
static java.lang.String getRegistryQueryService()
           
static org.sr.common.entitydef.ServiceDefinition getServiceDefinition(java.lang.String serviceName)
          Gives a registered service definition
static java.util.Map<java.lang.String,org.sr.common.entitydef.ServiceDefinition> getServiceDefinitions()
          Gives the map of the registered service definitions.
static IServiceLocator getServiceLocator(java.lang.String locatorName)
          Gives a defined locator instance by it's name
static java.util.Map<java.lang.String,IServiceLocator> getServiceLocators()
          Gives the map of the registered locator instances.
static void processRegisteredXMLConfig()
          Processes registered config files, resolves them and registers services, locators and interceptors within those files
static void registerInterceptor(org.sr.common.entitydef.InterceptorDefinition idef)
          Registers an interceptor definition
static void registerLocator(IServiceLocator locator)
          Registers a Service Locator
static void registerService(org.sr.common.entitydef.ServiceDefinition serviceDef)
          Registers a service definition
static void registerXMLConfig(java.io.InputStream configXml)
          Registers an XML config file to process later on with "processRegisteredXMLConfig" method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SERVICE_LOCATOR

public static final java.lang.String DEFAULT_SERVICE_LOCATOR
See Also:
Constant Field Values
Constructor Detail

ServicesRegistry

public ServicesRegistry()
Method Detail

getRegistryQueryService

public static java.lang.String getRegistryQueryService()

getServiceDefinition

public static org.sr.common.entitydef.ServiceDefinition getServiceDefinition(java.lang.String serviceName)
Gives a registered service definition

Parameters:
serviceName - name of the service
Returns:
Registered service definition or null if there isn't any

getDefaultServiceLocator

public static IServiceLocator getDefaultServiceLocator()
Registery keeps one locator (POJOServiceLocator) as default one to access service instances which are not specified their locator in their definitions.

Returns:
default service locator

getServiceLocator

public static IServiceLocator getServiceLocator(java.lang.String locatorName)
Gives a defined locator instance by it's name

Parameters:
locatorName - name of the locator
Returns:
a locator instance or null if there isn't any

getServiceLocators

public static java.util.Map<java.lang.String,IServiceLocator> getServiceLocators()
Gives the map of the registered locator instances. The key is the locator name.

Returns:
maps of the locators

getServiceDefinitions

public static java.util.Map<java.lang.String,org.sr.common.entitydef.ServiceDefinition> getServiceDefinitions()
Gives the map of the registered service definitions. Service instances are accessible through locators.The map key is the name of the services.

Returns:
map of registered service definitions

registerService

public static void registerService(org.sr.common.entitydef.ServiceDefinition serviceDef)
                            throws ServiceRegistrationException
Registers a service definition

Parameters:
serviceDef -
Throws:
ServiceRegistrationException

registerXMLConfig

public static void registerXMLConfig(java.io.InputStream configXml)
Registers an XML config file to process later on with "processRegisteredXMLConfig" method.

Parameters:
configXml -

processRegisteredXMLConfig

public static void processRegisteredXMLConfig()
Processes registered config files, resolves them and registers services, locators and interceptors within those files


registerLocator

public static void registerLocator(IServiceLocator locator)
                            throws ServiceRegistrationException
Registers a Service Locator

Parameters:
locator - locator instance
Throws:
ServiceRegistrationException

registerInterceptor

public static void registerInterceptor(org.sr.common.entitydef.InterceptorDefinition idef)
                                throws ServiceRegistrationException
Registers an interceptor definition

Parameters:
idef - an interceptor definition
Throws:
ServiceRegistrationException