01: /* Copyright 2005 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.tools.checks;
07:
08: /**
09: * Checks the Xalan version against a configured value.
10: *
11: * @version $Revision: 35833 $ $Date: 2005-05-19 18:51:40 -0700 (Thu, 19 May 2005) $
12: * @since uPortal 2.5
13: */
14: public class XalanVersionCheck implements ICheck {
15:
16: /**
17: * The version for which we will check.
18: */
19: private final String desiredVersion;
20:
21: public XalanVersionCheck(String desiredVersion) {
22: if (desiredVersion == null) {
23: throw new IllegalArgumentException(
24: "XalanVersionCheck requires a particular version String to check for.");
25: }
26: this .desiredVersion = desiredVersion;
27: }
28:
29: public CheckResult doCheck() {
30:
31: CheckResult result;
32:
33: try {
34: String versionFound = org.apache.xalan.Version.getVersion();
35: if (this .desiredVersion.equals(versionFound)) {
36: result = CheckResult.createSuccess("Xalan version ["
37: + versionFound + "] is present.");
38: } else {
39: result = CheckResult
40: .createFailure(
41: "Xalan version ["
42: + versionFound
43: + "] is present, rather than the desired version ["
44: + this .desiredVersion + "]",
45: "Install the Xalan jar corresponding to ["
46: + this .desiredVersion
47: + "] in the /endorsed/lib/ directory of the JRE.");
48: }
49: } catch (NoClassDefFoundError ncdfe) {
50: result = CheckResult
51: .createFailure(
52: "Class org.apache.xalan.Version could not be found.",
53: "Install the xalan jar corresponding to ["
54: + this .desiredVersion
55: + "] in the /lib/endorsed directory of the JRE.");
56: }
57:
58: return result;
59: }
60:
61: public String getDescription() {
62: return "Check that the version of Xalan present is ["
63: + this .desiredVersion + "]";
64: }
65:
66: }
|