setup-env-check.jspf 6.53 KB
Newer Older
1
<%--
2

3
  -	$RCSfile$
4

5
  -	$Revision$
6

7
  -	$Date$
8

9 10
--%>

11 12


13
<%@ page import="java.lang.reflect.Method,
14

15
                 java.io.File,
16

17
                 org.jivesoftware.util.LocaleUtils" %>
18

19 20


Bill Lynch's avatar
Bill Lynch committed
21
<%-- note, the loadClass method is defined in setup-global.jspf --%>
22

23 24


25 26
<%  // Check the user's environment for minimum requirements.

27 28


29
    boolean jdk13Installed = false;
30

31
    boolean servlet22Installed = false;
32

33
    boolean jsp11Installed = false;
34

35
    boolean jiveJarsInstalled = false;
36

Matt Tucker's avatar
Matt Tucker committed
37
    boolean messengerHomeExists = false;
38

Matt Tucker's avatar
Matt Tucker committed
39
    File messengerHome = null;
40

41 42


Bill Lynch's avatar
Bill Lynch committed
43
    // Check for JDK 1.5
44

Bill Lynch's avatar
Bill Lynch committed
45
    try {
46

Bill Lynch's avatar
Bill Lynch committed
47
        loadClass("java.util.concurrent.ConcurrentHashMap");
48

Bill Lynch's avatar
Bill Lynch committed
49
        jdk13Installed = true;
50

Bill Lynch's avatar
Bill Lynch committed
51
    }
52

Bill Lynch's avatar
Bill Lynch committed
53
    catch (ClassNotFoundException cnfe) {}
54

Bill Lynch's avatar
Bill Lynch committed
55
    // Check for Servlet 2.3:
56

Bill Lynch's avatar
Bill Lynch committed
57
    try {
58

Bill Lynch's avatar
Bill Lynch committed
59
        Class c = loadClass("javax.servlet.http.HttpSession");
60

Bill Lynch's avatar
Bill Lynch committed
61
        Method m = c.getMethod("getAttribute",new Class[]{String.class});
62

Bill Lynch's avatar
Bill Lynch committed
63
        servlet22Installed = true;
64

Bill Lynch's avatar
Bill Lynch committed
65
    }
66

Bill Lynch's avatar
Bill Lynch committed
67
    catch (ClassNotFoundException cnfe) {}
68

Bill Lynch's avatar
Bill Lynch committed
69
    // Check for JSP 1.1:
70

Bill Lynch's avatar
Bill Lynch committed
71
    try {
72

Bill Lynch's avatar
Bill Lynch committed
73
        loadClass("javax.servlet.jsp.tagext.Tag");
74

Bill Lynch's avatar
Bill Lynch committed
75
        jsp11Installed = true;
76

Bill Lynch's avatar
Bill Lynch committed
77
    }
78

Bill Lynch's avatar
Bill Lynch committed
79
    catch (ClassNotFoundException cnfe) {}
80

Bill Lynch's avatar
Bill Lynch committed
81
    // Check that the Messenger jar are installed:
82

Bill Lynch's avatar
Bill Lynch committed
83
    try {
84

Matt Tucker's avatar
Matt Tucker committed
85
        loadClass("org.jivesoftware.messenger.XMPPServer");
86

Bill Lynch's avatar
Bill Lynch committed
87
        jiveJarsInstalled = true;
88

Bill Lynch's avatar
Bill Lynch committed
89
    }
90

Bill Lynch's avatar
Bill Lynch committed
91
    catch (ClassNotFoundException cnfe) {}
92

93 94


95
    // Try to determine what the jiveHome directory is:
96

Bill Lynch's avatar
Bill Lynch committed
97
    try {
98 99 100 101 102

        Class jiveGlobalsClass = loadClass("org.jivesoftware.util.JiveGlobals");

        Method getMessengerHomeMethod = jiveGlobalsClass.getMethod("getHomeDirectory", (Class[])null);

Matt Tucker's avatar
Matt Tucker committed
103
        String messengerHomeProp = (String)getMessengerHomeMethod.invoke(jiveGlobalsClass, (Object[])null);
104

Matt Tucker's avatar
Matt Tucker committed
105
        if (messengerHomeProp != null) {
106

Matt Tucker's avatar
Matt Tucker committed
107
            messengerHome = new File(messengerHomeProp);
108

Matt Tucker's avatar
Matt Tucker committed
109
            if (messengerHome.exists()) {
110

Matt Tucker's avatar
Matt Tucker committed
111
                messengerHomeExists = true;
112

Bill Lynch's avatar
Bill Lynch committed
113
            }
114

Bill Lynch's avatar
Bill Lynch committed
115
        }
116

Bill Lynch's avatar
Bill Lynch committed
117
    }
118

Bill Lynch's avatar
Bill Lynch committed
119
    catch (Exception e) {
120

Bill Lynch's avatar
Bill Lynch committed
121
        e.printStackTrace();
122

Bill Lynch's avatar
Bill Lynch committed
123
    }
124

125 126


127
    // If there were no errors, redirect to the main setup page
128

129
    if (!jdk13Installed || !servlet22Installed || !jsp11Installed || !jiveJarsInstalled
130

Matt Tucker's avatar
Matt Tucker committed
131
            || !messengerHomeExists)
132

133
    {
134

135
%>
136

137
        <html>
138

139
        <head>
140

Matt Tucker's avatar
Matt Tucker committed
141
            <title><fmt:message key="title" /> <fmt:message key="setup.title" /></title>
142

143
            <link rel="stylesheet" type="text/css" href="style.css">
144

145
        </head>
146

147 148
        <body>

149 150


151
        <p class="jive-setup-page-header">
152

Matt Tucker's avatar
Matt Tucker committed
153
        <fmt:message key="title" /> <fmt:message key="setup.title" />
154

155 156
        </p>

157 158


159
        <p class="jive-setup-error-text">
160

Matt Tucker's avatar
Matt Tucker committed
161
        <fmt:message key="setup.env.check.error" /> <fmt:message key="title" /> <fmt:message key="setup.title" />.
162

163 164
        </p>

165 166


167
        <p>
168

169
        <fmt:message key="setup.env.check.error_info">
170

171
            <fmt:param value="<%= LocaleUtils.getLocalizedString("title") %>" />
172

173
        </fmt:message>
174

175 176
        </p>

177 178


179
        <ul>
180

181
        <table cellpadding="3" cellspacing="2" border="0">
182

183 184
        <%  if (jdk13Installed) { %>

185 186


187
            <tr>
188

189
                <td><img src="images/check.gif" width="13" height="13" border="0"></td>
190

191
                <td>
192

193
                    <fmt:message key="setup.env.check.jdk" />
194

195
                </td>
196

197 198
            </tr>

199 200


201 202
        <%  } else { %>

203 204


205
            <tr>
206

207
                <td><img src="images/x.gif" width="13" height="13" border="0"></td>
208

209
                <td>
210

211
                    <span class="jive-setup-error-text">
212

213
                    <fmt:message key="setup.env.check.jdk" />
214

215
                    </span>
216

217
                </td>
218

219 220
            </tr>

221 222


223
        <%  }
224

225
            if (servlet22Installed) {
226

227
        %>
228

229
            <tr>
230

231
                <td><img src="images/check.gif" width="13" height="13" border="0"></td>
232

233
                <td>
234

235
                    <fmt:message key="setup.env.check.servlet" />
236

237
                </td>
238

239 240
            </tr>

241 242


243 244
        <%  } else { %>

245 246


247
            <tr>
248

249
                <td><img src="images/x.gif" width="13" height="13" border="0"></td>
250

251
                <td>
252

253
                    <span class="jive-setup-error-text">
254

255
                    <fmt:message key="setup.env.check.servlet" />
256

257
                    </span>
258

259
                </td>
260

261 262
            </tr>

263 264


265
        <%  }
266

267
            if (jsp11Installed) {
268

269
        %>
270

271
            <tr>
272

273
                <td><img src="images/check.gif" width="13" height="13" border="0"></td>
274

275
                <td>
276

277
                    <fmt:message key="setup.env.check.jsp" />
278

279
                </td>
280

281 282
            </tr>

283 284


285 286
        <%  } else { %>

287 288


289
            <tr>
290

291
                <td><img src="images/x.gif" width="13" height="13" border="0"></td>
292

293
                <td>
294

295
                    <span class="jive-setup-error-text">
296

297
                    <fmt:message key="setup.env.check.jsp" />
298

299
                    </span>
300

301
                </td>
302

303 304
            </tr>

305 306


307
        <%  }
308

309
            if (jiveJarsInstalled) {
310

311
        %>
312

313
            <tr>
314

315
                <td><img src="images/check.gif" width="13" height="13" border="0"></td>
316

317
                <td>
318

319
                    <fmt:message key="title" /> <fmt:message key="setup.env.check.class" />
320

321
                </td>
322

323 324
            </tr>

325 326


327 328
        <%  } else { %>

329 330


331
            <tr>
332

333
                <td><img src="images/x.gif" width="13" height="13" border="0"></td>
334

335
                <td>
336

337
                    <span class="jive-setup-error-text">
338

339
                    <fmt:message key="title" /> <fmt:message key="setup.env.check.class" />
340

341
                    </span>
342

343
                </td>
344

345 346
            </tr>

347 348


349
        <%  }
350

Matt Tucker's avatar
Matt Tucker committed
351
            if (messengerHomeExists) {
352

353
        %>
354

355
            <tr>
356

357
                <td><img src="images/x.gif" width="13" height="13" border="0"></td>
358

359
                <td>
360

361
                    <span class="jive-setup-error-text">
362

363
                    <fmt:message key="setup.env.check.jive" /> (<%= messengerHome.toString() %>)
364

365
                    </span>
366

367
                </td>
368

369 370
            </tr>

371 372


373 374
        <%  } else { %>

375 376


377
            <tr>
378

379
                <td><img src="images/x.gif" width="13" height="13" border="0"></td>
380

381
                <td>
382

383
                    <span class="jive-setup-error-text">
384

385
                    <fmt:message key="setup.env.check.not_home" />
386

387
                    </span>
388

389
                </td>
390

391 392
            </tr>

393 394


395
        <%  } %>
396

397
        </table>
398

399 400
        </ul>

401 402


403
        <p>
404

405
        <fmt:message key="setup.env.check.doc" />
406

407 408
        </p>

409 410


411
        </body>
412

413 414
        </html>

415 416


417
<%      // return so we stop showing the page:
418

419
        return;
420

421
    }
422

423
%>