Source Code Cross Referenced for ApplicationReader.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.*;
014:        import org.mmbase.util.XMLEntityResolver;
015:
016:        /**
017:         * @javadoc
018:         * @author Case Roole
019:         * @author Rico Jansen
020:         * @author Pierre van Rooden
021:         * @version $Id: ApplicationReader.java,v 1.4 2007/02/11 19:21:12 nklasens Exp $
022:         */
023:        public class ApplicationReader extends DocumentReader {
024:
025:            /** Public ID of the Application DTD version 1.0 */
026:            public static final String PUBLIC_ID_APPLICATION_1_0 = "-//MMBase//DTD application config 1.0//EN";
027:            private static final String PUBLIC_ID_APPLICATION_1_0_FAULT = "-//MMBase/DTD application config 1.0//EN";
028:            /** Public ID of the Application DTD version 1.1 */
029:            public static final String PUBLIC_ID_APPLICATION_1_1 = "-//MMBase//DTD application config 1.1//EN";
030:
031:            /** DTD resource filename of the Application DTD version 1.0 */
032:            public static final String DTD_APPLICATION_1_0 = "application_1_0.dtd";
033:            /** DTD resource filename of the Application DTD version 1.1 */
034:            public static final String DTD_APPLICATION_1_1 = "application_1_1.dtd";
035:
036:            /** Public ID of the most recent Application DTD */
037:            public static final String PUBLIC_ID_APPLICATION = PUBLIC_ID_APPLICATION_1_1;
038:            /** DTD resource filename of the most Application DTD */
039:            public static final String DTD_APPLICATION = DTD_APPLICATION_1_1;
040:
041:            /**
042:             * Register the Public Ids for DTDs used by ApplicationReader
043:             * This method is called by XMLEntityResolve
044:             * @since MMBase-1.7
045:             */
046:            public static void registerPublicIDs() {
047:                // various builder dtd versions
048:                XMLEntityResolver.registerPublicID(PUBLIC_ID_APPLICATION_1_0,
049:                        DTD_APPLICATION_1_0, ApplicationReader.class);
050:                XMLEntityResolver.registerPublicID(PUBLIC_ID_APPLICATION_1_1,
051:                        DTD_APPLICATION_1_1, ApplicationReader.class);
052:
053:                // legacy public IDs (wrong, don't use these)
054:                XMLEntityResolver.registerPublicID(
055:                        PUBLIC_ID_APPLICATION_1_0_FAULT, DTD_APPLICATION_1_0,
056:                        ApplicationReader.class);
057:            }
058:
059:            private Element root;
060:
061:            public ApplicationReader(org.xml.sax.InputSource is) {
062:                super (is, ApplicationReader.class);
063:                root = getElementByPath("application");
064:            }
065:
066:            /**
067:             * @since MMBase-1.8
068:             */
069:            public ApplicationReader(Document doc) {
070:                super (doc);
071:            }
072:
073:            /**
074:             * Get the name of this application
075:             */
076:            public String getName() {
077:                return getElementAttributeValue(root, "name");
078:            }
079:
080:            /**
081:             * Get the version of this application
082:             */
083:            public int getVersion() {
084:                String ver = getElementAttributeValue(root, "version");
085:                if (!ver.equals(""))
086:                    try {
087:                        return Integer.parseInt(ver);
088:                    } catch (Exception e) {
089:                        return -1;
090:                    }
091:                else
092:                    return -1;
093:            }
094:
095:            /**
096:             * Get the auto-deploy value of this application
097:             */
098:            public boolean hasAutoDeploy() {
099:                return getElementAttributeValue(root, "auto-deploy").equals(
100:                        "true");
101:            }
102:
103:            /**
104:             * Get the maintainer of this application
105:             */
106:            public String getMaintainer() {
107:                return getElementAttributeValue(root, "maintainer");
108:            }
109:
110:            /**
111:             * Get the applicationlist required by this application
112:             * @since MMBase-1.7
113:             */
114:            public List<Map<String, String>> getRequirements() {
115:                List<Map<String, String>> results = new ArrayList<Map<String, String>>();
116:                for (Element n3 : getChildElements("application.requirements",
117:                        "requires")) {
118:                    Map<String, String> bset = new HashMap<String, String>();
119:                    bset.put("name", getElementAttributeValue(n3, "name"));
120:                    addAttribute(bset, n3, "maintainer");
121:                    addAttribute(bset, n3, "version");
122:                    addAttribute(bset, n3, "type");
123:                    results.add(bset);
124:                }
125:                return results;
126:            }
127:
128:            private void addAttribute(Map<String, String> bset, Element n,
129:                    String attribute) {
130:                String val = n.getAttribute(attribute);
131:                if (!val.equals("")) {
132:                    bset.put(attribute, val);
133:                }
134:            }
135:
136:            /**
137:             * Get the Builders needed for this application
138:             */
139:            public List<Map<String, String>> getNeededBuilders() {
140:                List<Map<String, String>> results = new ArrayList<Map<String, String>>();
141:                for (Element n3 : getChildElements(
142:                        "application.neededbuilderlist", "builder")) {
143:                    Map<String, String> bset = new HashMap<String, String>();
144:                    bset.put("name", getElementValue(n3));
145:                    addAttribute(bset, n3, "maintainer");
146:                    addAttribute(bset, n3, "version");
147:                    results.add(bset);
148:                }
149:                return results;
150:            }
151:
152:            /**
153:             * Get the RelDefs needed for this application
154:             */
155:            public List<Map<String, String>> getNeededRelDefs() {
156:                List<Map<String, String>> results = new ArrayList<Map<String, String>>();
157:                for (Element n3 : getChildElements(
158:                        "application.neededreldeflist", "reldef")) {
159:                    Map<String, String> bset = new HashMap<String, String>();
160:                    addAttribute(bset, n3, "source");
161:                    addAttribute(bset, n3, "target");
162:                    addAttribute(bset, n3, "direction");
163:                    addAttribute(bset, n3, "guisourcename");
164:                    addAttribute(bset, n3, "guitargetname");
165:                    addAttribute(bset, n3, "builder");
166:                    results.add(bset);
167:                }
168:                return results;
169:            }
170:
171:            /**
172:             * Get allowed relations for this application
173:             */
174:            public List<Map<String, String>> getAllowedRelations() {
175:                List<Map<String, String>> results = new ArrayList<Map<String, String>>();
176:                for (Element n3 : getChildElements(
177:                        "application.allowedrelationlist", "relation")) {
178:                    Map<String, String> bset = new HashMap<String, String>();
179:                    addAttribute(bset, n3, "from");
180:                    addAttribute(bset, n3, "to");
181:                    addAttribute(bset, n3, "type");
182:                    results.add(bset);
183:                }
184:                return results;
185:            }
186:
187:            /**
188:             * Get datasources attached to this application
189:             */
190:            public List<Map<String, String>> getDataSources() {
191:                List<Map<String, String>> results = new ArrayList<Map<String, String>>();
192:                for (Element n3 : getChildElements(
193:                        "application.datasourcelist", "datasource")) {
194:                    Map<String, String> bset = new HashMap<String, String>();
195:                    addAttribute(bset, n3, "path");
196:                    addAttribute(bset, n3, "builder");
197:                    results.add(bset);
198:                }
199:                return results;
200:            }
201:
202:            /**
203:             * Get relationsources attached to this application
204:             */
205:            public List<Map<String, String>> getRelationSources() {
206:                List<Map<String, String>> results = new ArrayList<Map<String, String>>();
207:                for (Element n3 : getChildElements(
208:                        "application.relationsourcelist", "relationsource")) {
209:                    Map<String, String> bset = new HashMap<String, String>();
210:                    addAttribute(bset, n3, "path");
211:                    addAttribute(bset, n3, "builder");
212:                    results.add(bset);
213:                }
214:                return results;
215:            }
216:
217:            /**
218:             * contextsources attached to this application
219:             */
220:            public List<Map<String, String>> getContextSources() {
221:                List<Map<String, String>> results = new ArrayList<Map<String, String>>();
222:                for (Element n3 : getChildElements(
223:                        "application.contextsourcelist", "contextsource")) {
224:                    Map<String, String> bset = new HashMap<String, String>();
225:                    addAttribute(bset, n3, "path");
226:                    addAttribute(bset, n3, "type");
227:                    addAttribute(bset, n3, "goal");
228:                    results.add(bset);
229:                }
230:                return results;
231:            }
232:
233:            /**
234:             * Get the installation notices for this application
235:             */
236:            public String getInstallNotice() {
237:                return getElementValue("application.install-notice");
238:            }
239:
240:            /**
241:             * Get the description for this application
242:             */
243:            public String getDescription() {
244:                return getElementValue("application.description");
245:            }
246:
247:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.