ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/util JavaEnvUtils.java
Date Mon, 17 Jun 2002 04:43:40 GMT
stevel      2002/06/16 21:43:40

  Modified:    src/main/org/apache/tools/ant/util Tag: ANT_15_BRANCH
                        JavaEnvUtils.java
  Log:
  Because these new methods aren't in use yet; this patch is not dangerous.
  It is building a vector of classes that are in the JREs that we think users
  need direct access to.
  
  Validation would be nice: are there classes in 1.2 and 1.1 that should be exported?
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.3   +55 -0     jakarta-ant/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
  
  Index: JavaEnvUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/util/JavaEnvUtils.java,v
  retrieving revision 1.3.2.2
  retrieving revision 1.3.2.3
  diff -u -r1.3.2.2 -r1.3.2.3
  --- JavaEnvUtils.java	28 May 2002 09:01:33 -0000	1.3.2.2
  +++ JavaEnvUtils.java	17 Jun 2002 04:43:40 -0000	1.3.2.3
  @@ -55,6 +55,7 @@
   
   import org.apache.tools.ant.taskdefs.condition.Os;
   import java.io.File;
  +import java.util.Vector;
   
   /**
    * A set of helper methods related to locating executables or checking
  @@ -81,6 +82,9 @@
   
       /** Version of currently running VM. */
       private static String javaVersion;
  +    
  +    /** floating version of the JVM */
  +    private static int javaVersionNumber;
   
       /** Version constant for Java 1.0 */
       public static final String JAVA_1_0 = "1.0";
  @@ -93,6 +97,10 @@
       /** Version constant for Java 1.4 */
       public static final String JAVA_1_4 = "1.4";
   
  +    /** array of packages in the runtime */ 
  +    private static Vector jrePackages;
  +    
  +
       static {
   
           // Determine the Java version by looking at available classes
  @@ -104,14 +112,19 @@
   
           try {
               javaVersion = JAVA_1_0;
  +            javaVersionNumber=10;
               Class.forName("java.lang.Void");
               javaVersion = JAVA_1_1;
  +            javaVersionNumber++;
               Class.forName("java.lang.ThreadLocal");
               javaVersion = JAVA_1_2;
  +            javaVersionNumber++;
               Class.forName("java.lang.StrictMath");
               javaVersion = JAVA_1_3;
  +            javaVersionNumber++;
               Class.forName("java.lang.CharSequence");
               javaVersion = JAVA_1_4;
  +            javaVersionNumber++;
           } catch (ClassNotFoundException cnfe) {
               // swallow as we've hit the max class version that
               // we have
  @@ -252,5 +265,47 @@
               }
           }
           return executable;
  +    }
  +        
  +    /**
  +     * demand creation of the package list
  +     */
  +     
  +    private static void buildJrePackages() {
  +        jrePackages=new Vector();
  +        switch(javaVersionNumber) {
  +            case 14:
  +                jrePackages.addElement("org.apache.crimson");
  +                jrePackages.addElement("org.apache.xalan");
  +                jrePackages.addElement("org.apache.xml");
  +                jrePackages.addElement("org.apache.xpath");
  +                jrePackages.addElement("org.w3c.dom");
  +                jrePackages.addElement("org.xml.sax");
  +                // fall through
  +            case 13:    
  +                jrePackages.addElement("org.omg");
  +                // fall through
  +            case 12:    
  +                jrePackages.addElement("sun.misc");
  +                // are there any here that we forgot?
  +                // fall through
  +            case 11:    
  +            default:
  +                jrePackages.addElement("java");
  +                jrePackages.addElement("javax");
  +                break;
  +        }
  +    }
  +    
  +    /**
  +     * get a vector of strings of packages built into 
  +     * that platforms runtime jar(s)
  +     * @return list of packages 
  +     */
  +    public static Vector getJrePackages() {
  +        if(jrePackages==null) {
  +            buildJrePackages();
  +        }
  +        return jrePackages;
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message