edu.rice.cs.drjava.model.repl.newjvm
Class ClassPathManager

java.lang.Object
  extended by edu.rice.cs.drjava.model.repl.newjvm.ClassPathManager
All Implemented Interfaces:
Lambda<ClassLoader,ClassLoader>

public class ClassPathManager
extends Object
implements Lambda<ClassLoader,ClassLoader>

Maintains a dynamic class path, allowing entries to be incrementally added in the appropriate place in the list. This class is used in the interpreter JVM, and may be accessed concurrently.


Field Summary
private  LinkedList<File> _buildCP
           
private  LinkedList<File> _externalFilesCP
           
private  LinkedList<File> _extraCP
           
private  Iterable<File> _fullPath
           
private  Lambda<Iterable<File>,Iterable<File>> _makeSafeSnapshot
           
private  LinkedList<File> _projectCP
           
private  LinkedList<File> _projectFilesCP
           
static String INTERACTIONS_CLASS_PATH_PROPERTY
           
 
Constructor Summary
ClassPathManager(Iterable<File> builtInCP)
           
 
Method Summary
 void addBuildDirectoryCP(File f)
          Adds the entry to the front of the build classpath.
 void addExternalFilesCP(File f)
          Adds new entry containing f to the front of the external classpath.
 void addExtraCP(File f)
          Adds the entry to the front of the extra classpath.
 void addProjectCP(File f)
          Adds the entry to the front of the project classpath (this is the classpath specified in project properties)
 void addProjectFilesCP(File f)
          Adds the entry to the front of the project files classpath (this is the classpath for all open project files).
 Iterable<File> getBuildDirectoryCP()
           
 Iterable<File> getClassPath()
          Get a dynamic view of the full class path.
 Iterable<File> getExternalFilesCP()
           
 Iterable<File> getExtraCP()
           
 Iterable<File> getProjectCP()
           
 Iterable<File> getProjectFilesCP()
           
 ClassLoader makeClassLoader(ClassLoader parent)
          Create a new class loader based on the given path.
protected  void updateProperty()
           
 ClassLoader value(ClassLoader parent)
          Lambda value method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_projectCP

private final LinkedList<File> _projectCP

_buildCP

private final LinkedList<File> _buildCP

_projectFilesCP

private final LinkedList<File> _projectFilesCP

_externalFilesCP

private final LinkedList<File> _externalFilesCP

_extraCP

private final LinkedList<File> _extraCP

_fullPath

private final Iterable<File> _fullPath

INTERACTIONS_CLASS_PATH_PROPERTY

public static final String INTERACTIONS_CLASS_PATH_PROPERTY
See Also:
Constant Field Values

_makeSafeSnapshot

private final Lambda<Iterable<File>,Iterable<File>> _makeSafeSnapshot
Constructor Detail

ClassPathManager

public ClassPathManager(Iterable<File> builtInCP)
Method Detail

updateProperty

protected void updateProperty()

addProjectCP

public void addProjectCP(File f)
Adds the entry to the front of the project classpath (this is the classpath specified in project properties)


getProjectCP

public Iterable<File> getProjectCP()

addBuildDirectoryCP

public void addBuildDirectoryCP(File f)
Adds the entry to the front of the build classpath.


getBuildDirectoryCP

public Iterable<File> getBuildDirectoryCP()

addProjectFilesCP

public void addProjectFilesCP(File f)
Adds the entry to the front of the project files classpath (this is the classpath for all open project files).


getProjectFilesCP

public Iterable<File> getProjectFilesCP()

addExternalFilesCP

public void addExternalFilesCP(File f)
Adds new entry containing f to the front of the external classpath.


getExternalFilesCP

public Iterable<File> getExternalFilesCP()

addExtraCP

public void addExtraCP(File f)
Adds the entry to the front of the extra classpath.


getExtraCP

public Iterable<File> getExtraCP()

makeClassLoader

public ClassLoader makeClassLoader(ClassLoader parent)
Create a new class loader based on the given path. The loader's path is dynamically updated as changes are made in the ClassPathManager. Each loader returned by this method will have its own set of loaded classes, and will only share those classes that are loaded by a common parent.

Parameters:
parent - The parent class loader. May be null, signifying the bootstrap class loader.

value

public ClassLoader value(ClassLoader parent)
Lambda value method

Specified by:
value in interface Lambda<ClassLoader,ClassLoader>

getClassPath

public Iterable<File> getClassPath()
Get a dynamic view of the full class path.