Source Code Cross Referenced for AbstractParser.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 org.jamwiki.utils.WikiLogger;
019:
020:        /**
021:         * Abstract class to be used when implementing new parsers.  New parsers
022:         * should extend this class and override any methods that need to be
023:         * implemented differently.
024:         */
025:        public abstract class AbstractParser {
026:
027:            private static final WikiLogger logger = WikiLogger
028:                    .getLogger(AbstractParser.class.getName());
029:            /** Parser configuration information. */
030:            protected ParserInput parserInput = null;
031:
032:            /**
033:             * The constructor creates a parser instance, initialized with the
034:             * specified parser input settings.
035:             *
036:             * @param parserInput Input configuration settings for this parser
037:             *  instance.
038:             */
039:            public AbstractParser(ParserInput parserInput) {
040:                this .parserInput = parserInput;
041:            }
042:
043:            /**
044:             * Return a parser-specific value that can be used as the content of a
045:             * topic representing a redirect.  For the Mediawiki syntax parser the
046:             * value returned would be of the form "#REDIRECT [[Topic]]".
047:             *
048:             * @param topicName The name of the topic to redirect to.
049:             * @return A parser-specific value that can be used as the content of a
050:             *  topic representing a redirect.
051:             */
052:            public abstract String buildRedirectContent(String topicName);
053:
054:            /**
055:             * This method parses content, performing all transformations except for
056:             * layout changes such as adding paragraph tags.  It is suitable to be used
057:             * when parsing the contents of a link or performing similar internal
058:             * manipulation.
059:             *
060:             * @param parserOutput A ParserOutput object containing parser
061:             *  metadata output.
062:             * @param raw The raw Wiki syntax to be converted into HTML.
063:             * @param mode The parser mode to use when parsing.  Mode affects what
064:             *  type of parsing actions are taken when processing raw text.
065:             * @return The parsed content.
066:             * @throws Exception Thrown if any error occurs during parsing.
067:             */
068:            // FIXME - should this have a mode flag???
069:            public abstract String parseFragment(ParserOutput parserOutput,
070:                    String raw, int mode) throws Exception;
071:
072:            /**
073:             * Returns a HTML representation of the given wiki raw text for online
074:             * representation.
075:             *
076:             * @param parserOutput A ParserOutput object containing parser
077:             *  metadata output.
078:             * @param raw The raw Wiki syntax to be converted into HTML.
079:             * @return The parsed content.
080:             * @throws Exception Thrown if any error occurs during parsing.
081:             */
082:            public abstract String parseHTML(ParserOutput parserOutput,
083:                    String raw) throws Exception;
084:
085:            /**
086:             * This method provides a way to parse content and set all output
087:             * metadata, such as link values used by the search engine.
088:             *
089:             * @param parserOutput A ParserOutput object containing parser
090:             *  metadata output.
091:             * @param raw The raw Wiki syntax to be converted into HTML.
092:             * @throws Exception Thrown if any error occurs during parsing.
093:             */
094:            public abstract void parseMetadata(ParserOutput parserOutput,
095:                    String raw) throws Exception;
096:
097:            /**
098:             * Perform a bare minimum of parsing as required prior to saving a topic
099:             * to the database.  In general this method will simply parse signature
100:             * tags are return.
101:             *
102:             * @param raw The raw Wiki syntax to be converted into HTML.
103:             * @return The parsed content.
104:             * @throws Exception Thrown if any error occurs during parsing.
105:             */
106:            public abstract String parseMinimal(String raw) throws Exception;
107:
108:            /**
109:             * When making a section edit this function provides the capability to retrieve
110:             * all text within a specific heading level.  For example, if targetSection is
111:             * specified as five, and the sixth heading is an <h2>, then this method
112:             * will return the heading tag and all text up to either the next <h2>,
113:             * <h1>, or the end of the document, whichever comes first.
114:             *
115:             * @param parserOutput A ParserOutput object containing parser
116:             *  metadata output.
117:             * @param raw The raw Wiki text that is to be parsed.
118:             * @param targetSection The section (counted from zero) that is to be returned.
119:             * @return Returns the raw topic content for the target section.
120:             * @throws Exception Thrown if any error occurs during parsing.
121:             */
122:            public abstract String parseSlice(ParserOutput parserOutput,
123:                    String raw, int targetSection) throws Exception;
124:
125:            /**
126:             * This method provides the capability for re-integrating a section edit back
127:             * into the main topic.  The text to be re-integrated is provided along with the
128:             * full Wiki text and a targetSection.  All of the content of targetSection
129:             * is then replaced with the new text.
130:             *
131:             * @param parserOutput A ParserOutput object containing parser
132:             *  metadata output.
133:             * @param raw The raw Wiki text that is to be parsed.
134:             * @param targetSection The section (counted from zero) that is to be returned.
135:             * @param replacementText The text to replace the target section text with.
136:             * @return The raw topic content including the new replacement text.
137:             * @throws Exception Thrown if any error occurs during parsing.
138:             */
139:            public abstract String parseSplice(ParserOutput parserOutput,
140:                    String raw, int targetSection, String replacementText)
141:                    throws Exception;
142:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.