public class Dependency extends DependencyModel implements FieldInterceptor, MethodInterceptor, ConstructorInjector
DependencyModel.DependencyEventType, DependencyModel.ServiceBindingHolderBROKEN, DYNAMIC_BINDING_POLICY, DYNAMIC_PRIORITY_BINDING_POLICY, m_serviceReferenceManager, RESOLVED, STATIC_BINDING_POLICY, UNRESOLVED| Constructor and Description |
|---|
Dependency(DependencyHandler handler,
java.lang.String field,
java.lang.Class spec,
org.osgi.framework.Filter filter,
boolean isOptional,
boolean isAggregate,
boolean nullable,
boolean isProxy,
java.lang.String identity,
org.osgi.framework.BundleContext context,
int policy,
java.util.Comparator cmp,
java.lang.String defaultImplementation,
java.lang.String exception)
Dependency constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addConstructorInjection(int index) |
protected void |
addDependencyCallback(DependencyCallback callback)
Add a callback to the dependency.
|
AggregateDependencyInjectionType |
getAggregateType() |
protected DependencyCallback[] |
getCallbacks() |
java.lang.Object |
getConstructorParameter(int index)
Gets the object to inject in the constructor parameter.
|
int |
getConstructorParameterIndex()
Gets the constructor parameter.
|
java.lang.Class |
getConstructorParameterType(int index)
Gets the type of the constructor parameter.
|
java.lang.String |
getDefaultImplementation() |
DependencyCallback[] |
getDependencyCallbacks()
Gets the list of callbacks attached to the current dependency.
|
java.lang.String |
getException() |
java.lang.String |
getField() |
DependencyHandler |
getHandler() |
java.lang.String |
getId()
Gets the dependency id.
|
java.lang.Object |
getService()
Called by the proxy to get service objects to delegate a method.
|
java.util.List<org.osgi.framework.ServiceReference> |
getServiceReferencesAsList()
Get the used service references list.
|
int |
getTimeout() |
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 |
isProxy() |
boolean |
isServiceLevelRequirement() |
void |
onDependencyReconfiguration(org.osgi.framework.ServiceReference[] departs,
org.osgi.framework.ServiceReference[] arrivals)
The dependency has been reconfigured.
|
void |
onEntry(java.lang.Object pojo,
java.lang.reflect.Member method,
java.lang.Object[] args)
A POJO method will be invoked.
|
void |
onError(java.lang.Object pojo,
java.lang.reflect.Member method,
java.lang.Throwable throwable)
A POJO method has thrown an error.
|
void |
onExit(java.lang.Object pojo,
java.lang.reflect.Member method,
java.lang.Object returnedObj)
A POJO method has returned.
|
void |
onFinally(java.lang.Object pojo,
java.lang.reflect.Member method)
A POJO method is finished.
|
java.lang.Object |
onGet(java.lang.Object pojo,
java.lang.String fieldName,
java.lang.Object value)
This method is called by the replaced code in the component
implementation class.
|
protected void |
onObjectCreation(java.lang.Object pojo)
Call the bind method.
|
void |
onServiceArrival(org.osgi.framework.ServiceReference reference)
A new service has to be injected.
|
void |
onServiceDeparture(org.osgi.framework.ServiceReference ref)
A used (already injected) service disappears.
|
void |
onServiceModification(org.osgi.framework.ServiceReference reference)
An already injected service is modified.
|
void |
onSet(java.lang.Object pojo,
java.lang.String fieldName,
java.lang.Object value)
The field was set.
|
void |
resetLocalCache()
Reset the thread local cache if used.
|
protected void |
setAggregateType(AggregateDependencyInjectionType type)
Set the type to inject.
|
void |
setProxy(boolean proxy) |
void |
setServiceLevelDependency()
Set that this dependency is a service level dependency.
|
void |
setSpecification(java.lang.Class spec)
Set the specification of the current dependency.
|
void |
setTimeout(int timeout)
Sets the dependency timeout.
|
void |
start()
Start the dependency.
|
void |
stop()
Stop the current dependency.
|
boolean |
supportsNullable()
Gets true if the dependency use Nullable objects.
|
void |
unfreeze()
Unfreeze the dependency.
|
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, ungetServicepublic Dependency(DependencyHandler handler, java.lang.String field, java.lang.Class spec, org.osgi.framework.Filter filter, boolean isOptional, boolean isAggregate, boolean nullable, boolean isProxy, java.lang.String identity, org.osgi.framework.BundleContext context, int policy, java.util.Comparator cmp, java.lang.String defaultImplementation, java.lang.String exception)
handler - : the dependency handler managing this dependencyfield - : field of the dependencyspec - : required specificationfilter - : LDAP filter of the dependencyisOptional - : is the dependency an optional dependency ?isAggregate - : is the dependency an aggregate dependencynullable - : describe if the nullable ability is enable or disableisProxy - : is the proxied dependencyidentity - : id of the dependency, may be nullcontext - : bundle context (or service context) to use.policy - : resolution policycmp - : comparator to sort referencesdefaultImplementation - : default-implementation classpublic void setSpecification(java.lang.Class spec)
setSpecification in class DependencyModelspec - : request service ClassDependencyModel.setSpecification(java.lang.Class)public java.lang.String getField()
protected void addDependencyCallback(DependencyCallback callback)
callback - : callback to addprotected void addConstructorInjection(int index)
throws ConfigurationException
ConfigurationExceptionpublic void stop()
stop in class DependencyModelDependencyModel.stop()public DependencyHandler getHandler()
public boolean isFrozen()
DependencyModelfalse by default.
The method must always return false for non-static dependencies.isFrozen in class DependencyModeltrue if the reference set is frozen.public void unfreeze()
unfreeze in class DependencyModelDependencyModel.unfreeze()protected void onObjectCreation(java.lang.Object pojo)
pojo - : pojo instance on which calling the bind method.public void start()
start in class DependencyModelDependencyModel.computeAndSetDependencyState()protected DependencyCallback[] getCallbacks()
public void setServiceLevelDependency()
public java.lang.String getId()
DependencyModelgetId in class DependencyModelpublic boolean isServiceLevelRequirement()
public void onServiceArrival(org.osgi.framework.ServiceReference reference)
onServiceArrival in class DependencyModelreference - : the new matching service reference.DependencyModel.onServiceArrival(org.osgi.framework.ServiceReference)public void onServiceModification(org.osgi.framework.ServiceReference reference)
onServiceModification in class DependencyModelreference - : the modified service reference.DependencyModel.onServiceModification(org.osgi.framework.ServiceReference)public void onServiceDeparture(org.osgi.framework.ServiceReference ref)
onServiceDeparture in class DependencyModelref - : leaving service reference.DependencyModel.onServiceDeparture(org.osgi.framework.ServiceReference)public void onDependencyReconfiguration(org.osgi.framework.ServiceReference[] departs,
org.osgi.framework.ServiceReference[] arrivals)
onDependencyReconfiguration in class DependencyModeldeparts - : no more matching services.arrivals - : new servicesDependencyModel.onDependencyReconfiguration(org.osgi.framework.ServiceReference[], org.osgi.framework.ServiceReference[])public void resetLocalCache()
public java.util.List<org.osgi.framework.ServiceReference> getServiceReferencesAsList()
public DependencyCallback[] getDependencyCallbacks()
null if no callbacks are attached to the current dependency.public java.lang.Object getService()
public java.lang.Object onGet(java.lang.Object pojo,
java.lang.String fieldName,
java.lang.Object value)
onGet in interface FieldInterceptorpojo - : POJO object.fieldName - : fieldvalue - : last value.FieldInterceptor.onGet(java.lang.Object, java.lang.String, java.lang.Object)public void onSet(java.lang.Object pojo,
java.lang.String fieldName,
java.lang.Object value)
onSet in interface FieldInterceptorpojo - : POJO objectfieldName - : field namevalue - : set value.FieldInterceptor.onSet(java.lang.Object, java.lang.String, java.lang.Object)public void onEntry(java.lang.Object pojo,
java.lang.reflect.Member method,
java.lang.Object[] args)
onEntry in interface MethodInterceptorpojo - : Pojo objectmethod - : called methodargs - : argumentsMethodInterceptor.onEntry(java.lang.Object, java.lang.reflect.Member, java.lang.Object[])public void onError(java.lang.Object pojo,
java.lang.reflect.Member method,
java.lang.Throwable throwable)
onError in interface MethodInterceptorpojo - : POJO object.method - : Method object.throwable - : thrown errorMethodInterceptor.onError(java.lang.Object, java.lang.reflect.Member, java.lang.Throwable)public void onExit(java.lang.Object pojo,
java.lang.reflect.Member method,
java.lang.Object returnedObj)
onExit in interface MethodInterceptorpojo - : POJO object.method - : Method object.returnedObj - : returned object (null for void method)MethodInterceptor.onExit(java.lang.Object, java.lang.reflect.Member, java.lang.Object)public void onFinally(java.lang.Object pojo,
java.lang.reflect.Member method)
onFinally in interface MethodInterceptorpojo - : POJO object.method - : Method object.MethodInterceptor.onFinally(java.lang.Object, java.lang.reflect.Member)public boolean supportsNullable()
public java.lang.String getDefaultImplementation()
public boolean isProxy()
public void setProxy(boolean proxy)
protected void setAggregateType(AggregateDependencyInjectionType type)
type - the type to inject.public void setTimeout(int timeout)
timeout - the timeout in ms.public int getConstructorParameterIndex()
-1 if not set.public java.lang.Object getConstructorParameter(int index)
getConstructorParameter in interface ConstructorInjectorindex - the index of the parameterConstructorInjector.getConstructorParameter(int)public java.lang.Class getConstructorParameterType(int index)
getConstructorParameterType in interface ConstructorInjectorindex - the parameter indexList or Set.ConstructorInjector.getConstructorParameterType(int)public java.lang.String getException()
public int getTimeout()
public AggregateDependencyInjectionType getAggregateType()
Copyright © 2006-2014 The Apache Software Foundation. All Rights Reserved.