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

java.lang.Object
  extended by org.apache.felix.ipojo.util.DependencyModel
      extended by org.apache.felix.ipojo.composite.service.instantiator.SvcInstance
All Implemented Interfaces:
org.apache.felix.ipojo.util.TrackerCustomizer

public class SvcInstance
extends org.apache.felix.ipojo.util.DependencyModel

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

Author:
Felix Project Team

Field Summary
 
Fields inherited from class org.apache.felix.ipojo.util.DependencyModel
BROKEN, DYNAMIC_BINDING_POLICY, DYNAMIC_PRIORITY_BINDING_POLICY, RESOLVED, STATIC_BINDING_POLICY, UNRESOLVED
 
Constructor Summary
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
 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 stop()
          Stop the service instance.
 
Methods inherited from class org.apache.felix.ipojo.util.DependencyModel
addedService, addingService, getBindingPolicy, getComparator, getFilter, getPolicy, getService, getServiceReference, getServiceReferences, getSize, getSpecification, getState, getUsedServiceReferences, isAggregate, isOptional, loadSpecification, modifiedService, onServiceModification, removedService, setAggregate, setBindingPolicy, 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 org.apache.felix.ipojo.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:
org.apache.felix.ipojo.ConfigurationException - : an attribute cannot be parsed correctly, or is incorrect.
Method Detail

stop

public void stop()
Stop the service instance.

Overrides:
stop in class org.apache.felix.ipojo.util.DependencyModel

isFrozen

public boolean isFrozen()
Overrides:
isFrozen in class org.apache.felix.ipojo.util.DependencyModel

freeze

public void freeze()
Freeze the set of used provider. This method is when the static binding policy is applied.


match

public boolean match(org.osgi.framework.ServiceReference fact)
Does the service instance match with the given factory ?

Overrides:
match in class org.apache.felix.ipojo.util.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 org.apache.felix.ipojo.util.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 org.apache.felix.ipojo.util.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 org.apache.felix.ipojo.util.DependencyModel
Parameters:
ref - : leaving service reference.
See Also:
DependencyModel.onServiceDeparture(org.osgi.framework.ServiceReference)