public class ServiceLookup extends Object
TestContainerException when no matching service becomes available during this period.
NOTE: Prefixing some method calls with our own class name is a workaround for a bug in the Oracle Java compiler, which does not occur when compiling in Eclipse.
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_TIMEOUT
Default timeout used for service lookup when no explicit timeout is specified.
|
| Constructor and Description |
|---|
ServiceLookup() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
getService(org.osgi.framework.BundleContext bc,
Class<T> type)
Returns a service matching the given criteria.
|
static <T> T |
getService(org.osgi.framework.BundleContext bc,
Class<T> type,
long timeout)
Returns a service matching the given criteria.
|
static <T> T |
getService(org.osgi.framework.BundleContext bc,
Class<T> type,
long timeout,
Map<String,String> props)
Returns a service matching the given criteria.
|
static <T> T |
getService(org.osgi.framework.BundleContext bc,
Class<T> type,
long timeout,
String filter)
Returns a service matching the given criteria.
|
static <T> T |
getService(org.osgi.framework.BundleContext bc,
Class<T> type,
Map<String,String> props)
Returns a service matching the given criteria.
|
static <T> T |
getService(org.osgi.framework.BundleContext bc,
String className)
Returns a service matching the given criteria.
|
static <T> T |
getService(org.osgi.framework.BundleContext bc,
String className,
long timeout,
Map<String,String> props)
Returns a service matching the given criteria.
|
static <T> T |
getService(org.osgi.framework.BundleContext bc,
String className,
long timeout,
String filter)
Returns a service matching the given criteria.
|
static Object |
getServiceByFilter(org.osgi.framework.BundleContext bc,
String ldapFilter)
Returns a service matching the given filter.
|
static Object |
getServiceByFilter(org.osgi.framework.BundleContext bc,
String ldapFilter,
long timeout)
Returns a service matching the given filter.
|
static org.osgi.framework.ServiceReference |
getServiceReference(org.osgi.framework.BundleContext bc,
String className,
long timeout,
String filter)
Returns a service reference matching the given criteria.
|
public static final long DEFAULT_TIMEOUT
public static <T> T getService(org.osgi.framework.BundleContext bc,
String className)
T - class implemented or extended by the servicebc - bundle context for accessing the OSGi registryclassName - name of class implemented or extended by the serviceServiceLookupException - when no matching service has been found after the timeoutpublic static <T> T getService(org.osgi.framework.BundleContext bc,
Class<T> type)
T - class implemented or extended by the servicebc - bundle context for accessing the OSGi registrytype - class implemented or extended by the serviceServiceLookupException - when no matching service has been found after the timeoutpublic static <T> T getService(org.osgi.framework.BundleContext bc,
Class<T> type,
Map<String,String> props)
T - class implemented or extended by the servicebc - bundle context for accessing the OSGi registrytype - class implemented or extended by the serviceprops - properties to be matched by the serviceServiceLookupException - when no matching service has been found after the timeoutpublic static <T> T getService(org.osgi.framework.BundleContext bc,
Class<T> type,
long timeout,
Map<String,String> props)
T - class implemented or extended by the servicebc - bundle context for accessing the OSGi registrytype - class implemented or extended by the servicetimeout - maximum wait period in millisecondsprops - properties to be matched by the serviceServiceLookupException - when no matching service has been found after the timeoutpublic static <T> T getService(org.osgi.framework.BundleContext bc,
Class<T> type,
long timeout)
T - class implemented or extended by the servicebc - bundle context for accessing the OSGi registrytype - class implemented or extended by the servicetimeout - maximum wait period in millisecondsServiceLookupException - when no matching service has been found after the timeoutpublic static <T> T getService(org.osgi.framework.BundleContext bc,
Class<T> type,
long timeout,
String filter)
T - class implemented or extended by the servicebc - bundle context for accessing the OSGi registrytype - class implemented or extended by the servicetimeout - maximum wait period in millisecondsfilter - LDAP filter to be matched by the service. The class name will be added to the
filter.ServiceLookupException - when no matching service has been found after the timeoutpublic static <T> T getService(org.osgi.framework.BundleContext bc,
String className,
long timeout,
Map<String,String> props)
T - class implemented or extended by the servicebc - bundle context for accessing the OSGi registryclassName - name of class implemented or extended by the servicetimeout - maximum wait period in millisecondsprops - properties to be matched by the serviceServiceLookupException - when no matching service has been found after the timeoutpublic static <T> T getService(org.osgi.framework.BundleContext bc,
String className,
long timeout,
String filter)
T - class implemented or extended by the servicebc - bundle context for accessing the OSGi registryclassName - name of class implemented or extended by the servicetimeout - maximum wait period in millisecondsfilter - LDAP filter to be matched by the service. The class name will be added to the
filter.ServiceLookupException - when no matching service has been found after the timeoutpublic static org.osgi.framework.ServiceReference getServiceReference(org.osgi.framework.BundleContext bc,
String className,
long timeout,
String filter)
bc - bundle context for accessing the OSGi registryclassName - name of class implemented or extended by the servicetimeout - maximum wait period in millisecondsfilter - LDAP filter to be matched by the service. The class name will be added to the
filter.ServiceLookupExceptionpublic static Object getServiceByFilter(org.osgi.framework.BundleContext bc, String ldapFilter)
bc - bundle context for accessing the OSGi registryldapFilter - LDAP filter to be matched by the service. The class name must be part of the
filter.ServiceLookupException - when no matching service has been found after the default
timeoutpublic static Object getServiceByFilter(org.osgi.framework.BundleContext bc, String ldapFilter, long timeout)
bc - bundle context for accessing the OSGi registryldapFilter - LDAP filter to be matched by the service. The class name must be part of the
filter.timeout - maximum wait period in millisecondsServiceLookupException - when no matching service has been found after the timeoutCopyright © 2006-2013 OPS4J - Open Participation Software for Java. All Rights Reserved.