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

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

public class ServiceImporter
extends DependencyModel

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

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
ServiceImporter(Class specification, Filter filter, boolean multiple, boolean optional, Comparator cmp, int policy, BundleContext context, String identitity, ServiceDependencyHandler handler)
          Constructor.
 
Method Summary
 void freeze()
          Freeze the set of used provider.
 String getId()
           
 List getProviders()
          Build the list of imported service provider.
 boolean isFrozen()
           
 boolean isServiceLevelRequirement()
           
 void onDependencyReconfiguration(ServiceReference[] departs, ServiceReference[] arrivals)
          On Dependency Reconfiguration notification method.
 void onServiceArrival(ServiceReference ref)
          A new service is injected by the tracker.
 void onServiceDeparture(ServiceReference ref)
          A used service disappears.
 void onServiceModification(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.
 
Methods inherited from class org.apache.felix.ipojo.util.DependencyModel
addedService, addingService, getBindingPolicy, getComparator, getComparator, getFilter, getPolicy, getService, getServiceReference, getServiceReferences, getSize, getSpecification, getState, getUsedServiceReferences, isAggregate, isOptional, loadSpecification, match, modifiedService, 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

ServiceImporter

public ServiceImporter(Class specification,
                       Filter filter,
                       boolean multiple,
                       boolean optional,
                       Comparator cmp,
                       int policy,
                       BundleContext context,
                       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.


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

Parameters:
b -

getId

public String getId()

isServiceLevelRequirement

public boolean isServiceLevelRequirement()

onDependencyReconfiguration

public void onDependencyReconfiguration(ServiceReference[] departs,
                                        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(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(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(ServiceReference ref)
A used service is modified.

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


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.