KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > tools > searchindex > CmsIndexingReport


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/searchindex/CmsIndexingReport.java,v $
3  * Date : $Date: 2006/03/27 14:52:21 $
4  * Version: $Revision: 1.8 $
5  *
6  * This program is part of the Alkacon OpenCms Software library.
7  *
8  * This license applies to all programs, pages, Java classes, parts and
9  * modules of the Alkacon OpenCms Software library published by
10  * Alkacon Software GmbH, unless otherwise noted.
11  *
12  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com) (http://www.alkacon.com)
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or (at
17  * your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  * General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27  *
28  * For further information about Alkacon Software GmbH, please see the
29  * companys website: http://www.alkacon.com.
30  *
31  * For further information about OpenCms, please see the OpenCms project
32  * website: http://www.opencms.org.
33  *
34  * The names "Alkacon", "Alkacon Software GmbH" and "OpenCms" must not be used
35  * to endorse or promote products derived from this software without prior
36  * written permission. For written permission, please contact info@alkacon.com.
37  *
38  * Products derived from this software may not be called "Alkacon",
39  * "Alkacon Software GmbH" or "OpenCms", nor may "Alkacon", "Alkacon Software GmbH"
40  * or "OpenCms" appear in their name, without prior written permission of
41  * Alkacon Software GmbH.
42  *
43  * This program is also available under a commercial non-GPL license. For
44  * pricing and ordering information, please inquire at sales@alkacon.com.
45  */

46
47 package org.opencms.workplace.tools.searchindex;
48
49 import org.opencms.jsp.CmsJspActionElement;
50 import org.opencms.workplace.CmsReport;
51 import org.opencms.workplace.CmsWorkplaceSettings;
52
53 import javax.servlet.http.HttpServletRequest JavaDoc;
54 import javax.servlet.http.HttpServletResponse JavaDoc;
55 import javax.servlet.jsp.JspException JavaDoc;
56 import javax.servlet.jsp.PageContext JavaDoc;
57
58 /**
59  * Implements methods for <code>CmsReport</code> to display the indexing progress.<p>
60  *
61  * @author Carsten Weinholz
62  *
63  * @version $Revision: 1.8 $
64  *
65  * @since 6.0.0
66  */

67 public class CmsIndexingReport extends CmsReport {
68
69     /** Postfix for error.message dialog keys in the resource bundle.<p> */
70     public static final String JavaDoc DIALOG_TYPE = "indexing";
71
72     /**
73      * Public constructor.<p>
74      *
75      * @param jsp an initialized JSP action element
76      */

77     public CmsIndexingReport(CmsJspActionElement jsp) {
78
79         super(jsp);
80     }
81
82     /**
83      * Public constructor with JSP variables.<p>
84      *
85      * @param context the JSP page context
86      * @param req the JSP request
87      * @param res the JSP response
88      */

89     public CmsIndexingReport(PageContext JavaDoc context, HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res) {
90
91         this(new CmsJspActionElement(context, req, res));
92     }
93
94     /**
95      * Performs the report, will be called by the JSP page.<p>
96      *
97      * @throws JspException if problems including sub-elements occur
98      */

99     public void actionReport() throws JspException JavaDoc {
100
101         // save initialized instance of this class in request attribute for included sub-elements
102
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
103         switch (getAction()) {
104             case ACTION_REPORT_UPDATE:
105                 setParamAction(REPORT_UPDATE);
106                 getJsp().include(FILE_REPORT_OUTPUT);
107                 break;
108             case ACTION_REPORT_BEGIN:
109             case ACTION_CONFIRMED:
110             default:
111
112                 CmsIndexingReportThread thread = new CmsIndexingReportThread(getCms(), null);
113                 setParamAction(REPORT_BEGIN);
114                 setParamThread(thread.getUUID().toString());
115                 getJsp().include(FILE_REPORT_OUTPUT);
116                 break;
117         }
118     }
119
120     /**
121      * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
122      */

123     protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest JavaDoc request) {
124
125         // fill the parameter values in the get/set methods
126
fillParamValues(request);
127         // set the dialog type
128
setParamDialogtype(DIALOG_TYPE);
129         // set the action for the JSP switch
130
if (DIALOG_CONFIRMED.equals(getParamAction())) {
131             setAction(ACTION_CONFIRMED);
132         } else if (REPORT_UPDATE.equals(getParamAction())) {
133             setAction(ACTION_REPORT_UPDATE);
134         } else if (REPORT_BEGIN.equals(getParamAction())) {
135             setAction(ACTION_REPORT_BEGIN);
136         } else if (REPORT_END.equals(getParamAction())) {
137             setAction(ACTION_REPORT_END);
138         } else if (DIALOG_CANCEL.equals(getParamAction())) {
139             setAction(ACTION_CANCEL);
140         } else {
141             setAction(ACTION_DEFAULT);
142             // add the title for the dialog
143
setParamTitle(key("title." + getParamDialogtype()));
144         }
145     }
146
147 }
Popular Tags