public abstract class AbstractTranslator extends java.lang.Object implements CompilerTranslator
| Modifier and Type | Class and Description |
|---|---|
static interface |
AbstractTranslator.ClassLoaderFacade
An interface for loading the proper IDL compiler class.
|
(package private) static class |
AbstractTranslator.ClassLoaderFacadeImpl
The implementation of ClassLoaderFacade used at runtime.
|
| Modifier and Type | Field and Description |
|---|---|
private static AbstractTranslator.ClassLoaderFacade |
classLoaderFacade |
private boolean |
debug
enable/disable debug messages
|
private boolean |
failOnError
Set to true to fail the build if an error occur while compiling the IDL.
|
private static boolean |
fork
Determines if the compiler can fork a process to run.
|
private org.apache.maven.plugin.logging.Log |
log
the
Log that will used for the messages |
| Constructor and Description |
|---|
AbstractTranslator() |
| Modifier and Type | Method and Description |
|---|---|
protected AbstractTranslator.ClassLoaderFacade |
getClassLoaderFacade()
Returns the object to use for classloading.
|
private java.lang.String |
getCommandLine(java.lang.Class<?> compilerClass,
java.lang.String[] arguments) |
org.apache.maven.plugin.logging.Log |
getLog() |
private boolean |
hasErrors(java.io.ByteArrayOutputStream err) |
protected void |
invokeCompilerInProcess(java.lang.Class<?> compilerClass,
java.util.List<java.lang.String> args)
Invokes the configured compiler and throws an exception if anything goes wrong
|
private boolean |
isCompilationFailed(java.io.ByteArrayOutputStream err,
int exitCode) |
boolean |
isDebug() |
boolean |
isFailOnError() |
protected static boolean |
isFork()
Returns true if the translator is allowed to create a new forked process.
|
private boolean |
isNotEmpty(java.io.ByteArrayOutputStream outputStream) |
private void |
logOutputMessages(java.io.ByteArrayOutputStream err,
java.io.ByteArrayOutputStream out) |
protected abstract int |
runCompiler(java.lang.Class<?> compilerClass,
java.lang.String... arguments)
Runs the IDL compiler
|
private int |
runCompilerAndRecordOutput(java.lang.Class<?> compilerClass,
java.lang.String[] arguments,
java.io.ByteArrayOutputStream err,
java.io.ByteArrayOutputStream out) |
(package private) static void |
setClassLoaderFacade(AbstractTranslator.ClassLoaderFacade classLoaderFacade)
Specifies the implementation of the classloader facade to use
|
void |
setDebug(boolean debug)
Enable/disable debug messages.
|
void |
setFailOnError(boolean failOnError)
Set to true to fail the build if an error occur while compiling the IDL.
|
void |
setLog(org.apache.maven.plugin.logging.Log log)
The
Log that will used for the messages |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinvokeCompilerprivate boolean debug
private boolean failOnError
private org.apache.maven.plugin.logging.Log log
Log that will used for the messagesprivate static AbstractTranslator.ClassLoaderFacade classLoaderFacade
private static boolean fork
public boolean isDebug()
public void setDebug(boolean debug)
CompilerTranslatorsetDebug in interface CompilerTranslatordebug - the debug to setpublic org.apache.maven.plugin.logging.Log getLog()
public void setLog(org.apache.maven.plugin.logging.Log log)
CompilerTranslatorLog that will used for the messagessetLog in interface CompilerTranslatorlog - the log to setpublic boolean isFailOnError()
public void setFailOnError(boolean failOnError)
CompilerTranslatorsetFailOnError in interface CompilerTranslatorfailOnError - the failOnError to setprotected static boolean isFork()
static void setClassLoaderFacade(AbstractTranslator.ClassLoaderFacade classLoaderFacade)
classLoaderFacade - a wrapper for class loading.protected AbstractTranslator.ClassLoaderFacade getClassLoaderFacade()
protected void invokeCompilerInProcess(java.lang.Class<?> compilerClass,
java.util.List<java.lang.String> args)
throws org.apache.maven.plugin.MojoExecutionException
compilerClass - the class representing the compiler to invokeargs - the arguments to pass to the compilerorg.apache.maven.plugin.MojoExecutionException - if any error occursprivate int runCompilerAndRecordOutput(java.lang.Class<?> compilerClass,
java.lang.String[] arguments,
java.io.ByteArrayOutputStream err,
java.io.ByteArrayOutputStream out)
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprotected abstract int runCompiler(java.lang.Class<?> compilerClass,
java.lang.String... arguments)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
compilerClass - the class which implements the compilerarguments - the arguments to pass to the compilerjava.lang.NoSuchMethodException - if the method which should run the compiler does not existjava.lang.IllegalAccessException - if no constructor is availablejava.lang.reflect.InvocationTargetException - if an error occurs while invoking the compilerprivate boolean isCompilationFailed(java.io.ByteArrayOutputStream err,
int exitCode)
private boolean hasErrors(java.io.ByteArrayOutputStream err)
private void logOutputMessages(java.io.ByteArrayOutputStream err,
java.io.ByteArrayOutputStream out)
private boolean isNotEmpty(java.io.ByteArrayOutputStream outputStream)
private java.lang.String getCommandLine(java.lang.Class<?> compilerClass,
java.lang.String[] arguments)