001    /*
002     * (c) 2010 ThoughtWorks Ltd
003     * All rights reserved.
004     *
005     * The software in this package is published under the terms of the BSD
006     * style license a copy of which has been included with this distribution in
007     * the LICENSE.txt file.
008     * 
009     * Created on 19-03-2010.
010     */
011    package com.thoughtworks.proxy.toys.privilege;
012    
013    import java.security.PrivilegedActionException;
014    import java.security.PrivilegedExceptionAction;
015    
016    /**
017     * Interface to execute a {@link PrivilegedExceptionAction}. Implementations of this type are used by the
018     * {@linkplain Privileging privileging toy}.
019     * 
020     * @author Jörg Schaible
021     * @since 1.0
022     */
023    public interface ActionExecutor
024    {
025        /**
026         * Execute a {@link PrivilegedExceptionAction}.
027         * 
028         * @param action the action to run
029         * @return the return value of the action
030         * @throws PrivilegedActionException if the execution of the action fails
031         * @since 1.0
032         */
033        Object execute(PrivilegedExceptionAction<Object> action) throws PrivilegedActionException;
034    }