KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > main > I_CmsEventListener


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/main/I_CmsEventListener.java,v $
3  * Date : $Date: 2006/04/28 15:20:52 $
4  * Version: $Revision: 1.30 $
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.main;
33
34 /**
35  * Implement this interface in case your class has to react
36  * to CmsEvents that are thrown by system.<p>
37  *
38  * In order to recieve system events, your class must register with
39  * the OpenCms event mechanism. This can be done in the constructor of a class
40  * like this:
41  * <pre>
42  * org.opencms.main.OpenCms.addCmsEventListener(this);
43  * </pre>
44  *
45  * A typical implementation might look like this:
46  * <pre>
47  * public void cmsEvent(org.opencms.main.CmsEvent event) {
48  * switch (event.getType()) {
49  * case org.opencms.main.I_CmsEventListener.EVENT_PUBLISH_PROJECT:
50  * case org.opencms.main.I_CmsEventListener.EVENT_CLEAR_CACHES:
51  * // do something
52  * break;
53  * case org.opencms.main.I_CmsEventListener.EVENT_LOGIN_USER:
54  * // do something else
55  * break;
56  * }
57  * }
58  * </pre>
59  *
60  * @author Alexander Kandzior
61  *
62  * @version $Revision: 1.30 $
63  *
64  * @since 6.0.0
65  *
66  * @see CmsEvent
67  * @see org.opencms.main.OpenCms#addCmsEventListener(I_CmsEventListener)
68  * @see org.opencms.main.OpenCms#addCmsEventListener(I_CmsEventListener, int[])
69  */

70 public interface I_CmsEventListener {
71
72     /** Key name for passing a report in the data map. */
73     String JavaDoc KEY_REPORT = "report";
74
75     /** Key name for passing a publish history id in the data map. */
76     String JavaDoc KEY_PUBLISHID = "publishHistoryId";
77     
78     /** Key name for passing a publish list in the data map. */
79     String JavaDoc KEY_PUBLISHLIST = "publishList";
80
81     /** Key name for passing a project id in the data map. */
82     String JavaDoc KEY_PROJECTID = "projectId";
83
84     /** Key name for passing a database context in the data map. */
85     String JavaDoc KEY_DBCONTEXT = "dbContext";
86
87     /**
88      * Marker for "all events".<p>
89      */

90     Integer JavaDoc LISTENERS_FOR_ALL_EVENTS = new Integer JavaDoc(-1);
91
92     /**
93      * Event "user has logged in".<p>
94      *
95      * @see org.opencms.file.CmsObject#loginUser(String, String)
96      */

97     int EVENT_LOGIN_USER = 1;
98
99     /**
100      * Event "a project was published".<p>
101      *
102      * Event data:
103      * <ul>
104      * <li><code>{@link #KEY_REPORT}</code>: a <code>{@link org.opencms.report.I_CmsReport}</code> to print output messages to</li>
105      * <li><code>{@link #KEY_PUBLISHID}</code>: the ID of the publish task in the publish history</li>
106      * <li><code>{@link #KEY_PROJECTID}</code>: the ID of the project that has been published</li>
107      * <li><code>{@link #KEY_DBCONTEXT}</code>: the current users database context</li>
108      * </ul>
109      *
110      * @see org.opencms.file.CmsObject#publishProject()
111      * @see #EVENT_BEFORE_PUBLISH_PROJECT
112      */

113     int EVENT_PUBLISH_PROJECT = 2;
114     
115     /**
116      * Event "a project is to published" (but has not yet been published).<p>
117      *
118      * Event data:
119      * <ul>
120      * <li><code>{@link #KEY_REPORT}</code>: a <code>{@link org.opencms.report.I_CmsReport}</code> to print output messages to</li>
121      * <li><code>{@link #KEY_PUBLISHLIST}</code>: a <code>{@link org.opencms.db.CmsPublishList}</code> that contains the resources that are to be published</li>
122      * <li><code>{@link #KEY_PROJECTID}</code>: the ID of the project that is to be published</li>
123      * <li><code>{@link #KEY_DBCONTEXT}</code>: the current users database context</li>
124      * </ul>
125      *
126      * @see org.opencms.file.CmsObject#publishProject()
127      * @see #EVENT_PUBLISH_PROJECT
128      */

129     int EVENT_BEFORE_PUBLISH_PROJECT = 3;
130
131     /**
132      * Event "all caches must be cleared".<p>
133      *
134      * Not thrown by the core classes, but might be used in modules.
135      */

136     int EVENT_CLEAR_CACHES = 5;
137
138     /**
139      * Event "all caches related to user and groups must be cleared".<p>
140      *
141      * Not thrown by the core classes, but might be used in modules.
142      */

143     int EVENT_CLEAR_PRINCIPAL_CACHES = 6;
144
145     /**
146      * Event "delete all JSP pages in the "real" file system
147      * (so they will be rebuild next time the JSP is requested)".<p>
148      *
149      * This is thrown on the "FlexCache Administration" page if you press
150      * the button "Purge JSP repository", or if you use the <code>_flex=purge</code>
151      * request parameter.
152      */

153     int EVENT_FLEX_PURGE_JSP_REPOSITORY = 8;
154
155     /**
156      * Event "the FlexCache must be cleared".<p>
157      *
158      * This is thrown on the "FlexCache Administration" page if you press
159      * one ot the "Clear cache" buttons, or if you use the <code>_flex=clearcache</code>
160      * request parameter.
161      */

162     int EVENT_FLEX_CACHE_CLEAR = 9;
163
164     /**
165      * Event "a single resource has been modified".<p>
166      *
167      * Event data:
168      * <ul>
169      * <li>key "resource" (mandatory): the modified CmsResource</li>
170      * </ul>
171      */

172     int EVENT_RESOURCE_MODIFIED = 11;
173
174     /**
175      * Event "a bunch of resources has been modified".<p>
176      *
177      * Event data:
178      * <ul>
179      * <li>key "resources" (mandatory): a List of modified CmsResources</li>
180      * </ul>
181      */

182     int EVENT_RESOURCES_MODIFIED = 12;
183
184     /**
185      * Event "the list of sub-resources of a folder has been modified", (e.g. a new resource has been created).<p>
186      *
187      * Event data:
188      * <ul>
189      * <li>key "resource" (mandatory): the modified CmsResource (a folder)</li>
190      * </ul>
191      */

192     int EVENT_RESOURCE_LIST_MODIFIED = 13;
193
194     /**
195      * Event "a single property (and so the resource itself, too) have been modified".<p>
196      *
197      * Event data:
198      * <ul>
199      * <li>key "resource" (mandatory): the CmsResource that has the modified property attached</li>
200      * <li>key "property" (mandatory): the modified property</li>
201      * </ul>
202      */

203     int EVENT_PROPERTY_MODIFIED = 14;
204
205     /**
206      * Event "all properties (and so the resource itself, too) have been modified".<p>
207      *
208      * Event data:
209      * <ul>
210      * <li>key "resource" (mandatory): the CmsResource that has the modified properties attached</li>
211      * </ul>
212      */

213     int EVENT_RESOURCE_AND_PROPERTIES_MODIFIED = 15;
214
215     /**
216      * Event "clear all offline caches".<p>
217      *
218      * Event data: none
219      */

220     int EVENT_CLEAR_OFFLINE_CACHES = 16;
221
222     /**
223      * Event "clear all online caches".<p>
224      *
225      * Event data: none
226      */

227     int EVENT_CLEAR_ONLINE_CACHES = 17;
228
229     /**
230      * Event "a project was modified" (e.g. a project has been deleted,
231      * or the project resources have been changed).<p>
232      *
233      * Event data:
234      * <ul>
235      * <li>key "project" (mandatory): the deleted CmsProject</li>
236      * </ul>
237      */

238     int EVENT_PROJECT_MODIFIED = 18;
239
240     /**
241      * Event "update exported resources".<p>
242      *
243      * This event updates all export points, deletes the content
244      * of the "export" folder, purges the JSP repository, and clears
245      * all caches.<p>
246      *
247      * This event is for internal use.<p>
248      */

249     int EVENT_UPDATE_EXPORTS = 19;
250
251     /**
252      * @see #EVENT_RESOURCE_AND_PROPERTIES_MODIFIED
253      */

254     int EVENT_RESOURCE_CREATED = 23;
255
256     /**
257      * @see #EVENT_RESOURCES_MODIFIED
258      */

259     int EVENT_RESOURCE_COPIED = 24;
260
261     /**
262      * @see #EVENT_RESOURCES_MODIFIED
263      */

264     int EVENT_RESOURCE_DELETED = 25;
265
266     /**
267      * Event "a property definition has been modified".<p>
268      *
269      * Event data:
270      * <ul>
271      * <li>key "propertyDefinition" (mandatory): the modified property definition</li>
272      * </ul>
273      */

274     int EVENT_PROPERTY_DEFINITION_MODIFIED = 26;
275
276     /**
277      * Event "a list of resources and their properties have been modified".<p>
278      *
279      * Event data:
280      * <ul>
281      * <li>key "resources" (mandatory): a List of modified CmsResources</li>
282      * </ul>
283      */

284     int EVENT_RESOURCES_AND_PROPERTIES_MODIFIED = 27;
285
286     /**
287      * Event "a property definition has been created".<p>
288      *
289      * Event data:
290      * <ul>
291      * <li>key "propertyDefinition" (mandatory): the modified property definition</li>
292      * </ul>
293      */

294     int EVENT_PROPERTY_DEFINITION_CREATED = 28;
295
296     /**
297      * Acknowledge the occurrence of the specified event, implement this
298      * method to check for CmsEvents in your class.
299      *
300      * @param event CmsEvent that has occurred
301      */

302     void cmsEvent(CmsEvent event);
303 }
304
Popular Tags