

Public Member Functions | |
| 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 |
Private Member Functions | |
| Class<?> | primitiveToWrapper (Class<?> inClass) |
Private Attributes | |
| final Logger | m_logger |
| final Object | m_delegate |
| final Map< String, Method > | m_delegateMethodMap |
| final List< TypeMapper > | m_typeMappers |
| final Map< String, TypeMapper > | m_mapperMap |
| alma::acs::component::dynwrapper::ComponentInvocationHandler::ComponentInvocationHandler | ( | java.lang.Object | delegate, | |
| Class | delegateIF, | |||
| Logger | logger | |||
| ) | [inline, 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>
References addTypeMapper(), m_delegate, m_delegateMethodMap, m_logger, m_mapperMap, and m_typeMappers.
| void alma::acs::component::dynwrapper::ComponentInvocationHandler::addTypeMapper | ( | TypeMapper | typeMapper | ) | [inline, package] |
References m_typeMappers.
Referenced by ComponentInvocationHandler().
| boolean alma::acs::component::dynwrapper::ComponentInvocationHandler::canTranslate | ( | Class<?> | oldObjClass, | |
| Class<?> | newObjClass | |||
| ) | [inline, package] |
References m_mapperMap, and m_typeMappers.
Referenced by alma::acs::component::dynwrapper::HolderMapper::canTranslate(), alma::acs::component::dynwrapper::CompositionMapper::canTranslate(), and translate().
| Method alma::acs::component::dynwrapper::ComponentInvocationHandler::findDelegateMethod | ( | Method | method | ) | throws DynWrapperException [inline, 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.
| method | the method from the outside interface |
| DynWrapperException | if no such method can be found. |
References m_delegateMethodMap.
Referenced by invoke().
| Object alma::acs::component::dynwrapper::ComponentInvocationHandler::invoke | ( | Object | proxy, | |
| Method | proxyMethod, | |||
| Object[] | proxyArgs | |||
| ) | throws Throwable [inline] |
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.
| 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. |
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.| 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. |
References findDelegateMethod(), m_delegate, and translate().
| Class<?> alma::acs::component::dynwrapper::ComponentInvocationHandler::primitiveToWrapper | ( | Class<?> | inClass | ) | [inline, private] |
Converts the Class of primitive types to the Class of the corresponding wrappers.
Referenced by translate().
| Object alma::acs::component::dynwrapper::ComponentInvocationHandler::translate | ( | Object | oldObject, | |
| Object | newObjectTemplate, | |||
| Class | newObjectClass | |||
| ) | throws DynWrapperException [inline, package] |
References canTranslate(), m_mapperMap, primitiveToWrapper(), and alma::acs::component::dynwrapper::TypeMapper::translate().
Referenced by invoke().
final Object alma::acs::component::dynwrapper::ComponentInvocationHandler::m_delegate [private] |
Referenced by ComponentInvocationHandler(), and invoke().
final Map<String, Method> alma::acs::component::dynwrapper::ComponentInvocationHandler::m_delegateMethodMap [private] |
Referenced by ComponentInvocationHandler(), and findDelegateMethod().
final Logger alma::acs::component::dynwrapper::ComponentInvocationHandler::m_logger [private] |
Referenced by ComponentInvocationHandler().
final Map<String, TypeMapper> alma::acs::component::dynwrapper::ComponentInvocationHandler::m_mapperMap [private] |
Referenced by canTranslate(), ComponentInvocationHandler(), and translate().
final List<TypeMapper> alma::acs::component::dynwrapper::ComponentInvocationHandler::m_typeMappers [private] |
Referenced by addTypeMapper(), canTranslate(), and ComponentInvocationHandler().
1.6.2