|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.ipojo.util.DependencyModel
public abstract class DependencyModel
Abstract dependency model. This class is the parent class of every service dependency. It manages the most part of dependency management. This class creates an insterface between the service tracker and the concrete dependency.
Field Summary | |
---|---|
static int |
BROKEN
Dependency state : BROKEN. |
static int |
DYNAMIC_BINDING_POLICY
Binding policy : Dynamic. |
static int |
DYNAMIC_PRIORITY_BINDING_POLICY
Binding policy : Dynamic-Priority. |
static int |
RESOLVED
Dependency state : RESOLVED. |
static int |
STATIC_BINDING_POLICY
Binding policy : Static. |
static int |
UNRESOLVED
Dependency state : UNRESOLVED. |
Constructor Summary | |
---|---|
DependencyModel(java.lang.Class specification,
boolean aggregate,
boolean optional,
org.osgi.framework.Filter filter,
java.util.Comparator comparator,
int policy,
org.osgi.framework.BundleContext context,
DependencyStateListener listener)
Constructor. |
Method Summary | |
---|---|
void |
addedService(org.osgi.framework.ServiceReference ref)
Service Tracker added service callback. |
boolean |
addingService(org.osgi.framework.ServiceReference ref)
Service tracker adding service callback. |
int |
getBindingPolicy()
Return the used binding policy. |
static java.util.Comparator |
getComparator(org.apache.felix.ipojo.metadata.Element dep,
org.osgi.framework.BundleContext context)
Helper method parsing the comparator attribute and returning the comparator object. |
java.lang.String |
getFilter()
Return the dependency filter (String form). |
static int |
getPolicy(org.apache.felix.ipojo.metadata.Element dep)
Helper method parsing the binding policy. |
java.lang.Object |
getService(org.osgi.framework.ServiceReference ref)
Get a service object for the given reference. |
org.osgi.framework.ServiceReference |
getServiceReference()
Get the next matching service reference. |
org.osgi.framework.ServiceReference[] |
getServiceReferences()
Get matching service references. |
int |
getSize()
Get the number of actual matching references. |
java.lang.Class |
getSpecification()
Get the tracked specification. |
int |
getState()
Get the actual state of the dependency. |
java.util.List |
getUsedServiceReferences()
Get the list of currently used service references. |
boolean |
isAggregate()
|
boolean |
isFrozen()
Is the reference set frozen (cannot change anymore) ? This method must be override by concrete dependency to support the static binding policy. |
boolean |
isOptional()
|
static java.lang.Class |
loadSpecification(java.lang.String specification,
org.osgi.framework.BundleContext context)
Load the given specification class. |
boolean |
match(org.osgi.framework.ServiceReference ref)
Does the service reference match ? This method must be override by concrete dependency if they need to advanced testing on service reference (that cannot be express in the LDAP filter). |
void |
modifiedService(org.osgi.framework.ServiceReference ref,
java.lang.Object arg1)
Service tracker modified service callback. |
abstract void |
onDependencyReconfiguration(org.osgi.framework.ServiceReference[] departs,
org.osgi.framework.ServiceReference[] arrivals)
Concrete dependency callback. |
abstract void |
onServiceArrival(org.osgi.framework.ServiceReference ref)
Concrete dependency callback. |
abstract void |
onServiceDeparture(org.osgi.framework.ServiceReference ref)
Concrete dependency callback. |
void |
onServiceModification(org.osgi.framework.ServiceReference ref)
This method can be override by the concrete dependency to be notified of service modification. |
void |
removedService(org.osgi.framework.ServiceReference ref,
java.lang.Object arg1)
Service tracker removed service callback. |
void |
setAggregate(boolean isAggregate)
Set the aggregate attribute of the current dependency. |
void |
setBindingPolicy()
Set the binding policy. |
void |
setBundleContext(org.osgi.framework.BundleContext context)
Set the bundle context used by this dependency. |
void |
setComparator(java.util.Comparator cmp)
|
void |
setFilter(org.osgi.framework.Filter filter)
Set the filter of the dependency. |
void |
setOptionality(boolean isOptional)
Set the optionality attribute of the current dependency. |
void |
setSpecification(java.lang.Class specification)
Set the required specification of this service dependency. |
void |
start()
Open the tracking. |
void |
stop()
Close the tracking. |
void |
ungetService(org.osgi.framework.ServiceReference ref)
Unget a used service reference. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BROKEN
public static final int UNRESOLVED
public static final int RESOLVED
public static final int DYNAMIC_BINDING_POLICY
public static final int STATIC_BINDING_POLICY
public static final int DYNAMIC_PRIORITY_BINDING_POLICY
Constructor Detail |
---|
public DependencyModel(java.lang.Class specification, boolean aggregate, boolean optional, org.osgi.framework.Filter filter, java.util.Comparator comparator, int policy, org.osgi.framework.BundleContext context, DependencyStateListener listener)
specification
- : required specificationaggregate
- : is the dependency aggregate ?optional
- : is the dependency optional ?filter
- : LDAP filtercomparator
- : comparator object to sort referencespolicy
- : binding policycontext
- : bundle context (or service context)listener
- : dependency lifecycle listener to notify from dependency state changes.Method Detail |
---|
public void start()
public void stop()
public boolean isFrozen()
public boolean match(org.osgi.framework.ServiceReference ref)
ref
- : tested reference.
public boolean addingService(org.osgi.framework.ServiceReference ref)
addingService
in interface TrackerCustomizer
ref
- : the new dependency.
TrackerCustomizer.addingService(org.osgi.framework.ServiceReference)
public void addedService(org.osgi.framework.ServiceReference ref)
addedService
in interface TrackerCustomizer
ref
- : new references.TrackerCustomizer.addedService(org.osgi.framework.ServiceReference)
public void removedService(org.osgi.framework.ServiceReference ref, java.lang.Object arg1)
removedService
in interface TrackerCustomizer
ref
- : leaving service referencearg1
- : service object if the service was getTrackerCustomizer.removedService(org.osgi.framework.ServiceReference, java.lang.Object)
public void modifiedService(org.osgi.framework.ServiceReference ref, java.lang.Object arg1)
modifiedService
in interface TrackerCustomizer
ref
- : modified referencearg1
- : service object if already get.TrackerCustomizer.modifiedService(org.osgi.framework.ServiceReference, java.lang.Object)
public org.osgi.framework.ServiceReference getServiceReference()
public org.osgi.framework.ServiceReference[] getServiceReferences()
public java.util.List getUsedServiceReferences()
public int getSize()
public abstract void onServiceArrival(org.osgi.framework.ServiceReference ref)
ref
- : service reference to inject.public abstract void onServiceDeparture(org.osgi.framework.ServiceReference ref)
ref
- : the leaving service reference.public void onServiceModification(org.osgi.framework.ServiceReference ref)
ref
- : modified service reference.public abstract void onDependencyReconfiguration(org.osgi.framework.ServiceReference[] departs, org.osgi.framework.ServiceReference[] arrivals)
departs
- : service leaving the matching set.arrivals
- : service arriving in the matching set.public int getState()
public java.lang.Class getSpecification()
public void setSpecification(java.lang.Class specification)
specification
- : required specification.public void setFilter(org.osgi.framework.Filter filter)
filter
- : new LDAP filter.public java.lang.String getFilter()
public void setAggregate(boolean isAggregate)
isAggregate
- : new aggregate attribute value.public boolean isAggregate()
public void setOptionality(boolean isOptional)
isOptional
- : the new optional attribute value.public boolean isOptional()
public int getBindingPolicy()
public void setBindingPolicy()
public void setComparator(java.util.Comparator cmp)
public void setBundleContext(org.osgi.framework.BundleContext context)
context
- : bundle context or service context to usepublic java.lang.Object getService(org.osgi.framework.ServiceReference ref)
ref
- : wanted service reference
public void ungetService(org.osgi.framework.ServiceReference ref)
ref
- : reference to unget.public static java.util.Comparator getComparator(org.apache.felix.ipojo.metadata.Element dep, org.osgi.framework.BundleContext context) throws ConfigurationException
dep
- : Element describing the dependencycontext
- : bundle context (to load the comparator class)
ConfigurationException
- the comparator class cannot be load or the comparator cannot be instantiated correctly.public static java.lang.Class loadSpecification(java.lang.String specification, org.osgi.framework.BundleContext context) throws ConfigurationException
specification
- : specification class name to loadcontext
- : bundle context
ConfigurationException
- : the class cannot be loaded correctly.public static int getPolicy(org.apache.felix.ipojo.metadata.Element dep) throws ConfigurationException
dep
- : Element describing the dependency
ConfigurationException
- : an unknown biding policy was described.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |