KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derbyTesting.functionTests.harness.j9_foundation
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 import java.util.Vector JavaDoc;
24 import java.util.StringTokenizer JavaDoc;
25 import java.util.Properties JavaDoc;
26
27 /**
28   <p>This class is for IBM's J9 jdk 1.3., foundation class library; v 2.2 (wctme5.7)
29
30   @author mayrna
31  */

32 public class j9_foundation extends jvm {
33
34     public String JavaDoc getName(){return "j9_foundation";}
35     public j9_foundation(boolean noasyncgc, boolean verbosegc, boolean noclassgc,
36     long ss, long oss, long ms, long mx, String JavaDoc classpath, String JavaDoc prof,
37     boolean verify, boolean noverify, boolean nojit, Vector JavaDoc D) {
38         super(noasyncgc,verbosegc,noclassgc,ss,oss,ms,mx,classpath,prof,
39         verify,noverify,nojit,D);
40     }
41     // more typical use:
42
public j9_foundation(String JavaDoc classpath, Vector JavaDoc D) {
43         super(classpath,D);
44     }
45     // more typical use:
46
public j9_foundation(long ms, long mx, String JavaDoc classpath, Vector JavaDoc D) {
47         super(ms,mx,classpath,D);
48     }
49     // actual use
50
public j9_foundation() {
51     Properties JavaDoc sp = System.getProperties();
52     String JavaDoc srvJvm = sp.getProperty("serverJvm");
53     if ((srvJvm!=null) && (srvJvm.toUpperCase().startsWith("J9")))
54     {
55         String JavaDoc wshome = guessWSHome();
56         // note, may have to use separator instead of hardcoding the slashes...
57
setJavaCmd(wshome+"/wctme5.7/ive/bin/j9");
58     }
59     else
60         setJavaCmd("j9");
61     }
62
63     // return the command line to invoke this VM. The caller then adds
64
// the class and program arguments.
65
public Vector JavaDoc getCommandLine()
66     {
67         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
68         Vector JavaDoc v = super.getCommandLine();
69         appendOtherFlags(sb);
70         String JavaDoc s = sb.toString();
71         StringTokenizer JavaDoc st = new StringTokenizer JavaDoc(s);
72         while (st.hasMoreTokens())
73         {
74             v.addElement(st.nextToken());
75         }
76         return v;
77     }
78
79     public void appendOtherFlags(StringBuffer JavaDoc sb)
80     {
81         Properties JavaDoc sp = System.getProperties();
82         String JavaDoc bootcp = sp.getProperty("bootcp");
83         String JavaDoc srvJvm = sp.getProperty("serverJvm");
84         // if we're coming in to be the server jvm for networkserver testing on j9,
85
// bootcp is null, so we need to try to setup the bootclasspath from scratch
86
// for now, assume we're only interested in doing this for wctme5.7_foundation, worry about
87
// newer versions, multiple class libraries, or multiple releases later.
88
sb.append(" -jcl:foun10");
89
90         if ((srvJvm !=null ) && (srvJvm.toUpperCase().startsWith("J9")))
91         {
92             String JavaDoc pathsep = System.getProperty("path.separator");
93             String JavaDoc wshome = guessWSHome();
94             // note, assuming jclFoundation classes sit under wctme5.7/ive/lib/jclFoundation10
95
// and that jdbc.jar sits under wctme5.7/ive/lib
96
// note, may have to switch to sep instead of hardcoding the slashes...
97
sb.append(" -Xbootclasspath/a:" + wshome + "/wctme5.7/ive/lib/jclFoundation10/classes.zip"
98                 + pathsep + wshome + "/wctme5.7/ive/lib/jclFoundation10/locale.zip"
99                 + pathsep + wshome + "/wctme5.7/ive/lib/jdbc.jar");
100         }
101         else
102             sb.append(" -Xbootclasspath/a:" + bootcp);
103         if (noasyncgc) warn("j9_foundation does not support noasyncgc");
104         if (verbosegc) sb.append(" -verbose:gc");
105         if (noclassgc) warn("j9_foundation does not support noclassgc");
106         if (ss>=0) warn("j9_foundation does not support ss");
107         if (oss>=0) warn("j9_foundation does not support oss");
108         if (ms>=0) {
109           sb.append(" -Xss");
110           sb.append(ms);
111           //sb.append("k");
112
}
113         if (mx>=0) {
114           sb.append(" -Xmx");
115           sb.append(mx);
116           //sb.append("k");
117
}
118         if (classpath!=null) warn("j9_foundation does not support classpath, use -Xbootclasspath,-Xbootclasspath/p,-Xbootclasspath/a");
119         if (prof!=null) warn("j9_foundation does not support prof");
120         if (verify) sb.append(" -verify");
121         if (noverify) warn("j9_foundation does not support noverify");
122         if (nojit) sb.append(" -Xnojit");
123         if (D != null)
124           for (int i=0; i<D.size();i++) {
125             sb.append(" -D");
126             sb.append((String JavaDoc)(D.elementAt(i)));
127           }
128     }
129     public String JavaDoc getDintro() { return "-D"; }
130
131 // Having the following method overload the one in jvm.java causes problems when running
132
// the junit tests - they *do* successfully run with securityManager.
133
// Foundation class tests actually run ok with security manager - except when useprocess
134
// is false. This is caused by a bug in the jvm. See also DERBY-885 and DERBY-1785.
135
// protected void setSecurityProps()
136
// {
137
// System.out.println("Note: J9 (foundation) tests do not run with security manager");
138
// }
139

140 }
141
Popular Tags