org.apache.felix.ipojo.dependency.interceptors

## Class DefaultServiceRankingInterceptor

- java.lang.Object
- - org.apache.felix.ipojo.dependency.interceptors.DefaultDependencyInterceptor
  - - org.apache.felix.ipojo.dependency.interceptors.DefaultServiceRankingInterceptor

All Implemented Interfaces:
  DependencyInterceptor, ServiceRankingInterceptor

    public class DefaultServiceRankingInterceptor
    extends DefaultDependencyInterceptor
    implements ServiceRankingInterceptor

Default implementation of the default service ranking interceptor. This implementation does not sort the given set, so returns it as it is. It also provides an `invalidateSelectedServices` method notifying all managed dependencies of a change in the selection service set. onDeparture, onArrival and onModified methods delegates to the getServiceReferences method.

### Field Summary

### Fields inherited from class org.apache.felix.ipojo.dependency.interceptors.DefaultDependencyInterceptor

`dependencies`

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

`TARGET_PROPERTY`

### Constructor Summary

Constructors
Constructor and Description
`DefaultServiceRankingInterceptor()`

### Method Summary

All Methods Instance Methods Concrete Methods
`java.util.List<org.osgi.framework.ServiceReference>` `getServiceReferences(DependencyModel dependency, java.util.List<org.osgi.framework.ServiceReference> matching)` Gets the sorted set of selected reference.
`void` `invalidateSelectedServices()` Notifies the managed dependencies of a change in the set of services selected by this interceptor.
`java.util.List<org.osgi.framework.ServiceReference>` `onServiceArrival(DependencyModel dependency, java.util.List<org.osgi.framework.ServiceReference> matching, org.osgi.framework.ServiceReference<?> reference)` A new service arrives in the matching set.
`java.util.List<org.osgi.framework.ServiceReference>` `onServiceDeparture(DependencyModel dependency, java.util.List<org.osgi.framework.ServiceReference> matching, org.osgi.framework.ServiceReference<?> reference)` A service leaves the matching set.
`java.util.List<org.osgi.framework.ServiceReference>` `onServiceModified(DependencyModel dependency, java.util.List<org.osgi.framework.ServiceReference> matching, org.osgi.framework.ServiceReference<?> reference)` A service from the matching set was modified.

### Methods inherited from class org.apache.felix.ipojo.dependency.interceptors.DefaultDependencyInterceptor

`close, open`

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

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

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

`close, open`

### Constructor Detail

#### DefaultServiceRankingInterceptor

    public DefaultServiceRankingInterceptor()

### Method Detail

#### invalidateSelectedServices

    public void invalidateSelectedServices()

Notifies the managed dependencies of a change in the set of services selected by this interceptor. The dependency will call the getServiceReferences method to recompute the set of selected services.

#### getServiceReferences

    public java.util.List<org.osgi.framework.ServiceReference> getServiceReferences(DependencyModel dependency,
                                                                                    java.util.List<org.osgi.framework.ServiceReference> matching)

Description copied from interface: `ServiceRankingInterceptor`
Gets the sorted set of selected reference.

Specified by:
  `getServiceReferences` in interface `ServiceRankingInterceptor`
Parameters:
  `dependency` - the dependency
  `matching` - the set of service to sort
Returns:
  the sorted set of selected reference. This set is a sub-set potentially empty of the given list of references.

#### onServiceArrival

    public java.util.List<org.osgi.framework.ServiceReference> onServiceArrival(DependencyModel dependency,
                                                                                java.util.List<org.osgi.framework.ServiceReference> matching,
                                                                                org.osgi.framework.ServiceReference<?> reference)

Description copied from interface: `ServiceRankingInterceptor`
A new service arrives in the matching set. This method is called to retrieve the new sorted set of selected services.

Specified by:
  `onServiceArrival` in interface `ServiceRankingInterceptor`
Parameters:
  `dependency` - the dependency
  `matching` - the set of matching service
  `reference` - the arriving reference
Returns:
  the new sorted set of service

#### onServiceDeparture

    public java.util.List<org.osgi.framework.ServiceReference> onServiceDeparture(DependencyModel dependency,
                                                                                  java.util.List<org.osgi.framework.ServiceReference> matching,
                                                                                  org.osgi.framework.ServiceReference<?> reference)

Description copied from interface: `ServiceRankingInterceptor`
A service leaves the matching set. This method is called to retrieve the new sorted set of selected services.

Specified by:
  `onServiceDeparture` in interface `ServiceRankingInterceptor`
Parameters:
  `dependency` - the dependency
  `matching` - the set of matching service
  `reference` - the leaving reference
Returns:
  the new sorted set of service

#### onServiceModified

    public java.util.List<org.osgi.framework.ServiceReference> onServiceModified(DependencyModel dependency,
                                                                                 java.util.List<org.osgi.framework.ServiceReference> matching,
                                                                                 org.osgi.framework.ServiceReference<?> reference)

Description copied from interface: `ServiceRankingInterceptor`
A service from the matching set was modified. This method is called to retrieve the new sorted set of selected services.

Specified by:
  `onServiceModified` in interface `ServiceRankingInterceptor`
Parameters:
  `dependency` - the dependency
  `matching` - the set of matching service
  `reference` - the modified service
Returns:
  the new sorted set of service