|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.ipojo.util.DependencyModel
org.apache.felix.ipojo.handlers.dependency.Dependency
public class Dependency
Represent a service dependency of the component instance.
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 | |
---|---|
Dependency(DependencyHandler handler,
String field,
Class spec,
Filter filter,
boolean isOptional,
boolean isAggregate,
boolean nullable,
boolean isProxy,
String identity,
BundleContext context,
int policy,
Comparator cmp,
String defaultImplem)
Dependency constructor. |
Method Summary | |
---|---|
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()
|
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 |
isProxy()
|
boolean |
isServiceLevelRequirement()
|
void |
onDependencyReconfiguration(ServiceReference[] departs,
ServiceReference[] arrivals)
The dependency has been reconfigured. |
void |
onEntry(Object pojo,
Method method,
Object[] args)
A POJO method will be invoked. |
void |
onError(Object pojo,
Method method,
Throwable throwable)
A POJO method has thrown an error. |
void |
onExit(Object pojo,
Method method,
Object returnedObj)
A POJO method has returned. |
void |
onFinally(Object pojo,
Method method)
A POJO method is finished. |
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(ServiceReference reference)
A new service has to be injected. |
void |
onServiceDeparture(ServiceReference ref)
A used (already injected) service disappears. |
void |
onServiceModification(ServiceReference reference)
An already injected service is modified. |
void |
onSet(Object pojo,
String fieldName,
Object value)
The field was set. |
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. |
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, manageModification, match, modifiedService, removedService, setAggregate, setBindingPolicy, setBundleContext, setComparator, setFilter, setOptionality, ungetService |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Dependency(DependencyHandler handler, String field, Class spec, Filter filter, boolean isOptional, boolean isAggregate, boolean nullable, boolean isProxy, String identity, 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 classMethod Detail |
---|
public 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 ConfigurationException
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 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 boolean isServiceLevelRequirement()
public void onServiceArrival(ServiceReference reference)
onServiceArrival
in class DependencyModel
reference
- : the new matching service reference.DependencyModel.onServiceArrival(org.osgi.framework.ServiceReference)
public void onServiceModification(ServiceReference reference)
onServiceModification
in class DependencyModel
reference
- : the modified service reference.DependencyModel.onServiceModification(org.osgi.framework.ServiceReference)
public void onServiceDeparture(ServiceReference ref)
onServiceDeparture
in class DependencyModel
ref
- : leaving service reference.DependencyModel.onServiceDeparture(org.osgi.framework.ServiceReference)
public void onDependencyReconfiguration(ServiceReference[] departs, 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 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 FieldInterceptor
pojo
- : POJO objectfieldName
- : field namevalue
- : set value.FieldInterceptor.onSet(java.lang.Object, java.lang.String, java.lang.Object)
public void onEntry(Object pojo, Method method, Object[] args)
onEntry
in interface MethodInterceptor
pojo
- : Pojo objectmethod
- : called methodargs
- : argumentsMethodInterceptor.onEntry(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
public void onError(Object pojo, Method method, Throwable throwable)
onError
in interface MethodInterceptor
pojo
- : POJO object.method
- : Method object.throwable
- : thrown errorMethodInterceptor.onError(java.lang.Object, java.lang.reflect.Method, java.lang.Throwable)
public void onExit(Object pojo, Method method, Object returnedObj)
onExit
in interface MethodInterceptor
pojo
- : POJO object.method
- : Method object.returnedObj
- : returned object (null for void method)MethodInterceptor.onExit(java.lang.Object, java.lang.reflect.Method, java.lang.Object)
public void onFinally(Object pojo, Method method)
onFinally
in interface MethodInterceptor
pojo
- : POJO object.method
- : Method object.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 ConstructorInjector
index
- the index of the parameter
ConstructorInjector.getConstructorParameter(int)
public Class getConstructorParameterType(int index)
getConstructorParameterType
in interface ConstructorInjector
index
- the parameter index
List
or Set
.ConstructorInjector.getConstructorParameterType(int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |