Source Code Cross Referenced for WSDeploymentDesc.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas_ws » deployment » api » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas_ws.deployment.api 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999-2004 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library 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 GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: WSDeploymentDesc.java 5411 2004-09-10 11:49:05Z sauthieg $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas_ws.deployment.api;
025:
026:        import java.util.HashMap;
027:        import java.util.Iterator;
028:        import java.util.List;
029:        import java.util.Map;
030:        import java.util.Set;
031:        import java.util.Vector;
032:
033:        import org.objectweb.jonas_lib.I18n;
034:        import org.objectweb.jonas_lib.deployment.api.AbsDeploymentDesc;
035:
036:        import org.objectweb.jonas_ws.deployment.xml.JonasWebserviceDescription;
037:        import org.objectweb.jonas_ws.deployment.xml.JonasWebservices;
038:        import org.objectweb.jonas_ws.deployment.xml.WebserviceDescription;
039:        import org.objectweb.jonas_ws.deployment.xml.Webservices;
040:
041:        import org.objectweb.util.monolog.api.BasicLevel;
042:        import org.objectweb.util.monolog.api.Logger;
043:
044:        /**
045:         * This Classes is a data structure that encapsulate informations contained in
046:         * <code>webservices.xml</code> deployment descriptor. It provides methods to
047:         * manipulate these informations.
048:         * @author Guillaume Sauthier
049:         * @author Xavier Delplanque
050:         * @author Helene Joanin
051:         */
052:        public class WSDeploymentDesc extends AbsDeploymentDesc {
053:
054:            /** The list of ServiceDesc described in webservices.xml */
055:            private Vector services = new Vector();
056:
057:            /** The Webservices display name */
058:            private String displayName;
059:
060:            /** The WebApp dispatching SOAP request to the PortComponents */
061:            private String warFile = null;
062:
063:            /** The Webservices logger */
064:            private Logger logger;
065:
066:            /**
067:             * Internationalization
068:             */
069:            private static I18n i18n = I18n.getInstance(WSDeploymentDesc.class);
070:
071:            /**
072:             * ContextRoot for this group of WebServices
073:             */
074:            private String contextRoot = null;
075:
076:            /**
077:             * Constructor : creates a WSDeploymentDesc object
078:             * @param jarCL module (war or ejbjar) class loader.
079:             * @param log the logger to use.
080:             * @param ws Zeus object containing webservices informations
081:             * @param jws Zeus object containing jonas-webservices informations
082:             * @throws WSDeploymentDescException if in the Webservices file : - each
083:             *         service haven't got an unique name. - each port component haven't
084:             *         got an unique name. - each handler haven't got an unique name. -
085:             *         wsdl ports aren't inclued in portComponents.
086:             */
087:            public WSDeploymentDesc(ClassLoader jarCL, Logger log,
088:                    Webservices ws, JonasWebservices jws)
089:                    throws WSDeploymentDescException {
090:                this .logger = log;
091:
092:                // set displayName
093:                displayName = ws.getDisplayName();
094:
095:                // Store the WebApp filename
096:                if (jws != null) {
097:                    if (jws.getWar() != null) {
098:                        warFile = jws.getWar();
099:                    }
100:                    // set contextRoot
101:                    String ctx = jws.getContextRoot();
102:                    if (ctx != null && !"".equals(ctx)) {
103:                        contextRoot = ctx;
104:                    }
105:
106:                }
107:
108:                // set services
109:                List wdl = ws.getWebserviceDescriptionList();
110:                Map links = associateWDAndJWD(ws, jws);
111:
112:                for (int i = 0; i < wdl.size(); i++) {
113:                    WebserviceDescription wd = (WebserviceDescription) wdl
114:                            .get(i);
115:                    JonasWebserviceDescription jwd = (JonasWebserviceDescription) links
116:                            .get(wd.getWebserviceDescriptionName());
117:                    services.add(new ServiceDesc(jarCL, wd, jwd));
118:                }
119:
120:                // validation
121:                // services names are unique
122:                // fill the list of service names
123:                Vector serviceNames = new Vector();
124:
125:                for (int i = 0; i < services.size(); i++) {
126:                    String sn = ((ServiceDesc) services.get(i)).getName();
127:
128:                    if (serviceNames.contains(sn)) {
129:                        // if the service name is already contained, it isn't unique
130:                        String err = getI18n().getMessage(
131:                                "WSDeploymentDesc.serviceNameNotUnique", sn); //$NON-NLS-1$
132:                        logger.log(BasicLevel.ERROR, err);
133:                        throw new WSDeploymentDescException(err);
134:                    }
135:
136:                    serviceNames.add(sn);
137:                }
138:
139:                // port components names are unique
140:                // fill the list of port component names
141:                Vector pcNames = new Vector();
142:
143:                for (int i = 0; i < services.size(); i++) {
144:                    ServiceDesc s = (ServiceDesc) services.get(i);
145:                    List pcl = s.getPortComponents();
146:
147:                    for (int j = 0; j < pcl.size(); j++) {
148:                        PortComponentDesc pcd = (PortComponentDesc) pcl.get(j);
149:                        String pcn = pcd.getName();
150:
151:                        if (pcNames.contains(pcn)) {
152:                            // if the port component name is already contained, it isn't
153:                            // unique
154:                            String err = getI18n()
155:                                    .getMessage(
156:                                            "WSDeploymentDesc.portCompNameNotUnique", pcn); //$NON-NLS-1$
157:                            logger.log(BasicLevel.ERROR, err);
158:                            throw new WSDeploymentDescException(err);
159:                        }
160:
161:                        pcNames.add(pcn);
162:                    }
163:                }
164:
165:                // verify that all wsdl ports are included inside portComponents
166:                // build the list of port component QNames
167:                Vector pcQNames = new Vector();
168:
169:                for (int i = 0; i < services.size(); i++) {
170:                    List pcl = ((ServiceDesc) services.get(i))
171:                            .getPortComponents();
172:
173:                    for (int j = 0; j < pcl.size(); j++) {
174:                        PortComponentDesc pc = (PortComponentDesc) pcl.get(j);
175:                        pcQNames.add(pc.getQName());
176:                    }
177:                }
178:
179:                // verify for each WSDLs that port are inside pcQNames
180:                for (int i = 0; i < services.size(); i++) {
181:                    WSDLFile wsdlf = ((ServiceDesc) services.get(i)).getWSDL();
182:
183:                    if (!wsdlf.hasPortsIncludedIn(pcQNames)) {
184:                        String err = getI18n()
185:                                .getMessage(
186:                                        "WSDeploymentDesc.wsdlDeclareUnknownPort", wsdlf.getName()); //$NON-NLS-1$
187:                        logger.log(BasicLevel.ERROR, err);
188:                        throw new WSDeploymentDescException(err);
189:                    }
190:                }
191:            }
192:
193:            /**
194:             * Associate WebserviceDescription.name to JonasWebserviceDescription
195:             * @param jws JonasWebservices instance
196:             * @param ws Webservices instance
197:             * @return Returns the JonasWebserviceDescription with the given name or null if not found.
198:             */
199:            private Map associateWDAndJWD(Webservices ws, JonasWebservices jws) {
200:                Map res = new HashMap();
201:                // for each wsd
202:                for (Iterator i = ws.getWebserviceDescriptionList().iterator(); i
203:                        .hasNext();) {
204:                    WebserviceDescription wsd = (WebserviceDescription) i
205:                            .next();
206:                    res.put(wsd.getWebserviceDescriptionName(), null);
207:                }
208:                // jonas-webservices.xml
209:                if (jws != null) {
210:
211:                    // get all wsd.name
212:                    Set keys = res.keySet();
213:
214:                    // for each jwsd
215:                    for (Iterator i = jws.getJonasWebserviceDescriptionList()
216:                            .iterator(); i.hasNext();) {
217:                        JonasWebserviceDescription jwsd = (JonasWebserviceDescription) i
218:                                .next();
219:                        String wsdName = jwsd.getWebserviceDescriptionName();
220:
221:                        if (keys.contains(wsdName)) {
222:                            // jonas-webservice-description linked to webservice-description
223:                            res.put(wsdName, jwsd);
224:                        } else {
225:                            String err = "jonas-webservice-description '"
226:                                    + wsdName
227:                                    + "' is not linked to any webservice-description. It will be ignored."; //getI18n().getMessage("WSDeploymentDesc.wsdlDeclareUnknownPort", wsdlf.getName());
228:                            logger.log(BasicLevel.WARN, err);
229:                        }
230:                    }
231:                }
232:                return res;
233:            }
234:
235:            /**
236:             * Return the list of ServiceDesc.
237:             * @return the list of ServiceDesc.
238:             */
239:            public List getServiceDescs() {
240:                return services;
241:            }
242:
243:            /**
244:             * Return the Webservices displayName.
245:             * @return the Webservices displayName.
246:             */
247:            public String getDisplayName() {
248:                return displayName;
249:            }
250:
251:            /**
252:             * @return Returns the contextRoot.
253:             */
254:            public String getContextRoot() {
255:                return contextRoot;
256:            }
257:
258:            /**
259:             * Return a String representation of the WSDeploymentDesc.
260:             * @return a String representation of the WSDeploymentDesc.
261:             */
262:            public String toString() {
263:                StringBuffer sb = new StringBuffer();
264:
265:                sb.append("\nWSDeploymentDesc :"); //$NON-NLS-1$
266:                sb.append("\ngetDisplayName()=" + getDisplayName()); //$NON-NLS-1$
267:
268:                for (Iterator i = getServiceDescs().iterator(); i.hasNext();) {
269:                    sb
270:                            .append("\ngetServiceDesc()=" + ((ServiceDesc) i.next()).toString()); //$NON-NLS-1$
271:                }
272:
273:                sb.append("\ngetWarFile()=" + getWarFile()); //$NON-NLS-1$
274:
275:                return sb.toString();
276:            }
277:
278:            /**
279:             * Return the filename of the WebApp dispatching SOAP requests to the
280:             * components (can be null if no filename specified in
281:             * jonas-webservices.xml).
282:             * @return the filename of the WebApp dispatching SOAP requests to the
283:             *         components.
284:             */
285:            public String getWarFile() {
286:                return warFile;
287:            }
288:
289:            /**
290:             * @return Returns the i18n.
291:             */
292:            protected static I18n getI18n() {
293:                return i18n;
294:            }
295:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.