KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > bull > eclipse > jonas > Jonas30Bootstrap


1 package com.bull.eclipse.jonas;
2
3 /*
4  * (c) Copyright Bull SA 2003.
5  * All Rights Reserved.
6  */

7
8 import java.io.File JavaDoc;
9 import java.util.Vector JavaDoc;
10
11 import org.eclipse.core.runtime.IPath;
12 import org.eclipse.core.runtime.Path;
13
14 import com.bull.eclipse.jonas.utils.TemplateDirUtil;
15 import com.bull.eclipse.jonas.utils.VMLauncherUtility;
16
17
18 /**
19  * See %JONAS_ROOT/bin/nt/jonas.bat
20  */

21 public class Jonas30Bootstrap extends JonasBootstrap {
22     
23     private String JavaDoc startCommand = "org.objectweb.jonas.server.Server";
24     private String JavaDoc adminCommand = "org.objectweb.jonas.adm.JonasAdmin";
25     private String JavaDoc mainClass = "org.objectweb.jonas.server.Bootstrap";
26     /*
27      * @see JonasBootstrap#getClasspath()
28      */

29     public String JavaDoc[] getClasspath() {
30         String JavaDoc[] classpath = new String JavaDoc[4];
31         classpath[0] = getJonasDir() + File.separator + "lib" + File.separator + "common" + File.separator + "ow_jonas_bootstrap.jar";
32         // Add tools.jar JDK file to classpath
33
String JavaDoc toolsJarLocation = VMLauncherUtility.getVMInstall().getInstallLocation() + File.separator + "lib" + File.separator + "tools.jar";
34         classpath[1] = toolsJarLocation;
35         String JavaDoc templateDir = TemplateDirUtil.getTemplateDir();
36         classpath[2] = templateDir;
37         String JavaDoc jonasConfig = getJonasDir() + File.separator + "conf";
38         classpath[3] = jonasConfig;
39
40         return classpath;
41     }
42
43
44     /*
45      * @see JonasBootstrap#getMainClass()
46      */

47     public String JavaDoc getMainClass() {
48         return mainClass;
49     }
50
51     /*
52      * @see JonasBootstrap#getStartCommand()
53      */

54     public String JavaDoc getStartCommand() {
55         return startCommand;
56     }
57
58     /*
59      * @see JonasBootstrap#getStopCommand()
60      */

61     public String JavaDoc getStopCommand() {
62         return adminCommand;
63
64     }
65
66     public String JavaDoc getAdminCommand() {
67         return adminCommand;
68
69     }
70
71     public String JavaDoc[] getPrgArgs(String JavaDoc command,String JavaDoc[] options) {
72         if ((command.equals(adminCommand)) && (options == null)) {
73             String JavaDoc[] prgArgs = new String JavaDoc[2];
74             prgArgs[0] = command;
75             prgArgs[1] = "-s";
76             return prgArgs;
77         } else {
78             if (options != null) {
79                 int nbOptions = options.length;
80                 String JavaDoc [] prgArgs = new String JavaDoc[nbOptions + 1];
81                 prgArgs[0] = adminCommand;
82                 for (int i=1; i<=nbOptions; i++) {
83                     prgArgs[i] = options[i];
84                 }
85                 return prgArgs;
86             } else {
87                 String JavaDoc[] prgArgs = new String JavaDoc[1];
88                 prgArgs[0] = command;
89                 return prgArgs;
90             }
91         }
92     
93         
94     }
95
96
97     /*
98      * @see JonasBootstrap#getVmArgs()
99      */

100     public String JavaDoc[] getVmArgs() {
101         String JavaDoc[] vmArgs = new String JavaDoc[6];
102         
103         vmArgs[0] = "-Dinstall.root=" + getJonasDir();
104     
105         vmArgs[1] = "-Djava.security.policy=" + getJonasDir() + File.separator + "conf" + File.separator + "java.policy";
106         vmArgs[2] = "-Dobjectweb.orb=" + getOrb();
107         vmArgs[3] = "-Djonas.base=" + getBaseDir();
108         vmArgs[4] = "-Djonas.classpath=" + getXtraClasspath();
109         vmArgs[5] = "-Djonas.default.classloader=true";
110                     
111         return vmArgs;
112     }
113
114     
115     /**
116      * @see JonasBootstrap#getLabel()
117      */

118     public String JavaDoc getLabel() {
119         return "Jonas 3.0.x";
120     }
121
122     
123     /**
124      * @see JonasBootstrap#getJonasJEREMIEJarPath()
125      */

126     public Vector JavaDoc getJonasJarPath() {
127         Vector JavaDoc vec = new Vector JavaDoc();
128         IPath libPath = null;
129         if (getOrb().equals("RMI")) {
130             libPath = new Path("lib").append("RMI_jonas.jar");
131             vec.add(libPath);
132             return vec;
133         }
134         else {
135             libPath = new Path("lib").append("JEREMIE_jonas.jar");
136             vec.add(libPath);
137             return vec;
138         }
139     }
140
141     /**
142      * @see JonasBootstrap#getJonasWebJarPath()
143      */

144     public Vector JavaDoc getJonasWebJarPath() {
145         Vector JavaDoc vec = new Vector JavaDoc();
146         IPath libPath = new Path("lib").append("web_catalina.jar");
147         vec.add(libPath);
148         
149         return vec;
150     }}
151
152
Popular Tags