Source Code Cross Referenced for ParserOutput.java in  » Wiki-Engine » JAMWiki » org » jamwiki » parser » 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 » JAMWiki » org.jamwiki.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.
003:         *
004:         * This program is free software; you can redistribute it and/or modify
005:         * it under the terms of the latest version of the GNU Lesser General
006:         * Public License as published by the Free Software Foundation;
007:         *
008:         * This program is distributed in the hope that it will be useful,
009:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
010:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
011:         * GNU Lesser General Public License for more details.
012:         *
013:         * You should have received a copy of the GNU Lesser General Public License
014:         * along with this program (LICENSE.txt); if not, write to the Free Software
015:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
016:         */package org.jamwiki.parser;
017:
018:        import java.io.Serializable;
019:        import java.util.Vector;
020:        import java.util.LinkedHashMap;
021:
022:        /**
023:         * This class represents the output from the JAMWiki parser.  It holds parsed
024:         * output text as well as metadata that is generated by the parser.
025:         */
026:        public class ParserOutput implements  Serializable {
027:
028:            private boolean cacheable = true;
029:            private final LinkedHashMap categories = new LinkedHashMap();
030:            private final Vector links = new Vector();
031:            private String redirect = null;
032:            private String sectionName = null;
033:            private final Vector templates = new Vector();
034:
035:            /**
036:             *
037:             */
038:            public ParserOutput() {
039:            }
040:
041:            /**
042:             * When a document contains a token indicating that the document belongs
043:             * to a specific category this method should be called to add that
044:             * category to the output metadata.
045:             *
046:             * @param categoryName The name of the category that the document belongs
047:             *  to.
048:             * @param sortKey The sort key for the category, or <code>null</code> if
049:             *  no sort key has been specified.  The sort key determines what order
050:             *  categories are sorted on category index pages, so a category for
051:             *  "John Doe" might be given a sort key of "Doe, John".
052:             */
053:            public void addCategory(String categoryName, String sortKey) {
054:                this .categories.put(categoryName, sortKey);
055:            }
056:
057:            /**
058:             * When a document contains a token indicating that the document links
059:             * to another Wiki topic this method should be called to add that
060:             * topic link to the output metadata.
061:             *
062:             * @param topicName The name of the topic that is linked to.
063:             */
064:            public void addLink(String topicName) {
065:                this .links.add(topicName);
066:            }
067:
068:            /**
069:             * When a document contains a token indicating that the document includes
070:             * a Wiki template this method should be called to add that template
071:             * to the output metadata.
072:             *
073:             * @param template The name of the template that is being included.
074:             */
075:            public void addTemplate(String template) {
076:                this .templates.add(template);
077:            }
078:
079:            /**
080:             *
081:             */
082:            public void appendMetadata(ParserOutput document) {
083:                if (document.getCategories() != null) {
084:                    this .categories.putAll(document.getCategories());
085:                }
086:                if (document.getLinks() != null) {
087:                    this .links.addAll(document.getLinks());
088:                }
089:                if (document.getTemplates() != null) {
090:                    this .links.addAll(document.getTemplates());
091:                }
092:                if (!document.getCacheable()) {
093:                    this .cacheable = false;
094:                }
095:            }
096:
097:            /**
098:             * Return a flag indicating whether or not the current ParserOutput
099:             * object can be cached.  If the document contains user-specific,
100:             * time-specific or other non-cacheable content then this method should
101:             * return <code>false</code>.
102:             *
103:             * @return <code>true</code> if the current ParserOutput is cacheable,
104:             *  <code>false</code> if it contains any non-cacheable content.
105:             */
106:            public boolean getCacheable() {
107:                return this .cacheable;
108:            }
109:
110:            /**
111:             * Sets a flag indicating whether or not the current ParserOutput
112:             * object can be cached.  If the document contains user-specific,
113:             * time-specific or other non-cacheable content then the cacheable flag
114:             * should be set to <code>false</code>.
115:             *
116:             * @param cacheable Set to <code>true</code> if the current ParserOutput
117:             *  is cacheable, <code>false</code> if it contains any non-cacheable
118:             *  content.
119:             */
120:            public void setCacheable(boolean cacheable) {
121:                this .cacheable = cacheable;
122:            }
123:
124:            /**
125:             * Return the current mapping of categories associated with the document
126:             * being parsed.  The mapping contains key-value pairs with the category
127:             * name as the key and the sort key (if any) as the value.
128:             *
129:             * @return A mapping of categories and their associated sort keys (if any)
130:             *  for all categories that are associated with the document being parsed.
131:             */
132:            public LinkedHashMap getCategories() {
133:                return this .categories;
134:            }
135:
136:            /**
137:             * For the document being parsed, return the current collection of topic
138:             * names for all topics that are linked to from the current document.
139:             *
140:             * @return A collection of all topic names that are linked to from the
141:             *  current document.
142:             */
143:            public Vector getLinks() {
144:                return this .links;
145:            }
146:
147:            /**
148:             * When editing or parsing a section of a document, get the name of
149:             * the heading for that section.
150:             *
151:             * @return The name of the heading for a section of a document being
152:             *  parsed, or <code>null</code> if a section is not being parsed. If not
153:             *  <code>null</code> then the section name should be encoded for use in a
154:             *  URL.
155:             */
156:            public String getSectionName() {
157:                return this .sectionName;
158:            }
159:
160:            /**
161:             * When editing or parsing a section of a document, set the name of
162:             * the heading for that section.
163:             *
164:             * @param sectionName The name of the heading for a section of a document
165:             *  being parsed, or <code>null</code> if a section is not being parsed.
166:             *  If not <code>null</code> then the section name should be encoded for
167:             *  use in a URL.
168:             */
169:            public void setSectionName(String sectionName) {
170:                this .sectionName = sectionName;
171:            }
172:
173:            /**
174:             * For the document being parsed, return the current collection of
175:             * templates names for all templates that are included in the current
176:             * document.
177:             *
178:             * @return A collection of all template names that are included in the
179:             *  current document.
180:             */
181:            public Vector getTemplates() {
182:                return this .templates;
183:            }
184:
185:            /**
186:             * If a document being parsed represents a redirect, return the name of
187:             * the topic that this document redirects to.
188:             *
189:             * @return The name of the topic that this document redirects to, or
190:             *  <code>null</code> if the document does not represent a redirect.
191:             */
192:            public String getRedirect() {
193:                return this .redirect;
194:            }
195:
196:            /**
197:             * If a document being parsed represents a redirect, set the name of
198:             * the topic that this document redirects to.
199:             *
200:             * @param redirect The name of the topic that this document redirects to,
201:             *  or <code>null</code> if the document does not represent a redirect.
202:             */
203:            public void setRedirect(String redirect) {
204:                this.redirect = redirect;
205:            }
206:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.