org.rhq.bindings.client
Class AbstractRhqFacadeProxy<T extends RhqFacade>

java.lang.Object
  extended by org.rhq.bindings.client.AbstractRhqFacadeProxy<T>
All Implemented Interfaces:
InvocationHandler

public abstract class AbstractRhqFacadeProxy<T extends RhqFacade>
extends Object
implements InvocationHandler

An abstract InvocationHandler to help the script users create proxies to actually call the correct methods on RHQ. This base implementation provides its inheritors with the facade impl and the concrete manager they should invoke the methods on and does the "de-simplification" of the arguments (i.e. the opposite of InterfaceSimplifier.simplify(Class).

Author:
Lukas Krejci

Constructor Summary
protected AbstractRhqFacadeProxy(T facade, RhqManagers manager)
           
 
Method Summary
protected abstract  Object doInvoke(Object proxy, Method originalMethod, Class<?>[] argTypes, Object[] args)
          This method actually calls the method according to the RhqFacade's implementation.
protected  RhqManagers getManager()
           
protected  T getRhqFacade()
           
 Object invoke(Object proxy, Method method, Object[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractRhqFacadeProxy

protected AbstractRhqFacadeProxy(T facade,
                                 RhqManagers manager)
Method Detail

getRhqFacade

protected T getRhqFacade()

getManager

protected RhqManagers getManager()

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Specified by:
invoke in interface InvocationHandler
Throws:
Throwable

doInvoke

protected abstract Object doInvoke(Object proxy,
                                   Method originalMethod,
                                   Class<?>[] argTypes,
                                   Object[] args)
                            throws Throwable
This method actually calls the method according to the RhqFacade's implementation. The argTypes and args are de-simplified (and thus the method can't be supplied just as a simple Method instance).

Parameters:
proxy - the proxy the method is executing on
originalMethod - the original method
argTypes - the de-simplified argument types
args - the de-simplified argumens
Returns:
the result of the invocation
Throws:
Throwable - if invocation throws an error


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.