public class FilterBasedServiceTrackingInterceptor extends java.lang.Object implements ServiceTrackingInterceptor
TARGET_PROPERTY
Constructor and Description |
---|
FilterBasedServiceTrackingInterceptor(org.osgi.framework.Filter filter) |
Modifier and Type | Method and Description |
---|---|
<S> TransformedServiceReference<S> |
accept(DependencyModel dependency,
org.osgi.framework.BundleContext context,
TransformedServiceReference<S> ref)
Does the interceptor accepts the reference of not ?
This methods has two goals.
|
void |
close(DependencyModel dependency)
The interceptor won't be use anymore by the given dependency.
|
<S> S |
getService(DependencyModel dependency,
S service,
org.osgi.framework.ServiceReference<S> reference) |
void |
open(DependencyModel dependency)
The interceptor is plugged to the given dependency.
|
void |
ungetService(DependencyModel dependency,
boolean noMoreUsage,
org.osgi.framework.ServiceReference reference) |
public FilterBasedServiceTrackingInterceptor(org.osgi.framework.Filter filter)
public void open(DependencyModel dependency)
DependencyInterceptor
open
in interface DependencyInterceptor
dependency
- the dependency starting using the interceptor.public <S> TransformedServiceReference<S> accept(DependencyModel dependency, org.osgi.framework.BundleContext context, TransformedServiceReference<S> ref)
ServiceTrackingInterceptor
TransformedServiceReference
,
but with the new set of properties.
So to filter out the service, return null. To accept the service,
return the reference as it is. To transform the service update the service reference and return it.
When several interceptors are collaborating on the same dependency, a chain is created. The received reference
is the reference modified by the preceding interceptor. Notice that once an interceptor returns null the chain is interrupted and the service rejected.accept
in interface ServiceTrackingInterceptor
S
- the type of servicedependency
- the dependencycontext
- the context of the dependencyref
- the referencepublic void close(DependencyModel dependency)
DependencyInterceptor
close
in interface DependencyInterceptor
dependency
- the dependency stopping its use of the interceptorpublic <S> S getService(DependencyModel dependency, S service, org.osgi.framework.ServiceReference<S> reference)
public void ungetService(DependencyModel dependency, boolean noMoreUsage, org.osgi.framework.ServiceReference reference)
Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved.