KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyTesting > functionTests > harness > currentjvm


1 /*
2
3    Derby - Class org.apache.derbyTesting.functionTests.harness.currentjvm
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derbyTesting.functionTests.harness;
23
24 import java.util.Vector JavaDoc;
25 import java.util.StringTokenizer JavaDoc;
26
27 /**
28   <p>This class is for whatever java is in the current classpath
29
30   @author ames
31  */

32
33 public class currentjvm extends jvm {
34
35     public String JavaDoc getName() {return "currentjvm";}
36     public currentjvm(boolean noasyncgc, boolean verbosegc, boolean noclassgc,
37     long ss, long oss, long ms, long mx, String JavaDoc classpath, String JavaDoc prof,
38     boolean verify, boolean noverify, boolean nojit, Vector JavaDoc D) {
39         super(noasyncgc,verbosegc,noclassgc,ss,oss,ms,mx,classpath,prof,
40         verify,noverify,nojit,D);
41     }
42     // more typical use:
43
public currentjvm(String JavaDoc classpath, Vector JavaDoc D) {
44         super(classpath,D);
45     }
46     // more typical use:
47
public currentjvm(long ms, long mx, String JavaDoc classpath, Vector JavaDoc D) {
48         super(ms,mx,classpath,D);
49     }
50     // actual use
51
public currentjvm() { }
52
53     // return the command line to invoke this VM. The caller then adds
54
// the class and program arguments.
55
public Vector JavaDoc getCommandLine()
56     {
57         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
58         Vector JavaDoc v = super.getCommandLine();
59         appendOtherFlags(sb);
60         String JavaDoc s = sb.toString();
61         StringTokenizer JavaDoc st = new StringTokenizer JavaDoc(s);
62         while (st.hasMoreTokens())
63         {
64             v.addElement(st.nextToken());
65         }
66         return v;
67     }
68
69     public void appendOtherFlags(StringBuffer JavaDoc sb)
70     {
71         if (noasyncgc) sb.append(" -noasyncgc");
72         if (verbosegc) sb.append(" -verbosegc");
73         if (noclassgc) sb.append(" -noclassgc");
74         if (ss>=0) {
75           sb.append(" -ss");
76           sb.append(ss);
77         }
78         if (oss>=0) {
79           sb.append(" -oss");
80           sb.append(oss);
81         }
82         if (ms>=0) {
83           sb.append(" -ms");
84           sb.append(ms);
85         }
86         if (mx>=0) {
87           sb.append(" -mx");
88           sb.append(mx);
89         }
90         if (classpath!=null) {
91           sb.append(" -classpath ");
92           sb.append(classpath);
93         }
94         if (prof!=null) {
95           sb.append(" -prof:");
96           sb.append(prof);
97         }
98         if (verify) sb.append(" -verify");
99         if (noverify) sb.append(" -noverify");
100         if (nojit) sb.append(" -nojit");
101         if (D!=null)
102           for (int i=0; i<D.size();i++) {
103             sb.append(" -D");
104             sb.append((String JavaDoc)(D.elementAt(i)));
105           }
106     }
107
108     public String JavaDoc getDintro() { return "-D"; }
109 }
110
Popular Tags