org.apache.felix.ipojo.dependency.impl

## Class FilterBasedServiceTrackingInterceptor

- java.lang.Object
- - org.apache.felix.ipojo.dependency.impl.FilterBasedServiceTrackingInterceptor

All Implemented Interfaces:
  DependencyInterceptor, ServiceTrackingInterceptor

    public class FilterBasedServiceTrackingInterceptor
    extends java.lang.Object
    implements ServiceTrackingInterceptor

An implementation of the service tracking interceptor using a filter.

### Field Summary

### Fields inherited from interface org.apache.felix.ipojo.dependency.interceptors.DependencyInterceptor

`TARGET_PROPERTY`

### Constructor Summary

Constructors
Constructor and Description
`FilterBasedServiceTrackingInterceptor(org.osgi.framework.Filter filter)`

### Method Summary

All Methods Instance Methods Concrete Methods
`<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)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### FilterBasedServiceTrackingInterceptor

    public FilterBasedServiceTrackingInterceptor(org.osgi.framework.Filter filter)

### Method Detail

#### open

    public void open(DependencyModel dependency)

Description copied from interface: `DependencyInterceptor`
The interceptor is plugged to the given dependency.

Specified by:
  `open` in interface `DependencyInterceptor`
Parameters:
  `dependency` - the dependency starting using the interceptor.

#### accept

    public <S> TransformedServiceReference<S> accept(DependencyModel dependency,
                                                     org.osgi.framework.BundleContext context,
                                                     TransformedServiceReference<S> ref)

Description copied from interface: `ServiceTrackingInterceptor`
Does the interceptor accepts the reference of not ? This methods has two goals. It can filter out undesirable services by returning null. In addition, it can transform the service reference to add / remove service properties. In this case, it must return the same instance of `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.

Specified by:
  `accept` in interface `ServiceTrackingInterceptor`
Type Parameters:
  `S` - the type of service
Parameters:
  `dependency` - the dependency
  `context` - the context of the dependency
  `ref` - the reference
Returns:
  null to filter out the service, the, optionally updated, reference to accept it.

#### close

    public void close(DependencyModel dependency)

Description copied from interface: `DependencyInterceptor`
The interceptor won't be use anymore by the given dependency. This method is called either when the interceptor is replace or when the instance's dependency is stopping.

Specified by:
  `close` in interface `DependencyInterceptor`
Parameters:
  `dependency` - the dependency stopping its use of the interceptor

#### getService

    public <S> S getService(DependencyModel dependency,
                            S service,
                            org.osgi.framework.ServiceReference<S> reference)

#### ungetService

    public void ungetService(DependencyModel dependency,
                             boolean noMoreUsage,
                             org.osgi.framework.ServiceReference reference)