Public Member Functions | Package Functions

alma.acs.component.dynwrapper.ComponentInvocationHandler Class Reference

Inherits java::lang::reflect::InvocationHandler.

List of all members.

Public Member Functions

void addOffshoot (Object offshootImpl, OffShoot shoot)
Object invoke (Object proxy, Method proxyMethod, Object[] proxyArgs) throws Throwable

Package Functions

 ComponentInvocationHandler (java.lang.Object delegate, Class delegateIF, Logger logger)
void addTypeMapper (TypeMapper typeMapper)
Method findDelegateMethod (Method method) throws DynWrapperException
boolean canTranslate (Class<?> oldObjClass, Class<?> newObjClass)
Object translate (Object oldObject, Object newObjectTemplate, Class newObjectClass) throws DynWrapperException

Detailed Description

Author:
heiko

Constructor & Destructor Documentation

alma.acs.component.dynwrapper.ComponentInvocationHandler.ComponentInvocationHandler ( java.lang.Object  delegate,
Class  delegateIF,
Logger  logger 
) [package]

Constructor for ComponentInvocationHandler.

<FONT size="-1">Explanation of why delegateIF must be passed in addition to delegate: the method findDelegateMethod has to resolve the corresponding method from the delegation object. In the server-side case, the delegation object is the component implementation, and the passed method belongs to the corba operations interface of that component. CORBA interfaces are not allowed to use two methods with the same name but different parameters, and the "internal" functional interface of the component is foreseen to be derived such that method names don't change.

One might thus believe that there would be a unique correspondence between method names from the corba operations interface and from the functional interface of the component implementation; this is not necessarily the case though, because the component implementation might inherit arbitrary methods for which the Corba IDL naming restrictions don't apply. Suppose the Corba operations IF contains a method SchedBlock getSchedBlock(). Thanks to IDL conventions, there can not be any other name-overloaded method like SchedBlock getSchedBlock(String name). However, the component implementation could contain this method, either directly or through inheritance, outside of the functional interface. This would cause an ambiguity when trying to dispatch to the correct method. To avoid this conflict, delegateIF is passed as well, so that the ComponentInvocationHandler knows which subset of methods found in delegate can be considered for method dispatching. </FONT>


Member Function Documentation

void alma.acs.component.dynwrapper.ComponentInvocationHandler.addOffshoot ( Object  offshootImpl,
OffShoot  shoot 
)
void alma.acs.component.dynwrapper.ComponentInvocationHandler.addTypeMapper ( TypeMapper  typeMapper  )  [package]
boolean alma.acs.component.dynwrapper.ComponentInvocationHandler.canTranslate ( Class<?>  oldObjClass,
Class<?>  newObjClass 
) [package]
Method alma.acs.component.dynwrapper.ComponentInvocationHandler.findDelegateMethod ( Method  method  )  throws DynWrapperException [package]

Finds the Method in the functional interface of the delegate object that maps to the given argument method.

Note that the restriction to methods from the functional interface (passed to the ctor) reduces the task to finding a method with the same name, because the interfaces considered here are derived from CORBA IDL definitions and therefore cannot have method names overloaded.

Parameters:
method the method from the outside interface
Returns:
the corresponding delegate method.
Exceptions:
DynWrapperException if no such method can be found.
Object alma.acs.component.dynwrapper.ComponentInvocationHandler.invoke ( Object  proxy,
Method  proxyMethod,
Object[]  proxyArgs 
) throws Throwable

Processes a method invocation on a proxy instance and returns the result. This method will be invoked on an invocation handler when a method is invoked on a proxy instance that it is associated with.

Parameters:
proxy the proxy instance that the method was invoked on
method the Method instance corresponding to the interface method invoked on the proxy instance. The declaring class of the Method object will be the interface that the method was declared in, which may be a superinterface of the proxy interface that the proxy class inherits the method through.
args an array of objects containing the values of the arguments passed in the method invocation on the proxy instance, or null if interface method takes no arguments. Arguments of primitive types are wrapped in instances of the appropriate primitive wrapper class, such as java.lang.Integer or java.lang.Boolean.
Returns:
the value to return from the method invocation on the proxy instance. If the declared return type of the interface method is a primitive type, then the value returned by this method must be an instance of the corresponding primitive wrapper class; otherwise, it must be a type assignable to the declared return type. If the value returned by this method is null and the interface method's return type is primitive, then a NullPointerException will be thrown by the method invocation on the proxy instance. If the value returned by this method is otherwise not compatible with the interface method's declared return type as described above, a ClassCastException will be thrown by the method invocation on the proxy instance.
Exceptions:
Throwable the exception to throw from the method invocation on the proxy instance. The exception's type must be assignable either to any of the exception types declared in the throws clause of the interface method or to the unchecked exception types java.lang.RuntimeException or java.lang.Error. If a checked exception is thrown by this method that is not assignable to any of the exception types declared in the throws clause of the interface method, then an UndeclaredThrowableException containing the exception that was thrown by this method will be thrown by the method invocation on the proxy instance.
See also:
UndeclaredThrowableException
java.lang.reflect.InvocationHandler.invoke(Object, Method, Object[])
Object alma.acs.component.dynwrapper.ComponentInvocationHandler.translate ( Object  oldObject,
Object  newObjectTemplate,
Class  newObjectClass 
) throws DynWrapperException [package]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties