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

## Class SvcInstance

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

    public class SvcInstance
    extends DependencyModel

Manage a service instantiation. This service create component instance providing the required service specification.

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
`SvcInstance(ServiceDependencyHandler handler, java.lang.String spec, java.util.Dictionary conf, boolean isAgg, boolean isOpt, org.osgi.framework.Filter filt, java.util.Comparator cmp, int policy)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `freeze()` Freeze the set of used provider.
`protected java.util.Map` `getMatchingFactories()` Get the map of used references [reference, component instance].
`java.lang.String` `getServiceSpecification()` Get the required specification.
`boolean` `isFrozen()`
`boolean` `match(org.osgi.framework.ServiceReference fact)` Does the service instance match with the given factory ?
`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.
`void` `onServiceDeparture(org.osgi.framework.ServiceReference ref)` A used service is leaving.
`void` `onServiceModification(org.osgi.framework.ServiceReference arg0)` A factory is modified.
`void` `stop()` Stop the service instance.
`void` `unfreeze()` Unfreezes.

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

`acquireReadLockIfNotHeld, acquireWriteLockIfNotHeld, addListener, applyReconfiguration, cleanup, getBindingPolicy, getBundleContext, getComparator, getComponentInstance, getContextSourceManager, getFilter, getId, getService, getService, getServiceReference, getServiceReferenceManager, getServiceReferences, getSize, getSpecification, getState, getTracker, getUsedServiceReferences, invalidateMatchingServices, invalidateSelectedServices, isAggregate, isOptional, 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

#### SvcInstance

    public SvcInstance(ServiceDependencyHandler handler,
                       java.lang.String spec,
                       java.util.Dictionary conf,
                       boolean isAgg,
                       boolean isOpt,
                       org.osgi.framework.Filter filt,
                       java.util.Comparator cmp,
                       int policy)
                throws ConfigurationException

Constructor.

Parameters:
  `handler` - : the handler.
  `spec` - : required specification.
  `conf` - : instance configuration.
  `isAgg` - : is the service instance an aggregate service ?
  `isOpt` - : is the service instance optional ?
  `filt` - : LDAP filter
  `cmp` - : comparator to use for the tracking
  `policy` - : binding policy
Throws:
  `ConfigurationException` - : an attribute cannot be parsed correctly, or is incorrect.

### Method Detail

#### stop

    public void stop()

Stop the service instance.

Overrides:
  `stop` in class `DependencyModel`

#### isFrozen

    public boolean isFrozen()

Overrides:
  `isFrozen` in class `DependencyModel`

#### freeze

    public void freeze()

Freeze the set of used provider. This method is when the static binding policy is applied.

#### unfreeze

    public void unfreeze()

Unfreezes.

Overrides:
  `unfreeze` in class `DependencyModel`

#### match

    public boolean match(org.osgi.framework.ServiceReference fact)

Does the service instance match with the given factory ?

Overrides:
  `match` in class `DependencyModel`
Parameters:
  `fact` - : the factory to test.
Returns:
  true if the factory match, false otherwise.

#### getServiceSpecification

    public java.lang.String getServiceSpecification()

Get the required specification.

Returns:
  the required specification.

#### getMatchingFactories

    protected java.util.Map getMatchingFactories()

Get the map of used references [reference, component instance].

Returns:
  the map of used references.

#### 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. This method create the sub-service instance in the composite.

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

#### onServiceDeparture

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

A used service is leaving. This method dispose the created instance.

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 arg0)

A factory is modified. This should not happen.

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