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, ClassLoader classloader) 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 FileInputStream getFileInputStream(File file) throws IOException
IOExceptionpublic FileOutputStream 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 void deleteFileOnExit(File file) throws IOException
IOExceptionpublic URLConnection openURLConnection(URL url) throws IOException
IOExceptionpublic ZipFile openZipFile(File file) throws IOException
IOExceptionpublic JarFile openJarFile(File file) throws IOException
IOExceptionpublic void startActivator(BundleActivator activator, BundleContext context) throws Exception
Exceptionpublic void stopActivator(BundleActivator activator, 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
Exceptionpublic void invokeBundleCollisionHook(CollisionHook ch, int operationType, Bundle targetBundle, Collection<Bundle> collisionCandidates) throws Exception
Exceptionpublic void invokeBundleFindHook(FindHook fh, BundleContext bc, Collection<Bundle> bundles) throws Exception
Exceptionpublic void invokeBundleEventHook(EventHook eh, BundleEvent event, Collection<BundleContext> contexts) throws Exception
Exceptionpublic void invokeWeavingHook(WeavingHook wh, WovenClass wc) throws Exception
Exceptionpublic void invokeServiceEventHook(EventHook eh, ServiceEvent event, Collection<BundleContext> contexts) throws Exception
Exceptionpublic void invokeServiceFindHook(FindHook fh, BundleContext context, String name, String filter, boolean allServices, Collection<ServiceReference<?>> references) throws Exception
Exceptionpublic void invokeServiceListenerHookAdded(ListenerHook lh, Collection<ListenerHook.ListenerInfo> listeners) throws Exception
Exceptionpublic void invokeServiceListenerHookRemoved(ListenerHook lh, Collection<ListenerHook.ListenerInfo> listeners) throws Exception
Exceptionpublic void invokeServiceEventListenerHook(EventListenerHook elh, ServiceEvent event, Map<BundleContext,Collection<ListenerHook.ListenerInfo>> listeners) throws Exception
Exceptionpublic ResolverHook invokeResolverHookFactory(ResolverHookFactory rhf, Collection<BundleRevision> triggers) throws Exception
Exceptionpublic void invokeResolverHookResolvable(ResolverHook rh, Collection<BundleRevision> candidates) throws Exception
Exceptionpublic void invokeResolverHookSingleton(ResolverHook rh, BundleCapability singleton, Collection<BundleCapability> collisions) throws Exception
Exceptionpublic void invokeResolverHookMatches(ResolverHook rh, BundleRequirement req, Collection<BundleCapability> candidates) throws Exception
Exceptionpublic void invokeResolverHookEnd(ResolverHook rh) throws Exception
Exceptionpublic void invokeWovenClassListener(WovenClassListener wcl, WovenClass wc) throws Exception
Exceptionpublic <T> T run(PrivilegedAction<T> action)
public <T> T run(PrivilegedExceptionAction<T> action) throws Exception
Exceptionpublic String getCanonicalPath(File dataFile) throws IOException
IOExceptionpublic Object createProxy(ClassLoader classLoader, Class<?>[] interfaces, InvocationHandler handler)
Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.