KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > report > I_CmsReport


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/report/I_CmsReport.java,v $
3  * Date : $Date: 2006/10/04 07:35:21 $
4  * Version: $Revision: 1.28 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.report;
33
34 import org.opencms.i18n.CmsMessageContainer;
35
36 import java.util.List JavaDoc;
37 import java.util.Locale JavaDoc;
38
39 /**
40  * This is the interface for the report classes which are used for the output
41  * during operations that run on a spearate Thread in OpenCms,
42  * like publish, import, export etc.<p>
43  *
44  * @author Alexander Kandzior
45  * @author Jan Baudisch
46  * @author Peter Bonrad
47  *
48  * @version $Revision: 1.28 $
49  *
50  * @since 6.0.0
51  */

52 public interface I_CmsReport {
53
54     /** Indicates default formatting. */
55     int FORMAT_DEFAULT = 0;
56
57     /** Indicates error formatting. */
58     int FORMAT_ERROR = 5;
59
60     /** Indicates headline formatting. */
61     int FORMAT_HEADLINE = 2;
62
63     /** Indicates note formatting. */
64     int FORMAT_NOTE = 3;
65
66     /** Indicates OK formatting. */
67     int FORMAT_OK = 4;
68
69     /** Indicates warning formatting. */
70     int FORMAT_WARNING = 1;
71
72     /** Request parameter value that this report should create an "extended" output. */
73     String JavaDoc REPORT_TYPE_EXTENDED = "extended";
74
75     /** Request parameter value that this report should create a "simple" output. */
76     String JavaDoc REPORT_TYPE_SIMPLE = "simple";
77
78     /**
79      * Adds an error object to the list of errors that occured during the report.<p>
80      *
81      * @param obj the error object
82      */

83     void addError(Object JavaDoc obj);
84
85     /**
86      * Adds a warning object to the list of warnings that occured during the report.<p>
87      *
88      * @param obj the error object
89      */

90     void addWarning(Object JavaDoc obj);
91
92     /**
93      * Formats the runtime formatted as "hh:mm:ss".<p>
94      *
95      * @return the runtime formatted as "hh:mm:ss"
96      */

97     String JavaDoc formatRuntime();
98
99     /**
100      * Returns a list of all errors that occured during the report.<p>
101      *
102      * @return an error list that occured during the report
103      */

104     List JavaDoc getErrors();
105
106     /**
107      * Returns the locale this report was initialized with.<p>
108      *
109      * @return the locale this report was initialized with
110      */

111     Locale JavaDoc getLocale();
112
113     /**
114      * Updates this report, this processes all new output added since
115      * the last call to this method.<p>
116      *
117      * This is only required in case the output is written to a HTML page,
118      * if the shell output is used, this will just return an empty String.<p>
119      *
120      * @return new elements that have been added to the report and not yet processed.
121      */

122     String JavaDoc getReportUpdate();
123
124     /**
125      * Returns the time this report has been running.<p>
126      *
127      * @return the time this report has been running
128      */

129     long getRuntime();
130
131     /**
132      * Returns the original site root of the user who started this report,
133      * or <code>null</code> if the original site root has not been set.<p>
134      *
135      * @return the original site root of the user who started this report
136      */

137     String JavaDoc getSiteRoot();
138
139     /**
140      * Returns a list of all warnings that occured during the report.<p>
141      *
142      * @return a warning list that occured during the report
143      */

144     List JavaDoc getWarnings();
145
146     /**
147      * Returns if the report generated an error output.<p>
148      *
149      * @return true if the report generated an error, otherwise false
150      */

151     boolean hasError();
152
153     /**
154      * Returns if the report generated a warning output.<p>
155      *
156      * @return true if the report generated a warning, otherwise false
157      */

158     boolean hasWarning();
159
160     /**
161      * Prints a localized message to the report.<p>
162      *
163      * @param container the String to add
164      */

165     void print(CmsMessageContainer container);
166
167     /**
168      * Prints a localized message to the report, using the indicated formatting.<p>
169      *
170      * Use the contants starting with <code>FORMAT</code> from this interface
171      * to indicate which formatting to use.<p>
172      *
173      * @param container the String to add
174      * @param format the formatting to use for the output
175      */

176     void print(CmsMessageContainer container, int format);
177
178     /**
179      * Adds a line break to the report.<p>
180      */

181     void println();
182
183     /**
184      * Prints a localized message to the report.<p>
185      *
186      * @param container the message container to add
187      */

188     void println(CmsMessageContainer container);
189
190     /**
191      * Prints a localized message to the report, using the indicated formatting.<p>
192      *
193      * Use the contants starting with <code>FORMAT</code> from this interface
194      * to indicate which formatting to use.<p>
195      *
196      * @param container the message container to add
197      * @param format the formatting to use for the output
198      */

199     void println(CmsMessageContainer container, int format);
200
201     /**
202      * Adds an Exception to the report, ensuring that the Exception content is
203      * processed to generate a valid output esp. for HTML pages.<p>
204      *
205      * The exception will be stored and the output will later be processed
206      * in a special way.<p>
207      *
208      * @param t the exception to add
209      */

210     void println(Throwable JavaDoc t);
211
212     /**
213      * Prints a localized message followed by a parametera and dots to the report.<p>
214      *
215      * @param container the Message to add
216      * @param param the Parameter to add
217      */

218     void printMessageWithParam(CmsMessageContainer container, Object JavaDoc param);
219
220     /**
221      * Convenience method to print a localized message, followed by a parameter and dots to the report.<p>
222      *
223      * The output follows the pattern: ( 3 / 8 ) Deleting filename.txt ...
224      *
225      * @param m the number of the report output
226      * @param n the total number of report outputs
227      * @param container the Message to add
228      * @param param the Parameter to add
229      *
230      */

231     void printMessageWithParam(int m, int n, CmsMessageContainer container, Object JavaDoc param);
232
233     /**
234      * Removes the report site root prefix from the absolute path in the resource name,
235      * that is adjusts the resource name for the report site root.<p>
236      *
237      * If the site root for this report has not been set,
238      * or the resource name does not start with the report site root,
239      * the name it is left untouched.<p>
240      *
241      * @param resourcename the resource name (full path)
242      *
243      * @return the resource name adjusted for the report site root
244      *
245      * @see org.opencms.file.CmsRequestContext#removeSiteRoot(String)
246      */

247     String JavaDoc removeSiteRoot(String JavaDoc resourcename);
248
249     /**
250      * Resets the runtime to 0 milliseconds.<p>
251      */

252     void resetRuntime();
253 }
Popular Tags