Package org.codehaus.mojo.idlj
Class IdljTranslator
- java.lang.Object
-
- org.codehaus.mojo.idlj.AbstractTranslator
-
- org.codehaus.mojo.idlj.IdljTranslator
-
- All Implemented Interfaces:
CompilerTranslator
- Direct Known Subclasses:
BuiltInTranslator
,GlassfishTranslator
abstract class IdljTranslator extends AbstractTranslator implements CompilerTranslator
Parent class for translators that use the IDLJ parameters.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.codehaus.mojo.idlj.AbstractTranslator
AbstractTranslator.ClassLoaderFacade
-
-
Constructor Summary
Constructors Constructor Description IdljTranslator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private void
addEmitOption(java.util.List<java.lang.String> args, Source source)
private void
addSymbolDefinition(java.util.List<java.lang.String> args, Define define)
private static java.lang.String
fixSeparator(java.lang.String filename)
Convert the provided filename from a Windows separator \\ to a unix/java separator /private java.util.List<java.lang.String>
getArguments(java.lang.String sourceDirectory, java.io.File[] includeDirs, java.lang.String targetDirectory, java.lang.String idlFile, Source source)
private static java.lang.String
getCanonicalPath(java.io.File file)
Return the unique path to the resource.(package private) void
invokeCompiler(java.lang.Class<?> compilerClass, java.util.List<java.lang.String> args)
Invoke the specified compiler with a set of argumentsvoid
invokeCompiler(java.lang.String sourceDirectory, java.io.File[] includeDirs, java.lang.String targetDirectory, java.lang.String idlFile, Source source)
This method it's used to invoke the compiler(package private) abstract void
invokeCompiler(java.util.List<java.lang.String> args)
private boolean
isOptionEnabled(java.lang.Boolean option)
protected int
runCompiler(java.lang.Class<?> compilerClass, java.lang.String... arguments)
Runs the IDL compilerprivate static java.lang.String
toRelativeAndFixSeparator(java.io.File fromdir, java.io.File todir, boolean replaceSlashesWithDashes)
Taken from maven-eclipse-plugin-
Methods inherited from class org.codehaus.mojo.idlj.AbstractTranslator
getClassLoaderFacade, getLog, invokeCompilerInProcess, isDebug, isFailOnError, isFork, setClassLoaderFacade, setDebug, setFailOnError, setLog
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.codehaus.mojo.idlj.CompilerTranslator
setDebug, setFailOnError, setLog
-
-
-
-
Method Detail
-
fixSeparator
private static java.lang.String fixSeparator(java.lang.String filename)
Convert the provided filename from a Windows separator \\ to a unix/java separator /- Parameters:
filename
- file name to fix separator- Returns:
- filename with all \\ replaced with /
-
getCanonicalPath
private static java.lang.String getCanonicalPath(java.io.File file) throws org.apache.maven.plugin.MojoExecutionException
Return the unique path to the resource.- Parameters:
file
- a resource to locate- Returns:
- the computed path
- Throws:
org.apache.maven.plugin.MojoExecutionException
- if the infrastructure detects a problem
-
toRelativeAndFixSeparator
private static java.lang.String toRelativeAndFixSeparator(java.io.File fromdir, java.io.File todir, boolean replaceSlashesWithDashes) throws org.apache.maven.plugin.MojoExecutionException
Taken from maven-eclipse-plugin- Parameters:
fromdir
- not suretodir
- what these arereplaceSlashesWithDashes
- true if we need to replace slashes with dashes to accomodate the OS- Returns:
- the relative path between fromdir to todir
- Throws:
org.apache.maven.plugin.MojoExecutionException
- thrown if an error is detected by the mojo infrastructure
-
invokeCompiler
public void invokeCompiler(java.lang.String sourceDirectory, java.io.File[] includeDirs, java.lang.String targetDirectory, java.lang.String idlFile, Source source) throws org.apache.maven.plugin.MojoExecutionException
This method it's used to invoke the compiler- Specified by:
invokeCompiler
in interfaceCompilerTranslator
- Parameters:
sourceDirectory
- the path to the sourcesincludeDirs
- theFile[]
of directories where to find the includestargetDirectory
- the path to the destination of the compilationidlFile
- the path to the file to compilesource
- the source tag available in the configuration tree of the maven plugin- Throws:
org.apache.maven.plugin.MojoExecutionException
- the exception is thrown whenever the compilation fails or crashes
-
invokeCompiler
abstract void invokeCompiler(java.util.List<java.lang.String> args) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getArguments
private java.util.List<java.lang.String> getArguments(java.lang.String sourceDirectory, java.io.File[] includeDirs, java.lang.String targetDirectory, java.lang.String idlFile, Source source) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
addSymbolDefinition
private void addSymbolDefinition(java.util.List<java.lang.String> args, Define define) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
addEmitOption
private void addEmitOption(java.util.List<java.lang.String> args, Source source)
-
isOptionEnabled
private boolean isOptionEnabled(java.lang.Boolean option)
-
invokeCompiler
void invokeCompiler(java.lang.Class<?> compilerClass, java.util.List<java.lang.String> args) throws org.apache.maven.plugin.MojoExecutionException
Invoke the specified compiler with a set of arguments- Parameters:
compilerClass
- theClass
that implements the compilerargs
- aList
that contains the arguments to use for the compiler- Throws:
org.apache.maven.plugin.MojoExecutionException
- if the compilation fail or the compiler crashes
-
runCompiler
protected int runCompiler(java.lang.Class<?> compilerClass, java.lang.String... arguments) throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
Description copied from class:AbstractTranslator
Runs the IDL compiler- Specified by:
runCompiler
in classAbstractTranslator
- Parameters:
compilerClass
- the class which implements the compilerarguments
- the arguments to pass to the compiler- Returns:
- the return status (a non-zero value indicates an error)
- Throws:
java.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 compiler
-
-