com.thoughtworks.proxy.toys.privilege
Class PrivilegingInvoker<T>

java.lang.Object
  extended by com.thoughtworks.proxy.toys.delegate.DelegatingInvoker<T>
      extended by com.thoughtworks.proxy.toys.privilege.PrivilegingInvoker<T>
All Implemented Interfaces:
Invoker, Serializable

public class PrivilegingInvoker<T>
extends DelegatingInvoker<T>

Invoker that creates for the invoked method a PrivilegedExceptionAction and runs this action with the provided ActionExecutor.

Since:
1.0
Author:
Jörg Schaible
See Also:
Serialized Form

Constructor Summary
PrivilegingInvoker(ProxyFactory proxyFactory, ObjectReference<T> delegateReference, ActionExecutor executor)
          Construct the invoker.
PrivilegingInvoker(T delegate)
          Construct the invoker using a AccessControllerExecutor.
PrivilegingInvoker(T delegate, ActionExecutor executor)
          Construct the invoker.
 
Method Summary
protected  Object invokeOnDelegate(Method method, Object[] args)
          Invoke the given method on the delegate.
 
Methods inherited from class com.thoughtworks.proxy.toys.delegate.DelegatingInvoker
delegate, equals, getDelegateReference, getMethodToInvoke, getProxyFactory, hashCode, invoke
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrivilegingInvoker

public PrivilegingInvoker(ProxyFactory proxyFactory,
                          ObjectReference<T> delegateReference,
                          ActionExecutor executor)
Construct the invoker.

Parameters:
proxyFactory - the proxy factory used to create the proxy
delegateReference - the reference object managing the delegate for the call
executor - the executor of the PrivilegedExceptionAction
Since:
1.0

PrivilegingInvoker

public PrivilegingInvoker(T delegate,
                          ActionExecutor executor)
Construct the invoker.

Parameters:
delegate - the delegate for the call
executor - the executor of the PrivilegedExceptionAction
Since:
1.0

PrivilegingInvoker

public PrivilegingInvoker(T delegate)
Construct the invoker using a AccessControllerExecutor.

Parameters:
delegate - the delegate for the call
Since:
1.0
Method Detail

invokeOnDelegate

protected Object invokeOnDelegate(Method method,
                                  Object[] args)
                           throws InvocationTargetException
Description copied from class: DelegatingInvoker
Invoke the given method on the delegate.

Overrides:
invokeOnDelegate in class DelegatingInvoker<T>
Parameters:
method - the method to invoke
args - the arguments for the invocation
Returns:
the method's result
Throws:
InvocationTargetException - if the invoked method throws any exception


Copyright © 2005-2010 Codehaus. All Rights Reserved.