org.apache.felix.ipojo.dependency.interceptors

## Interface ServiceTrackingInterceptor

All Superinterfaces:
  DependencyInterceptor

All Known Implementing Classes:
  DefaultServiceTrackingInterceptor, FilterBasedServiceTrackingInterceptor

    public interface ServiceTrackingInterceptor
    extends DependencyInterceptor

A service to influence the visibility of services within a service dependency. This service is called to determine which services from the tracker (base set) is going to the matching set. Several tracking interceptors can be plugged to the same service dependency. In this case, a chain is created where all interceptor can influence the next one. If the dependency has a filter, a tracking interceptor using this filter is the last interceptor of the chain. Obviously an interceptor can be plugged to several dependencies. Conversely, several tracking interceptor can be plugged to one dependency.

Since:
  1.10.1

### Field Summary

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

`TARGET_PROPERTY`

### Method Summary

All Methods Instance Methods Abstract 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.

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

`close, open`

### Method Detail

#### accept

    <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. 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.

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.