Source Code Cross Referenced for WikiPageEvent.java in  » Wiki-Engine » JSPWiki » com » ecyrd » jspwiki » event » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Wiki Engine » JSPWiki » com.ecyrd.jspwiki.event 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:            JSPWiki - a JSP-based WikiWiki clone.
003:
004:            Copyright (C) 2001-2006 Janne Jalkanen (Janne.Jalkanen@iki.fi)
005:
006:            This program is free software; you can redistribute it and/or modify
007:            it under the terms of the GNU Lesser General Public License as published by
008:            the Free Software Foundation; either version 2.1 of the License, or
009:            (at your option) any later version.
010:
011:            This program is distributed in the hope that it will be useful,
012:            but WITHOUT ANY WARRANTY; without even the implied warranty of
013:            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:            GNU Lesser General Public License for more details.
015:
016:            You should have received a copy of the GNU Lesser General Public License
017:            along with this program; if not, write to the Free Software
018:            Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         */
020:
021:        package com.ecyrd.jspwiki.event;
022:
023:        /**
024:         * WikiPageEvent indicates a change in the state or processing of a WikiPage.
025:         * There are basically two types of page events:
026:         * <dl>
027:         *   <dt><b>Phase Boundary Events</b></dt>
028:         *   <dd>Those considered as "beginning-of-phase", and those as "end-of-phase"
029:         *       events (as designated by <tt>*_BEGIN</tt> and <tt>*_END</tt>), as
030:         *       generated by the WikiEngine. The phases include pre-save, post-save,
031:         *       pre-translate, and post-translate.
032:         *   </dd>
033:         *   <dt><b>In-Phase Events</b></dt>
034:         *   <dd>In-phase events are generated as specific events from the
035:         *       PageEventFilter (or elsewhere), on a per-listener basis. There may
036:         *       be many such events during a particular phase.
037:         *   </dd>
038:         * </dl>
039:         * <p>
040:         * E.g., a typical event sequence for the pre-translate phase would be:
041:         * </p>
042:         * <ol>
043:         *  <li>PRE_TRANSLATE_BEGIN</li>
044:         *  <li>PRE_TRANSLATE</li>
045:         *  <li>PRE_TRANSLATE</li>
046:         *  <li>...</li>
047:         *  <li>PRE_TRANSLATE_END</li>
048:         * </ol>
049:         *
050:         * <h2>Notes</h2>
051:         *
052:         * <h3>Page Requested and Delivered Events</h3>
053:         * <p>
054:         * These two events are fired once per page request, at the beginning
055:         * and after delivery of the page (respectively). They are generated
056:         * by the {@link com.ecyrd.jspwiki.ui.WikiServletFilter}.
057:         * </p>
058:         *
059:         * <h3>Page Lock and Unlock Events</h3>
060:         * <p>
061:         * Page lock and unlock events occur only once during an editing session,
062:         * so there are no begin and end events. They are generated
063:         * by the {@link com.ecyrd.jspwiki.PageManager}.
064:         * </p>
065:         *
066:         * <h3>WikiPageEvents</h3>
067:         * <p>
068:         * Other WikiPageEvents include both <i>phase boundary</i> and <i>in-phase</i>
069:         * events for saving, pre- and post-translating content. These are very noisy 
070:         * event types, but are not fired unless a listener is available. They are
071:         * generated by the {@link com.ecyrd.jspwiki.filters.FilterManager}, 
072:         * {@link com.ecyrd.jspwiki.event.PageEventFilter}, and potentially other 
073:         * implementing classes.
074:         * </p>
075:         *
076:         * <h3>Firing Order and Phase Boundaries</h3>
077:         * <p>
078:         * Note that due to the asynchronous nature of event processing, any threads
079:         * spawned by such events will not necessarily have completed during their
080:         * specific phase; we can assume only that no more events of that phase will
081:         * be fired after its <tt>*_END</tt> event has been fired.
082:         * </p>
083:         *
084:         * @author  Murray Altheim
085:         * @see     com.ecyrd.jspwiki.event.WikiEvent
086:         * @since   2.4.20
087:         */
088:        public class WikiPageEvent extends WikiEvent {
089:            // PAGE LOCKING EVENTS ...
090:
091:            /**
092:             * 
093:             */
094:            private static final long serialVersionUID = 1L;
095:
096:            /** Indicates a page lock event. This is based on events
097:             * generated by {@link com.ecyrd.jspwiki.PageManager}. */
098:            public static final int PAGE_LOCK = 10;
099:
100:            /** Indicates a page unlock event. This is based on events
101:             * generated by {@link com.ecyrd.jspwiki.PageManager}. */
102:            public static final int PAGE_UNLOCK = 11;
103:
104:            // PRE_TRANSLATE .........
105:
106:            /** Indicates the beginning of all wiki pre-translate page events. This is based
107:             * on events generated by {@link com.ecyrd.jspwiki.filters.FilterManager}. */
108:            public static final int PRE_TRANSLATE_BEGIN = 12;
109:
110:            /** Indicates a wiki pre-translate page event. This is based on events
111:             * generated by {@link com.ecyrd.jspwiki.event.PageEventFilter}. */
112:            public static final int PRE_TRANSLATE = 13;
113:
114:            /** Indicates the end of all wiki pre-translate page events. This is based
115:             * on events generated by {@link com.ecyrd.jspwiki.filters.FilterManager}. */
116:            public static final int PRE_TRANSLATE_END = 14;
117:
118:            // POST_TRANSLATE ........
119:
120:            /** Indicates the beginning of all wiki post-translate page events. This is based
121:             * on events generated by {@link com.ecyrd.jspwiki.filters.FilterManager}. */
122:            public static final int POST_TRANSLATE_BEGIN = 15;
123:
124:            /** Indicates a wiki post-translate page event. This is based on events
125:             * generated by {@link com.ecyrd.jspwiki.event.PageEventFilter}. */
126:            public static final int POST_TRANSLATE = 16;
127:
128:            /** Indicates the end of all wiki post-translate page events. This is based
129:             * on events generated by {@link com.ecyrd.jspwiki.filters.FilterManager}. */
130:            public static final int POST_TRANSLATE_END = 17;
131:
132:            // PRE_SAVE ..............
133:
134:            /** Indicates the beginning of all wiki pre-save page events. This is based
135:             * on events generated by {@link com.ecyrd.jspwiki.filters.FilterManager}. */
136:            public static final int PRE_SAVE_BEGIN = 18;
137:
138:            /** Indicates a wiki pre-save page event. This is based on events
139:             * generated by {@link com.ecyrd.jspwiki.event.PageEventFilter}. */
140:            public static final int PRE_SAVE = 19;
141:
142:            /** Indicates the end of all wiki pre-save page events. This is based
143:             * on events generated by {@link com.ecyrd.jspwiki.filters.FilterManager}. */
144:            public static final int PRE_SAVE_END = 20;
145:
146:            // POST_SAVE .............
147:
148:            /** Indicates the beginning of all wiki post-save page events. This is based
149:             * on events generated by {@link com.ecyrd.jspwiki.filters.FilterManager}. */
150:            public static final int POST_SAVE_BEGIN = 21;
151:
152:            /** Indicates a wiki post-save page event. This is based on events
153:             * generated by {@link com.ecyrd.jspwiki.event.PageEventFilter}. */
154:            public static final int POST_SAVE = 22;
155:
156:            /** Indicates the end of all wiki post-save page events. This is based
157:             * on events generated by {@link com.ecyrd.jspwiki.filters.FilterManager}. */
158:            public static final int POST_SAVE_END = 23;
159:
160:            // PAGE REQUESTS .........
161:
162:            /** Indicates a wiki page request event (the start of a request). This is based
163:             * on events generated by {@link com.ecyrd.jspwiki.ui.WikiServletFilter}. */
164:            public static final int PAGE_REQUESTED = 24;
165:
166:            /** Indicates a wiki page delivery event (the end of a request). This is based
167:             * on events generated by {@link com.ecyrd.jspwiki.ui.WikiServletFilter}. */
168:            public static final int PAGE_DELIVERED = 25;
169:
170:            /** Indicates a wiki page delete event (the beginning of a delete request). 
171:             * This is based on events generated by {@link com.ecyrd.jspwiki.ui.WikiServletFilter}. 
172:             * @since 2.4.65 */
173:            public static final int PAGE_DELETE_REQUEST = 26;
174:
175:            /** Indicates a wiki page deleted event (after the delete has been completed). 
176:             * This is based on events generated by {@link com.ecyrd.jspwiki.ui.WikiServletFilter}. 
177:             * @since 2.4.65 */
178:            public static final int PAGE_DELETED = 27;
179:
180:            private String m_pagename = null;
181:
182:            // ............
183:
184:            /**
185:             * Constructs an instance of this event.
186:             * @param src    the Object that is the source of the event.
187:             * @param type      the type of the event (see the enumerated int values defined
188:             *                  in {@link com.ecyrd.jspwiki.event.WikiEvent}).
189:             * @param pagename  the WikiPage being acted upon.
190:             */
191:            public WikiPageEvent(Object src, int type, String pagename) {
192:                super (src, type);
193:                m_pagename = pagename;
194:            }
195:
196:            /**
197:             * Returns the Wiki page name associated with this event.
198:             * This may be null if unavailable.
199:             *
200:             * @return     the Wiki page name associated with this WikiEvent, or null.
201:             */
202:            public String getPageName() {
203:                return m_pagename;
204:            }
205:
206:            /**
207:             * Returns true if the int value is a WikiPageEvent type.
208:             */
209:            public static boolean isValidType(int type) {
210:                return type >= PAGE_LOCK && type <= PAGE_DELETED;
211:            }
212:
213:            /**
214:             * Returns a textual representation of the event type.
215:             * @return a String representation of the type
216:             */
217:            public String eventName() {
218:                switch (getType()) {
219:                case PAGE_LOCK:
220:                    return "PAGE_LOCK";
221:                case PAGE_UNLOCK:
222:                    return "PAGE_UNLOCK";
223:
224:                case PRE_TRANSLATE_BEGIN:
225:                    return "PRE_TRANSLATE_BEGIN";
226:                case PRE_TRANSLATE:
227:                    return "PRE_TRANSLATE";
228:                case PRE_TRANSLATE_END:
229:                    return "PRE_TRANSLATE_END";
230:
231:                case POST_TRANSLATE_BEGIN:
232:                    return "POST_TRANSLATE_BEGIN";
233:                case POST_TRANSLATE:
234:                    return "POST_TRANSLATE";
235:                case POST_TRANSLATE_END:
236:                    return "POST_TRANSLATE_END";
237:
238:                case PRE_SAVE_BEGIN:
239:                    return "PRE_SAVE_BEGIN";
240:                case PRE_SAVE:
241:                    return "PRE_SAVE";
242:                case PRE_SAVE_END:
243:                    return "PRE_SAVE_END";
244:
245:                case POST_SAVE_BEGIN:
246:                    return "POST_SAVE_BEGIN";
247:                case POST_SAVE:
248:                    return "POST_SAVE";
249:                case POST_SAVE_END:
250:                    return "POST_SAVE_END";
251:
252:                case PAGE_REQUESTED:
253:                    return "PAGE_REQUESTED";
254:                case PAGE_DELIVERED:
255:                    return "PAGE_DELIVERED";
256:
257:                case PAGE_DELETE_REQUEST:
258:                    return "PAGE_DELETE_REQUEST";
259:                case PAGE_DELETED:
260:                    return "PAGE_DELETED";
261:
262:                default:
263:                    return super .eventName();
264:                }
265:            }
266:
267:            /** Returns a human-readable description of the event type.
268:             * @return a String description of the type
269:             */
270:            public String getTypeDescription() {
271:                switch (getType()) {
272:                case PAGE_LOCK:
273:                    return "page lock event";
274:                case PAGE_UNLOCK:
275:                    return "page unlock event";
276:
277:                case PRE_TRANSLATE_BEGIN:
278:                    return "begin page pre-translate events";
279:                case PRE_TRANSLATE:
280:                    return "page pre-translate event";
281:                case PRE_TRANSLATE_END:
282:                    return "end of page pre-translate events";
283:
284:                case POST_TRANSLATE_BEGIN:
285:                    return "begin page post-translate events";
286:                case POST_TRANSLATE:
287:                    return "page post-translate event";
288:                case POST_TRANSLATE_END:
289:                    return "end of page post-translate events";
290:
291:                case PRE_SAVE_BEGIN:
292:                    return "begin page pre-save events";
293:                case PRE_SAVE:
294:                    return "page pre-save event";
295:                case PRE_SAVE_END:
296:                    return "end of page pre-save events";
297:
298:                case POST_SAVE_BEGIN:
299:                    return "begin page post-save events";
300:                case POST_SAVE:
301:                    return "page post-save event";
302:                case POST_SAVE_END:
303:                    return "end of page post-save events";
304:
305:                case PAGE_REQUESTED:
306:                    return "page requested event";
307:                case PAGE_DELIVERED:
308:                    return "page delivered event";
309:
310:                case PAGE_DELETE_REQUEST:
311:                    return "page delete request event";
312:                case PAGE_DELETED:
313:                    return "page deleted event";
314:
315:                default:
316:                    return super .getTypeDescription();
317:                }
318:            }
319:
320:        } // end class com.ecyrd.jspwiki.event.WikiPageEvent
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.