org.objectweb.dsrg.sofa.bootstrap
Class FactoryInterceptorController

java.lang.Object
  extended by org.objectweb.dsrg.sofa.bootstrap.FactoryInterceptorController
All Implemented Interfaces:
java.lang.reflect.InvocationHandler, SOFAMicroComponent, SOFAMicroInterceptor

public class FactoryInterceptorController
extends java.lang.Object
implements SOFAMicroInterceptor, java.lang.reflect.InvocationHandler

Class that wraps generated Proxy object with SOFAMicroInterceptor. interface.


Constructor Summary
FactoryInterceptorController()
           
 
Method Summary
 java.lang.Object getDelegatedProvided()
          Takes reference to delegated provided interface implementation.
 java.lang.Object getProvided(java.lang.String name)
          Takes reference to implementation of provided interface with given name.
 void init(ComponentDescription component, java.util.Map<java.lang.String,java.lang.String> parameters)
          Initialises microcomponent.
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          Method implementing the InvocationHandler interface.
 void setDelegatedRequired(java.lang.Object ref)
          Gives the microcomponent reference to interface where to delegate calls.
 void setRequired(java.lang.String name, java.lang.Object ref)
          Gives the microcomponent reference to destination of its required interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FactoryInterceptorController

public FactoryInterceptorController()
Method Detail

init

public void init(ComponentDescription component,
                 java.util.Map<java.lang.String,java.lang.String> parameters)
          throws SOFAException
Description copied from interface: SOFAMicroComponent
Initialises microcomponent. This method is called after all microcomponents are instantiated and bound.

Specified by:
init in interface SOFAMicroComponent
Parameters:
component - Containing component description.
parameters - Parameters from the model extended by parameters from the Sofa2 runtime.
Throws:
SOFAException

getDelegatedProvided

public java.lang.Object getDelegatedProvided()
                                      throws SOFAException
Description copied from interface: SOFAMicroInterceptor
Takes reference to delegated provided interface implementation.

Specified by:
getDelegatedProvided in interface SOFAMicroInterceptor
Returns:
Reference to delegated provided interface implementation.
Throws:
SOFAException

getProvided

public java.lang.Object getProvided(java.lang.String name)
                             throws SOFAException
Description copied from interface: SOFAMicroComponent
Takes reference to implementation of provided interface with given name.

Specified by:
getProvided in interface SOFAMicroComponent
Parameters:
name - Name of the provided interface.
Returns:
Reference to the provided interface implementation.
Throws:
SOFAException

setDelegatedRequired

public void setDelegatedRequired(java.lang.Object ref)
                          throws SOFAException
Description copied from interface: SOFAMicroInterceptor
Gives the microcomponent reference to interface where to delegate calls.

Specified by:
setDelegatedRequired in interface SOFAMicroInterceptor
Parameters:
ref - Interface implementation reference to delegate to.
Throws:
SOFAException

setRequired

public void setRequired(java.lang.String name,
                        java.lang.Object ref)
                 throws SOFAException
Description copied from interface: SOFAMicroComponent
Gives the microcomponent reference to destination of its required interface.

Specified by:
setRequired in interface SOFAMicroComponent
Parameters:
name - Name of the required interface.
ref - Reference to the destination interface implementation.
Throws:
SOFAException

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Method implementing the InvocationHandler interface. Delegates call to factory component and creates new delegation chain for the returned reference to the outside connector. Note: Not all methods on the factory interface create component.

Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Throws:
java.lang.Throwable