setup-env-check.jspf 6.63 KB
Newer Older
1 2 3 4 5 6 7 8 9
<%--
  -	$RCSfile$
  -	$Revision: 1217 $
  -	$Date: 2005-04-11 14:11:06 -0700 (Mon, 11 Apr 2005) $
--%>

<%@ page import="java.lang.reflect.Method,
                 java.io.File,
                 org.jivesoftware.util.LocaleUtils" %>
10
<%@ page import="org.jivesoftware.util.ClassUtils"%>
11 12 13 14 15 16 17

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

    boolean jdk13Installed = false;
    boolean servlet22Installed = false;
    boolean jsp11Installed = false;
    boolean jiveJarsInstalled = false;
18 19
    boolean wildfireHomeExists = false;
    File wildfireHome = null;
20 21 22

    // Check for JDK 1.5
    try {
23
        ClassUtils.forName("java.util.concurrent.ConcurrentHashMap");
24 25 26 27 28
        jdk13Installed = true;
    }
    catch (ClassNotFoundException cnfe) {}
    // Check for Servlet 2.3:
    try {
29
        Class c = ClassUtils.forName("javax.servlet.http.HttpSession");
30 31 32 33 34 35
        Method m = c.getMethod("getAttribute",new Class[]{String.class});
        servlet22Installed = true;
    }
    catch (ClassNotFoundException cnfe) {}
    // Check for JSP 1.1:
    try {
36
        ClassUtils.forName("javax.servlet.jsp.tagext.Tag");
37 38 39
        jsp11Installed = true;
    }
    catch (ClassNotFoundException cnfe) {}
40
    // Check that the Wildfire jar are installed:
41
    try {
42
        ClassUtils.forName("org.jivesoftware.wildfire.XMPPServer");
43 44 45 46 47 48
        jiveJarsInstalled = true;
    }
    catch (ClassNotFoundException cnfe) {}

    // Try to determine what the jiveHome directory is:
    try {
49
        Class jiveGlobalsClass = ClassUtils.forName("org.jivesoftware.util.JiveGlobals");
50 51 52 53 54 55
        Method getWildfireHomeMethod = jiveGlobalsClass.getMethod("getHomeDirectory", (Class[])null);
        String wildfireHomeProp = (String)getWildfireHomeMethod.invoke(jiveGlobalsClass, (Object[])null);
        if (wildfireHomeProp != null) {
            wildfireHome = new File(wildfireHomeProp);
            if (wildfireHome.exists()) {
                wildfireHomeExists = true;
56 57 58 59 60 61 62 63 64
            }
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }

    // If there were no errors, redirect to the main setup page
    if (!jdk13Installed || !servlet22Installed || !jsp11Installed || !jiveJarsInstalled
65
            || !wildfireHomeExists)
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
    {
%>
        <html>
        <head>
            <title><fmt:message key="title" /> <fmt:message key="setup.title" /></title>
            <link rel="stylesheet" type="text/css" href="style.css">
        </head>
        <body>

        <p class="jive-setup-page-header">
        <fmt:message key="title" /> <fmt:message key="setup.title" />
        </p>

        <p class="jive-setup-error-text">
        <fmt:message key="setup.env.check.error" /> <fmt:message key="title" /> <fmt:message key="setup.title" />.
        </p>

        <p>
        <fmt:message key="setup.env.check.error_info">
            <fmt:param value="<%= LocaleUtils.getLocalizedString("title") %>" />
        </fmt:message>
        </p>

        <ul>
        <table cellpadding="3" cellspacing="2" border="0">
        <%  if (jdk13Installed) { %>

            <tr>
                <td><img src="../images/check.gif" width="13" height="13" border="0"></td>
                <td>
                    <fmt:message key="setup.env.check.jdk" />
                </td>
            </tr>

        <%  } else { %>

            <tr>
                <td><img src="../images/x.gif" width="13" height="13" border="0"></td>
                <td>
                    <span class="jive-setup-error-text">
                    <fmt:message key="setup.env.check.jdk" />
                    </span>
                </td>
            </tr>

        <%  }
            if (servlet22Installed) {
        %>
            <tr>
                <td><img src="../images/check.gif" width="13" height="13" border="0"></td>
                <td>
                    <fmt:message key="setup.env.check.servlet" />
                </td>
            </tr>

        <%  } else { %>

            <tr>
                <td><img src="../images/x.gif" width="13" height="13" border="0"></td>
                <td>
                    <span class="jive-setup-error-text">
                    <fmt:message key="setup.env.check.servlet" />
                    </span>
                </td>
            </tr>

        <%  }
            if (jsp11Installed) {
        %>
            <tr>
                <td><img src="../images/check.gif" width="13" height="13" border="0"></td>
                <td>
                    <fmt:message key="setup.env.check.jsp" />
                </td>
            </tr>

        <%  } else { %>

            <tr>
                <td><img src="../images/x.gif" width="13" height="13" border="0"></td>
                <td>
                    <span class="jive-setup-error-text">
                    <fmt:message key="setup.env.check.jsp" />
                    </span>
                </td>
            </tr>

        <%  }
            if (jiveJarsInstalled) {
        %>
            <tr>
                <td><img src="../images/check.gif" width="13" height="13" border="0"></td>
                <td>
                    <fmt:message key="title" /> <fmt:message key="setup.env.check.class" />
                </td>
            </tr>

        <%  } else { %>

            <tr>
                <td><img src="../images/x.gif" width="13" height="13" border="0"></td>
                <td>
                    <span class="jive-setup-error-text">
                    <fmt:message key="title" /> <fmt:message key="setup.env.check.class" />
                    </span>
                </td>
            </tr>

        <%  }
175
            if (wildfireHomeExists) {
176 177 178 179 180
        %>
            <tr>
                <td><img src="../images/x.gif" width="13" height="13" border="0"></td>
                <td>
                    <span class="jive-setup-error-text">
181
                    <fmt:message key="setup.env.check.jive" /> (<%= wildfireHome.toString() %>)
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
                    </span>
                </td>
            </tr>

        <%  } else { %>

            <tr>
                <td><img src="../images/x.gif" width="13" height="13" border="0"></td>
                <td>
                    <span class="jive-setup-error-text">
                    <fmt:message key="setup.env.check.not_home" />
                    </span>
                </td>
            </tr>

        <%  } %>
        </table>
        </ul>

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

        </body>
        </html>

<%      // return so we stop showing the page:
        return;
    }
211
%>