Package org.opennms.osgi
Interface OnmsServiceManager
-
- All Superinterfaces:
SessionListener
- All Known Implementing Classes:
OnmsServiceManagerImpl
public interface OnmsServiceManager extends SessionListener
The OnmsServiceManager is a abstraction layer above theBundleContext
. Its intention is to provide a so called session-scope for services. The session-scope is realized by theVaadinApplicationContext
-object.
/ Therefore you should always use OnmsServiceManager instead of theBundleContext
.
A OnmsServiceManager also listens to session events (e.g. to remove all registered services from the OSGi-container for a session when the session has already been destroyed).- Author:
- Markus von RĂ¼den
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description VaadinApplicationContext
createApplicationContext(VaadinApplicationContextCreator creator)
EventRegistry
getEventRegistry()
<T> T
getService(Class<T> clazz, VaadinApplicationContext applicationContext)
Returns a service in session-scope.<T> List<T>
getServices(Class<T> clazz, VaadinApplicationContext applicationContext, Hashtable<String,Object> additionalProperties)
Returns all registered services within session-scope and may be consider additional Properties.<T> void
registerAsService(Class<T> serviceClass, T serviceBean, VaadinApplicationContext applicationContext)
Register a service with session scope.<T> void
registerAsService(Class<T> serviceClass, T serviceBean, VaadinApplicationContext applicationContext, Dictionary<String,Object> additionalProperties)
Registers a service with session scope but allows to set additional Properties.-
Methods inherited from interface org.opennms.vaadin.extender.SessionListener
sessionDestroyed, sessionInitialized
-
-
-
-
Method Detail
-
registerAsService
<T> void registerAsService(Class<T> serviceClass, T serviceBean, VaadinApplicationContext applicationContext)
Register a service with session scope.- Parameters:
serviceBean
- The service to be registered. Must not be null.applicationContext
- The session scope. Must not be null.
-
registerAsService
<T> void registerAsService(Class<T> serviceClass, T serviceBean, VaadinApplicationContext applicationContext, Dictionary<String,Object> additionalProperties)
Registers a service with session scope but allows to set additional Properties.- Parameters:
serviceBean
- The service to be registered. Must not be null.applicationContext
- the session scope. Must not be null.additionalProperties
- Additional Properties. Must not be null.
-
getService
<T> T getService(Class<T> clazz, VaadinApplicationContext applicationContext)
Returns a service in session-scope. Be aware that if there are multiple services registered for the given class, only the first one is returned.- Parameters:
clazz
- The type of the service. Must not be null.applicationContext
- The session-scope. Must not be null.
-
getServices
<T> List<T> getServices(Class<T> clazz, VaadinApplicationContext applicationContext, Hashtable<String,Object> additionalProperties)
Returns all registered services within session-scope and may be consider additional Properties.- Parameters:
clazz
- the type of the service. Must not be null.applicationContext
- The session scope. Must not be null.additionalProperties
- optional additional propeties. Must not be null.
-
createApplicationContext
VaadinApplicationContext createApplicationContext(VaadinApplicationContextCreator creator)
-
getEventRegistry
EventRegistry getEventRegistry()
-
-