Package org.opennms.osgi.internal
Class OnmsServiceManagerImpl
- java.lang.Object
-
- org.opennms.osgi.internal.OnmsServiceManagerImpl
-
- All Implemented Interfaces:
OnmsServiceManager,SessionListener
public class OnmsServiceManagerImpl extends java.lang.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 VaadinApplicationContextcreateApplicationContext(VaadinApplicationContextCreator creator)EventRegistrygetEventRegistry()<T> TgetService(java.lang.Class<T> clazz, VaadinApplicationContext applicationContext)Returns a service in session-scope.<T> java.util.List<T>getServices(java.lang.Class<T> clazz, VaadinApplicationContext applicationContext, java.util.Hashtable<java.lang.String,java.lang.Object> additionalProperties)Returns all registered services within session-scope and may be consider additional Properties.<T> voidregisterAsService(java.lang.Class<T> serviceClass, T serviceBean, VaadinApplicationContext applicationContext)Register a service with session scope.<T> voidregisterAsService(java.lang.Class<T> serviceClass, T serviceBean, VaadinApplicationContext applicationContext, java.util.Dictionary<java.lang.String,java.lang.Object> properties)Registers a service with session scope but allows to set additional Properties.voidsessionDestroyed(java.lang.String sessionId)Remove all services from OSGi-container for the destroyed session.voidsessionInitialized(java.lang.String sessionId)
-
-
-
Method Detail
-
registerAsService
public <T> void registerAsService(java.lang.Class<T> serviceClass, T serviceBean, VaadinApplicationContext applicationContext)Description copied from interface:OnmsServiceManagerRegister a service with session scope.- Specified by:
registerAsServicein interfaceOnmsServiceManagerserviceBean- The service to be registered. Must not be null.applicationContext- The session scope. Must not be null.
-
registerAsService
public <T> void registerAsService(java.lang.Class<T> serviceClass, T serviceBean, VaadinApplicationContext applicationContext, java.util.Dictionary<java.lang.String,java.lang.Object> properties)Description copied from interface:OnmsServiceManagerRegisters a service with session scope but allows to set additional Properties.- Specified by:
registerAsServicein interfaceOnmsServiceManagerserviceBean- 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:
getEventRegistryin interfaceOnmsServiceManager
-
getService
public <T> T getService(java.lang.Class<T> clazz, VaadinApplicationContext applicationContext)Description copied from interface:OnmsServiceManagerReturns 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:
getServicein interfaceOnmsServiceManager- Parameters:
clazz- The type of the service. Must not be null.applicationContext- The session-scope. Must not be null.
-
getServices
public <T> java.util.List<T> getServices(java.lang.Class<T> clazz, VaadinApplicationContext applicationContext, java.util.Hashtable<java.lang.String,java.lang.Object> additionalProperties)Description copied from interface:OnmsServiceManagerReturns all registered services within session-scope and may be consider additional Properties.- Specified by:
getServicesin 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(java.lang.String sessionId)
- Specified by:
sessionInitializedin interfaceSessionListener
-
sessionDestroyed
public void sessionDestroyed(java.lang.String sessionId)
Remove all services from OSGi-container for the destroyed session.- Specified by:
sessionDestroyedin interfaceSessionListener
-
createApplicationContext
public VaadinApplicationContext createApplicationContext(VaadinApplicationContextCreator creator)
- Specified by:
createApplicationContextin interfaceOnmsServiceManager
-
-