import java.io.File;
import java.security.PrivilegedAction;

/**
 * This is a sample PrivilegedAction implementation, designed to be
 * used with the JaasAzn class.
 */
public class SampleAction implements PrivilegedAction {

    /**
     * This sample PrivilegedAction performs the following operations:
     * <ul>
     * <li> Access the System property <i>java.home</i>
     * <li> Access the System property <i>user.home</i>
     * <li> Access the file <i>foo.txt</i>
     * </ul>
     *
     * @return <code>null</code> in all cases.
     *
     * @exception SecurityException if the caller does not have permission
     *		to perform any of the operations listed above.
     */
    public Object run() {
	System.out.println("\nYour java.home property value is: "
			    +System.getProperty("java.home"));

	System.out.println("\nYour user.home property value is: "
			    +System.getProperty("user.home"));

	File f = new File("foo.txt");
	System.out.print("\nfoo.txt does ");
	if (!f.exists())
	    System.out.print("not ");
	System.out.println("exist in the current working directory.");
	return null;
    }
}

