Source Code Cross Referenced for WikiBase.java in  » Wiki-Engine » JAMWiki » org » jamwiki » 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 
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;
017:
018:        import java.util.Locale;
019:        import org.jamwiki.model.WikiUser;
020:        import org.jamwiki.utils.WikiUtil;
021:        import org.jamwiki.utils.WikiCache;
022:        import org.jamwiki.utils.WikiLogger;
023:
024:        /**
025:         * <code>WikiBase</code> is loaded as a singleton class and provides access
026:         * to all core wiki structures.  In addition this class provides utility methods
027:         * for resetting core structures including caches and permissions.
028:         *
029:         * @see org.jamwiki.DataHandler
030:         * @see org.jamwiki.UserHandler
031:         * @see org.jamwiki.search.SearchEngine
032:         */
033:        public class WikiBase {
034:
035:            /** Standard logger. */
036:            private static final WikiLogger logger = WikiLogger
037:                    .getLogger(WikiBase.class.getName());
038:            /** The singleton instance of this class. */
039:            private static WikiBase instance = null;
040:            /** The data handler that looks after read/write operations. */
041:            private static DataHandler dataHandler = null;
042:            /** The handler for user login/authentication. */
043:            private static UserHandler userHandler = null;
044:            /** The search engine instance. */
045:            private static SearchEngine searchEngine = null;
046:
047:            /** Cache name for the cache of parsed topic content. */
048:            public static final String CACHE_PARSED_TOPIC_CONTENT = "org.jamwiki.WikiBase.CACHE_PARSED_TOPIC_CONTENT";
049:            /** Ansi data handler class */
050:            public static final String DATA_HANDLER_ANSI = "org.jamwiki.db.AnsiDataHandler";
051:            /** DB2 data handler class */
052:            public static final String DATA_HANDLER_DB2 = "org.jamwiki.db.DB2DataHandler";
053:            /** DB2/400 data handler class */
054:            public static final String DATA_HANDLER_DB2400 = "org.jamwiki.db.DB2400DataHandler";
055:            /** HSql data handler class */
056:            public static final String DATA_HANDLER_HSQL = "org.jamwiki.db.HSqlDataHandler";
057:            /** MSSql data handler class */
058:            public static final String DATA_HANDLER_MSSQL = "org.jamwiki.db.MSSqlDataHandler";
059:            /** MySql data handler class */
060:            public static final String DATA_HANDLER_MYSQL = "org.jamwiki.db.MySqlDataHandler";
061:            /** Oracle data handler class */
062:            public static final String DATA_HANDLER_ORACLE = "org.jamwiki.db.OracleDataHandler";
063:            /** Postgres data handler class */
064:            public static final String DATA_HANDLER_POSTGRES = "org.jamwiki.db.PostgresDataHandler";
065:            /** Sybase ASA data handler class */
066:            public static final String DATA_HANDLER_ASA = "org.jamwiki.db.SybaseASADataHandler";
067:            /** Name of the default wiki */
068:            // FIXME - make this configurable
069:            public static final String DEFAULT_VWIKI = "en";
070:            /** Data stored using an external database */
071:            public static final String PERSISTENCE_EXTERNAL = "DATABASE";
072:            /** Data stored using an internal copy of the HSQL database */
073:            public static final String PERSISTENCE_INTERNAL = "INTERNAL";
074:            /** Lucene search engine class */
075:            public static final String SEARCH_ENGINE_LUCENE = "org.jamwiki.search.LuceneSearchEngine";
076:            /** Root directory within the WAR distribution that contains the default topic pages. */
077:            public static final String SPECIAL_PAGE_DIR = "pages";
078:            /** Name of the default starting points topic. */
079:            public static final String SPECIAL_PAGE_STARTING_POINTS = "StartingPoints";
080:            /** Name of the default left menu topic. */
081:            public static final String SPECIAL_PAGE_LEFT_MENU = "LeftMenu";
082:            /** Name of the default footer topic. */
083:            public static final String SPECIAL_PAGE_BOTTOM_AREA = "BottomArea";
084:            /** Name of the default jamwiki.css topic. */
085:            public static final String SPECIAL_PAGE_SPECIAL_PAGES = "SpecialPages";
086:            /** Name of the default jamwiki.css topic. */
087:            public static final String SPECIAL_PAGE_STYLESHEET = "StyleSheet";
088:            /** Allow file uploads of any file type. */
089:            public static final int UPLOAD_ALL = 0;
090:            /** Use a blacklist to determine what file types can be uploaded. */
091:            public static final int UPLOAD_BLACKLIST = 2;
092:            /** Disable all file uploads. */
093:            public static final int UPLOAD_NONE = 1;
094:            /** Use a whitelist to determine what file types can be uploaded. */
095:            public static final int UPLOAD_WHITELIST = 3;
096:            /** Database user handler class */
097:            public static final String USER_HANDLER_DATABASE = "org.jamwiki.db.DatabaseUserHandler";
098:            /** LDAP user handler class */
099:            public static final String USER_HANDLER_LDAP = "org.jamwiki.ldap.LdapUserHandler";
100:
101:            static {
102:                try {
103:                    WikiBase.instance = new WikiBase();
104:                } catch (Exception e) {
105:                    logger.severe("Failure while initializing WikiBase", e);
106:                }
107:            }
108:
109:            /**
110:             * Creates an instance of <code>WikiBase</code>, initializing the default
111:             * data handler instance and search engine instance.
112:             *
113:             * @throws Exception If the instance cannot be instantiated.
114:             */
115:            private WikiBase() throws Exception {
116:                this .reload();
117:            }
118:
119:            /**
120:             * Get an instance of the current data handler.
121:             *
122:             * @return The current data handler instance, or <code>null</code>
123:             *  if the handler has not yet been initialized.
124:             */
125:            public static DataHandler getDataHandler() {
126:                return WikiBase.dataHandler;
127:            }
128:
129:            /**
130:             * Get an instance of the current search engine.
131:             *
132:             * @return The current search engine instance.
133:             */
134:            public static SearchEngine getSearchEngine() {
135:                return WikiBase.searchEngine;
136:            }
137:
138:            /**
139:             *
140:             */
141:            public static UserHandler getUserHandler() {
142:                return WikiBase.userHandler;
143:            }
144:
145:            /**
146:             * Reload the data handler, user handler, and other basic wiki
147:             * data structures.
148:             */
149:            public static void reload() throws Exception {
150:                WikiBase.dataHandler = WikiUtil.dataHandlerInstance();
151:                WikiBase.userHandler = WikiUtil.userHandlerInstance();
152:                WikiBase.searchEngine = WikiUtil.searchEngineInstance();
153:            }
154:
155:            /**
156:             * Reset the WikiBase object, re-initializing the data handler and
157:             * other values.
158:             *
159:             * @param locale The locale to be used if any system pages need to be set up
160:             *  as a part of the initialization process.
161:             * @param user A sysadmin user to be used in case any system pages need to
162:             *  be created as a part of the initialization process.
163:             * @throws Exception Thrown if an error occurs during re-initialization.
164:             */
165:            public static void reset(Locale locale, WikiUser user)
166:                    throws Exception {
167:                WikiBase.instance = new WikiBase();
168:                WikiCache.initialize();
169:                WikiBase.dataHandler.setup(locale, user);
170:            }
171:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.