Package org.hibernate.osgi
Class OsgiServiceUtil
- java.lang.Object
-
- org.hibernate.osgi.OsgiServiceUtil
-
- All Implemented Interfaces:
org.hibernate.service.spi.Stoppable
public class OsgiServiceUtil extends Object implements org.hibernate.service.spi.Stoppable
Utilities for dealing with OSGi environments
-
-
Constructor Summary
Constructors Constructor Description OsgiServiceUtil(org.osgi.framework.BundleContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetServiceImpl(Class<T> contract)Locate the single implementor of the given service contract in the given OSGi buindle context.<T> T[]getServiceImpls(Class<T> contract)Locate all implementors of the given service contract in the given OSGi buindle context.voidstop()
-
-
-
Method Detail
-
getServiceImpls
public <T> T[] getServiceImpls(Class<T> contract)
Locate all implementors of the given service contract in the given OSGi buindle context. UtilizesServiceTracker(best practice, automatically handles a lot of boilerplate and error conditions).- Type Parameters:
T- The Java type of the service to locate- Parameters:
contract- The service contract for which to locate implementors- Returns:
- All know implementors
-
getServiceImpl
public <T> T getServiceImpl(Class<T> contract)
Locate the single implementor of the given service contract in the given OSGi buindle context. UtilizesServiceTracker.waitForService(long)- Type Parameters:
T- The Java type of the service to locate- Parameters:
contract- The service contract for which to locate implementors- Returns:
- All know implementors
-
stop
public void stop()
- Specified by:
stopin interfaceorg.hibernate.service.spi.Stoppable
-
-