Class StubGenerator

java.lang.Object
org.glassfish.rmic.iiop.Generator
org.glassfish.rmic.iiop.StubGenerator
All Implemented Interfaces:
Constants, Generator, Constants, Constants, RuntimeConstants

public class StubGenerator extends Generator
An IIOP stub/tie generator for rmic.
Author:
Bryan Atsatt, Anil Vijendran, M. Mortazavi
  • Constructor Details

    • StubGenerator

      public StubGenerator()
      Default constructor for Main to use.
  • Method Details

    • generate

      public void generate(BatchEnvironment env, File destDir, ClassDefinition cdef)
      Overridden in order to set the standardPackage flag.
      Specified by:
      generate in interface Generator
      Overrides:
      generate in class Generator
      Parameters:
      env - The compiler environment
      destDir - The directory for the root of the package hierarchy
      cdef - The definition for the implementation class or interface from which to generate output
    • requireNewInstance

      protected boolean requireNewInstance()
      Return true if a new instance should be created for each class on the command line. Subclasses which return true should override newInstance() to return an appropriately constructed instance.
      Specified by:
      requireNewInstance in class Generator
    • parseNonConforming

      protected boolean parseNonConforming(ContextStack stack)
      Return true if non-conforming types should be parsed.
      Specified by:
      parseNonConforming in class Generator
      Parameters:
      stack - The context stack.
    • getTopType

      protected CompoundType getTopType(ClassDefinition cdef, ContextStack stack)
      Create and return a top-level type.
      Specified by:
      getTopType in class Generator
      Parameters:
      cdef - The top-level class definition.
      stack - The context stack.
      Returns:
      The compound type or null if is non-conforming.
    • parseArgs

      public boolean parseArgs(String[] argv, Main main)
      Examine and consume command line arguments.
      Specified by:
      parseArgs in interface Generator
      Overrides:
      parseArgs in class Generator
      Parameters:
      argv - The command line arguments. Ignore null and unknown arguments. Set each consumed argument to null.
      main - Report any errors using the main.error() methods.
      Returns:
      true if no errors, false otherwise.
    • getOutputTypesFor

      protected Generator.OutputType[] getOutputTypesFor(CompoundType topType, HashSet alreadyChecked)
      Return an array containing all the file names and types that need to be generated for the given top-level type. The file names must NOT have an extension (e.g. ".java").
      Specified by:
      getOutputTypesFor in class Generator
      Parameters:
      topType - The type returned by getTopType().
      alreadyChecked - A set of Types which have already been checked. Intended to be passed to topType.collectMatching(filter,alreadyChecked).
    • getFileNameExtensionFor

      protected String getFileNameExtensionFor(Generator.OutputType outputType)
      Return the file name extension for the given file name (e.g. ".java"). All files generated with the ".java" extension will be compiled. To change this behavior for ".java" files, override the compileJavaSourceFile method to return false.
      Specified by:
      getFileNameExtensionFor in class Generator
      Parameters:
      outputType - One of the items returned by getOutputTypesFor(...)
    • writeOutputFor

      protected void writeOutputFor(Generator.OutputType outputType, HashSet alreadyChecked, IndentingWriter writer) throws IOException
      Write the output for the given OutputFileName into the output stream.
      Specified by:
      writeOutputFor in class Generator
      Parameters:
      outputType - One of the items returned by getOutputTypesFor(...)
      alreadyChecked - A set of Types which have already been checked. Intended to be passed to Type.collectMatching(filter,alreadyChecked).
      writer - The output stream.
      Throws:
      IOException
    • writeTie

      protected void writeTie(Generator.OutputType outputType, IndentingWriter p) throws IOException
      Write the Tie for the remote class to a stream.
      Throws:
      IOException
    • catchWrongPolicy

      public void catchWrongPolicy(IndentingWriter p) throws IOException
      Throws:
      IOException
    • catchServantNotActive

      public void catchServantNotActive(IndentingWriter p) throws IOException
      Throws:
      IOException
    • catchObjectNotActive

      public void catchObjectNotActive(IndentingWriter p) throws IOException
      Throws:
      IOException
    • write_tie_thisObject_method

      public void write_tie_thisObject_method(IndentingWriter p, Identifier idCorbaObject) throws IOException
      Throws:
      IOException
    • write_tie_deactivate_method

      public void write_tie_deactivate_method(IndentingWriter p) throws IOException
      Throws:
      IOException
    • write_tie_orb_method

      public void write_tie_orb_method(IndentingWriter p) throws IOException
      Throws:
      IOException
    • write_tie__ids_method

      public void write_tie__ids_method(IndentingWriter p) throws IOException
      Throws:
      IOException
    • getOutputDirectory

      protected File getOutputDirectory(File destinationDir, Identifier id, BatchEnvironment environment)
      Specified by:
      getOutputDirectory in class Generator
    • postProcessFile

      protected void postProcessFile(BatchEnvironment env, File file) throws FileNotFoundException
      Overrides:
      postProcessFile in class Generator
      Throws:
      FileNotFoundException