public class SecureAction extends Object
This is a utility class to centralize all action that should be performed in a doPrivileged() block. To perform a secure action, simply create an instance of this class and use the specific method to perform the desired action. When an instance is created, this class will capture the security context and will then use that context when checking for permission to perform the action. Instances of this class should not be passed around since they may grant the receiver a capability to perform privileged actions.
| Modifier and Type | Field and Description |
|---|---|
protected static int |
BUFSIZE |
| Constructor and Description |
|---|
SecureAction() |
public ClassLoader getParentClassLoader(ClassLoader loader)
public ClassLoader getSystemClassLoader()
public ClassLoader getClassLoader(Class clazz)
public Class forName(String name) throws ClassNotFoundException
ClassNotFoundExceptionpublic URL createURL(String protocol, String host, int port, String path, URLStreamHandler handler) throws MalformedURLException
MalformedURLExceptionpublic URL createURL(URL context, String spec, URLStreamHandler handler) throws MalformedURLException
MalformedURLExceptionpublic Process exec(String command) throws IOException
IOExceptionpublic boolean fileExists(File file)
public boolean isFileDirectory(File file)
public boolean mkdir(File file)
public boolean mkdirs(File file)
public InputStream getFileInputStream(File file) throws IOException
IOExceptionpublic OutputStream getFileOutputStream(File file) throws IOException
IOExceptionpublic InputStream getURLConnectionInputStream(URLConnection conn) throws IOException
IOExceptionpublic boolean deleteFile(File target)
public File createTempFile(String prefix, String suffix, File dir) throws IOException
IOExceptionpublic URLConnection openURLConnection(URL url) throws IOException
IOExceptionpublic JarFileX openJAR(File file) throws IOException
IOExceptionpublic JarFileX openJAR(File file, boolean verify) throws IOException
IOExceptionpublic void startActivator(org.osgi.framework.BundleActivator activator,
org.osgi.framework.BundleContext context)
throws Exception
Exceptionpublic void stopActivator(org.osgi.framework.BundleActivator activator,
org.osgi.framework.BundleContext context)
throws Exception
Exceptionpublic Policy getPolicy()
public void addURLToURLClassLoader(URL extension, ClassLoader loader) throws Exception
Exceptionpublic Constructor getConstructor(Class target, Class[] types) throws Exception
Exceptionpublic Constructor getDeclaredConstructor(Class target, Class[] types) throws Exception
Exceptionpublic Method getMethod(Class target, String method, Class[] types) throws Exception
Exceptionpublic Method getDeclaredMethod(Class target, String method, Class[] types) throws Exception
Exceptionpublic void setAccesssible(AccessibleObject ao)
public Object invoke(Method method, Object target, Object[] params) throws Exception
Exceptionpublic Object invokeDirect(Method method, Object target, Object[] params) throws Exception
Exceptionpublic Object invoke(Constructor constructor, Object[] params) throws Exception
Exceptionpublic Object getDeclaredField(Class targetClass, String name, Object target) throws Exception
Exceptionpublic Object swapStaticFieldIfNotClass(Class targetClazz, Class targetType, Class condition, String lockName) throws Exception
ExceptionCopyright © 2012 JBoss by Red Hat. All Rights Reserved.