Class JDKBridge


  • public class JDKBridge
    extends java.lang.Object
    Utility methods for doing various method calls which are used by multiple classes
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  JDKBridge.LoadClassCache  
    • Constructor Summary

      Constructors 
      Constructor Description
      JDKBridge()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getLocalCodebase()
      Get local codebase System property (java.rmi.server.codebase).
      static java.lang.Class loadClass​(java.lang.String className)
      Returns a class instance for the specified class.
      static java.lang.Class loadClass​(java.lang.String className, java.lang.String remoteCodebase)
      Returns a class instance for the specified class.
      static java.lang.Class loadClass​(java.lang.String className, java.lang.String remoteCodebase, java.lang.ClassLoader loader)
      Returns a class instance for the specified class.
      private static java.lang.Class loadClassM​(java.lang.String className, java.lang.String remoteCodebase, boolean useCodebaseOnly)  
      static void setCodebaseProperties()
      Set the codebase and useCodebaseOnly properties.
      static void setLocalCodebase​(java.lang.String codebase)
      Set the default code base.
      static boolean useCodebaseOnly()
      Return true if the system property "java.rmi.server.useCodebaseOnly" is set, false otherwise.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        private static java.util.logging.Logger logger
      • LOCAL_CODEBASE_KEY

        private static final java.lang.String LOCAL_CODEBASE_KEY
        See Also:
        Constant Field Values
      • USE_CODEBASE_ONLY_KEY

        private static final java.lang.String USE_CODEBASE_ONLY_KEY
        See Also:
        Constant Field Values
      • localCodebase

        private static java.lang.String localCodebase
      • useCodebaseOnly

        private static boolean useCodebaseOnly
    • Constructor Detail

      • JDKBridge

        public JDKBridge()
    • Method Detail

      • getLocalCodebase

        public static java.lang.String getLocalCodebase()
        Get local codebase System property (java.rmi.server.codebase). May be null or a space separated array of URLS.
        Returns:
        The value of the property
      • useCodebaseOnly

        public static boolean useCodebaseOnly()
        Return true if the system property "java.rmi.server.useCodebaseOnly" is set, false otherwise.
        Returns:
        If the property is set
      • loadClass

        public static java.lang.Class loadClass​(java.lang.String className,
                                                java.lang.String remoteCodebase,
                                                java.lang.ClassLoader loader)
                                         throws java.lang.ClassNotFoundException
        Returns a class instance for the specified class.
        Parameters:
        className - the name of the class
        remoteCodebase - a space-separated array of urls at which the class might be found. May be null.
        loader - a ClassLoader who may be used to load the class if all other methods fail.
        Returns:
        the Class object representing the loaded class.
        Throws:
        java.lang.ClassNotFoundException - if class cannot be loaded.
      • loadClass

        public static java.lang.Class loadClass​(java.lang.String className,
                                                java.lang.String remoteCodebase)
                                         throws java.lang.ClassNotFoundException
        Returns a class instance for the specified class.
        Parameters:
        className - the name of the class
        remoteCodebase - a space-separated array of urls at which the class might be found. May be null.
        Returns:
        the Class object representing the loaded class.
        Throws:
        java.lang.ClassNotFoundException - if class cannot be loaded.
      • loadClass

        public static java.lang.Class loadClass​(java.lang.String className)
                                         throws java.lang.ClassNotFoundException
        Returns a class instance for the specified class.
        Parameters:
        className - the name of the class
        Returns:
        the Class object representing the loaded class.
        Throws:
        java.lang.ClassNotFoundException - if class cannot be loaded.
      • setCodebaseProperties

        public static void setCodebaseProperties()
        Set the codebase and useCodebaseOnly properties. This is public only for test code.
      • setLocalCodebase

        public static void setLocalCodebase​(java.lang.String codebase)
        Set the default code base. This method is here only for test code.
        Parameters:
        codebase - The local codebase
      • loadClassM

        private static java.lang.Class loadClassM​(java.lang.String className,
                                                  java.lang.String remoteCodebase,
                                                  boolean useCodebaseOnly)
                                           throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException