001: /*
002:
003: Derby - Class org.apache.derbyTesting.functionTests.harness.currentjvm
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to You under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derbyTesting.functionTests.harness;
023:
024: import java.util.Vector;
025: import java.util.StringTokenizer;
026:
027: /**
028: <p>This class is for whatever java is in the current classpath
029:
030: @author ames
031: */
032:
033: public class currentjvm extends jvm {
034:
035: public String getName() {
036: return "currentjvm";
037: }
038:
039: public currentjvm(boolean noasyncgc, boolean verbosegc,
040: boolean noclassgc, long ss, long oss, long ms, long mx,
041: String classpath, String prof, boolean verify,
042: boolean noverify, boolean nojit, Vector D) {
043: super (noasyncgc, verbosegc, noclassgc, ss, oss, ms, mx,
044: classpath, prof, verify, noverify, nojit, D);
045: }
046:
047: // more typical use:
048: public currentjvm(String classpath, Vector D) {
049: super (classpath, D);
050: }
051:
052: // more typical use:
053: public currentjvm(long ms, long mx, String classpath, Vector D) {
054: super (ms, mx, classpath, D);
055: }
056:
057: // actual use
058: public currentjvm() {
059: }
060:
061: // return the command line to invoke this VM. The caller then adds
062: // the class and program arguments.
063: public Vector getCommandLine() {
064: StringBuffer sb = new StringBuffer();
065: Vector v = super .getCommandLine();
066: appendOtherFlags(sb);
067: String s = sb.toString();
068: StringTokenizer st = new StringTokenizer(s);
069: while (st.hasMoreTokens()) {
070: v.addElement(st.nextToken());
071: }
072: return v;
073: }
074:
075: public void appendOtherFlags(StringBuffer sb) {
076: if (noasyncgc)
077: sb.append(" -noasyncgc");
078: if (verbosegc)
079: sb.append(" -verbosegc");
080: if (noclassgc)
081: sb.append(" -noclassgc");
082: if (ss >= 0) {
083: sb.append(" -ss");
084: sb.append(ss);
085: }
086: if (oss >= 0) {
087: sb.append(" -oss");
088: sb.append(oss);
089: }
090: if (ms >= 0) {
091: sb.append(" -ms");
092: sb.append(ms);
093: }
094: if (mx >= 0) {
095: sb.append(" -mx");
096: sb.append(mx);
097: }
098: if (classpath != null) {
099: sb.append(" -classpath ");
100: sb.append(classpath);
101: }
102: if (prof != null) {
103: sb.append(" -prof:");
104: sb.append(prof);
105: }
106: if (verify)
107: sb.append(" -verify");
108: if (noverify)
109: sb.append(" -noverify");
110: if (nojit)
111: sb.append(" -nojit");
112: if (D != null)
113: for (int i = 0; i < D.size(); i++) {
114: sb.append(" -D");
115: sb.append((String) (D.elementAt(i)));
116: }
117: }
118:
119: public String getDintro() {
120: return "-D";
121: }
122: }
|