org.apache.felix.ipojo.composite.service.instantiator

## Class ServiceImporter

- java.lang.Object
- - org.apache.felix.ipojo.util.DependencyModel
  - - org.apache.felix.ipojo.composite.service.instantiator.ServiceImporter

    public class ServiceImporter
    extends DependencyModel

Import a service form the parent to the internal service registry.

Author:
  Felix Project Team

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.felix.ipojo.util.DependencyModel

`DependencyModel.DependencyEventType, DependencyModel.ServiceBindingHolder`

### Field Summary

### Fields inherited from class org.apache.felix.ipojo.util.DependencyModel

`BROKEN, DYNAMIC_BINDING_POLICY, DYNAMIC_PRIORITY_BINDING_POLICY, m_serviceReferenceManager, RESOLVED, STATIC_BINDING_POLICY, UNRESOLVED`

### Constructor Summary

Constructors
Constructor and Description
`ServiceImporter(java.lang.Class specification, org.osgi.framework.Filter filter, boolean multiple, boolean optional, java.util.Comparator cmp, int policy, org.osgi.framework.BundleContext context, java.lang.String identitity, ServiceDependencyHandler handler)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `freeze()` Freeze the set of used provider.
`java.lang.String` `getId()`
`java.util.List` `getProviders()` Build the list of imported service provider.
`boolean` `isFrozen()`
`boolean` `isServiceLevelRequirement()`
`void` `onDependencyReconfiguration(org.osgi.framework.ServiceReference[] departs, org.osgi.framework.ServiceReference[] arrivals)` On Dependency Reconfiguration notification method.
`void` `onServiceArrival(org.osgi.framework.ServiceReference ref)` A new service is injected by the tracker.
`void` `onServiceDeparture(org.osgi.framework.ServiceReference ref)` A used service disappears.
`void` `onServiceModification(org.osgi.framework.ServiceReference ref)` A used service is modified.
`void` `setServiceLevelDependency()` Set that this dependency is a service level dependency.
`void` `stop()` Stop the management of the import.
`void` `unfreeze()` Unfreezes.

### Methods inherited from class org.apache.felix.ipojo.util.DependencyModel

`acquireReadLockIfNotHeld, acquireWriteLockIfNotHeld, addListener, applyReconfiguration, cleanup, getBindingPolicy, getBundleContext, getComparator, getComponentInstance, getContextSourceManager, getFilter, getService, getService, getServiceReference, getServiceReferenceManager, getServiceReferences, getSize, getSpecification, getState, getTracker, getUsedServiceReferences, invalidateMatchingServices, invalidateSelectedServices, isAggregate, isOptional, match, notifyListeners, onChange, releaseReadLockIfHeld, releaseWriteLockIfHeld, removeListener, setAggregate, setBundleContext, setComparator, setFilter, setOptionality, setSpecification, start, ungetService`

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

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

### Constructor Detail

#### ServiceImporter

    public ServiceImporter(java.lang.Class specification,
                           org.osgi.framework.Filter filter,
                           boolean multiple,
                           boolean optional,
                           java.util.Comparator cmp,
                           int policy,
                           org.osgi.framework.BundleContext context,
                           java.lang.String identitity,
                           ServiceDependencyHandler handler)

Constructor.

Parameters:
  `specification` - : targeted specification
  `filter` - : LDAP filter
  `multiple` - : should the importer imports several services ?
  `optional` - : is the import optional ?
  `cmp` - : comparator to use for the tracking
  `policy` - : resolving policy
  `context` - : bundle context to use for the tracking (can be a servie context)
  `identitity` - : requirement id (may be null)
  `handler` - : handler

### Method Detail

#### freeze

    public void freeze()

Freeze the set of used provider. This method allow to fix the set of provider when the static binding policy is used.

#### unfreeze

    public void unfreeze()

Unfreezes.

Overrides:
  `unfreeze` in class `DependencyModel`

#### isFrozen

    public boolean isFrozen()

Overrides:
  `isFrozen` in class `DependencyModel`

#### stop

    public void stop()

Stop the management of the import.

Overrides:
  `stop` in class `DependencyModel`

#### getProviders

    public java.util.List getProviders()

Build the list of imported service provider.

Returns:
  the list of all imported services.

#### setServiceLevelDependency

    public void setServiceLevelDependency()

Set that this dependency is a service level dependency. This forces the scoping policy to be STRICT.

#### getId

    public java.lang.String getId()

Overrides:
  `getId` in class `DependencyModel`

#### isServiceLevelRequirement

    public boolean isServiceLevelRequirement()

#### onDependencyReconfiguration

    public void onDependencyReconfiguration(org.osgi.framework.ServiceReference[] departs,
                                            org.osgi.framework.ServiceReference[] arrivals)

On Dependency Reconfiguration notification method.

Specified by:
  `onDependencyReconfiguration` in class `DependencyModel`
Parameters:
  `departs` - : leaving service references.
  `arrivals` - : new injected service references.
See Also:
  `DependencyModel.onDependencyReconfiguration(org.osgi.framework.ServiceReference[], org.osgi.framework.ServiceReference[])`

#### onServiceArrival

    public void onServiceArrival(org.osgi.framework.ServiceReference ref)

A new service is injected by the tracker. This method create a 'Record' and register it.

Specified by:
  `onServiceArrival` in class `DependencyModel`
Parameters:
  `ref` - : new service reference.
See Also:
  `DependencyModel.onServiceArrival(org.osgi.framework.ServiceReference)`

#### onServiceDeparture

    public void onServiceDeparture(org.osgi.framework.ServiceReference ref)

A used service disappears. This method find the implicated 'Record', dispose it and remove it from the list.

Specified by:
  `onServiceDeparture` in class `DependencyModel`
Parameters:
  `ref` - : leaving service reference.
See Also:
  `DependencyModel.onServiceDeparture(org.osgi.framework.ServiceReference)`

#### onServiceModification

    public void onServiceModification(org.osgi.framework.ServiceReference ref)

A used service is modified.

Specified by:
  `onServiceModification` in class `DependencyModel`
Parameters:
  `ref` - : modified service reference.
See Also:
  `DependencyModel.onServiceModification(org.osgi.framework.ServiceReference)`