⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setup.jsp

📁 一个jive论坛管理的源码 学习Jive源程序
💻 JSP
字号:
<%@ page contentType="text/html;charset=GB2312" %>
<%
/**
 * $RCSfile: setup.jsp,v $
 * $Revision: 1.1.1.1 $
 * $Date: 2002/09/09 13:50:21 $
 *
 * Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
 *
 * This software is the proprietary information of CoolServlets, Inc.
 * Use is subject to license terms.
 */
%>

<%@ page import="java.io.*,
                 java.util.*,
                 java.lang.reflect.*"
%>

<%@ include file="global.jsp" %>

<%@ include file="header.jsp" %>

<table cellpadding="6" cellspacing="0" border="0" width="100%">
<tr>
<td width="1%" valign="top">
<%  // set sidebar properties
    session.setAttribute("sidebar.0.active", new Boolean(true));
    if (!GREEN.equals(getSessionString(session,"sidebar.0.light"))) {
        session.setAttribute("sidebar.0.light", YELLOW);
    }
%>
<%@ include file="sidebar.jsp" %>
</td>
<td width="99%" valign="top">

    <b>欢迎使用Jive论坛!</b>
    <hr size="0">

    <font size="-1">
    在安装继续进行前,你的服务器环境必须通过以下所有检查:
    </font>

    <ul>
    <table border="0">
    <tr><td valign=top><img src="images/check.gif" width="13" height="13"></td>
        <td>
        <font size="-1">
        安装工具检测到你正运行在
        <%= application.getServerInfo() %>上
        </font>
	    </td>
    </tr>

<%  // JDK check. See if they have Java2 or later installed by trying to
    // load java.util.HashMap.
    boolean isJDK1_2 = true;
    try {
        Class.forName("java.util.HashMap");
    }
    catch (ClassNotFoundException cnfe) {
        isJDK1_2 = false;
    }
    if (isJDK1_2) {
%>
	<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td>
        <td>
		<font size="-1">
        你的JDK版本为1.2或者更新。
        </font>
	    </td>
    </tr>
<%  }
    else {
%>
	<tr><td valign=top><img src="images/x.gif" width="13" height="13"></td>
        <td>
		<font size="-1">
        你的JDK版本好像低于JDK 1.2。因此安装不能继续。如果可能,请更新JDK版本并重新开始这个过程。
        </font>
	    </td>
    </tr>
<%  }

    // Servlet version check. The appserver must support at least support
    // the Servlet API 2.2.
    boolean servlet2_2 = true;
    try {
        Class sessionClass = session.getClass();
        Class[] setAttributeParams = new Class[1];
        setAttributeParams[0] = Class.forName("java.lang.String");
        Method getAttributeMethod = sessionClass.getMethod("getAttribute", setAttributeParams);
    }
    catch (SecurityException se) {
        // some class loaders might not let us do the reflection above, so use
        // the old method of finding the appserver version:
        servlet2_2 = application.getMajorVersion() >= 2
                        && application.getMinorVersion() >= 2;
    }
    catch (Exception e) {
        // ClassNotFoundException & MethodNotFoundException end up here.
        servlet2_2 = false;
    }
    if (servlet2_2) {
%>
	<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td>
        <td>
		<font size="-1">
        你的应用服务器支持servlet 2.2或者更新。
        </font>
	    </td>
    </tr>
<%  }
    else {
%>
	<tr><td valign=top><img src="images/x.gif" width="13" height="13"></td><td>
		<font size="-1">你的应用服务器不支持servlet 2.2或者更新。</font>
	</td></tr>
	<%
		}
	%>

	<%
		// Jive
		boolean jiveInstalled = true;
		try {  Class.forName("com.jivesoftware.forum.Forum");  }
		catch (ClassNotFoundException cnfe) {  jiveInstalled = false;  }

		// Lucene
		boolean luceneInstalled = true;
		try {  Class.forName("org.apache.lucene.document.Document");  }
		catch (ClassNotFoundException cnfe) {  luceneInstalled = false;  }

		// Lucene Chinese support
		boolean luceneChineseInstalled = true;
		try {  Class.forName("org.apache.lucene.analysis.cn.ChineseAnalyzer");  }
		catch (ClassNotFoundException cnfe) {  luceneChineseInstalled = false;  }

		// JavaMail
		boolean javaMailInstalled = true;
		try {
			Class.forName("javax.mail.Address");  // mail.jar
			Class.forName("javax.activation.DataHandler"); // activation.jar
			Class.forName("dog.mail.nntp.Newsgroup"); // nntp.jar
		}
		catch (ClassNotFoundException cnfe) {  javaMailInstalled = false;  }

		// JDBC std ext
		boolean jdbcExtInstalled = true;
		try {  Class.forName("javax.sql.DataSource");  }
		catch (ClassNotFoundException cnfe) {  jdbcExtInstalled = false;  }

		boolean filesOK = jiveInstalled && luceneInstalled && javaMailInstalled &&
				jdbcExtInstalled;
		if (filesOK) {
	%>
	<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td><td>
		<font size="-1">所有的应用程序包都安装正确。
	<%  }
		else {
	%>
	<tr><td valign=top><img src="images/x.gif" width="13" height="13"></td><td>
		<font size="-1">一个或者多个应用程序包没有被安装。
	<%  }  %>
	<%	if (luceneChineseInstalled) {
	%>
	<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td><td>
		<font size="-1">支持中文检索的lucene包安装正确。
	<%  }
		else {
	%>
	<tr><td valign=top><img src="images/x.gif" width="13" height="13"></td><td>
		<font size="-1">中文检索支持lucene包安装不正确,这不会影响论坛的基本使用,但是不能进行中文的检索甚至在进行中文检索时会出现错误!推荐你升级你的lucene包。
	<%  }  %>

	<ul>
		 	<img src="images/<%= jiveInstalled?"check.gif":"x.gif" %>" width="13" height="13">
			Jive论坛内核 (jive.jar)
		<br> <img src="images/<%= luceneInstalled?"check.gif":"x.gif" %>" width="13" height="13">
			文本搜索引擎Lucene (lucene.jar)(中文支持)
		<br> <img src="images/<%= javaMailInstalled?"check.gif":"x.gif" %>" width="13" height="13">
			JavaMail和NNTP支持 (mail.jar, activation.jar, nntp.jar)
		<br> <img src="images/<%= jdbcExtInstalled?"check.gif":"x.gif" %>" width="13" height="13">
			JDBC 2.0 扩展 (jdbc2_0-stdext.jar)
	</ul>
	</font>
	</td></tr>

	<%
		//Check the status of JiveHome

		boolean propError = false;
		String errorMessage = null;
		String jiveHome = null;
		try {
			Class jiveGlobals = Class.forName("com.jivesoftware.forum.JiveGlobals");

			Method getJiveHome = jiveGlobals.getMethod("getJiveHome", null);
			jiveHome = (String)getJiveHome.invoke(null, null);
			if (jiveHome != null) {
                // See if the jiveHome directory actually exists
                try {
                    File file = new File(jiveHome);
                    if (!file.exists()) {
                        propError = true;
                        errorMessage = "目录 <tt>" + jiveHome + "</tt> " +
                            "不存在。请编辑 <tt>jive_init.properties</tt> 文件" +
                            "指定正确的jiveHome目录。";
                    }
                }
                catch (Exception e) {}
                if (!propError) {
    				// See if jiveHome is readable and writable.
    				Method jiveHomeReadable = jiveGlobals.getMethod("isJiveHomeReadable", null);
    				boolean readable = ((Boolean)jiveHomeReadable.invoke(null, null)).booleanValue();
    				if (!readable) {
    					propError = true;
    					errorMessage = "<tt>jiveHome</tt> 存在于<tt>" + jiveHome +
    					"</tt>, 但是你的应用服务器没有对它的读权限。请设置目录的权限修正此问题。";
    				}
    				Method jiveHomeWritable = jiveGlobals.getMethod("isJiveHomeWritable", null);
    				boolean writable = ((Boolean)jiveHomeWritable.invoke(null, null)).booleanValue();
    				if (!writable) {
    					propError = true;
    					errorMessage =  "<tt>jiveHome</tt> 存在于<tt>" + jiveHome +
    					"</tt>, 但是你的应用服务器没有对它的写权限。请设置目录的权限修正此问题。";
    				}
    				// Jive Home appears to exist and to be setup correctly. Make sure that all of the proper sub-dirs exist
    				// or create them as necessary.
    				File homeFile = new File(jiveHome);
    				String [] subDirs = new String [] { "search", "logs", "data" };
    				for (int i=0; i<subDirs.length; i++) {
    					File subDir = new File(jiveHome, subDirs[i]);
    					if (!subDir.exists()) {
    						subDir.mkdir();
    					}
    				}
                }
	    	}
        	else {
           		propError = true;
           		errorMessage = "<tt>jiveHome</tt> 目录设置不正确。请参考安装文档正确设置 <tt>jive_init.properties</tt> 文件中的值。";
        	}
		}
		catch (Exception e) {
			e.printStackTrace();
			propError = true;
           	errorMessage = "检查<tt>jiveHome</tt>目录时发生异常。" +
				"请确认你安装的是最新的Jive论坛";
		}
		if (!propError) {
	%>
	<tr><td valign=top><img src="images/check.gif" width="13" height="13"></td><td>
		<tt>jiveHome</tt> <font size="-1">目录正确配置于: </font><tt><%= jiveHome %></tt>.
	</td></tr>
	<%
		}
		else {
	%>
	<tr><td valign=top><img src="images/x.gif" width="13" height="13"></td><td>
		<font size="-1"><%= errorMessage %><font>
	</td></tr>
	<%
		}
	%>

</table>
</ul>

<%
	if (propError || !filesOK || !isJDK1_2 || !servlet2_2) {
%>
	<font color="red" size="-1"><b>安装初始化检查过程中发现错误,请更正,然后重新启动服务器重新开始安装过程。</b></font>
<%
	}
	else {
        // everything is ok, so update the sidebar variables in the session:
        session.setAttribute("sidebar.0.light", GREEN);
%>
</font>

    <form action="setup2.jsp">
    <hr size="0">
    <div align="center">
    <input type="submit" value="继续">
    </form>
    </div>
<%
	}
%>

<%@ include file="footer.jsp" %>

</td>
</tr>
</table>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -