org.apache.felix.framework.util
Class SecureAction
java.lang.Object
org.apache.felix.framework.util.SecureAction
public class SecureAction
- extends java.lang.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.
Field Summary |
protected static int |
BUFSIZE
|
Method Summary |
void |
addURLToURLClassLoader(java.net.URL extension,
java.lang.ClassLoader loader)
|
java.io.File |
createTempFile(java.lang.String prefix,
java.lang.String suffix,
java.io.File dir)
|
java.net.URL |
createURL(java.lang.String protocol,
java.lang.String host,
int port,
java.lang.String path,
java.net.URLStreamHandler handler)
|
java.net.URL |
createURL(java.net.URL context,
java.lang.String spec,
java.net.URLStreamHandler handler)
|
boolean |
deleteFile(java.io.File target)
|
java.lang.Process |
exec(java.lang.String command)
|
boolean |
fileExists(java.io.File file)
|
void |
flush(java.lang.Class targetClazz,
java.lang.Object lock)
|
java.lang.Class |
forName(java.lang.String name)
|
java.lang.String |
getAbsolutePath(java.io.File file)
|
java.lang.ClassLoader |
getClassLoader(java.lang.Class clazz)
|
java.lang.reflect.Constructor |
getConstructor(java.lang.Class target,
java.lang.Class[] types)
|
java.lang.reflect.Constructor |
getDeclaredConstructor(java.lang.Class target,
java.lang.Class[] types)
|
java.lang.Object |
getDeclaredField(java.lang.Class targetClass,
java.lang.String name,
java.lang.Object target)
|
java.lang.reflect.Method |
getDeclaredMethod(java.lang.Class target,
java.lang.String method,
java.lang.Class[] types)
|
java.io.InputStream |
getFileInputStream(java.io.File file)
|
java.io.OutputStream |
getFileOutputStream(java.io.File file)
|
java.lang.reflect.Method |
getMethod(java.lang.Class target,
java.lang.String method,
java.lang.Class[] types)
|
java.lang.ClassLoader |
getParentClassLoader(java.lang.ClassLoader loader)
|
java.security.Policy |
getPolicy()
|
java.lang.ClassLoader |
getSystemClassLoader()
|
java.lang.String |
getSystemProperty(java.lang.String name,
java.lang.String def)
|
java.io.InputStream |
getURLConnectionInputStream(java.net.URLConnection conn)
|
java.lang.Object |
invoke(java.lang.reflect.Constructor constructor,
java.lang.Object[] params)
|
java.lang.Object |
invoke(java.lang.reflect.Method method,
java.lang.Object target,
java.lang.Object[] params)
|
java.lang.Object |
invokeDirect(java.lang.reflect.Method method,
java.lang.Object target,
java.lang.Object[] params)
|
boolean |
isFileDirectory(java.io.File file)
|
java.io.File[] |
listDirectory(java.io.File file)
|
boolean |
mkdir(java.io.File file)
|
boolean |
mkdirs(java.io.File file)
|
JarFileX |
openJAR(java.io.File file)
|
JarFileX |
openJAR(java.io.File file,
boolean verify)
|
java.net.URLConnection |
openURLConnection(java.net.URL url)
|
boolean |
renameFile(java.io.File oldFile,
java.io.File newFile)
|
void |
setAccesssible(java.lang.reflect.AccessibleObject ao)
|
void |
startActivator(org.osgi.framework.BundleActivator activator,
org.osgi.framework.BundleContext context)
|
void |
stopActivator(org.osgi.framework.BundleActivator activator,
org.osgi.framework.BundleContext context)
|
java.lang.Object |
swapStaticFieldIfNotClass(java.lang.Class targetClazz,
java.lang.Class targetType,
java.lang.Class condition,
java.lang.String lockName)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BUFSIZE
protected static transient int BUFSIZE
SecureAction
public SecureAction()
getSystemProperty
public java.lang.String getSystemProperty(java.lang.String name,
java.lang.String def)
getParentClassLoader
public java.lang.ClassLoader getParentClassLoader(java.lang.ClassLoader loader)
getSystemClassLoader
public java.lang.ClassLoader getSystemClassLoader()
getClassLoader
public java.lang.ClassLoader getClassLoader(java.lang.Class clazz)
forName
public java.lang.Class forName(java.lang.String name)
throws java.lang.ClassNotFoundException
- Throws:
java.lang.ClassNotFoundException
createURL
public java.net.URL createURL(java.lang.String protocol,
java.lang.String host,
int port,
java.lang.String path,
java.net.URLStreamHandler handler)
throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
createURL
public java.net.URL createURL(java.net.URL context,
java.lang.String spec,
java.net.URLStreamHandler handler)
throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
exec
public java.lang.Process exec(java.lang.String command)
throws java.io.IOException
- Throws:
java.io.IOException
getAbsolutePath
public java.lang.String getAbsolutePath(java.io.File file)
fileExists
public boolean fileExists(java.io.File file)
isFileDirectory
public boolean isFileDirectory(java.io.File file)
mkdir
public boolean mkdir(java.io.File file)
mkdirs
public boolean mkdirs(java.io.File file)
listDirectory
public java.io.File[] listDirectory(java.io.File file)
renameFile
public boolean renameFile(java.io.File oldFile,
java.io.File newFile)
getFileInputStream
public java.io.InputStream getFileInputStream(java.io.File file)
throws java.io.IOException
- Throws:
java.io.IOException
getFileOutputStream
public java.io.OutputStream getFileOutputStream(java.io.File file)
throws java.io.IOException
- Throws:
java.io.IOException
getURLConnectionInputStream
public java.io.InputStream getURLConnectionInputStream(java.net.URLConnection conn)
throws java.io.IOException
- Throws:
java.io.IOException
deleteFile
public boolean deleteFile(java.io.File target)
createTempFile
public java.io.File createTempFile(java.lang.String prefix,
java.lang.String suffix,
java.io.File dir)
throws java.io.IOException
- Throws:
java.io.IOException
openURLConnection
public java.net.URLConnection openURLConnection(java.net.URL url)
throws java.io.IOException
- Throws:
java.io.IOException
openJAR
public JarFileX openJAR(java.io.File file)
throws java.io.IOException
- Throws:
java.io.IOException
openJAR
public JarFileX openJAR(java.io.File file,
boolean verify)
throws java.io.IOException
- Throws:
java.io.IOException
startActivator
public void startActivator(org.osgi.framework.BundleActivator activator,
org.osgi.framework.BundleContext context)
throws java.lang.Exception
- Throws:
java.lang.Exception
stopActivator
public void stopActivator(org.osgi.framework.BundleActivator activator,
org.osgi.framework.BundleContext context)
throws java.lang.Exception
- Throws:
java.lang.Exception
getPolicy
public java.security.Policy getPolicy()
addURLToURLClassLoader
public void addURLToURLClassLoader(java.net.URL extension,
java.lang.ClassLoader loader)
throws java.lang.Exception
- Throws:
java.lang.Exception
getConstructor
public java.lang.reflect.Constructor getConstructor(java.lang.Class target,
java.lang.Class[] types)
throws java.lang.Exception
- Throws:
java.lang.Exception
getDeclaredConstructor
public java.lang.reflect.Constructor getDeclaredConstructor(java.lang.Class target,
java.lang.Class[] types)
throws java.lang.Exception
- Throws:
java.lang.Exception
getMethod
public java.lang.reflect.Method getMethod(java.lang.Class target,
java.lang.String method,
java.lang.Class[] types)
throws java.lang.Exception
- Throws:
java.lang.Exception
getDeclaredMethod
public java.lang.reflect.Method getDeclaredMethod(java.lang.Class target,
java.lang.String method,
java.lang.Class[] types)
throws java.lang.Exception
- Throws:
java.lang.Exception
setAccesssible
public void setAccesssible(java.lang.reflect.AccessibleObject ao)
invoke
public java.lang.Object invoke(java.lang.reflect.Method method,
java.lang.Object target,
java.lang.Object[] params)
throws java.lang.Exception
- Throws:
java.lang.Exception
invokeDirect
public java.lang.Object invokeDirect(java.lang.reflect.Method method,
java.lang.Object target,
java.lang.Object[] params)
throws java.lang.Exception
- Throws:
java.lang.Exception
invoke
public java.lang.Object invoke(java.lang.reflect.Constructor constructor,
java.lang.Object[] params)
throws java.lang.Exception
- Throws:
java.lang.Exception
getDeclaredField
public java.lang.Object getDeclaredField(java.lang.Class targetClass,
java.lang.String name,
java.lang.Object target)
throws java.lang.Exception
- Throws:
java.lang.Exception
swapStaticFieldIfNotClass
public java.lang.Object swapStaticFieldIfNotClass(java.lang.Class targetClazz,
java.lang.Class targetType,
java.lang.Class condition,
java.lang.String lockName)
throws java.lang.Exception
- Throws:
java.lang.Exception
flush
public void flush(java.lang.Class targetClazz,
java.lang.Object lock)
throws java.lang.Exception
- Throws:
java.lang.Exception
Copyright © 2011. All Rights Reserved.