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.
| Modifier and Type | Field and Description |
|---|---|
protected static int |
BUFSIZE |
| Constructor and Description |
|---|
SecureAction() |
| Modifier and Type | Method and Description |
|---|---|
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.FileInputStream |
getFileInputStream(java.io.File file) |
java.io.FileOutputStream |
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) |
void |
invokeBundleEventHook(EventHook eh,
BundleEvent event,
java.util.Collection<BundleContext> contexts) |
void |
invokeBundleFindHook(FindHook fh,
BundleContext bc,
java.util.Collection<Bundle> bundles) |
java.lang.Object |
invokeDirect(java.lang.reflect.Method method,
java.lang.Object target,
java.lang.Object[] params) |
void |
invokeResolverHookEnd(ResolverHook rh) |
ResolverHook |
invokeResolverHookFactory(ResolverHookFactory rhf,
java.util.Collection<BundleRevision> triggers) |
void |
invokeResolverHookMatches(ResolverHook rh,
BundleRequirement req,
java.util.Collection<BundleCapability> candidates) |
void |
invokeResolverHookResolvable(ResolverHook rh,
java.util.Collection<BundleRevision> candidates) |
void |
invokeResolverHookSingleton(ResolverHook rh,
BundleCapability singleton,
java.util.Collection<BundleCapability> collisions) |
void |
invokeServiceEventHook(EventHook eh,
ServiceEvent event,
java.util.Collection<BundleContext> contexts) |
void |
invokeServiceEventListenerHook(EventListenerHook elh,
ServiceEvent event,
java.util.Map<BundleContext,java.util.Collection<ListenerHook.ListenerInfo>> listeners) |
void |
invokeServiceFindHook(FindHook fh,
BundleContext context,
java.lang.String name,
java.lang.String filter,
boolean allServices,
java.util.Collection<ServiceReference<?>> references) |
void |
invokeServiceListenerHookAdded(ListenerHook lh,
java.util.Collection<ListenerHook.ListenerInfo> listeners) |
void |
invokeServiceListenerHookRemoved(ListenerHook lh,
java.util.Collection<ListenerHook.ListenerInfo> listeners) |
void |
invokeWeavingHook(WeavingHook wh,
WovenClass wc) |
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) |
java.net.URLConnection |
openURLConnection(java.net.URL url) |
java.util.zip.ZipFile |
openZipFile(java.io.File file) |
boolean |
renameFile(java.io.File oldFile,
java.io.File newFile) |
void |
setAccesssible(java.lang.reflect.AccessibleObject ao) |
void |
startActivator(BundleActivator activator,
BundleContext context) |
void |
stopActivator(BundleActivator activator,
BundleContext context) |
java.lang.Object |
swapStaticFieldIfNotClass(java.lang.Class targetClazz,
java.lang.Class targetType,
java.lang.Class condition,
java.lang.String lockName) |
java.net.URI |
toURI(java.io.File file) |
public java.lang.String getSystemProperty(java.lang.String name,
java.lang.String def)
public java.lang.ClassLoader getParentClassLoader(java.lang.ClassLoader loader)
public java.lang.ClassLoader getSystemClassLoader()
public java.lang.ClassLoader getClassLoader(java.lang.Class clazz)
public java.lang.Class forName(java.lang.String name)
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundExceptionpublic 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
java.net.MalformedURLExceptionpublic java.net.URL createURL(java.net.URL context,
java.lang.String spec,
java.net.URLStreamHandler handler)
throws java.net.MalformedURLException
java.net.MalformedURLExceptionpublic java.lang.Process exec(java.lang.String command)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getAbsolutePath(java.io.File file)
public boolean fileExists(java.io.File file)
public boolean isFileDirectory(java.io.File file)
public boolean mkdir(java.io.File file)
public boolean mkdirs(java.io.File file)
public java.io.File[] listDirectory(java.io.File file)
public boolean renameFile(java.io.File oldFile,
java.io.File newFile)
public java.io.FileInputStream getFileInputStream(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic java.io.FileOutputStream getFileOutputStream(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic java.net.URI toURI(java.io.File file)
public java.io.InputStream getURLConnectionInputStream(java.net.URLConnection conn)
throws java.io.IOException
java.io.IOExceptionpublic boolean deleteFile(java.io.File target)
public java.io.File createTempFile(java.lang.String prefix,
java.lang.String suffix,
java.io.File dir)
throws java.io.IOException
java.io.IOExceptionpublic java.net.URLConnection openURLConnection(java.net.URL url)
throws java.io.IOException
java.io.IOExceptionpublic java.util.zip.ZipFile openZipFile(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic void startActivator(BundleActivator activator, BundleContext context) throws java.lang.Exception
java.lang.Exceptionpublic void stopActivator(BundleActivator activator, BundleContext context) throws java.lang.Exception
java.lang.Exceptionpublic java.security.Policy getPolicy()
public void addURLToURLClassLoader(java.net.URL extension,
java.lang.ClassLoader loader)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.reflect.Constructor getConstructor(java.lang.Class target,
java.lang.Class[] types)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.reflect.Constructor getDeclaredConstructor(java.lang.Class target,
java.lang.Class[] types)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.reflect.Method getMethod(java.lang.Class target,
java.lang.String method,
java.lang.Class[] types)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.reflect.Method getDeclaredMethod(java.lang.Class target,
java.lang.String method,
java.lang.Class[] types)
throws java.lang.Exception
java.lang.Exceptionpublic void setAccesssible(java.lang.reflect.AccessibleObject ao)
public java.lang.Object invoke(java.lang.reflect.Method method,
java.lang.Object target,
java.lang.Object[] params)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.Object invokeDirect(java.lang.reflect.Method method,
java.lang.Object target,
java.lang.Object[] params)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.Object invoke(java.lang.reflect.Constructor constructor,
java.lang.Object[] params)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.Object getDeclaredField(java.lang.Class targetClass,
java.lang.String name,
java.lang.Object target)
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.Object swapStaticFieldIfNotClass(java.lang.Class targetClazz,
java.lang.Class targetType,
java.lang.Class condition,
java.lang.String lockName)
throws java.lang.Exception
java.lang.Exceptionpublic void flush(java.lang.Class targetClazz,
java.lang.Object lock)
throws java.lang.Exception
java.lang.Exceptionpublic void invokeBundleFindHook(FindHook fh, BundleContext bc, java.util.Collection<Bundle> bundles) throws java.lang.Exception
java.lang.Exceptionpublic void invokeBundleEventHook(EventHook eh, BundleEvent event, java.util.Collection<BundleContext> contexts) throws java.lang.Exception
java.lang.Exceptionpublic void invokeWeavingHook(WeavingHook wh, WovenClass wc) throws java.lang.Exception
java.lang.Exceptionpublic void invokeServiceEventHook(EventHook eh, ServiceEvent event, java.util.Collection<BundleContext> contexts) throws java.lang.Exception
java.lang.Exceptionpublic void invokeServiceFindHook(FindHook fh, BundleContext context, java.lang.String name, java.lang.String filter, boolean allServices, java.util.Collection<ServiceReference<?>> references) throws java.lang.Exception
java.lang.Exceptionpublic void invokeServiceListenerHookAdded(ListenerHook lh, java.util.Collection<ListenerHook.ListenerInfo> listeners) throws java.lang.Exception
java.lang.Exceptionpublic void invokeServiceListenerHookRemoved(ListenerHook lh, java.util.Collection<ListenerHook.ListenerInfo> listeners) throws java.lang.Exception
java.lang.Exceptionpublic void invokeServiceEventListenerHook(EventListenerHook elh, ServiceEvent event, java.util.Map<BundleContext,java.util.Collection<ListenerHook.ListenerInfo>> listeners) throws java.lang.Exception
java.lang.Exceptionpublic ResolverHook invokeResolverHookFactory(ResolverHookFactory rhf, java.util.Collection<BundleRevision> triggers) throws java.lang.Exception
java.lang.Exceptionpublic void invokeResolverHookResolvable(ResolverHook rh, java.util.Collection<BundleRevision> candidates) throws java.lang.Exception
java.lang.Exceptionpublic void invokeResolverHookSingleton(ResolverHook rh, BundleCapability singleton, java.util.Collection<BundleCapability> collisions) throws java.lang.Exception
java.lang.Exceptionpublic void invokeResolverHookMatches(ResolverHook rh, BundleRequirement req, java.util.Collection<BundleCapability> candidates) throws java.lang.Exception
java.lang.Exceptionpublic void invokeResolverHookEnd(ResolverHook rh) throws java.lang.Exception
java.lang.ExceptionCopyright © 2012. All Rights Reserved.