|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.rice.cs.drjava.model.compiler.CompilerRegistry
Registry for all CompilerInterface implementations.
Allows registration, by class name, of CompilerInterface
implementations. Later, the list of these registered compilers (but only
those that successfully loaded) can be retrieved.
Field Summary | |
private CompilerInterface |
_activeCompiler
The active compiler. |
private ClassLoader |
_baseClassLoader
Class loader to use to fetch compiler classes. |
private LinkedList |
_registeredCompilers
Linked list of class names of registered compilers. |
static String[] |
DEFAULT_COMPILERS
The list of compiler interfaces that are distributed with DrJava. |
static CompilerRegistry |
ONLY
Singleton instance. |
Constructor Summary | |
private |
CompilerRegistry()
Private constructor due to singleton. |
Method Summary | |
private static URL[] |
_getToolsJarURLs()
Returns reasonable location guesses for tools jar file. |
private CompilerInterface |
_instantiateCompiler(String name)
Instantiate the given compiler. |
private void |
_registerDefaultCompilers()
|
static CompilerInterface |
createCompiler(Class clazz)
|
CompilerInterface |
getActiveCompiler()
Gets the compiler is the "active" compiler. |
CompilerInterface[] |
getAvailableCompilers()
Returns all registered compilers that are actually available. |
ClassLoader |
getBaseClassLoader()
Gets the base class loader used to load compiler classes. |
boolean |
isNoCompilerAvailable()
|
void |
registerCompiler(String name)
Register the given compiler, adding it to the list of potential compilers. |
void |
setActiveCompiler(CompilerInterface compiler)
Sets which compiler is the "active" compiler. |
void |
setBaseClassLoader(ClassLoader l)
Sets the base class loader used to load compiler classes. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final String[] DEFAULT_COMPILERS
public static final CompilerRegistry ONLY
private ClassLoader _baseClassLoader
private LinkedList _registeredCompilers
private CompilerInterface _activeCompiler
Constructor Detail |
private CompilerRegistry()
Method Detail |
public void setBaseClassLoader(ClassLoader l)
public ClassLoader getBaseClassLoader()
public void registerCompiler(String name)
name
- Name of the CompilerInterface
implementation class.public CompilerInterface[] getAvailableCompilers()
This method will never return null or a zero-length array.
Instead, if no compiler is registered and available, this will return
a one-element array containing an instance of
NoCompilerAvailable
.
public boolean isNoCompilerAvailable()
public void setActiveCompiler(CompilerInterface compiler)
compiler
- Compiler to set active.getActiveCompiler()
public CompilerInterface getActiveCompiler()
NoCompilerAvailable
.setActiveCompiler(edu.rice.cs.drjava.model.compiler.CompilerInterface)
private void _registerDefaultCompilers()
private CompilerInterface _instantiateCompiler(String name) throws Throwable
name
- Fully qualified class name of the compiler to instantiate.
This class must implement CompilerInterface
.CompilerInterface
. This will either be
the value of the .ONLY field of the class (if it exists and
is an implementation of CompilerInterface) or a new instance
of the given class.Throwable
- If the compiler would not load, some type of exception
will be thrown. Which particular one depends on how
it failed. But either way, it is non-recoverable;
the exception is thrown just to indicate failure.public static CompilerInterface createCompiler(Class clazz) throws Throwable
private static URL[] _getToolsJarURLs()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |