KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > common > dods > RunParameters


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  * Paul Mahar
21  *
22  */

23 package org.enhydra.kelp.common.dods;
24
25 // ToolBox
26
import org.enhydra.tool.ToolBoxInfo;
27
28 // AddinCore
29
import org.enhydra.kelp.common.Constants;
30 import org.enhydra.kelp.common.PathUtil;
31 import org.enhydra.kelp.common.node.OtterProject;
32
33 // JDK
34
import java.io.File JavaDoc;
35
36 //
37
public class RunParameters {
38     private OtterProject project = null;
39     private boolean is3 = false;
40
41     //
42
public RunParameters(OtterProject p) {
43         project = p;
44         is3 = ToolBoxInfo.isEnhydra3();
45
46     }
47
48     public String JavaDoc getAppParameters() {
49         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
50         buf.append('\"');
51         buf.append(project.getDeployBootstrapPath());
52         buf.append('\"');
53         return buf.toString();
54    }
55
56    public String JavaDoc getClasspathArg()
57    {
58        if (is3) {
59            return "";
60        }
61        else {
62             StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
63             String JavaDoc eRoot = new String JavaDoc();
64
65             eRoot = ToolBoxInfo.getEnhydraRoot().replace('\\', '/');
66             buf.setLength(0);
67             buf.append("-classpath ");
68             buf.append('\"');
69             buf.append(eRoot);
70             buf.append("/lib/Boot.jar");
71             buf.append(File.pathSeparatorChar);
72             buf.append(eRoot);
73             buf.append("/lib/EAAL.jar");
74             buf.append('\"');
75             return buf.toString();
76        }
77    }
78
79    public String JavaDoc getBootArg() {
80        if (is3) {
81            return "";
82        } else {
83             StringBuffer JavaDoc bootPath = new StringBuffer JavaDoc();
84
85             bootPath.append("-Dorg.enhydra.boot.properties="); // nores
86
bootPath.append('\"');
87             bootPath.append(project.getDeployRootPath());
88             bootPath.append(File.separator);
89             bootPath.append("boot.properties");
90             bootPath.append('\"');
91             return bootPath.toString().replace('\\', '/');
92        }
93    }
94
95 /* public String getPolicyArg() {
96        if (is3) {
97            return "";
98        } else {
99             StringBuffer policyPath = new StringBuffer();
100             StringBuffer buf = new StringBuffer();
101
102             policyPath.append(PathUtil.getDeployConfPath(project));
103             policyPath.append(File.separator);
104             policyPath.append(Constants.FILE_JAVA_POLICY);
105
106             File policy = new File(policyPath.toString().replace('\\', '/'));
107             if (!policy.exists()) {
108                 policy = RunGenerator.createPolicyFile(policyPath.toString());
109             }
110
111             buf.append("-Djava.security.policy="); // nores
112             buf.append('\"');
113             buf.append(policyPath);
114             buf.append('\"');
115             return buf.toString();
116        }
117    } */

118
119    public String JavaDoc getTCcpArg() {
120        if (is3) {
121            return "";
122        } else {
123            StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
124            String JavaDoc eRoot = ToolBoxInfo.getEnhydraRoot().replace('\\', '/');
125
126             buf.append("-Dtc_path_add=");
127             buf.append('\"');
128             buf.append(eRoot);
129             buf.append("/lib/WebService.jar");
130             buf.append(File.pathSeparator);
131             buf.append(eRoot);
132             buf.append("/lib/SharedApiService.jar");
133             buf.append('\"');
134             return buf.toString();
135        }
136    }
137     public String JavaDoc getVMParameters() {
138         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
139
140         if (is3) {
141
142             // done
143
} else {
144             buf.setLength(0);
145             buf.append(' ');
146             buf.append(getClasspathArg());
147             buf.append(' ');
148             buf.append(getTCcpArg());
149             buf.append(' ');
150 // buf.append(getPolicyArg());
151
buf.append(' ');
152             buf.append(getBootArg());
153         }
154         return buf.toString();
155     }
156
157 }
158
Popular Tags