public final class HippoServiceRegistry extends Object
Modifier and Type | Method and Description |
---|---|
static List<HippoServiceRegistration> |
getRegistrations(Class ifaceClass)
Retrieve a list of whiteboard services by it's default (class) name.
|
static <T> T |
getService(Class<T> ifaceClass)
Retrieve a service by it's default (class) name.
|
static <T> T |
getService(Class<T> ifaceClass,
String name) |
static int |
getVersion() |
static void |
registerService(Object service,
Class[] ifaceClasses)
Register a service under a
SingletonService annotated interface. |
static void |
registerService(Object service,
Class<?> ifaceClass)
Register a service under a
SingletonService annotated interface. |
static void |
registerService(Object service,
Class<?>[] ifaceClasses,
String name) |
static void |
registerService(Object service,
Class<?> ifaceClass,
String name) |
static void |
unregisterService(Object service,
Class<?> ifaceClass) |
static void |
unregisterService(Object service,
Class<?> ifaceClass,
String name) |
public static void registerService(Object service, Class<?> ifaceClass)
SingletonService
annotated interface.
If the service is an instance of the interface, it will be registered as the singleton.
If the interface has an WhiteboardService
annotation, it is still possible to
register the service.
The service will be proxied to enforce the Thread ContextClassLoader during invocation to be set to the Thread ContextClassLoader during registration.
service
- service object to registerifaceClass
- interface to register the service upon for service lookuppublic static void registerService(Object service, Class[] ifaceClasses)
SingletonService
annotated interface.
If the service is an instance of the interface, it will be registered as the singleton.
If the interface has an WhiteboardService
annotation, it is still possible to
register the service.
The service will be proxied to enforce the Thread ContextClassLoader during invocation to be set to the Thread ContextClassLoader during registration.
Additional interfaces can be specified by the ifaceClasses parameter to be also exposed through the proxy. This allows for example (web application) internal interfaces to be used to access additional methods, not to be shared across web applications.
service
- service object to registerifaceClasses
- array of interfaces to proxy for the service, the first interface is used to register the
service upon for service lookuppublic static <T> T getService(Class<T> ifaceClass)
ifaceClass
- public static List<HippoServiceRegistration> getRegistrations(Class ifaceClass)
ifaceClass
- public static void registerService(Object service, Class<?> ifaceClass, String name)
public static void registerService(Object service, Class<?>[] ifaceClasses, String name)
public static void unregisterService(Object service, Class<?> ifaceClass, String name)
public static int getVersion()
HippoServiceRegistry
: Every time the registry gets a service added or removed
the version is incremented. This is for classes using the HippoServiceRegistry that they can easily check whether
they need to register or unregister new HippoServiceRegistration
sCopyright © 2012–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.