Class Realm


  • public class Realm
    extends java.lang.Object
    Represents a classloader. Realms form a tree structure where children delegates to the parent for classloading.
    Author:
    Kohsuke Kawaguchi
    • Constructor Summary

      Constructors 
      Constructor Description
      Realm​(java.lang.String name, Realm parent)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addClassFolder​(java.io.File classFolder)
      Adds a single class folder.
      void addJar​(java.io.File jar)
      Adds a single jar.
      void addJarFolder​(java.io.File folder, java.lang.String... excludes)
      Adds all jars in the given folder.
      void dump​(java.io.PrintStream out)  
      java.lang.ClassLoader getClassLoader()  
      org.apache.tools.ant.types.Path getPath()  
      java.io.File[] list()
      List all the components in this realm (excluding those defined in parent.)
      java.lang.Class loadClass​(java.lang.String className)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Realm

        public Realm​(java.lang.String name,
                     Realm parent)
    • Method Detail

      • getClassLoader

        public java.lang.ClassLoader getClassLoader()
      • addJar

        public void addJar​(java.io.File jar)
                    throws java.io.IOException
        Adds a single jar.
        Throws:
        java.io.IOException
      • addClassFolder

        public void addClassFolder​(java.io.File classFolder)
                            throws java.io.IOException
        Adds a single class folder.
        Throws:
        java.io.IOException
      • addJarFolder

        public void addJarFolder​(java.io.File folder,
                                 java.lang.String... excludes)
                          throws java.io.IOException
        Adds all jars in the given folder.
        Parameters:
        folder - A directory that contains a bunch of jar files.
        excludes - List of jars to be excluded
        Throws:
        java.io.IOException
      • dump

        public void dump​(java.io.PrintStream out)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • list

        public java.io.File[] list()
        List all the components in this realm (excluding those defined in parent.)
      • getPath

        public org.apache.tools.ant.types.Path getPath()
      • loadClass

        public java.lang.Class loadClass​(java.lang.String className)
                                  throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException