Source Code Cross Referenced for ModuleReader.java in  » Database-ORM » MMBase » org » mmbase » util » xml » 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 » Database ORM » MMBase » org.mmbase.util.xml 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:        This software is OSI Certified Open Source Software.
004:        OSI Certified is a certification mark of the Open Source Initiative.
005:
006:        The license (Mozilla version 1.0) can be read at the MMBase site.
007:        See http://www.MMBase.org/license
008:
009:         */
010:        package org.mmbase.util.xml;
011:
012:        import java.util.*;
013:        import org.w3c.dom.Document;
014:        import org.w3c.dom.Element;
015:        import org.xml.sax.InputSource;
016:
017:        import org.mmbase.util.LocalizedString;
018:        import org.mmbase.util.XMLEntityResolver;
019:
020:        /**
021:         * @javadoc
022:         * @since MMBase-1.8
023:         * @author Daniel Ockeloen
024:         * @author Pierre van Rooden
025:         * @version $Id: ModuleReader.java,v 1.8 2007/06/19 14:00:54 michiel Exp $
026:         */
027:        public class ModuleReader extends DocumentReader {
028:
029:            /** Public ID of the Module DTD version 1.0 */
030:            public static final String PUBLIC_ID_MODULE_1_0 = "-//MMBase//DTD module config 1.0//EN";
031:            private static final String PUBLIC_ID_MODULE_1_0_FAULT = "-//MMBase/DTD module config 1.0//EN";
032:            private static final String PUBLIC_ID_MODULE_1_0_FAULT2 = "-//MMBase/ DTD module config 1.0//EN";
033:            /** Public ID of the most recent Module DTD */
034:            public static final String PUBLIC_ID_MODULE = PUBLIC_ID_MODULE_1_0;
035:
036:            /** DTD resource filename of the most recent Module DTD */
037:            public static final String DTD_MODULE_1_0 = "module_1_0.dtd";
038:            /** DTD resource filename of the most recent Module DTD */
039:            public static final String DTD_MODULE = DTD_MODULE_1_0;
040:
041:            public static final String XSD_MODULE_2_0 = "module.xsd";
042:            public static final String NAMESPACE_MODULE_2_0 = "http://www.mmbase.org/xmlns/module";
043:            public static final String NAMESPACE_MODULE = NAMESPACE_MODULE_2_0;
044:
045:            /**
046:             * Register the namespace and XSD used by DataTypeConfigurer
047:             * This method is called by XMLEntityResolver.
048:             */
049:            public static void registerSystemIDs() {
050:                XMLEntityResolver.registerSystemID(NAMESPACE_MODULE_2_0
051:                        + ".xsd", XSD_MODULE_2_0, ModuleReader.class);
052:            }
053:
054:            /**
055:             * Register the Public Ids for DTDs used by ModuleReader
056:             * This method is called by XMLEntityResolver.
057:             * @since MMBase-1.7
058:             */
059:            public static void registerPublicIDs() {
060:                XMLEntityResolver.registerPublicID(PUBLIC_ID_MODULE_1_0,
061:                        DTD_MODULE_1_0, ModuleReader.class);
062:                // legacy public IDs (wrong, don't use these)
063:                XMLEntityResolver.registerPublicID(PUBLIC_ID_MODULE_1_0_FAULT,
064:                        DTD_MODULE_1_0, ModuleReader.class);
065:                XMLEntityResolver.registerPublicID(PUBLIC_ID_MODULE_1_0_FAULT2,
066:                        DTD_MODULE_1_0, ModuleReader.class);
067:            }
068:
069:            public ModuleReader(InputSource is) {
070:                super (is, ModuleReader.class);
071:            }
072:
073:            /**
074:             * @since MMBase-1.8
075:             */
076:            public ModuleReader(Document doc) {
077:                super (doc);
078:            }
079:
080:            /**
081:             * Get the status of this module
082:             */
083:            public String getStatus() {
084:                Element e = getElementByPath("module.status");
085:                String s = getElementValue(e);
086:                return s.equals("") ? "active" : s;
087:            }
088:
089:            /**
090:             * Get the version of this module
091:             */
092:            public int getVersion() {
093:                Element e = getElementByPath("module");
094:                String version = getElementAttributeValue(e, "version");
095:                int n = 0;
096:                if (version == null) {
097:                    return n;
098:                } else {
099:                    try {
100:                        n = Integer.parseInt(version);
101:                    } catch (Exception f) {
102:                        n = 0;
103:                    }
104:                    return n;
105:                }
106:            }
107:
108:            /**
109:             * Get the name of this module.
110:             * Returns <code>null</code> if no name is found.
111:             * @since MMBase-1.9
112:             */
113:            public String getName() {
114:                Element e = getElementByPath("module");
115:                String tmp = getElementAttributeValue(e, "name");
116:                if (tmp != null && !tmp.equals("")) {
117:                    return tmp;
118:                } else {
119:                    return null;
120:                }
121:            }
122:
123:            /**
124:             * Get the maintainer of this module
125:             */
126:            public String getMaintainer() {
127:                Element e = getElementByPath("module");
128:                String tmp = getElementAttributeValue(e, "maintainer");
129:                if (tmp != null && !tmp.equals("")) {
130:                    return tmp;
131:                } else {
132:                    return "mmbase.org";
133:                }
134:            }
135:
136:            /**
137:             * The name of the class which is implementing this Module.
138:             */
139:            public String getClassName() {
140:                Element e = getElementByPath("module.class");
141:                if (e != null)
142:                    return getElementValue(e);
143:                // legacy fall back
144:                e = getElementByPath("module.classfile");
145:                return getElementValue(e);
146:
147:            }
148:
149:            /**
150:             * get the optional resource url for the module
151:             * @return the url of the resource or null if no url was defined
152:             **/
153:            public String getURLString() {
154:                Element e = getElementByPath("module.url");
155:                if (e != null) {
156:                    return getElementValue(e);
157:                }
158:                return null;
159:            }
160:
161:            /**
162:             * Get the descriptions of this module.
163:             * @return the descriptions as a LocalizedString
164:             */
165:            public LocalizedString getLocalizedDescription(
166:                    LocalizedString description) {
167:                description.fillFromXml("description",
168:                        getElementByPath("module.descriptions"));
169:                return description;
170:            }
171:
172:            /**
173:             * Get the (gui) names of this module.
174:             * @return the names as a LocalizedString
175:             */
176:            public LocalizedString getLocalizedGUIName(LocalizedString guiName) {
177:                guiName.fillFromXml("name", getElementByPath("module.names"));
178:                return guiName;
179:            }
180:
181:            /**
182:             * Get the properties of this builder
183:             */
184:            public Map<String, String> getProperties() {
185:                Map<String, String> results = new LinkedHashMap<String, String>();
186:                for (Element el : getChildElements("module.properties",
187:                        "property")) {
188:                    String name = getElementAttributeValue(el, "name");
189:                    results.put(name, getElementValue(el));
190:                }
191:                return results;
192:            }
193:
194:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.