com.thoughtworks.proxy.toys.privilege
Class SubjectExecutor

java.lang.Object
  extended by com.thoughtworks.proxy.toys.privilege.SubjectExecutor
All Implemented Interfaces:
ActionExecutor

public class SubjectExecutor
extends Object
implements ActionExecutor

Execution of a PrivilegedExceptionAction with a Subject.

Since:
1.0
Author:
Jörg Schaible

Constructor Summary
SubjectExecutor(Subject subject)
          Construct a SubjectExecutor that runs a PrivilegedExceptionAction with the Subject.doAs(Subject, PrivilegedExceptionAction) method.
SubjectExecutor(Subject subject, AccessControlContext context)
          Construct a SubjectExecutor that runs a PrivilegedExceptionAction with the Subject.doAsPrivileged(Subject, PrivilegedExceptionAction, AccessControlContext) method.
 
Method Summary
 Object execute(PrivilegedExceptionAction<Object> action)
          Execute a PrivilegedExceptionAction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubjectExecutor

public SubjectExecutor(Subject subject)
Construct a SubjectExecutor that runs a PrivilegedExceptionAction with the Subject.doAs(Subject, PrivilegedExceptionAction) method.

Parameters:
subject - the subject used to run the methods
Since:
1.0

SubjectExecutor

public SubjectExecutor(Subject subject,
                       AccessControlContext context)
Construct a SubjectExecutor that runs a PrivilegedExceptionAction with the Subject.doAsPrivileged(Subject, PrivilegedExceptionAction, AccessControlContext) method.

Parameters:
subject - the subject used to run the methods
context - the AccessControlContext defining privileges for the subject
Since:
1.0
Method Detail

execute

public Object execute(PrivilegedExceptionAction<Object> action)
               throws PrivilegedActionException
Description copied from interface: ActionExecutor
Execute a PrivilegedExceptionAction.

Specified by:
execute in interface ActionExecutor
Parameters:
action - the action to run
Returns:
the return value of the action
Throws:
PrivilegedActionException - if the execution of the action fails


Copyright © 2005-2010 Codehaus. All Rights Reserved.