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


001:        /**
002:         * ChainBuilder ESB
003:         *          Visual Enterprise Integration
004:         * 
005:         * Copyright (C) 2006 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:         */package com.bostechcorp.cbesb.common.util.generators;
024:
025:        import java.util.Iterator;
026:        import java.util.List;
027:
028:        import org.jdom.Element;
029:        import org.jdom.Namespace;
030:
031:        import com.bostechcorp.cbesb.common.sa.component.AbstractComponent;
032:
033:        /**
034:         * @author LPS
035:         *
036:         */
037:        public class AbstractComponentDOMJbiXMLGenerator extends
038:                AbstractDOMGenerator {
039:            private static final String JBI_T = "jbi";
040:            private static final String SERVICES_T = "services";
041:            private static final String PROVIDES_T = "provides";
042:            private static final String CONSUMES_T = "consumes";
043:            private static final String INTERFACE_NAME_A = "interface-name";
044:            private static final String SERVICE_NAME_A = "service-name";
045:            private static final String ENDPOINT_NAME_A = "endpoint-name";
046:            private static final String BINDING_COMPONENT_A = "binding-component";
047:
048:            protected String sus_jbi_xml_output_filename = "META-INF/jbi.xml";
049:            private String JBI_Namespace = "http://java.sun.com/xml/ns/jbi";
050:            private String namespacePrefixtext = "nspf"; //
051:            private int namespacePrefixIndex = 0; //
052:            private static String URI_CONSTANT_STRING = "http://bostechcorp.com/SU/";
053:            protected Element services; // inner tag
054:            private String saName;
055:
056:            public AbstractComponentDOMJbiXMLGenerator(
057:                    Boolean isBindingComponent, String saName) {
058:                super ();
059:                this .saName = saName;
060:                buildDocumentStructure();
061:                setIsBindingComponent(isBindingComponent);
062:            }
063:
064:            public AbstractComponentDOMJbiXMLGenerator(String path,
065:                    Boolean isBindingComponent, String saName) {
066:                super (path);
067:                this .saName = saName;
068:                buildDocumentStructure();
069:                setIsBindingComponent(isBindingComponent);
070:            }
071:
072:            /* (non-Javadoc)
073:             * @see com.bostechcorp.cbesb.common.util.generators.AbstractDOMGenerator#buildDocumentStructure()
074:             */
075:            @Override
076:            protected void buildDocumentStructure() {
077:                rootElement = jdomFactory.element(JBI_T);
078:                rootElement.setNamespace(Namespace.getNamespace(JBI_Namespace));
079:                rootElement.setAttribute(jdomFactory
080:                        .attribute("version", "1.0"));
081:                services = jdomFactory.element(SERVICES_T);
082:
083:                rootElement.addContent(services);
084:            }
085:
086:            /**
087:             * 
088:             * @param suName    
089:             * @param interfaceName
090:             * @param ServiceName
091:             * @param endpointName
092:             */
093:            public void addProviderPart(String suName, String interfaceName,
094:                    String ServiceName, String endpointName) {
095:                Namespace ns = getNamespaceDeclaration(suName);
096:                rootElement.addNamespaceDeclaration(ns);
097:                Element provides = jdomFactory.element(PROVIDES_T);
098:                provides.setAttribute(jdomFactory.attribute(INTERFACE_NAME_A,
099:                        ns.getPrefix() + ":" + saName + "_" + interfaceName));
100:                provides.setAttribute(jdomFactory.attribute(SERVICE_NAME_A, ns
101:                        .getPrefix()
102:                        + ":" + saName + "_" + ServiceName));
103:                provides.setAttribute(jdomFactory.attribute(ENDPOINT_NAME_A,
104:                        saName + "_" + endpointName));
105:                services.addContent(provides);
106:            }
107:
108:            /**
109:             * @param suName
110:             * @param interfaceName
111:             * @param ServiceName
112:             * @param endpointName
113:             * @param conn 
114:             */
115:            public void addConsumerPart(List<AbstractComponent> conn) {
116:                //DONE -- modified 
117:
118:                for (AbstractComponent component : conn) {
119:                    Namespace ns = getNamespaceDeclaration(component.getName());
120:                    rootElement.addNamespaceDeclaration(ns);
121:                    //String suName= saName+"_"+component.getName();
122:                    String interfaceName = saName + "_" + component.getName()
123:                            + "_Interface";
124:                    String ServiceName = saName + "_" + component.getName()
125:                            + "_Service";
126:                    String endpointName = saName + "_"
127:                            + component.getProviderEndpointName();
128:                    Element consumes = jdomFactory.element(CONSUMES_T);
129:                    consumes.setAttribute(jdomFactory.attribute(
130:                            INTERFACE_NAME_A, ns.getPrefix() + ":"
131:                                    + interfaceName));
132:                    consumes.setAttribute(jdomFactory.attribute(SERVICE_NAME_A,
133:                            ns.getPrefix() + ":" + ServiceName));
134:                    consumes.setAttribute(jdomFactory.attribute(
135:                            ENDPOINT_NAME_A, endpointName));
136:                    services.addContent(consumes);
137:                }
138:            }
139:
140:            private void setIsBindingComponent(Boolean isBindingComponent) {
141:                services.setAttribute(jdomFactory
142:                        .attribute(BINDING_COMPONENT_A, String
143:                                .valueOf(isBindingComponent)));
144:            }
145:
146:            /* (non-Javadoc)
147:             * @see com.bostechcorp.cbesb.common.util.generators.AbstractDOMGenerator#getFileOut()
148:             */
149:            @Override
150:            protected String getFileOut() {
151:                if (filePath.endsWith("/"))
152:                    return filePath + sus_jbi_xml_output_filename;
153:                return filePath + "/" + sus_jbi_xml_output_filename;
154:            }
155:
156:            private Namespace getNamespaceDeclaration(String suName) {
157:                String prefixString = "";
158:                // test wether the namespace exist
159:                List l = rootElement.getAdditionalNamespaces();
160:                for (Iterator nsIter = l.iterator(); nsIter.hasNext();) {
161:                    Object nsObject = nsIter.next();
162:                    if (nsObject instanceof  Namespace) {
163:                        Namespace nsElement = (Namespace) nsObject;
164:                        if (nsElement.getURI().equals(
165:                                URI_CONSTANT_STRING + saName + "_" + suName)) {
166:                            return nsElement;
167:                        }
168:                    }
169:                }
170:                prefixString = namespacePrefixtext + namespacePrefixIndex;
171:                namespacePrefixIndex++;
172:                String uriString = URI_CONSTANT_STRING + saName + "_" + suName;
173:                return Namespace.getNamespace(prefixString, uriString);
174:            }
175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.