|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rioproject.associations.AssociationInjector<T>
public class AssociationInjector<T>
The AssociationInjector is an AssociationListener implementation that provides support for setter-based dependency injection by calling setters on a target object method when it receives association events. For example, we have a bean called Foo and it requires JavaSpace. In order to have the JavaSpace proxy set, a setter method is required :
public class Foo {
JavaSpace myJavaSpace;
...
public void setMyJavaSpace(JavaSpace space) {
myJavaSpace = space;
}
...
}
Finally, in the OperationalString, you'll need to create an Association with a
Property attribute which matches the setter.
associations {
association type:"uses", name="JavaSpace", property="myJavaSpace"
}
| Constructor Summary | |
|---|---|
AssociationInjector(Object target)
Create an AssociationInjector |
|
| Method Summary | |
|---|---|
void |
broken(Association<T> association,
T service)
Notify the AssociationListener that an Association is broken. |
void |
changed(Association<T> association,
T service)
Notify the AssociationListener that a service endpoint has changed |
void |
discovered(Association<T> association,
T service)
Notify the AssociationListener that an Association has been discovered |
Map<AssociationDescriptor,Long> |
getInvocationMap()
For each generated association proxy, get the corresponding AssociationDescriptor and how many successful invocations were made to all services in the association. |
void |
injectEmpty(Association<T> association)
|
void |
setBackend(Object target)
Set the object that will have dependencies injected |
void |
setCallerClassLoader(ClassLoader callerCL)
Set The ClassLoader which will be used to load proxies |
void |
terminate()
If any AssociationProxy instances were created, make sure they are terminated |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AssociationInjector(Object target)
target - The object that will have dependencies injected| Method Detail |
|---|
public void setBackend(Object target)
target - The object that will have dependencies injectedpublic void setCallerClassLoader(ClassLoader callerCL)
callerCL - The classloader for the targetpublic void terminate()
public Map<AssociationDescriptor,Long> getInvocationMap()
public void injectEmpty(Association<T> association)
public void discovered(Association<T> association,
T service)
AssociationListener
discovered in interface AssociationListener<T>association - The Associationservice - The associated service that has been discoveredAssociationListener.discovered(Association, Object)
public void changed(Association<T> association,
T service)
AssociationListener
changed in interface AssociationListener<T>association - The Associationservice - The service that was removed, changing the endpoint
public void broken(Association<T> association,
T service)
AssociationListener
broken in interface AssociationListener<T>association - The Association.service - The service that was removed, causing the Association to
be broken
|
Copyright © Rio Project. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||