Package org.opennms.osgi.internal
Class OnmsServiceManagerImpl
- java.lang.Object
-
- org.opennms.osgi.internal.OnmsServiceManagerImpl
-
- All Implemented Interfaces:
OnmsServiceManager
,SessionListener
public class OnmsServiceManagerImpl extends Object implements OnmsServiceManager
-
-
Constructor Summary
Constructors Constructor Description OnmsServiceManagerImpl(org.osgi.framework.BundleContext bundleContext)
-
Method Summary
All Methods Instance Methods Concrete 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> properties)
Registers a service with session scope but allows to set additional Properties.void
sessionDestroyed(String sessionId)
Remove all services from OSGi-container for the destroyed session.void
sessionInitialized(String sessionId)
-
-
-
Method Detail
-
registerAsService
public <T> void registerAsService(Class<T> serviceClass, T serviceBean, VaadinApplicationContext applicationContext)
Description copied from interface:OnmsServiceManager
Register a service with session scope.- Specified by:
registerAsService
in interfaceOnmsServiceManager
serviceBean
- The service to be registered. Must not be null.applicationContext
- The session scope. Must not be null.
-
registerAsService
public <T> void registerAsService(Class<T> serviceClass, T serviceBean, VaadinApplicationContext applicationContext, Dictionary<String,Object> properties)
Description copied from interface:OnmsServiceManager
Registers a service with session scope but allows to set additional Properties.- Specified by:
registerAsService
in interfaceOnmsServiceManager
serviceBean
- The service to be registered. Must not be null.applicationContext
- the session scope. Must not be null.properties
- Additional Properties. Must not be null.
-
getEventRegistry
public EventRegistry getEventRegistry()
- Specified by:
getEventRegistry
in interfaceOnmsServiceManager
-
getService
public <T> T getService(Class<T> clazz, VaadinApplicationContext applicationContext)
Description copied from interface:OnmsServiceManager
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.- Specified by:
getService
in interfaceOnmsServiceManager
- Parameters:
clazz
- The type of the service. Must not be null.applicationContext
- The session-scope. Must not be null.
-
getServices
public <T> List<T> getServices(Class<T> clazz, VaadinApplicationContext applicationContext, Hashtable<String,Object> additionalProperties)
Description copied from interface:OnmsServiceManager
Returns all registered services within session-scope and may be consider additional Properties.- Specified by:
getServices
in interfaceOnmsServiceManager
- 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.
-
sessionInitialized
public void sessionInitialized(String sessionId)
- Specified by:
sessionInitialized
in interfaceSessionListener
-
sessionDestroyed
public void sessionDestroyed(String sessionId)
Remove all services from OSGi-container for the destroyed session.- Specified by:
sessionDestroyed
in interfaceSessionListener
-
createApplicationContext
public VaadinApplicationContext createApplicationContext(VaadinApplicationContextCreator creator)
- Specified by:
createApplicationContext
in interfaceOnmsServiceManager
-
-