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
ClassNotFoundException
public URL createURL(String protocol, String host, int port, String path, URLStreamHandler handler) throws MalformedURLException
MalformedURLException
public URL createURL(URL context, String spec, URLStreamHandler handler) throws MalformedURLException
MalformedURLException
public Process exec(String command) throws IOException
IOException
public 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
IOException
public FileOutputStream getFileOutputStream(File file) throws IOException
IOException
public InputStream getURLConnectionInputStream(URLConnection conn) throws IOException
IOException
public boolean deleteFile(File target)
public File createTempFile(String prefix, String suffix, File dir) throws IOException
IOException
public void deleteFileOnExit(File file) throws IOException
IOException
public URLConnection openURLConnection(URL url) throws IOException
IOException
public ZipFile openZipFile(File file) throws IOException
IOException
public JarFile openJarFile(File file) throws IOException
IOException
public void startActivator(BundleActivator activator, BundleContext context) throws Exception
Exception
public void stopActivator(BundleActivator activator, BundleContext context) throws Exception
Exception
public Policy getPolicy()
public void addURLToURLClassLoader(URL extension, ClassLoader loader) throws Exception
Exception
public Constructor getConstructor(Class target, Class[] types) throws Exception
Exception
public Constructor getDeclaredConstructor(Class target, Class[] types) throws Exception
Exception
public Method getMethod(Class target, String method, Class[] types) throws Exception
Exception
public Method getDeclaredMethod(Class target, String method, Class[] types) throws Exception
Exception
public void setAccesssible(AccessibleObject ao)
public Object invoke(Method method, Object target, Object[] params) throws Exception
Exception
public Object invokeDirect(Method method, Object target, Object[] params) throws Exception
Exception
public Object invoke(Constructor constructor, Object[] params) throws Exception
Exception
public Object getDeclaredField(Class targetClass, String name, Object target) throws Exception
Exception
public Object swapStaticFieldIfNotClass(Class targetClazz, Class targetType, Class condition, String lockName) throws Exception
Exception
public void invokeBundleCollisionHook(CollisionHook ch, int operationType, Bundle targetBundle, Collection<Bundle> collisionCandidates) throws Exception
Exception
public void invokeBundleFindHook(FindHook fh, BundleContext bc, Collection<Bundle> bundles) throws Exception
Exception
public void invokeBundleEventHook(EventHook eh, BundleEvent event, Collection<BundleContext> contexts) throws Exception
Exception
public void invokeWeavingHook(WeavingHook wh, WovenClass wc) throws Exception
Exception
public void invokeServiceEventHook(EventHook eh, ServiceEvent event, Collection<BundleContext> contexts) throws Exception
Exception
public void invokeServiceFindHook(FindHook fh, BundleContext context, String name, String filter, boolean allServices, Collection<ServiceReference<?>> references) throws Exception
Exception
public void invokeServiceListenerHookAdded(ListenerHook lh, Collection<ListenerHook.ListenerInfo> listeners) throws Exception
Exception
public void invokeServiceListenerHookRemoved(ListenerHook lh, Collection<ListenerHook.ListenerInfo> listeners) throws Exception
Exception
public void invokeServiceEventListenerHook(EventListenerHook elh, ServiceEvent event, Map<BundleContext,Collection<ListenerHook.ListenerInfo>> listeners) throws Exception
Exception
public ResolverHook invokeResolverHookFactory(ResolverHookFactory rhf, Collection<BundleRevision> triggers) throws Exception
Exception
public void invokeResolverHookResolvable(ResolverHook rh, Collection<BundleRevision> candidates) throws Exception
Exception
public void invokeResolverHookSingleton(ResolverHook rh, BundleCapability singleton, Collection<BundleCapability> collisions) throws Exception
Exception
public void invokeResolverHookMatches(ResolverHook rh, BundleRequirement req, Collection<BundleCapability> candidates) throws Exception
Exception
public void invokeResolverHookEnd(ResolverHook rh) throws Exception
Exception
public void invokeWovenClassListener(WovenClassListener wcl, WovenClass wc) throws Exception
Exception
Copyright © 2006–2016 The Apache Software Foundation. All rights reserved.