Source Code Cross Referenced for JbiXmlFile.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » build » ant » util » 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 » ESB » cbesb 1.2 » com.bostechcorp.cbesb.build.ant.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ChainBuilder ESB
003:         * 		Visual Enterprise Integration
004:         * 
005:         * Copyright (C) 2008 Bostech Corporation
006:         * 
007:         * This program is free software; you can redistribute it and/or modify it 
008:         * under the terms of the GNU General Public License as published by the 
009:         * Free Software Foundation; either version 2 of the License, or (at your option) 
010:         * any later version.
011:         *
012:         * This program is distributed in the hope that it will be useful, 
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
014:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
015:         * for more details.
016:         * 
017:         * You should have received a copy of the GNU General Public License along with 
018:         * this program; if not, write to the Free Software Foundation, Inc., 
019:         * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020:         *
021:         *
022:         * $Id$
023:         */
024:        package com.bostechcorp.cbesb.build.ant.util;
025:
026:        import java.io.File;
027:        import java.util.List;
028:        import java.util.Vector;
029:
030:        import javax.xml.parsers.DocumentBuilder;
031:        import javax.xml.parsers.DocumentBuilderFactory;
032:
033:        import org.w3c.dom.Document;
034:        import org.w3c.dom.Element;
035:        import org.w3c.dom.Node;
036:
037:        public class JbiXmlFile {
038:
039:            public static final String JBI_NS = "http://java.sun.com/xml/ns/jbi";
040:            public static final String JBI = "jbi";
041:            public static final String VERSION = "version";
042:            public static final String COMPONENT = "component";
043:            public static final String IDENTIFICATION = "identification";
044:            public static final String NAME = "name";
045:            public static final String DESCRIPTION = "description";
046:            public static final String COMPONENT_CLASS_NAME = "component-class-name";
047:            public static final String COMPONENT_CLASS_PATH = "component-class-path";
048:            public static final String BOOTSTRAP_CLASS_NAME = "bootstrap-class-name";
049:            public static final String BOOTSTRAP_CLASS_PATH = "bootstrap-class-path";
050:            public static final String PATH_ELEMENT = "path-element";
051:            public static final String SHARED_LIBRARY = "shared-library";
052:            public static final String SHARED_LIBRARY_CLASS_PATH = "shared-library-class-path";
053:
054:            private boolean isComponent = false;
055:            private boolean isSharedLibrary = false;
056:            private String name;
057:            private String description;
058:            private String componentClassName;
059:            private Vector<String> componentClasspath;
060:            private String bootstrapClassName;
061:            private Vector<String> bootstrapClasspath;
062:            private Vector<String> sharedLibraries;
063:            private Vector<String> sharedLibraryClasspath;
064:
065:            public JbiXmlFile() {
066:                name = null;
067:                description = null;
068:                componentClassName = null;
069:                componentClasspath = new Vector<String>();
070:                bootstrapClassName = null;
071:                bootstrapClasspath = new Vector<String>();
072:                sharedLibraries = new Vector<String>();
073:                sharedLibraryClasspath = new Vector<String>();
074:            }
075:
076:            public boolean isComponent() {
077:                return isComponent;
078:            }
079:
080:            public boolean isSharedLibrary() {
081:                return isSharedLibrary;
082:            }
083:
084:            public String getBootstrapClassName() {
085:                return bootstrapClassName;
086:            }
087:
088:            public String getComponentClassName() {
089:                return componentClassName;
090:            }
091:
092:            public String getDescription() {
093:                return description;
094:            }
095:
096:            public String getName() {
097:                return name;
098:            }
099:
100:            public List<String> getComponentClasspath() {
101:                return componentClasspath;
102:            }
103:
104:            public List<String> getBootstrapClasspath() {
105:                return bootstrapClasspath;
106:            }
107:
108:            public List<String> getSharedLibraries() {
109:                return sharedLibraries;
110:            }
111:
112:            public List<String> getSharedLibraryClasspath() {
113:                return sharedLibraryClasspath;
114:            }
115:
116:            public void load(File jbiFile) throws Exception {
117:                DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
118:                        .newInstance();
119:                docBuilderFactory.setNamespaceAware(true);
120:                DocumentBuilder docBuilder = docBuilderFactory
121:                        .newDocumentBuilder();
122:                Document doc = docBuilder.parse(jbiFile);
123:                Element root = doc.getDocumentElement();
124:                if (JBI.equals(root.getLocalName())
125:                        && JBI_NS.equals(root.getNamespaceURI())) {
126:                    Node child = root.getFirstChild();
127:                    while (child != null) {
128:                        if (child.getNodeType() == Node.ELEMENT_NODE) {
129:                            if (child.getLocalName().equals(COMPONENT)) {
130:                                isComponent = true;
131:                                Node child2 = child.getFirstChild();
132:                                while (child2 != null) {
133:                                    if (child2.getNodeType() == Node.ELEMENT_NODE) {
134:                                        if (child2.getLocalName().equals(
135:                                                IDENTIFICATION)) {
136:                                            loadIdentification((Element) child2);
137:                                        } else if (child2.getLocalName()
138:                                                .equals(COMPONENT_CLASS_NAME)) {
139:                                            loadComponentClassName((Element) child2);
140:                                        } else if (child2.getLocalName()
141:                                                .equals(COMPONENT_CLASS_PATH)) {
142:                                            loadComponentClassPath((Element) child2);
143:                                        } else if (child2.getLocalName()
144:                                                .equals(BOOTSTRAP_CLASS_NAME)) {
145:                                            loadBootstrapClassName((Element) child2);
146:                                        } else if (child2.getLocalName()
147:                                                .equals(BOOTSTRAP_CLASS_PATH)) {
148:                                            loadBootstrapClassPath((Element) child2);
149:                                        } else if (child2.getLocalName()
150:                                                .equals(SHARED_LIBRARY)) {
151:                                            loadSharedLibrary((Element) child2);
152:                                        }
153:                                    }
154:                                    child2 = child2.getNextSibling();
155:                                }
156:                            } else if (child.getLocalName().equals(
157:                                    SHARED_LIBRARY)) {
158:                                isSharedLibrary = true;
159:                                Node child2 = child.getFirstChild();
160:                                while (child2 != null) {
161:                                    if (child2.getNodeType() == Node.ELEMENT_NODE) {
162:                                        if (child2.getLocalName().equals(
163:                                                IDENTIFICATION)) {
164:                                            loadIdentification((Element) child2);
165:                                        } else if (child2
166:                                                .getLocalName()
167:                                                .equals(
168:                                                        SHARED_LIBRARY_CLASS_PATH)) {
169:                                            loadSharedLibraryClasspath((Element) child2);
170:                                        }
171:                                    }
172:                                    child2 = child2.getNextSibling();
173:                                }
174:
175:                            }
176:                        }
177:                        child = child.getNextSibling();
178:                    }
179:                } else {
180:                    throw new Exception("Root element of file is not '{"
181:                            + JBI_NS + "}" + JBI + "'");
182:                }
183:            }
184:
185:            private void loadIdentification(Element identification) {
186:                Node child = identification.getFirstChild();
187:                while (child != null) {
188:                    if (child.getNodeType() == Node.ELEMENT_NODE) {
189:                        if (child.getLocalName().equals(NAME)) {
190:                            name = child.getTextContent();
191:                        } else if (child.getLocalName().equals(DESCRIPTION)) {
192:                            description = child.getTextContent();
193:                        }
194:                    }
195:                    child = child.getNextSibling();
196:                }
197:            }
198:
199:            private void loadComponentClassName(Element componentClassName) {
200:                this .componentClassName = componentClassName.getTextContent();
201:            }
202:
203:            private void loadComponentClassPath(Element componentClasspath) {
204:                Node child = componentClasspath.getFirstChild();
205:                while (child != null) {
206:                    if (child.getNodeType() == Node.ELEMENT_NODE
207:                            && child.getLocalName().equals(PATH_ELEMENT)) {
208:                        this .componentClasspath.add(child.getTextContent());
209:                    }
210:                    child = child.getNextSibling();
211:                }
212:            }
213:
214:            private void loadBootstrapClassName(Element bootstrapClassName) {
215:                this .bootstrapClassName = bootstrapClassName.getTextContent();
216:            }
217:
218:            private void loadBootstrapClassPath(Element bootstrapClassPath) {
219:                Node child = bootstrapClassPath.getFirstChild();
220:                while (child != null) {
221:                    if (child.getNodeType() == Node.ELEMENT_NODE
222:                            && child.getLocalName().equals(PATH_ELEMENT)) {
223:                        this .bootstrapClasspath.add(child.getTextContent());
224:                    }
225:                    child = child.getNextSibling();
226:                }
227:            }
228:
229:            private void loadSharedLibrary(Element sharedLib) {
230:                sharedLibraries.add(sharedLib.getTextContent());
231:            }
232:
233:            private void loadSharedLibraryClasspath(Element sharedLibClasspath) {
234:                Node child = sharedLibClasspath.getFirstChild();
235:                while (child != null) {
236:                    if (child.getNodeType() == Node.ELEMENT_NODE
237:                            && child.getLocalName().equals(PATH_ELEMENT)) {
238:                        this.sharedLibraryClasspath.add(child.getTextContent());
239:                    }
240:                    child = child.getNextSibling();
241:                }
242:
243:            }
244:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.