1 /*
   2  * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.rmi.rmic.newrmic;
  27 
  28 import com.sun.javadoc.ClassDoc;
  29 import java.io.File;
  30 import java.util.Set;
  31 
  32 /**
  33  * The interface to rmic back end implementations.  Classes that
  34  * implement this interface correspond to the various generation modes
  35  * of rmic (JRMP, IIOP, IDL, etc.).
  36  *
  37  * A Generator instance corresponds to a particular rmic compilation
  38  * batch, and its instance state represents the generator-specific
  39  * command line options for that batch.  Main will instantiate a
  40  * generator class when the command line arguments indicate selection
  41  * of the corresponding generation mode.  Main will then invoke the
  42  * "parseArgs" method to allow the generator to process any
  43  * generator-specific command line options and set its instance state
  44  * accordingly.
  45  *
  46  * WARNING: The contents of this source file are not part of any
  47  * supported API.  Code that depends on them does so at its own risk:
  48  * they are subject to change or removal without notice.
  49  *
  50  * @author Peter Jones
  51  **/
  52 public interface Generator {
  53 
  54     /**
  55      * Processes the command line options specific to this generator.
  56      * Processed options are set to null in the specified array.
  57      * Returns true if successful or false if an error occurs.  Errors
  58      * are output to the specific Main instance.
  59      **/
  60     public boolean parseArgs(String[] args, Main main);
  61 
  62     /**
  63      * Returns the most specific environment class required by this
  64      * generator.
  65      **/
  66     public Class<? extends BatchEnvironment> envClass();
  67 
  68     /**
  69      * Returns the names of the classes that must be available through
  70      * the doclet API in order for this generator to function.
  71      **/
  72     public Set<String> bootstrapClassNames();
  73 
  74     /**
  75      * Generates the protocol-specific rmic output files for the
  76      * specified remote class.  This method is invoked once for each
  77      * class or interface specified on the command line for the rmic
  78      * compilation batch associated with this instance.
  79      *
  80      * Any generated source files (to be compiled with javac) are
  81      * passed to the addGeneratedFile method of the specified
  82      * BatchEnvironment.
  83      **/
  84     public void generate(BatchEnvironment env,
  85                          ClassDoc inputClass,
  86                          File destDir);
  87 }