|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjaxx.compiler.JAXXEngine
public class JAXXEngine
| Nested Class Summary | |
|---|---|
protected static class |
JAXXEngine.LifeCycle
Different passes of the engine. |
| Field Summary | |
|---|---|
protected java.lang.String[] |
classNames
original list of classes to run |
protected java.util.Map<java.lang.String,JAXXCompiler> |
compilers
Maps the names of classes being compiled to the compiler instance handling the compilation. |
protected CompilerConfiguration |
configuration
configuration of the launchor and underlines compilers |
protected java.util.Map<java.lang.String,CompiledObjectDecorator> |
decorators
decorators available in engine |
protected java.util.List<java.lang.String> |
errors
Errors detected while running. |
protected java.io.File[] |
files
original list of files to run |
protected java.util.List<JAXXCompilerFinalizer> |
finalizers
finalizers available in engine |
protected static org.apache.commons.logging.Log |
log
Logger |
protected JAXXProfile |
profiler
profile attached to the engine (can be null) |
protected static JAXXEngine |
singleton
shared instance of unique launchor at a givne time. |
protected java.util.Map<java.io.File,SymbolTable> |
symbolTables
Maps the names of classes being compiled to their symbol tables (created after the first compiler pass). |
protected java.util.List<java.lang.String> |
warnings
Warnings detected while running. |
| Constructor Summary | |
|---|---|
protected |
JAXXEngine(java.io.File[] files,
java.lang.String[] classNames,
CompilerConfiguration options)
|
| Method Summary | |
|---|---|
void |
addError(java.lang.String error)
Add an error to the engine. |
void |
addJaxxFile(java.io.File jaxxFile)
|
void |
addJaxxFileClassName(java.lang.String className)
|
void |
addProfileTime(JAXXCompiler compiler,
java.lang.String key)
Add a profile time for the given compiler and key. |
void |
addWarning(java.lang.String warning)
Add a warning to the engine. |
boolean |
containsJaxxFileClassName(java.lang.String className)
|
static JAXXCompiler |
createDummyCompiler(java.lang.ClassLoader classLoader)
Creates a dummy Compiler for use in unit testing or dettached use of an engine. |
static JAXXEngine |
get()
|
protected JAXXCompiler |
getCompiler(java.lang.String className,
java.lang.String message)
Obtain the compiler for the given class name. |
JAXXEngine.LifeCycle |
getCurrentPass()
|
CompiledObjectDecorator |
getDecorator(java.lang.Class<?> type)
Obtain the decorator of the given type. |
CompiledObjectDecorator |
getDecorator(java.lang.String name)
Obtain the decorator of the given name. |
java.util.List<java.lang.String> |
getErrors()
|
JAXXCompiler |
getJAXXCompiler(java.lang.String className)
Obtain the jaxx compiler of the given class name. |
SymbolTable |
getSymbolTable(java.lang.String className)
Obtain the symbo table for the given class name. |
java.lang.String |
getVersion()
|
java.util.List<java.lang.String> |
getWarnings()
|
static boolean |
isRegistred()
|
static void |
loadLibraries(boolean verbose)
Load the Initializer services found via theServiceLoader mecanism. |
protected JAXXCompiler |
newCompiler(java.io.File parentFile,
java.io.File file,
java.lang.String className)
Create a new compiler. |
static JAXXEngine |
newLaunchor()
Create a new empty launchor and set it as current launchor accessible via method get() |
static JAXXEngine |
newLaunchor(java.io.File[] files,
java.lang.String[] classNames,
CompilerConfiguration configuration)
Create a new launchor and set it as current launchor accessible via method get(). |
static JAXXEngine |
newLaunchor(java.io.File base,
java.lang.String[] relativePaths,
CompilerConfiguration configuration)
Create a new launchor and set it as current launchor accessible via method get(). |
protected void |
reset()
Resets all state in preparation for a new compilation session. |
int |
run()
Compiled a set of files. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.commons.logging.Log log
protected static JAXXEngine singleton
protected CompilerConfiguration configuration
protected final java.io.File[] files
protected final java.lang.String[] classNames
protected java.util.Map<java.lang.String,JAXXCompiler> compilers
protected java.util.Map<java.io.File,SymbolTable> symbolTables
protected java.util.List<java.lang.String> warnings
protected java.util.List<java.lang.String> errors
protected JAXXProfile profiler
protected java.util.Map<java.lang.String,CompiledObjectDecorator> decorators
protected java.util.List<JAXXCompilerFinalizer> finalizers
| Constructor Detail |
|---|
protected JAXXEngine(java.io.File[] files,
java.lang.String[] classNames,
CompilerConfiguration options)
| Method Detail |
|---|
public void addJaxxFileClassName(java.lang.String className)
public void addJaxxFile(java.io.File jaxxFile)
public boolean containsJaxxFileClassName(java.lang.String className)
public JAXXEngine.LifeCycle getCurrentPass()
public static JAXXEngine newLaunchor()
get()
public static JAXXEngine newLaunchor(java.io.File base,
java.lang.String[] relativePaths,
CompilerConfiguration configuration)
get().
The launchor will be prepared to run a set of files, expressed as paths relative to a base directory.
The class names of the compiled files are derived from the relative path strings
(e.g. "example/Foo.jaxx" compiles into a class named "example.Foo").
base - the directory against which to resolve relative pathsrelativePaths - a list of relative paths to .jaxx files being compiledconfiguration - the compiler configuration to use
public static JAXXEngine newLaunchor(java.io.File[] files,
java.lang.String[] classNames,
CompilerConfiguration configuration)
get().
The launchor will be prepared to run a set of files, with the class names specified explicitly.
The class compiled from files[i] will be named classNames[i].
files - the .jaxx files to runclassNames - the names of the classes being compiledconfiguration - the compiler configuration to use
public static JAXXEngine get()
throws java.lang.NullPointerException
java.lang.NullPointerException - if no launchor was registred via a newLaunchor-like method.public static boolean isRegistred()
if there is a launchor registred, false otherwise.public static void loadLibraries(boolean verbose)
Initializer services found via theServiceLoader mecanism.
verbose - protected void reset()
public java.lang.String getVersion()
public static JAXXCompiler createDummyCompiler(java.lang.ClassLoader classLoader)
classLoader - class loader to use
public JAXXCompiler getJAXXCompiler(java.lang.String className)
className - the name of the class to use
public SymbolTable getSymbolTable(java.lang.String className)
className - the name of the class to use
null if no such symbol table could be found.
public CompiledObjectDecorator getDecorator(java.lang.String name)
throws java.lang.IllegalArgumentException
name - the name of the decorator
java.lang.IllegalArgumentException - if decorator not found for the given name.public CompiledObjectDecorator getDecorator(java.lang.Class<?> type)
type - the type of the decorator (syas his fqn)
public void addWarning(java.lang.String warning)
warning - the warning to addpublic void addError(java.lang.String error)
error - the error to addpublic java.util.List<java.lang.String> getErrors()
public java.util.List<java.lang.String> getWarnings()
public int run()
-1 if errors appears, the number of generated files
otherwise.
protected JAXXCompiler getCompiler(java.lang.String className,
java.lang.String message)
throws CompilerException
className - the class name of the searched compilermessage - the message to throw if compiler not found
CompilerException - if compiler not found
protected JAXXCompiler newCompiler(java.io.File parentFile,
java.io.File file,
java.lang.String className)
throws java.lang.reflect.InvocationTargetException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException
parentFile - the directory where to generate the java filefile - the path of file to generateclassName - name of the class to generate in the file
java.lang.reflect.InvocationTargetException - introspection error
java.lang.IllegalAccessException - introspection error
java.lang.InstantiationException - introspection error
java.lang.NoSuchMethodException - introspection error
public void addProfileTime(JAXXCompiler compiler,
java.lang.String key)
profiler is null, do nothing
compiler - the compiler to profilekey - the key of profiling
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||