SRJRCFrames
v0.1.296

de.schwarzrot.app.support
Class ApplicationServiceProvider

java.lang.Object
  extended by de.schwarzrot.app.support.ApplicationServiceProvider

public final class ApplicationServiceProvider
extends Object

central singleton for access configurable services. A service may be configured via XML-context or created dynamically by the application. Each service is registered to a class or interface and all request refer to that class or interface.

This class is one of the fundaments of IOC-pattern (inversion of control), which includes, that there exists no static factories, but instances of factories published as service, so that they may be exchanged without compilation or even at runtime.

i.e. a MessageSource is a service to find localized messages by a key. No matter what class offers this service, the service is registered to org.springframework.context.MessageSource

Author:
Reinhard Mantey

Constructor Summary
ApplicationServiceProvider()
           
 
Method Summary
static Map<Class<?>,Object> getPool()
           
static
<S> S
getService(Class<S> clazz)
          retrieve a registered service
static boolean hasService(Class<?> clazz)
          query wether a service has been registered for given class or interface
static
<S> void
registerService(Class<S> clazz, S service)
          register a service to be known by the class or interface
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationServiceProvider

public ApplicationServiceProvider()
Method Detail

getPool

public static Map<Class<?>,Object> getPool()

getService

public static <S> S getService(Class<S> clazz)
retrieve a registered service

Parameters:
clazz - - the class or interface to identify the service
Returns:
the registered service or null if no service has been registered to that class or interface.

hasService

public static boolean hasService(Class<?> clazz)
query wether a service has been registered for given class or interface

Parameters:
clazz - - the class or interface to identify the service
Returns:
true if a service has been registered for the given class or interface

registerService

public static <S> void registerService(Class<S> clazz,
                                       S service)
register a service to be known by the class or interface

Type Parameters:
S - - type of the service to register
Parameters:
clazz - - the class or interface to identify the service
service - - the service to register

SRJRCFrames
v0.1.296

hosted at
Find SRJRCFrames at SourceForge.net. Fast, secure and free:
           Open Source Software download
Submit a bug or request a feature

SRJRCFrames is published according to the GNU General Public License
Copyright 2005-2012 Reinhard Mantey - some rights reserved.