public class Dependency extends DependencyModel implements org.apache.felix.ipojo.FieldInterceptor, org.apache.felix.ipojo.MethodInterceptor, org.apache.felix.ipojo.ConstructorInjector
BROKEN, DYNAMIC_BINDING_POLICY, DYNAMIC_PRIORITY_BINDING_POLICY, logger, RESOLVED, STATIC_BINDING_POLICY, UNRESOLVED
Constructor and Description |
---|
Dependency(DependencyHandler handler,
String field,
Class spec,
org.osgi.framework.Filter filter,
boolean isOptional,
boolean isAggregate,
boolean nullable,
boolean isProxy,
String identity,
org.osgi.framework.BundleContext context,
int policy,
Comparator cmp,
String defaultImplem)
Dependency constructor.
|
Dependency(DependencyHandler handler,
String field,
Class spec,
org.osgi.framework.Filter filter,
boolean isOptional,
boolean isAggregate,
boolean nullable,
boolean isProxy,
String identity,
org.osgi.framework.BundleContext context,
int policy,
Comparator cmp,
String defaultImplem,
int maxCardinality,
boolean immediate)
Dependency constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addConstructorInjection(int index) |
protected void |
addDependencyCallback(DependencyCallback callback)
Add a callback to the dependency.
|
protected DependencyCallback[] |
getCallbacks() |
Object |
getConstructorParameter(int index)
Gets the object to inject in the constructor parameter.
|
int |
getConstructorParameterIndex()
Gets the constructor parameter.
|
Class |
getConstructorParameterType(int index)
Gets the type of the constructor parameter.
|
String |
getDefaultImplementation() |
String |
getField() |
DependencyHandler |
getHandler() |
String |
getId() |
int |
getMaxServiceInjected() |
Object |
getService()
Called by the proxy to get service objects to delegate a method.
|
List |
getServiceReferencesAsList()
Get the used service references list.
|
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 |
isImmediate() |
boolean |
isProxy() |
boolean |
isServiceLevelRequirement() |
boolean |
isServicesInWaitToInject() |
void |
onDependencyReconfiguration(org.osgi.framework.ServiceReference[] departs,
org.osgi.framework.ServiceReference[] arrivals)
The dependency has been reconfigured.
|
void |
onEntry(Object arg0,
Member arg1,
Object[] arg2) |
void |
onEntry(Object pojo,
Method method,
Object[] args) |
void |
onError(Object arg0,
Member arg1,
Throwable arg2) |
void |
onError(Object pojo,
Method method,
Throwable throwable) |
void |
onExit(Object arg0,
Member arg1,
Object arg2) |
void |
onExit(Object pojo,
Method method,
Object returnedObj) |
void |
onFinally(Object pojo,
Member method)
A POJO method is finished.
|
void |
onFinally(Object pojo,
Method method) |
Object |
onGet(Object pojo,
String fieldName,
Object value)
This method is called by the replaced code in the component
implementation class.
|
protected void |
onObjectCreation(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(Object pojo,
String fieldName,
Object value)
The field was set.
|
void |
reconfigure(Dictionary dict) |
void |
resetLocalCache()
Reset the thread local cache if used.
|
void |
setProxy(boolean proxy) |
void |
setServiceLevelDependency()
Set that this dependency is a service level dependency.
|
void |
setSpecification(Class spec)
Set the specification of the current dependency.
|
protected void |
setType(int type)
Set the type to inject.
|
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.
|
addedService, addingService, getBindingPolicy, getComparator, getComparator, getFilter, getPolicy, getPolicy, getService, getServiceReference, getServiceReferences, getSize, getSpecification, getState, getUsedServiceReferences, isAggregate, isOptional, loadSpecification, manageModification, match, modifiedService, removedService, setAggregate, setBindingPolicy, setBundleContext, setComparator, setFilter, setOptionality, ungetService
public Dependency(DependencyHandler handler, String field, Class spec, org.osgi.framework.Filter filter, boolean isOptional, boolean isAggregate, boolean nullable, boolean isProxy, String identity, org.osgi.framework.BundleContext context, int policy, Comparator cmp, String defaultImplem)
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 referencesdefaultImplem
- : default-implementation classpublic Dependency(DependencyHandler handler, String field, Class spec, org.osgi.framework.Filter filter, boolean isOptional, boolean isAggregate, boolean nullable, boolean isProxy, String identity, org.osgi.framework.BundleContext context, int policy, Comparator cmp, String defaultImplem, int maxCardinality, boolean immediate)
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 referencesdefaultImplem
- : default-implementation classpublic void setSpecification(Class spec)
setSpecification
in class DependencyModel
spec
- : request service ClassDependencyModel.setSpecification(java.lang.Class)
public String getField()
protected void addDependencyCallback(DependencyCallback callback)
callback
- : callback to addprotected void addConstructorInjection(int index) throws org.apache.felix.ipojo.ConfigurationException
org.apache.felix.ipojo.ConfigurationException
public void stop()
stop
in class DependencyModel
DependencyModel.stop()
public DependencyHandler getHandler()
public boolean isFrozen()
DependencyModel
false
by
default. The method must always return false
for non-static
dependencies.isFrozen
in class DependencyModel
true
if the reference set is frozen.public boolean isImmediate()
isImmediate
in class DependencyModel
public boolean isServicesInWaitToInject()
isServicesInWaitToInject
in class DependencyModel
public int getMaxServiceInjected()
getMaxServiceInjected
in class DependencyModel
public void unfreeze()
unfreeze
in class DependencyModel
DependencyModel.unfreeze()
protected void onObjectCreation(Object pojo)
pojo
- : pojo instance on which calling the bind method.public void start()
start
in class DependencyModel
DependencyModel.computeDependencyState()
protected DependencyCallback[] getCallbacks()
public void setServiceLevelDependency()
public String getId()
public void onServiceArrival(org.osgi.framework.ServiceReference reference)
onServiceArrival
in class DependencyModel
reference
- : the new matching service reference.DependencyModel.onServiceArrival(org.osgi.framework.ServiceReference)
public void onServiceModification(org.osgi.framework.ServiceReference reference)
onServiceModification
in class DependencyModel
reference
- : the modified service reference.DependencyModel.onServiceModification(org.osgi.framework.ServiceReference)
public boolean isServiceLevelRequirement()
public void onServiceDeparture(org.osgi.framework.ServiceReference ref)
onServiceDeparture
in class DependencyModel
ref
- : 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 DependencyModel
departs
- : no more matching services.arrivals
- : new servicesDependencyModel.onDependencyReconfiguration(org.osgi.framework.ServiceReference[],
org.osgi.framework.ServiceReference[])
public void resetLocalCache()
public List getServiceReferencesAsList()
public Object getService()
public Object onGet(Object pojo, String fieldName, Object value)
onGet
in interface org.apache.felix.ipojo.FieldInterceptor
pojo
- : POJO object.fieldName
- : fieldvalue
- : last value.FieldInterceptor.onGet(java.lang.Object,
java.lang.String, java.lang.Object)
public void onSet(Object pojo, String fieldName, Object value)
onSet
in interface org.apache.felix.ipojo.FieldInterceptor
pojo
- : POJO objectfieldName
- : field namevalue
- : set value.FieldInterceptor.onSet(java.lang.Object,
java.lang.String, java.lang.Object)
public void onFinally(Object pojo, Member method)
onFinally
in interface org.apache.felix.ipojo.MethodInterceptor
pojo
- : POJO object.method
- : Method object.org.apache.felix.ipojo.MethodInterceptor#onFinally(java.lang.Object,
java.lang.reflect.Method)
public boolean supportsNullable()
public String getDefaultImplementation()
public boolean isProxy()
public void setProxy(boolean proxy)
protected void setType(int type)
type
- either list of vectorpublic int getConstructorParameterIndex()
-1
if not
set.public Object getConstructorParameter(int index)
getConstructorParameter
in interface org.apache.felix.ipojo.ConstructorInjector
index
- the index of the parameterConstructorInjector.getConstructorParameter(int)
public Class getConstructorParameterType(int index)
getConstructorParameterType
in interface org.apache.felix.ipojo.ConstructorInjector
index
- the parameter indexList
or Set
.ConstructorInjector.getConstructorParameterType(int)
public void reconfigure(Dictionary dict)
public void onEntry(Object arg0, Member arg1, Object[] arg2)
onEntry
in interface org.apache.felix.ipojo.MethodInterceptor
public void onError(Object arg0, Member arg1, Throwable arg2)
onError
in interface org.apache.felix.ipojo.MethodInterceptor
Copyright © 2012-2013 Adele Team | LIG. All Rights Reserved.