Example usage for java.security PrivilegedAction PrivilegedAction

List of usage examples for java.security PrivilegedAction PrivilegedAction

Introduction

In this page you can find the example usage for java.security PrivilegedAction PrivilegedAction.

Prototype

PrivilegedAction

Source Link

Usage

From source file:javazoom.jlgui.player.amp.PlayerApplet.java

/**
 * Simulates "Eject" selection./*from  w w  w  .  java 2s. c  om*/
 */
public void pressEject() {
    AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
            acEject.fireEvent();
            return null;
        }
    });
}

From source file:javazoom.jlgui.player.amp.PlayerApplet.java

/**
 * Load skin.//from   ww w  . jav  a 2  s .c  om
 */
public void loadMySkin(final String skn) {
    AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
            loadSkin(skn);
            return null;
        }
    });
}

From source file:javazoom.jlgui.player.amp.PlayerApplet.java

/**
 * Reset Playlist./*from   w w w. ja  v a  2 s .  c o m*/
 */
public void resetMyPlaylist() {
    AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
            resetPlaylist();
            return null;
        }
    });
}

From source file:javazoom.jlgui.player.amp.PlayerApplet.java

/**
 * Load a playlist./*from  w  w w  . j  av  a  2  s.co  m*/
 * @param playlistName
 */
public void loadMyPlaylist(final String playlistName) {
    AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
            loadPlaylist(playlistName);
            return null;
        }
    });
}

From source file:javazoom.jlgui.player.amp.PlayerApplet.java

/**
 * Simulates "Shuffle" selection./*from ww w  . j  a  v  a  2  s  .c  o  m*/
 */
public void pressShuffle() {
    final MouseEvent smevt = new MouseEvent(this, MouseEvent.MOUSE_RELEASED, 0, 1, 0, 0, 1, false);
    AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
            acShuffle.processEvent(smevt);
            return null;
        }
    });
}

From source file:org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.java

/**
 * Get an annotation.  This is wrappered to avoid a Java2Security violation.
 * @param cls Class that contains annotation 
 * @param annotation Class of requrested Annotation
 * @return annotation or null/*w ww . j av a  2s.  co m*/
 */
private static Annotation getAnnotation(final Class cls, final Class annotation) {
    return (Annotation) AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
            return cls.getAnnotation(annotation);
        }
    });
}

From source file:javazoom.jlgui.player.amp.PlayerApplet.java

/**
 * Simulates "Repeat" selection.//  w  w w  . j a v a2s  . c om
 */
public void pressRepeat() {
    final MouseEvent rmevt = new MouseEvent(this, MouseEvent.MOUSE_RELEASED, 0, 1, 0, 0, 1, false);
    AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
            acRepeat.processEvent(rmevt);
            return null;
        }
    });
}

From source file:org.apache.axis2.jaxws.description.impl.OperationDescriptionImpl.java

/**
 * Get an annotation.  This is wrappered to avoid a Java2Security violation.
 * @param cls Class that contains annotation 
 * @param annotation Class of requrested Annotation
 * @return annotation or null//w  w w  . jav a  2s . c  om
 */
private static Annotation getAnnotation(final AnnotatedElement element, final Class annotation) {
    return (Annotation) AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
            return element.getAnnotation(annotation);
        }
    });
}

From source file:edu.ku.brc.af.ui.forms.ViewFactory.java

/**
 * Returns the singleton for the ViewSetMgr.
 * @return the singleton for the ViewSetMgr
 *//*from   w w w .j  a v  a2  s. c o  m*/
public static ViewFactory getInstance() {
    if (instance != null) {
        return instance;

    }
    // else
    String factoryNameStr = AccessController.doPrivileged(new PrivilegedAction<String>() {
        public String run() {
            return System.getProperty(factoryName);
        }
    });

    if (factoryNameStr != null) {
        try {
            instance = (ViewFactory) Class.forName(factoryNameStr).newInstance();
            return instance;

        } catch (Exception e) {
            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(AppContextMgr.class, e);
            InternalError error = new InternalError("Can't instantiate ViewFactory factory " + factoryNameStr); //$NON-NLS-1$
            error.initCause(e);
            throw error;
        }
    }
    return instance = new ViewFactory();
}