类 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.

    • 字段详细资料

      • 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,
                                       java.lang.ClassLoader classloader)
                                throws java.lang.ClassNotFoundException
        抛出:
        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
        抛出:
        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
        抛出:
        java.net.MalformedURLException
      • exec

        public java.lang.Process exec​(java.lang.String command)
                               throws java.io.IOException
        抛出:
        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.FileInputStream getFileInputStream​(java.io.File file)
                                                   throws java.io.IOException
        抛出:
        java.io.IOException
      • getFileOutputStream

        public java.io.FileOutputStream getFileOutputStream​(java.io.File file)
                                                     throws java.io.IOException
        抛出:
        java.io.IOException
      • toURI

        public java.net.URI toURI​(java.io.File file)
      • getURLConnectionInputStream

        public java.io.InputStream getURLConnectionInputStream​(java.net.URLConnection conn)
                                                        throws java.io.IOException
        抛出:
        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
        抛出:
        java.io.IOException
      • deleteFileOnExit

        public void deleteFileOnExit​(java.io.File file)
                              throws java.io.IOException
        抛出:
        java.io.IOException
      • openURLConnection

        public java.net.URLConnection openURLConnection​(java.net.URL url)
                                                 throws java.io.IOException
        抛出:
        java.io.IOException
      • openZipFile

        public java.util.zip.ZipFile openZipFile​(java.io.File file)
                                          throws java.io.IOException
        抛出:
        java.io.IOException
      • openJarFile

        public java.util.jar.JarFile openJarFile​(java.io.File file)
                                          throws java.io.IOException
        抛出:
        java.io.IOException
      • startActivator

        public void startActivator​(BundleActivator activator,
                                   BundleContext context)
                            throws java.lang.Exception
        抛出:
        java.lang.Exception
      • stopActivator

        public void stopActivator​(BundleActivator activator,
                                  BundleContext context)
                           throws java.lang.Exception
        抛出:
        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
        抛出:
        java.lang.Exception
      • getConstructor

        public java.lang.reflect.Constructor getConstructor​(java.lang.Class target,
                                                            java.lang.Class[] types)
                                                     throws java.lang.Exception
        抛出:
        java.lang.Exception
      • getDeclaredConstructor

        public java.lang.reflect.Constructor getDeclaredConstructor​(java.lang.Class target,
                                                                    java.lang.Class[] types)
                                                             throws java.lang.Exception
        抛出:
        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
        抛出:
        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
        抛出:
        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
        抛出:
        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
        抛出:
        java.lang.Exception
      • invoke

        public java.lang.Object invoke​(java.lang.reflect.Constructor constructor,
                                       java.lang.Object[] params)
                                throws java.lang.Exception
        抛出:
        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
        抛出:
        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
        抛出:
        java.lang.Exception
      • flush

        public void flush​(java.lang.Class targetClazz,
                          java.lang.Object lock)
                   throws java.lang.Exception
        抛出:
        java.lang.Exception
      • invokeBundleCollisionHook

        public void invokeBundleCollisionHook​(CollisionHook ch,
                                              int operationType,
                                              Bundle targetBundle,
                                              java.util.Collection<Bundle> collisionCandidates)
                                       throws java.lang.Exception
        抛出:
        java.lang.Exception
      • invokeBundleFindHook

        public void invokeBundleFindHook​(FindHook fh,
                                         BundleContext bc,
                                         java.util.Collection<Bundle> bundles)
                                  throws java.lang.Exception
        抛出:
        java.lang.Exception
      • invokeBundleEventHook

        public void invokeBundleEventHook​(EventHook eh,
                                          BundleEvent event,
                                          java.util.Collection<BundleContext> contexts)
                                   throws java.lang.Exception
        抛出:
        java.lang.Exception
      • invokeWeavingHook

        public void invokeWeavingHook​(WeavingHook wh,
                                      WovenClass wc)
                               throws java.lang.Exception
        抛出:
        java.lang.Exception
      • invokeServiceEventHook

        public void invokeServiceEventHook​(EventHook eh,
                                           ServiceEvent event,
                                           java.util.Collection<BundleContext> contexts)
                                    throws java.lang.Exception
        抛出:
        java.lang.Exception
      • invokeServiceFindHook

        public 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.Exception
      • invokeServiceListenerHookAdded

        public void invokeServiceListenerHookAdded​(ListenerHook lh,
                                                   java.util.Collection<ListenerHook.ListenerInfo> listeners)
                                            throws java.lang.Exception
        抛出:
        java.lang.Exception
      • invokeServiceListenerHookRemoved

        public void invokeServiceListenerHookRemoved​(ListenerHook lh,
                                                     java.util.Collection<ListenerHook.ListenerInfo> listeners)
                                              throws java.lang.Exception
        抛出:
        java.lang.Exception
      • invokeResolverHookResolvable

        public void invokeResolverHookResolvable​(ResolverHook rh,
                                                 java.util.Collection<BundleRevision> candidates)
                                          throws java.lang.Exception
        抛出:
        java.lang.Exception
      • invokeResolverHookSingleton

        public void invokeResolverHookSingleton​(ResolverHook rh,
                                                BundleCapability singleton,
                                                java.util.Collection<BundleCapability> collisions)
                                         throws java.lang.Exception
        抛出:
        java.lang.Exception
      • invokeResolverHookEnd

        public void invokeResolverHookEnd​(ResolverHook rh)
                                   throws java.lang.Exception
        抛出:
        java.lang.Exception
      • invokeWovenClassListener

        public void invokeWovenClassListener​(WovenClassListener wcl,
                                             WovenClass wc)
                                      throws java.lang.Exception
        抛出:
        java.lang.Exception