Source Code Cross Referenced for WikiModuleInfo.java in  » Wiki-Engine » JSPWiki » com » ecyrd » jspwiki » modules » 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.modules 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:            JSPWiki - a JSP-based WikiWiki clone.
003:
004:            Copyright (C) 2001-2002 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:        package com.ecyrd.jspwiki.modules;
021:
022:        import java.io.BufferedInputStream;
023:        import java.io.ByteArrayOutputStream;
024:        import java.io.IOException;
025:        import java.net.URL;
026:
027:        import org.jdom.Element;
028:
029:        import com.ecyrd.jspwiki.FileUtil;
030:
031:        /**
032:         *  A WikiModule describes whatever JSPWiki plugin there is: it can be a plugin,
033:         *  an editor, a filter, etc.
034:         *  @author jalkanen
035:         *  @since 2.4
036:         */
037:        public class WikiModuleInfo implements  Comparable {
038:            protected String m_name;
039:            protected String m_scriptLocation;
040:            protected String m_scriptText;
041:            protected String m_stylesheetLocation;
042:            protected String m_stylesheetText;
043:            protected String m_author;
044:            protected URL m_resource;
045:            protected String m_minVersion;
046:            protected String m_maxVersion;
047:            protected String m_adminBeanClass;
048:
049:            public WikiModuleInfo(String name) {
050:                m_name = name;
051:            }
052:
053:            /**
054:             *  The WikiModuleInfo is equal to another WikiModuleInfo, if the name is equal.  All
055:             *  objects are unique across JSPWiki.
056:             */
057:            public boolean equals(Object obj) {
058:                if (obj instanceof  WikiModuleInfo) {
059:                    return ((WikiModuleInfo) obj).m_name.equals(m_name);
060:                }
061:
062:                return false;
063:            }
064:
065:            public int hashCode() {
066:                return m_name.hashCode();
067:            }
068:
069:            protected void initializeFromXML(Element el) {
070:                m_scriptLocation = el.getChildText("script");
071:                m_stylesheetLocation = el.getChildText("stylesheet");
072:                m_author = el.getChildText("author");
073:                m_minVersion = el.getChildText("minVersion");
074:                m_maxVersion = el.getChildText("maxVersion");
075:                m_adminBeanClass = el.getChildText("adminBean");
076:            }
077:
078:            public String getAdminBeanClass() {
079:                return m_adminBeanClass;
080:            }
081:
082:            /**
083:             *  Returns the common name for this particular module.  Note that
084:             *  this is not the class name, nor is it an alias.  For different modules
085:             *  the name may have different meanings.
086:             *  <p>
087:             *  Every module defines a name, so this method should never return null.
088:             *  
089:             *  @return A module name.
090:             */
091:            public String getName() {
092:                return m_name;
093:            }
094:
095:            public String getStylesheetLocation() {
096:                return m_stylesheetLocation;
097:            }
098:
099:            public String getScriptLocation() {
100:                return m_scriptLocation;
101:            }
102:
103:            /**
104:             *  Returns the name of the author of this plugin (if defined).
105:             * @return Author name, or null.
106:             */
107:            public String getAuthor() {
108:                return m_author;
109:            }
110:
111:            public String getMinVersion() {
112:                return m_minVersion;
113:            }
114:
115:            public String getMaxVersion() {
116:                return m_maxVersion;
117:            }
118:
119:            protected String getTextResource(String resourceLocation)
120:                    throws IOException {
121:                if (m_resource == null) {
122:                    return "";
123:                }
124:
125:                // The text of this resource should be loaded from the same
126:                //   jar-file as the jspwiki_modules.xml -file! This is because 2 plugins
127:                //   could have the same name of the resourceLocation!
128:                //   (2 plugins could have their stylesheet-files in 'ini/jspwiki.css')
129:
130:                // So try to construct a resource that loads this resource from the
131:                //   same jar-file.
132:                String spec = m_resource.toString();
133:
134:                // Replace the 'PLUGIN_RESOURCE_LOCATION' with the requested
135:                //   resourceLocation.
136:                int length = ModuleManager.PLUGIN_RESOURCE_LOCATION.length();
137:                spec = spec.substring(0, spec.length() - length)
138:                        + resourceLocation;
139:
140:                URL url = new URL(spec);
141:                BufferedInputStream in = new BufferedInputStream(url
142:                        .openStream());
143:                ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
144:
145:                FileUtil.copyContents(in, out);
146:
147:                in.close();
148:                String text = out.toString();
149:                out.close();
150:
151:                return text;
152:            }
153:
154:            public int compareTo(Object arg0) {
155:                if (arg0 instanceof  WikiModuleInfo) {
156:                    return m_name.compareTo(((WikiModuleInfo) arg0).getName());
157:                }
158:
159:                throw new ClassCastException(arg0.getClass().getName());
160:            }
161:
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.