< prev index next >

src/jdk.rmic/share/classes/sun/rmi/rmic/Main.java

Print this page


   1 /*
   2  * Copyright (c) 1996, 2015, 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


  64  * WARNING: The contents of this source file are not part of any
  65  * supported API.  Code that depends on them does so at its own risk:
  66  * they are subject to change or removal without notice.
  67  */
  68 public class Main implements sun.rmi.rmic.Constants {
  69     String sourcePathArg;
  70     String sysClassPathArg;
  71     String classPathString;
  72     File destDir;
  73     int flags;
  74     long tm;
  75     Vector<String> classes;
  76     boolean nowrite;
  77     boolean nocompile;
  78     boolean keepGenerated;
  79     boolean status;
  80     String[] generatorArgs;
  81     Vector<Generator> generators;
  82     Class<? extends BatchEnvironment> environmentClass =
  83         BatchEnvironment.class;
  84     boolean iiopGeneration = false;
  85 
  86     /**
  87      * Name of the program.
  88      */
  89     String program;
  90 
  91     /**
  92      * The stream where error message are printed.
  93      */
  94     OutputStream out;
  95 
  96     /**
  97      * Constructor.
  98      */
  99     public Main(OutputStream out, String program) {
 100         this.out = out;
 101         this.program = program;
 102     }
 103 
 104     /**
 105      * Output a message.


 407 
 408                 } else {
 409 
 410                     // No. Is the current class a subclass of the
 411                     // new one?
 412 
 413                     if (!envClass.isAssignableFrom(environmentClass)) {
 414 
 415                         // No, so it's a conflict...
 416 
 417                         error("rmic.cannot.use.both",environmentClass.getName(),envClass.getName());
 418                         return null;
 419                     }
 420                 }
 421             } catch (ClassNotFoundException e) {
 422                 error("rmic.class.not.found",env);
 423                 return null;
 424             }
 425         }
 426 
 427         // If this is the iiop stub generator, cache
 428         // that fact for the jrmp generator...
 429 
 430         if (arg.equals("iiop")) {
 431             iiopGeneration = true;
 432         }
 433         return gen;
 434     }
 435 
 436     /**
 437      * Grab a resource string and parse it into an array of strings. Assumes
 438      * comma separated list.
 439      * @param name The resource name.
 440      * @param mustExist If true, throws error if resource does not exist. If
 441      * false and resource does not exist, returns zero element array.
 442      */
 443     protected String[] getArray(String name, boolean mustExist) {
 444         String[] result = null;
 445         String value = getString(name);
 446         if (value == null) {
 447             if (mustExist) {
 448                 error("rmic.resource.not.found",name);
 449                 return null;
 450             } else {
 451                 return new String[0];
 452             }


   1 /*
   2  * Copyright (c) 1996, 2018, 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


  64  * WARNING: The contents of this source file are not part of any
  65  * supported API.  Code that depends on them does so at its own risk:
  66  * they are subject to change or removal without notice.
  67  */
  68 public class Main implements sun.rmi.rmic.Constants {
  69     String sourcePathArg;
  70     String sysClassPathArg;
  71     String classPathString;
  72     File destDir;
  73     int flags;
  74     long tm;
  75     Vector<String> classes;
  76     boolean nowrite;
  77     boolean nocompile;
  78     boolean keepGenerated;
  79     boolean status;
  80     String[] generatorArgs;
  81     Vector<Generator> generators;
  82     Class<? extends BatchEnvironment> environmentClass =
  83         BatchEnvironment.class;


  84     /**
  85      * Name of the program.
  86      */
  87     String program;
  88 
  89     /**
  90      * The stream where error message are printed.
  91      */
  92     OutputStream out;
  93 
  94     /**
  95      * Constructor.
  96      */
  97     public Main(OutputStream out, String program) {
  98         this.out = out;
  99         this.program = program;
 100     }
 101 
 102     /**
 103      * Output a message.


 405 
 406                 } else {
 407 
 408                     // No. Is the current class a subclass of the
 409                     // new one?
 410 
 411                     if (!envClass.isAssignableFrom(environmentClass)) {
 412 
 413                         // No, so it's a conflict...
 414 
 415                         error("rmic.cannot.use.both",environmentClass.getName(),envClass.getName());
 416                         return null;
 417                     }
 418                 }
 419             } catch (ClassNotFoundException e) {
 420                 error("rmic.class.not.found",env);
 421                 return null;
 422             }
 423         }
 424 






 425         return gen;
 426     }
 427 
 428     /**
 429      * Grab a resource string and parse it into an array of strings. Assumes
 430      * comma separated list.
 431      * @param name The resource name.
 432      * @param mustExist If true, throws error if resource does not exist. If
 433      * false and resource does not exist, returns zero element array.
 434      */
 435     protected String[] getArray(String name, boolean mustExist) {
 436         String[] result = null;
 437         String value = getString(name);
 438         if (value == null) {
 439             if (mustExist) {
 440                 error("rmic.resource.not.found",name);
 441                 return null;
 442             } else {
 443                 return new String[0];
 444             }


< prev index next >