Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jini.rio.associations
Class AssociationInjector<T>

    java.lang.Object
      org.jini.rio.associations.AssociationInjector<T>

All Implemented Interfaces:
  AssociationListener<T>

    public class AssociationInjector<T>

extends Object
implements AssociationListener<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"/>
     </Associations>

Constructor Summary
`AssociationInjector(T 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 succesful invocations were made to all services in the association.
`void` | `injectEmpty(Association<T> association)`
`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

### AssociationInjector

    public AssociationInjector(T target)
                        throws IntrospectionException

  Create an AssociationInjector

  Parameters:
    `target` - The object which will have dependencies injected
  Throws:
    `IntrospectionException` - If there are erros introspecting on the bean

Method Detail

### setCallerClassLoader

    public void setCallerClassLoader(ClassLoader callerCL)

  Set The ClassLoader which will be used to load proxies

  Parameters:
    `callerCL` - The classloader for the target

### terminate

    public void terminate()

  If any AssociationProxy instances were created, make sure they are terminated

### getInvocationMap

    public Map<AssociationDescriptor,Long> getInvocationMap()

  For each generated association proxy, get the corresponding AssociationDescriptor and how many succesful invocations were made to all services in the association.

  Returns:
    A Map whose keys are AssociationDescriptor, and values are the number of succesful invocations made to all services in the association. If there are no generated association proxy instances, a Map with no entries is returned. A new Map is created each time this method is called.

### injectEmpty

    public void injectEmpty(Association<T> association)

### discovered

    public void discovered(Association<T> association,
                           T service)

  Description copied from interface: `AssociationListener`
  Notify the AssociationListener that an Association has been discovered

  Specified by:
    `discovered` in interface `AssociationListener<T>`
  Parameters:
    `association` - The Association
    `service` - The associated service that has been discovered
  See Also:
    `AssociationListener.discovered(Association, Object)`

### changed

    public void changed(Association<T> association,
                        T service)

  Description copied from interface: `AssociationListener`
  Notify the AssociationListener that a service endpoint has changed

  Specified by:
    `changed` in interface `AssociationListener<T>`
  Parameters:
    `association` - The Association
    `service` - The service that was removed, changing the endpoint

### broken

    public void broken(Association<T> association,
                       T service)

  Description copied from interface: `AssociationListener`
  Notify the AssociationListener that an Association is broken. If the Association type is requires, the AssociationManagement object will unadvertise the ServiceBean using the ServiceBean instances ServiceBeanControl interface unless the unadvertiseOnBroken is set to false

  Specified by:
    `broken` in interface `AssociationListener<T>`
  Parameters:
    `association` - The Association.
    `service` - The service that was removed, causing the Association to be broken

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © Project Rio.