SMILA (incubation) API documentation

org.eclipse.smila.utils.service
Class ServiceUtils<T>

java.lang.Object
  extended by org.eclipse.smila.utils.service.ServiceUtils<T>
Type Parameters:
T - the type

public final class ServiceUtils<T>
extends java.lang.Object

The Class ServiceHelper.


Method Summary
static
<T> T
getService(BundleContext context, java.lang.Class<T> clazz)
          Gets the service with default wait delay.
static
<T> T
getService(BundleContext context, java.lang.Class<T> clazz, long timeout)
          Uses a ServiceTracker to get the given DeclarativeService.
static
<T> T
getService(java.lang.Class<T> clazz)
          Gets the service with default wait delay using the BundleContext of UtilsActivator.
static
<T> T
getService(java.lang.Class<T> clazz, long timeout)
          Gets the service with the given wait delay using the BundleContext of UtilsActivator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getService

public static <T> T getService(BundleContext context,
                               java.lang.Class<T> clazz,
                               long timeout)
                    throws java.lang.InterruptedException
Uses a ServiceTracker to get the given DeclarativeService.

Type Parameters:
T - expected service class
Parameters:
clazz - the service class of the DeclarativeService interface
timeout - the number of milliseconds to wait for the ServiceTracker to find the service
context - the context
Returns:
the DeclarativeService.
Throws:
java.lang.InterruptedException - a InterruptedException

getService

public static <T> T getService(BundleContext context,
                               java.lang.Class<T> clazz)
                    throws java.lang.InterruptedException
Gets the service with default wait delay.

Type Parameters:
T - expected service class
Parameters:
clazz - the clazz
context - the context
Returns:
the service
Throws:
java.lang.InterruptedException - the interrupted exception

getService

public static <T> T getService(java.lang.Class<T> clazz,
                               long timeout)
                    throws java.lang.InterruptedException
Gets the service with the given wait delay using the BundleContext of UtilsActivator.

Type Parameters:
T - expected service class
Parameters:
clazz - the clazz
timeout - the number of milliseconds to wait for the ServiceTracker to find the service
Returns:
the service
Throws:
java.lang.InterruptedException - the interrupted exception

getService

public static <T> T getService(java.lang.Class<T> clazz)
                    throws java.lang.InterruptedException
Gets the service with default wait delay using the BundleContext of UtilsActivator.

Type Parameters:
T - expected service class
Parameters:
clazz - the clazz
Returns:
the service
Throws:
java.lang.InterruptedException - the interrupted exception

SMILA (incubation) API documentation