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 VaadinApplicationContextcreateApplicationContext(VaadinApplicationContextCreator creator)EventRegistrygetEventRegistry()<T> TgetService(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> voidregisterAsService(Class<T> serviceClass, T serviceBean, VaadinApplicationContext applicationContext)Register a service with session scope.<T> voidregisterAsService(Class<T> serviceClass, T serviceBean, VaadinApplicationContext applicationContext, Dictionary<String,Object> properties)Registers a service with session scope but allows to set additional Properties.voidsessionDestroyed(String sessionId)Remove all services from OSGi-container for the destroyed session.voidsessionInitialized(String sessionId)
-
-
-
Method Detail
-
registerAsService
public <T> void registerAsService(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(Class<T> serviceClass, T serviceBean, VaadinApplicationContext applicationContext, Dictionary<String,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(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> List<T> getServices(Class<T> clazz, VaadinApplicationContext applicationContext, Hashtable<String,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(String sessionId)
- Specified by:
sessionInitializedin interfaceSessionListener
-
sessionDestroyed
public void sessionDestroyed(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
-
-