Source Code Cross Referenced for ParserInput.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.util.Hashtable;
019:        import java.util.Locale;
020:        import org.jamwiki.model.WikiUser;
021:
022:        /**
023:         * This class is a utility class used to hold configuration settings for the
024:         * parser.
025:         */
026:        public class ParserInput {
027:
028:            private boolean allowSectionEdit = true;
029:            private String context = null;
030:            /** Depth is used to prevent infinite nesting of templates and other objects. */
031:            private int depth = 0;
032:            private Locale locale = null;
033:            private TableOfContents tableOfContents = new TableOfContents();
034:            /** Template inclusion tracks whether or not template code is being parsed.  A counter is used to deal with nested templates. */
035:            private int templateDepth = 0;
036:            /** Hashtable of generic temporary objects used during parsing. */
037:            private final Hashtable tempParams = new Hashtable();
038:            private String topicName = null;
039:            /** IP address of the current user. */
040:            private String userIpAddress = null;
041:            private String virtualWiki = null;
042:            /** Current WikiUser (if any). */
043:            private WikiUser wikiUser = null;
044:
045:            /**
046:             *
047:             */
048:            public ParserInput() {
049:            }
050:
051:            /**
052:             * Copy constructor.
053:             */
054:            public ParserInput(ParserInput parserInput) {
055:                this .allowSectionEdit = parserInput.allowSectionEdit;
056:                this .context = parserInput.context;
057:                this .locale = parserInput.locale;
058:                this .topicName = parserInput.topicName;
059:                this .userIpAddress = parserInput.userIpAddress;
060:                this .virtualWiki = parserInput.virtualWiki;
061:                this .wikiUser = parserInput.wikiUser;
062:            }
063:
064:            /**
065:             * This method will return <code>true</code> if edit links are allowed
066:             * next to each section heading.  During preview and in some other
067:             * instances that feature needs to be disabled.
068:             *
069:             * @return Returns <code>true</code> if edit links are allowed next to
070:             *  each section heading.
071:             */
072:            public boolean getAllowSectionEdit() {
073:                return allowSectionEdit;
074:            }
075:
076:            /**
077:             * Set method used to indicate whether or not to allow edit links
078:             * next to each section heading.  During preview and in some other
079:             * instances that feature needs to be disabled.
080:             *
081:             * @param allowSectionEdit Set to <code>true</code> if edits links are
082:             *  allowed next to each section heading, <code>false</code> otherwise.
083:             */
084:            public void setAllowSectionEdit(boolean allowSectionEdit) {
085:                this .allowSectionEdit = allowSectionEdit;
086:            }
087:
088:            /**
089:             * Get the servlet context associated with the current parser input
090:             * instance.  Servlet context is used when building links.
091:             *
092:             * @return The servlet context associated with the current parser
093:             *  input instance.
094:             */
095:            public String getContext() {
096:                return context;
097:            }
098:
099:            /**
100:             * Set the servlet context associated with the current parser input
101:             * instance.  Servlet context is used when building links.
102:             *
103:             * @param context The servlet context associated with the current parser
104:             *  input instance.
105:             */
106:            public void setContext(String context) {
107:                this .context = context;
108:            }
109:
110:            /**
111:             * Since it is possible to call a new parser instance from within another
112:             * parser instance, depth provides a way to determine how many times the
113:             * parser has nested, thus providing a way of avoiding infinite loops.
114:             *
115:             * @return The current nesting level of the parser instance.
116:             */
117:            public int getDepth() {
118:                return depth;
119:            }
120:
121:            /**
122:             * This method decreases the current parser instance depth and should
123:             * only be called when a parser instance exits.  Depth is useful as a
124:             * way of avoiding infinite loops in the parser.
125:             */
126:            public void decrementDepth() {
127:                this .depth--;
128:            }
129:
130:            /**
131:             * This method increases the current parser instance depth and should
132:             * only be called when a instantiating a new parser instance.  Depth is
133:             * useful as a way of avoiding infinite loops in the parser.
134:             */
135:            public void incrementDepth() {
136:                this .depth++;
137:            }
138:
139:            /**
140:             * Since it is possible to call a new parser instance from within another
141:             * parser instance, depth provides a way to determine how many times the
142:             * parser has nested, thus providing a way of avoiding infinite loops.
143:             *
144:             * @param depth The current nesting level of the parser instance.
145:             */
146:            public void setDepth(int depth) {
147:                this .depth = depth;
148:            }
149:
150:            /**
151:             * Get the locale associated with the current parser input instance.
152:             * Locale is used primarily when building links or displaying messages.
153:             *
154:             * @return The locale associated with the current parser input instance.
155:             */
156:            public Locale getLocale() {
157:                return locale;
158:            }
159:
160:            /**
161:             * Set the locale associated with the current parser input instance.
162:             * Locale is used primarily when building links or displaying messages.
163:             *
164:             * @param locale The locale associated with the current parser input
165:             *  instance.
166:             */
167:            public void setLocale(Locale locale) {
168:                this .locale = locale;
169:            }
170:
171:            /**
172:             * Get the table of contents object associated with the current parser
173:             * input instance.  The table of contents is used for building an internal
174:             * set of links to headings in the current document.
175:             *
176:             * @return The table of contents object associated with the current parser
177:             *  input instance.
178:             */
179:            public TableOfContents getTableOfContents() {
180:                return this .tableOfContents;
181:            }
182:
183:            /**
184:             * Set the table of contents object associated with the current parser
185:             * input instance.  The table of contents is used for building an internal
186:             * set of links to headings in the current document.
187:             *
188:             * @param tableOfContents The table of contents object associated with the
189:             *  current parser input instance.
190:             */
191:            public void setTableOfContents(TableOfContents tableOfContents) {
192:                this .tableOfContents = tableOfContents;
193:            }
194:
195:            /**
196:             * Get the Hashtable of arbitrary temporary parameters associated with
197:             * the current parser input instance.  This hashtable provides a method
198:             * for the parser to keep track of arbitrary data during the parsing
199:             * process.
200:             *
201:             * @return The Hashtable of arbitrary temporary parameters associated with
202:             *  the current parser input instance.
203:             */
204:            public Hashtable getTempParams() {
205:                return this .tempParams;
206:            }
207:
208:            /**
209:             * Get the depth level when template code is being parsed.
210:             *
211:             * @return The current number of template inclusions.
212:             */
213:            public int getTemplateDepth() {
214:                return templateDepth;
215:            }
216:
217:            /**
218:             * This method decreases the current template inclusion depth and should
219:             * only be called when a template finishes processing.
220:             */
221:            public void decrementTemplateDepth() {
222:                this .templateDepth--;
223:            }
224:
225:            /**
226:             * This method decreases the current template inclusion depth and should
227:             * only be called when a template begins processing.
228:             */
229:            public void incrementTemplateDepth() {
230:                this .templateDepth++;
231:            }
232:
233:            /**
234:             * Set the depth level when template code is being parsed.
235:             *
236:             * @param templateDepth The current number of template inclusions.
237:             */
238:            public void setTemplateDepth(int templateDepth) {
239:                this .templateDepth = templateDepth;
240:            }
241:
242:            /**
243:             * Get the topic name for the topic being parsed by this parser input
244:             * instance.
245:             *
246:             * @return The topic name for the topic being parsed by this parser input
247:             * instance.
248:             */
249:            public String getTopicName() {
250:                return this .topicName;
251:            }
252:
253:            /**
254:             * Set the topic name for the topic being parsed by this parser input
255:             * instance.
256:             *
257:             * @param topicName The topic name for the topic being parsed by this
258:             *  parser input instance.
259:             */
260:            public void setTopicName(String topicName) {
261:                this .topicName = topicName;
262:            }
263:
264:            /**
265:             * Get the user IP address associated with the current parser input
266:             * instance.  The user IP address is used primarily when parsing
267:             * signatures.
268:             *
269:             * @return The user IP address associated with the current parser input
270:             * instance.
271:             */
272:            public String getUserIpAddress() {
273:                return this .userIpAddress;
274:            }
275:
276:            /**
277:             * Set the user IP address associated with the current parser input
278:             * instance.  The user IP address is used primarily when parsing
279:             * signatures.
280:             *
281:             * @param userIpAddress The user IP address associated with the current
282:             *  parser input instance.
283:             */
284:            public void setUserIpAddress(String userIpAddress) {
285:                this .userIpAddress = userIpAddress;
286:            }
287:
288:            /**
289:             * Get the virtual wiki name associated with the current parser input
290:             * instance.  The virtual wiki name is used primarily when parsing links.
291:             *
292:             * @return The virtual wiki name associated with the current parser input
293:             * instance.
294:             */
295:            public String getVirtualWiki() {
296:                return this .virtualWiki;
297:            }
298:
299:            /**
300:             * Set the virtual wiki name associated with the current parser input
301:             * instance.  The virtual wiki name is used primarily when parsing links.
302:             *
303:             * @param virtualWiki The virtual wiki name associated with the current
304:             *  parser input instance.
305:             */
306:            public void setVirtualWiki(String virtualWiki) {
307:                this .virtualWiki = virtualWiki;
308:            }
309:
310:            /**
311:             * Get the wiki user object associated with the current parser input
312:             * instance.  The wiki user object is used primarily when parsing
313:             * signatures.
314:             *
315:             * @return The wiki user object associated with the current parser input
316:             * instance.
317:             */
318:            public WikiUser getWikiUser() {
319:                return this .wikiUser;
320:            }
321:
322:            /**
323:             * Set the wiki user object associated with the current parser input
324:             * instance.  The wiki user object is used primarily when parsing
325:             * signatures.
326:             *
327:             * @param user The wiki user object associated with the current
328:             *  parser input instance.
329:             */
330:            public void setWikiUser(WikiUser user) {
331:                this.wikiUser = user;
332:            }
333:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.