org.jikesrvm.classloader
Class BootstrapClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.jikesrvm.classloader.BootstrapClassLoader

public final class BootstrapClassLoader
extends ClassLoader

Implements an object that functions as the bootstrap class loader. This class is a Singleton pattern.


Nested Class Summary
private static interface BootstrapClassLoader.Handler<T>
           
 
Field Summary
private static BootstrapClassLoader bootstrapClassLoader
           
private static String bootstrapClasspath
          Places whence we load bootstrap .class files.
private  ImmutableEntryHashMapRVM<String,RVMType> loaded
           
static String myName
          Keep this a static field, since it's looked at in MemberReference.parse(java.util.StringTokenizer).
private static HashMap<String,ZipFile> zipFileCache
           
 
Constructor Summary
private BootstrapClassLoader()
          Prevent other classes from constructing one.
 
Method Summary
static void boot(String bootstrapClasspath)
          Initialize for execution.
 Class<?> findClass(String className)
          Search the bootstrap class loader's classpath for given class.
 URL findResource(String name)
           
 Enumeration<URL> findResources(String name)
           
static BootstrapClassLoader getBootstrapClassLoader()
           
static String getBootstrapRepositories()
           
 InputStream getResourceAsStream(String name)
           
private
<T> T
getResourceInternal(String name, BootstrapClassLoader.Handler<T> h, boolean multiple)
           
 Class<?> loadClass(String className, boolean resolveClass)
           
(package private)  RVMType loadVMClass(String className)
          Backdoor for use by TypeReference.resolve when !
static void setBootstrapRepositories(String bootstrapClasspath)
          Set list of places to be searched for VM classes and resources.
 String toString()
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, clone, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

loaded

private final ImmutableEntryHashMapRVM<String,RVMType> loaded

bootstrapClasspath

private static String bootstrapClasspath
Places whence we load bootstrap .class files.


bootstrapClassLoader

private static final BootstrapClassLoader bootstrapClassLoader

myName

public static final String myName
Keep this a static field, since it's looked at in MemberReference.parse(java.util.StringTokenizer).

See Also:
Constant Field Values

zipFileCache

private static HashMap<String,ZipFile> zipFileCache
Constructor Detail

BootstrapClassLoader

private BootstrapClassLoader()
Prevent other classes from constructing one.

Method Detail

setBootstrapRepositories

public static void setBootstrapRepositories(String bootstrapClasspath)
Set list of places to be searched for VM classes and resources.

Parameters:
bootstrapClasspath - path specification in standard "classpath" format

getBootstrapRepositories

public static String getBootstrapRepositories()
Returns:
List of places to be searched for VM classes and resources, in standard "classpath" format

boot

public static void boot(String bootstrapClasspath)
Initialize for execution.

Parameters:
bootstrapClasspath - names of directories containing the bootstrap .class files, and the names of any .zip/.jar files. These are the ones that implement the VM and its standard runtime libraries. This may contain several names separated with colons (':'), just as a classpath may. (null ==> use the values specified by setBootstrapRepositories(java.lang.String) when the boot image was created. This feature is not actually used, but may be helpful in avoiding trouble.)

getBootstrapClassLoader

public static BootstrapClassLoader getBootstrapClassLoader()

loadVMClass

RVMType loadVMClass(String className)
              throws NoClassDefFoundError
Backdoor for use by TypeReference.resolve when !VM.runningVM. As of this writing, it is not used by any other classes.

Throws:
NoClassDefFoundError

loadClass

public Class<?> loadClass(String className,
                          boolean resolveClass)
                   throws ClassNotFoundException
Overrides:
loadClass in class ClassLoader
Throws:
ClassNotFoundException

findClass

public Class<?> findClass(String className)
                   throws ClassNotFoundException
Search the bootstrap class loader's classpath for given class.

Overrides:
findClass in class ClassLoader
Parameters:
className - the name of the class to load
Returns:
the class object, if it was found
Throws:
ClassNotFoundException - if the class was not found, or was invalid

toString

public String toString()
Overrides:
toString in class Object

getResourceAsStream

public InputStream getResourceAsStream(String name)
Overrides:
getResourceAsStream in class ClassLoader

findResource

public URL findResource(String name)
Overrides:
findResource in class ClassLoader

findResources

public Enumeration<URL> findResources(String name)
Overrides:
findResources in class ClassLoader

getResourceInternal

private <T> T getResourceInternal(String name,
                                  BootstrapClassLoader.Handler<T> h,
                                  boolean multiple)