@Qualifier @Target(value={TYPE,METHOD,PARAMETER,FIELD}) @Retention(value=RUNTIME) public @interface OsgiService
Injection points with this qualifier are injected with an OSGi bean which acts as a proxy to an
OSGi service obtained from the service registry. The service matches the type of the injection
point and any additional properties specified in the filter() attribute.
Any matching service can be injected, the bundle that registered the service does not have to be a bean bundle.
For the complementary action of publishing a CDI bean in the OSGi service registry, use the
OsgiServiceProvider qualifier.
| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
dynamic
Indicates whether this proxy is static or dynamic.
|
String |
filter
An LDAP filter in the usual OSGi syntax for narrowing down the set of matching OSGi services.
|
boolean |
required |
int |
timeout
Timeout in milliseconds for obtaining a matching service.
|
public abstract boolean dynamic
A static proxy (the default) looks up a matching OSGi service once during the CDI bean validation phase. If no service is found, bean validation fails. Otherwise, any bean method invocation is forwarded to the service instance acquired during bean validation. If the service has been unregistered, the proxy throws an exception and will not try to acquire another service instance.
public abstract boolean required
public abstract String filter
objectClass property is always implicitly set to the type of the injection point.public abstract int timeout
dynamic() is true,
this timeout applies to every method invocation of the injected bean: If a matching service
is available, the proxied method is invoked immediately. Otherwise, the proxy method blocks for
at most the given timeout period until a matching service has been acquired.Copyright © 2006-2014 OPS4J - Open Participation Software for Java. All Rights Reserved.