001: /*
002: * Enhydra Java Application Server Project
003: *
004: * The contents of this file are subject to the Enhydra Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License on
007: * the Enhydra web site ( http://www.enhydra.org/ ).
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011: * the License for the specific terms governing rights and limitations
012: * under the License.
013: *
014: * The Initial Developer of the Enhydra Application Server is Lutris
015: * Technologies, Inc. The Enhydra Application Server and portions created
016: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017: * All Rights Reserved.
018: *
019: * Contributor(s):
020: * Paul Mahar
021: *
022: */
023: package org.enhydra.kelp.common.deployer;
024:
025: // ToolBox
026: import org.enhydra.tool.ToolBoxInfo;
027:
028: // AddinCore
029: import org.enhydra.kelp.common.Constants;
030: import org.enhydra.kelp.common.PathUtil;
031: import org.enhydra.kelp.common.node.OtterProject;
032:
033: // JDK
034: import java.io.File;
035:
036: //
037: public class RunParameters {
038: private OtterProject project = null;
039:
040: //
041: public RunParameters(OtterProject p) {
042: project = p;
043:
044: }
045:
046: public String getAppParameters() {
047: StringBuffer buf = new StringBuffer();
048: buf.append('\"');
049: buf.append(project.getDeployBootstrapPath());
050: buf.append('\"');
051: return buf.toString();
052: }
053:
054: public String getClasspathArg() {
055: StringBuffer buf = new StringBuffer();
056: String eRoot = new String();
057:
058: eRoot = ToolBoxInfo.getEnhydraRoot().replace('\\', '/');
059: buf.setLength(0);
060: buf.append("-classpath ");
061: buf.append('\"');
062: buf.append(eRoot);
063: buf.append("/lib/Boot.jar");
064: buf.append(File.pathSeparatorChar);
065: buf.append(eRoot);
066: buf.append("/lib/EAAL.jar");
067: buf.append('\"');
068: return buf.toString();
069: }
070:
071: public String getBootArg() {
072: StringBuffer bootPath = new StringBuffer();
073:
074: bootPath.append("-Dorg.enhydra.boot.properties="); // nores
075: bootPath.append('\"');
076: bootPath.append(project.getDeployRootPath());
077: bootPath.append(File.separator);
078: bootPath.append("boot.properties");
079: bootPath.append('\"');
080: return bootPath.toString().replace('\\', '/');
081: }
082:
083: public String getPolicyArg() {
084: StringBuffer policyPath = new StringBuffer();
085: StringBuffer buf = new StringBuffer();
086:
087: policyPath.append(PathUtil.getDeployConfPath(project));
088: policyPath.append(File.separator);
089: policyPath.append(Constants.FILE_JAVA_POLICY);
090:
091: File policy = new File(policyPath.toString().replace('\\', '/'));
092: if (!policy.exists()) {
093: policy = RunBuilder.createPolicyFile(policyPath.toString());
094: }
095:
096: buf.append("-Djava.security.policy="); // nores
097: buf.append('\"');
098: buf.append(policyPath);
099: buf.append('\"');
100: return buf.toString();
101: }
102:
103: public String getTCcpArg() {
104: StringBuffer buf = new StringBuffer();
105: String eRoot = ToolBoxInfo.getEnhydraRoot().replace('\\', '/');
106:
107: buf.append("-Dtc_path_add=");
108: buf.append('\"');
109: buf.append(eRoot);
110: buf.append("/lib/WebService.jar");
111: buf.append(File.pathSeparator);
112: buf.append(eRoot);
113: buf.append("/lib/SharedApiService.jar");
114: buf.append('\"');
115: return buf.toString();
116: }
117:
118: public String getVMParameters() {
119: StringBuffer buf = new StringBuffer();
120: buf.setLength(0);
121: buf.append(' ');
122: buf.append(getClasspathArg());
123: buf.append(' ');
124: buf.append(getTCcpArg());
125: buf.append(' ');
126: buf.append(getPolicyArg());
127: buf.append(' ');
128: buf.append(getBootArg());
129: return buf.toString();
130: }
131:
132: }
|