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.
  • Constructor Details

    • IdljTranslator

      IdljTranslator()
  • Method Details

    • fixSeparator

      private static String fixSeparator(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 String getCanonicalPath(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 String toRelativeAndFixSeparator(File fromdir, File todir, boolean replaceSlashesWithDashes) throws org.apache.maven.plugin.MojoExecutionException
      Taken from maven-eclipse-plugin
      Parameters:
      fromdir - not sure
      todir - what these are
      replaceSlashesWithDashes - 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(String sourceDirectory, File[] includeDirs, String targetDirectory, String idlFile, Source source) throws org.apache.maven.plugin.MojoExecutionException
      This method it's used to invoke the compiler
      Specified by:
      invokeCompiler in interface CompilerTranslator
      Parameters:
      sourceDirectory - the path to the sources
      includeDirs - the File[] of directories where to find the includes
      targetDirectory - the path to the destination of the compilation
      idlFile - the path to the file to compile
      source - 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(List<String> args) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • getArguments

      private List<String> getArguments(String sourceDirectory, File[] includeDirs, String targetDirectory, String idlFile, Source source) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • addSymbolDefinition

      private void addSymbolDefinition(List<String> args, Define define) throws org.apache.maven.plugin.MojoExecutionException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • addEmitOption

      private void addEmitOption(List<String> args, Source source)
    • isOptionEnabled

      private boolean isOptionEnabled(Boolean option)
    • invokeCompiler

      void invokeCompiler(Class<?> compilerClass, List<String> args) throws org.apache.maven.plugin.MojoExecutionException
      Invoke the specified compiler with a set of arguments
      Parameters:
      compilerClass - the Class that implements the compiler
      args - a List 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(Class<?> compilerClass, String... arguments) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
      Description copied from class: AbstractTranslator
      Runs the IDL compiler
      Specified by:
      runCompiler in class AbstractTranslator
      Parameters:
      compilerClass - the class which implements the compiler
      arguments - the arguments to pass to the compiler
      Returns:
      the return status (a non-zero value indicates an error)
      Throws:
      NoSuchMethodException - if the method which should run the compiler does not exist
      IllegalAccessException - if no constructor is available
      InvocationTargetException - if an error occurs while invoking the compiler