1 23 package org.enhydra.kelp.common.deployer; 24 25 import org.enhydra.tool.ToolBoxInfo; 27 28 import org.enhydra.kelp.common.Constants; 30 import org.enhydra.kelp.common.PathUtil; 31 import org.enhydra.kelp.common.node.OtterProject; 32 33 import java.io.File ; 35 36 public class RunParameters { 38 private OtterProject project = null; 39 private boolean is3 = false; 40 41 public RunParameters(OtterProject p) { 43 project = p; 44 is3 = ToolBoxInfo.isEnhydra3(); 45 46 } 47 48 public String getAppParameters() { 49 StringBuffer buf = new StringBuffer (); 50 buf.append('\"'); 51 buf.append(project.getDeployBootstrapPath()); 52 buf.append('\"'); 53 return buf.toString(); 54 } 55 56 public String getClasspathArg() 57 { 58 if (is3) { 59 return ""; 60 } 61 else { 62 StringBuffer buf = new StringBuffer (); 63 String eRoot = new String (); 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 getBootArg() { 80 if (is3) { 81 return ""; 82 } else { 83 StringBuffer bootPath = new StringBuffer (); 84 85 bootPath.append("-Dorg.enhydra.boot.properties="); 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 = RunBuilder.createPolicyFile(policyPath.toString()); 109 } 110 111 buf.append("-Djava.security.policy="); buf.append('\"'); 113 buf.append(policyPath); 114 buf.append('\"'); 115 return buf.toString(); 116 } 117 } 118 119 public String getTCcpArg() { 120 if (is3) { 121 return ""; 122 } else { 123 StringBuffer buf = new StringBuffer (); 124 String 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 getVMParameters() { 138 StringBuffer buf = new StringBuffer (); 139 140 if (is3) { 141 buf.setLength(0); 144 buf.append(' '); 145 buf.append("-Denhydra.home="+ToolBoxInfo.getEnhydraRoot().replace('\\', '/')); 146 return buf.toString(); 147 } else { 150 buf.setLength(0); 151 buf.append(' '); 152 buf.append(getClasspathArg()); 153 buf.append(' '); 154 buf.append(getTCcpArg()); 155 buf.append(' '); 156 buf.append(getPolicyArg()); 157 buf.append(' '); 158 buf.append(getBootArg()); 159 } 160 return buf.toString(); 161 } 162 163 } 164 | Popular Tags |