KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > ws > AbsWebServicesServiceImpl


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2005 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: AbsWebServicesServiceImpl.java,v 1.38 2005/07/28 09:52:22 sauthieg Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.ws;
27
28 import java.io.File JavaDoc;
29 import java.io.IOException JavaDoc;
30 import java.io.UnsupportedEncodingException JavaDoc;
31 import java.net.MalformedURLException JavaDoc;
32 import java.net.URL JavaDoc;
33 import java.net.URLClassLoader JavaDoc;
34 import java.net.URLEncoder JavaDoc;
35 import java.util.ArrayList JavaDoc;
36 import java.util.HashMap JavaDoc;
37 import java.util.Iterator JavaDoc;
38 import java.util.List JavaDoc;
39 import java.util.Map JavaDoc;
40 import java.util.Stack JavaDoc;
41 import java.util.StringTokenizer JavaDoc;
42
43 import javax.management.MBeanServer JavaDoc;
44 import javax.management.MalformedObjectNameException JavaDoc;
45 import javax.management.ObjectName JavaDoc;
46 import javax.naming.Context JavaDoc;
47 import javax.naming.InitialContext JavaDoc;
48 import javax.naming.NamingException JavaDoc;
49 import javax.naming.Reference JavaDoc;
50 import javax.naming.StringRefAddr JavaDoc;
51 import javax.xml.namespace.QName JavaDoc;
52
53 import org.objectweb.jonas_lib.I18n;
54 import org.objectweb.jonas_lib.deployment.api.HandlerDesc;
55 import org.objectweb.jonas_lib.loader.WebappClassLoader;
56 import org.objectweb.jonas_lib.naming.ContainerNaming;
57 import org.objectweb.jonas_lib.naming.factory.URLFactory;
58
59 import org.objectweb.jonas_web.deployment.api.WebContainerDeploymentDesc;
60 import org.objectweb.jonas_web.deployment.api.WebContainerDeploymentDescException;
61 import org.objectweb.jonas_web.deployment.lib.wrapper.WebManagerWrapper;
62
63 import org.objectweb.jonas_ws.deployment.api.JaxRpcPortComponentDesc;
64 import org.objectweb.jonas_ws.deployment.api.PortComponentDesc;
65 import org.objectweb.jonas_ws.deployment.api.SSBPortComponentDesc;
66 import org.objectweb.jonas_ws.deployment.api.ServiceDesc;
67 import org.objectweb.jonas_ws.deployment.api.WSDLFile;
68 import org.objectweb.jonas_ws.deployment.api.WSDeploymentDesc;
69 import org.objectweb.jonas_ws.deployment.api.WSDeploymentDescException;
70 import org.objectweb.jonas_ws.deployment.lib.wrapper.WSManagerWrapper;
71
72 import org.objectweb.jonas.common.JProp;
73 import org.objectweb.jonas.common.Log;
74 import org.objectweb.jonas.ear.EarServiceImpl;
75 import org.objectweb.jonas.jmx.J2eeObjectName;
76 import org.objectweb.jonas.jmx.JmxService;
77 import org.objectweb.jonas.naming.CompNamingContext;
78 import org.objectweb.jonas.naming.NamingManager;
79 import org.objectweb.jonas.service.AbsServiceImpl;
80 import org.objectweb.jonas.service.ServiceException;
81 import org.objectweb.jonas.service.ServiceManager;
82 import org.objectweb.jonas.web.JWebContainerService;
83 import org.objectweb.jonas.web.JWebContainerServiceException;
84 import org.objectweb.jonas.ws.handler.WSDLHandler;
85 import org.objectweb.jonas.ws.handler.WSDLHandlerFactory;
86 import org.objectweb.jonas.ws.mbean.Handler;
87 import org.objectweb.jonas.ws.mbean.PortComponent;
88 import org.objectweb.jonas.ws.mbean.Service;
89 import org.objectweb.jonas.ws.mbean.WebServicesObjectName;
90
91 import org.objectweb.util.monolog.api.BasicLevel;
92 import org.objectweb.util.monolog.api.Logger;
93
94 /**
95  * implements deployment process and declares commons abstract methods for all
96  * (used) Web services engine. Actually we consider Glue and AXIS.
97  * @author Guillaume Sauthier
98  * @author Xavier Delplanque
99  */

100 public abstract class AbsWebServicesServiceImpl extends AbsServiceImpl implements WebServicesService,
101         AbsWebServicesServiceImplMBean {
102
103     /**
104      * WebServices service configuration properties : Xml parsing with
105      * validation
106      */

107     public static final String JavaDoc PARSINGWITHVALIDATION = "jonas.service.ws.parsingwithvalidation";
108
109     /** WebServices service configuration properties : WSDL handlers */
110     public static final String JavaDoc WSDL_HANDLERS = "jonas.service.ws.wsdlhandlers";
111
112     /**
113      * WebServices service configuration properties : base for web services
114      * properties.
115      */

116     public static final String JavaDoc WS_BASE = "jonas.service.ws.";
117
118
119
120     /** Logger for this service. */
121     private static Logger logger = null;
122
123     /** Internationalization tool */
124     private static I18n i18n = I18n.getInstance(AbsWebServicesServiceImpl.class);
125
126     /** Manager for WSDL files publishing. */
127     private WSDLManager wsdlManager = null;
128
129     /** Reference to the web container service */
130     private JWebContainerService webService = null;
131
132     /** JMX Server */
133     private MBeanServer JavaDoc mbeanServer = null;
134
135     /**
136      * Map of deployments descriptor (ClassLoader -> Stack)
137      */

138     private Map JavaDoc deployments = null;
139
140     /**
141      * Map of warURL -> WebServices
142      */

143     private Map JavaDoc webservicesMBeans = null;
144
145     /**
146      * Initialize the service.
147      * @param ctx the configuration context of the service.
148      * @throws ServiceException if the initialization failed.
149      */

150     protected void doInit(Context JavaDoc ctx) throws ServiceException {
151         // Init the logger
152
logger = Log.getLogger(Log.JONAS_WS_PREFIX);
153
154
155         ServiceManager serviceManager = null;
156         try {
157             serviceManager = ServiceManager.getInstance();
158         } catch (Exception JavaDoc e) {
159             throw new ServiceException("Cannot initialize the WebServices Service", e);
160         }
161
162         // Init variables
163
deployments = new HashMap JavaDoc();
164         webservicesMBeans = new HashMap JavaDoc();
165
166         // Set the XML parsing mode to no validation
167
String JavaDoc parsingMode = "false";
168
169         try {
170             parsingMode = (String JavaDoc) ctx.lookup(PARSINGWITHVALIDATION);
171         } catch (NamingException JavaDoc e) {
172             // No problem if there is no value for 'parsingwithvalidation'
173
// (false by default)
174
parsingMode = "false";
175         }
176
177         WSManagerWrapper.setParsingWithValidation("true".equalsIgnoreCase(parsingMode));
178
179         if ("false".equalsIgnoreCase(parsingMode)) {
180             logger.log(BasicLevel.DEBUG, "WebServices XML parsing without validation");
181         } else {
182             logger.log(BasicLevel.DEBUG, "WebServices XML parsing with validation");
183         }
184
185         try {
186             // Get the JMX Server via JMX Service
187
JmxService jmxService = (JmxService) serviceManager.getJmxService();
188             mbeanServer = jmxService.getJmxServer();
189         } catch (ServiceException e) {
190             // the JMX service may not be started
191
mbeanServer = null;
192         }
193
194         // Init the wsdl Manager
195
wsdlManager = new WSDLManager();
196
197         // Get publishing parameters in jonas properties
198
JProp jp = null;
199
200         try {
201             jp = JProp.getInstance();
202         } catch (Exception JavaDoc e) {
203             String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.doInit.noJProp");
204             logger.log(BasicLevel.ERROR, err + " " + e.getMessage());
205             throw new WSServiceException(err, e);
206         }
207
208         String JavaDoc[] handlers = jp.getValueAsArray(WSDL_HANDLERS);
209
210         if (handlers == null) {
211             String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.doInit.noHandlers", WSDL_HANDLERS);
212             logger.log(BasicLevel.ERROR, err);
213             throw new WSServiceException(err);
214         }
215
216         // Build WSDLHandlers
217

218         WSDLHandlerFactory factory = WSDLHandlerFactory.newInstance();
219
220         // build each specified handlers and add it in the WSDLManager.
221
for (int i = 0; i < handlers.length; i++) {
222
223             // Create the handler
224
WSDLHandler handler = factory.newHandler(handlers[i]);
225
226             if (logger.isLoggable(BasicLevel.DEBUG)) {
227                 logger.log(BasicLevel.DEBUG, "Adding WSDLHandler '" + handlers[i] + "'");
228             }
229
230             // Add the created Handler
231
wsdlManager.addHandler(handler);
232         }
233     }
234
235     /**
236      * Get, update and publish WSDL documents contained in a set of jars and
237      * wars.
238      * @param ctx the context containing the configuration to deploy the wars.
239      * <BR>This context contains the following parameters :<BR>-
240      * jarUrls the list of the urls of the jars to deploy. <BR>- warUrls
241      * the list of the urls of the wars to deploy. <BR>- ejbClassLoader
242      * the classLoader of the ejbs(used for webapps too). <BR>-
243      * earClassLoader the ear classLoader of the j2ee app. <BR>-
244      * warCtxRootMapping the webapps contextRoots with associated war
245      * name. <BR>- unpackDir the directory where EAR has been unpacked
246      * (optionnal for pure webapp webservices).
247      * @throws WSServiceException if an error occurs during the deployment.
248      */

249     public void deployWebServices(Context JavaDoc ctx) throws WSServiceException {
250         /**
251          * For each Jar/WarUrls in the given ctx : - Get the jar/war deployment
252          * desc - Get the WSDL definition - Update the WSDL location - Publish
253          * the WSDL
254          */

255
256         // Cannot get webContainer at startup (cycles)
257
if (webService == null) {
258             try {
259                 webService = (JWebContainerService) ServiceManager.getInstance().getWebContainerService();
260             } catch (Exception JavaDoc e) {
261                 String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.deployWebServices.noWeb");
262                 logger.log(BasicLevel.ERROR, err);
263                 throw new WSServiceException(err, e);
264             }
265         }
266
267         // Get context parameters.
268
URL JavaDoc[] jarUrls = null;
269         URL JavaDoc[] warUrls = null;
270         URL JavaDoc earURL = null;
271         ClassLoader JavaDoc ejbClassLoader = null;
272         ClassLoader JavaDoc earClassLoader = null;
273         Map JavaDoc warCtxRootMapping = null;
274         String JavaDoc unpackDir = null;
275
276         // EAR & Webapp case common information
277
try {
278             jarUrls = (URL JavaDoc[]) ctx.lookup("jarUrls");
279             warUrls = (URL JavaDoc[]) ctx.lookup("warUrls");
280             unpackDir = (String JavaDoc) ctx.lookup("unpackDir");
281         } catch (NamingException JavaDoc e) {
282             String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.deployWebServices.ctxParamProblem");
283             logger.log(BasicLevel.ERROR, err + e.getMessage());
284             throw new WSServiceException(err, e);
285         }
286
287         // EAR case specific information
288
try {
289             earURL = (URL JavaDoc) ctx.lookup("earURL");
290             earClassLoader = (ClassLoader JavaDoc) ctx.lookup("earClassLoader");
291             warCtxRootMapping = (Map JavaDoc) ctx.lookup("warCtxRootMapping");
292             ejbClassLoader = (ClassLoader JavaDoc) ctx.lookup("ejbClassLoader");
293         } catch (NamingException JavaDoc ne) {
294             // WebApp case
295
earURL = null;
296             earClassLoader = null;
297             warCtxRootMapping = null;
298             ejbClassLoader = null;
299         }
300
301         // Deploy wars Web services.
302
URLClassLoader JavaDoc loaderForCls = null;
303         String JavaDoc earAppName = null;
304         if (earURL != null) {
305             earAppName = EarServiceImpl.buildJ2eeApplicationName(earURL);
306         }
307
308         String JavaDoc fileName = null;
309         WSDeploymentDesc wsDD = null;
310
311         for (int i = 0; i < warUrls.length; i++) {
312             // Get the name of a war to deploy.
313
fileName = warUrls[i].getFile();
314             logger.log(BasicLevel.DEBUG, "Analyzing war '" + fileName + "' for web services");
315
316             // Get the class loader for the current war.
317
loaderForCls = webService.getClassLoader(warUrls[i], earAppName, ejbClassLoader);
318
319             WebappClassLoader webLoader = (WebappClassLoader) loaderForCls;
320             URL JavaDoc url = webLoader.getBaseURL();
321
322             // Get the deployment descriptor from file.
323
try {
324                 wsDD = WSManagerWrapper.getDeploymentDesc(warUrls[i], url, loaderForCls, earClassLoader);
325             } catch (WSDeploymentDescException wsdde) {
326                 String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.deployWebServices.wsddEx", fileName);
327                 logger.log(BasicLevel.ERROR, err + ": " + wsdde);
328                 throw new WSServiceException(err, wsdde);
329             }
330
331             if (wsDD != null) {
332                 // The current War contains Webservices
333
try {
334                     Context JavaDoc compCtx = new CompNamingContext(fileName);
335                     compCtx.rebind("wsDD", wsDD);
336                     compCtx.rebind("cl", loaderForCls);
337
338                     if (earClassLoader != null) {
339                         compCtx.rebind("earCL", earClassLoader);
340                     }
341                     compCtx.rebind("warURL", warUrls[i]);
342
343                     // ear case
344
if (warCtxRootMapping != null) {
345                         compCtx.rebind("warContextRoot", warCtxRootMapping.get(warUrls[i]));
346
347                         // non-ear case
348
} else {
349                         compCtx.rebind("warContextRoot", "");
350                     }
351
352                     doDeployWebServices(compCtx);
353                 } catch (NamingException JavaDoc ne) {
354                     String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.deployWebServices.bindError", fileName);
355                     logger.log(BasicLevel.ERROR, err);
356                     throw new WSServiceException(err, ne);
357                 }
358             }
359         }
360         // End deploy wars Web services.
361

362         // Deploy jars Web services.
363
// Check warCtxRootMapping presence
364
if ((jarUrls.length != 0) && (warCtxRootMapping == null)) {
365             String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.deployWebServices.ctxRootMappingMissing");
366             logger.log(BasicLevel.ERROR, err);
367             throw new WSServiceException(err);
368         }
369
370         for (int i = 0; i < jarUrls.length; i++) {
371             // Get the name of a war to deploy.
372
fileName = jarUrls[i].getFile();
373             logger.log(BasicLevel.DEBUG, "Analyzing EjbJar '" + fileName + "' for web services");
374
375             URLClassLoader JavaDoc webClassLoader = null;
376
377             // Get the deployment descriptor from file.
378
try {
379                 wsDD = WSManagerWrapper.getDeploymentDesc(jarUrls[i], ejbClassLoader, earClassLoader);
380             } catch (WSDeploymentDescException wsdde) {
381                 String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.deployWebServices.wsddEx", fileName);
382                 logger.log(BasicLevel.ERROR, err + ": " + wsdde);
383                 throw new WSServiceException(err, wsdde);
384             }
385
386             if (wsDD != null) {
387                 // The current Jar contains Webservices
388
URL JavaDoc warURL = null;
389
390                 try {
391                     /**
392                      * Default Naming Convention for Webapp linked to Ejb
393                      * <ejb-name>.jar -> <ejb-name>.war
394                      */

395                     if (wsDD.getWarFile() != null) {
396                         // use getCanonicalFile to fix Bug #300658
397
//new File(new URL(dirName + File.separator + s).getFile()).getCanonicalFile().toURL();
398
warURL = new File JavaDoc(new URL JavaDoc(unpackDir + File.separator + wsDD.getWarFile()).getFile()).getCanonicalFile().toURL();
399                         //warURL = new URL(unpackDir + "/" + wsDD.getWarFile());
400
} else {
401                         String JavaDoc ejb = new File JavaDoc(jarUrls[i].getFile()).getName();
402                         String JavaDoc war = ejb.substring(0, ejb.length() - ".jar".length());
403                         //warURL = new URL(unpackDir + "/" + war + ".war");
404
warURL = new File JavaDoc(new URL JavaDoc(unpackDir + File.separator + war + ".war").getFile()).getCanonicalFile().toURL();
405                     }
406                     logger.log(BasicLevel.DEBUG, "Unpack Dir : " + unpackDir);
407                     logger.log(BasicLevel.DEBUG, "Computed URL : " + warURL);
408
409                     // check if webapp is present
410
boolean present = false;
411
412                     for (int w = 0; w < warUrls.length; w++) {
413                         if (warUrls[w].equals(warURL)) {
414                             present = true;
415                         }
416                         logger.log(BasicLevel.DEBUG, "warUrls[" + w + "]=" + warUrls[w]);
417                     }
418
419                     // get the linked web classloader
420
webClassLoader = webService.getClassLoader(warURL, earAppName, ejbClassLoader);
421
422                     if (!present) {
423                         String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.deployWebServices.webappNotFound",
424                                 warURL);
425                         logger.log(BasicLevel.ERROR, err);
426                         throw new WSServiceException(err);
427                     }
428                 } catch (MalformedURLException JavaDoc mue) {
429                     String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.deployWebServices.mue");
430                     logger.log(BasicLevel.ERROR, mue.getMessage());
431                     throw new WSServiceException(err, mue);
432                 } catch (IOException JavaDoc ioe) {
433                     // TODO add i18n
434
String JavaDoc err = "Cannot locate file : " + ioe.getMessage();
435                     logger.log(BasicLevel.ERROR, err);
436                     throw new WSServiceException(err, ioe);
437                 }
438
439                 try {
440                     Context JavaDoc compCtx = new CompNamingContext(fileName);
441                     compCtx.rebind("wsDD", wsDD);
442
443                     // Using WebClassLoader ()
444
compCtx.rebind("cl", webClassLoader);
445                     compCtx.rebind("earCL", earClassLoader);
446
447                     compCtx.rebind("warURL", warURL);
448
449                     // warContextRoot cannot be null in ejb case
450
// because an ejb needs a webapp for webservices
451
compCtx.rebind("warContextRoot", warCtxRootMapping.get(warURL));
452                     doDeployWebServices(compCtx);
453                 } catch (NamingException JavaDoc ne) {
454                     String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.deployWebServices.bindError", fileName);
455                     logger.log(BasicLevel.ERROR, err);
456                     throw new WSServiceException(err, ne);
457                 }
458             }
459         }
460
461         // End deploy jars Web services.
462
}
463
464     /**
465      * Deploy the given Web services.
466      * @param ctx Context used for parameter passing.
467      * @throws WSServiceException when error occurs.
468      */

469     protected void doDeployWebServices(Context JavaDoc ctx) throws WSServiceException {
470         /**
471          * Context structure : - wsDD Web Services deployment descriptor. - cl
472          * Module ClassLoader - earCL Application ClassLoader - warContextRoot
473          * the context-root of the war (null in ejb case) - warURL the url of
474          * war dispatching SOAP requests
475          */

476         WSDeploymentDesc wsDD = null;
477         ClassLoader JavaDoc cl = null;
478         ClassLoader JavaDoc earCL = null;
479         String JavaDoc warContextRoot = null;
480         URL JavaDoc warURL = null;
481
482         try {
483             wsDD = (WSDeploymentDesc) ctx.lookup("wsDD");
484             cl = (ClassLoader JavaDoc) ctx.lookup("cl");
485             warContextRoot = (String JavaDoc) ctx.lookup("warContextRoot");
486             warURL = (URL JavaDoc) ctx.lookup("warURL");
487         } catch (NamingException JavaDoc ne) {
488             String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.doDeployWebServices.namingError");
489             logger.log(BasicLevel.ERROR, err);
490             throw new WSServiceException(err, ne);
491         }
492
493         if (logger.isLoggable(BasicLevel.DEBUG)) {
494             logger.log(BasicLevel.DEBUG, "Deploying WebServices for '" + warURL + "'");
495         }
496
497         try {
498             earCL = (ClassLoader JavaDoc) ctx.lookup("earCL");
499         } catch (NamingException JavaDoc ne) {
500             // Nothing to do : non EAR case
501
earCL = null;
502         }
503
504         // store WSDeployInfo for later use (completeWSDeployment method)
505
ClassLoader JavaDoc key = cl;
506         if (earCL != null) {
507             key = earCL;
508         }
509         Stack JavaDoc s = (Stack JavaDoc) deployments.get(key);
510         if (s == null) {
511             s = new Stack JavaDoc();
512             deployments.put(key, s);
513         }
514         s.push(new WSDeployInfo(warURL, wsDD));
515
516
517         List JavaDoc sds = wsDD.getServiceDescs();
518
519         // for each WSDL contained in the component
520
for (Iterator JavaDoc i = sds.iterator(); i.hasNext();) {
521             ServiceDesc sd = (ServiceDesc) i.next();
522             WSDLFile wsdl = sd.getWSDL();
523
524             // get the endpoint URL for each port-component
525
// update the WSDL Definition
526
for (Iterator JavaDoc pc = sd.getPortComponents().iterator(); pc.hasNext();) {
527                 PortComponentDesc pcd = (PortComponentDesc) pc.next();
528                 QName JavaDoc portQName = pcd.getQName();
529                 URL JavaDoc endpoint = null;
530                 if (pcd.hasJaxRpcImpl()) {
531                     endpoint = getEndpointURL(wsDD, (JaxRpcPortComponentDesc) pcd, warURL, warContextRoot);
532                 } else {
533                     endpoint = getEndpointURL(wsDD, (SSBPortComponentDesc) pcd, warURL, cl, earCL, warContextRoot);
534                 }
535
536                 pcd.setEndpointURL(endpoint);
537                 wsdl.setLocation(portQName, endpoint);
538
539                 // add endpoint URL into JNDI namespace to allow application
540
// clients (that are not running in the same JVM) to use
541
// port-component-link
542
Context JavaDoc registry;
543                 try {
544                     registry = new InitialContext JavaDoc();
545                     Reference JavaDoc urlRef = new Reference JavaDoc(URL JavaDoc.class.getName(), URLFactory.class.getName(), null);
546                     urlRef.add(new StringRefAddr JavaDoc("url", endpoint.toString()));
547                     registry.rebind(pcd.getName(), urlRef);
548                     logger.log(BasicLevel.DEBUG, "Bind updated URL (" + endpoint + ") in " + pcd.getName());
549                 } catch (NamingException JavaDoc ne) {
550                     throw new WSServiceException("Cannot bind updated URL for port-component '" + pcd.getName()
551                             + "'", ne);
552                 }
553
554             }
555
556             // publish WSDL
557
wsdlManager.publish(sd);
558         }
559     }
560
561     /**
562      * Creates and adds all nested Handlers in the parent PortComponent.
563      * @param pcMBean parent PortComponent MBean
564      * @param pcd PortComponent Descriptor
565      */

566     private void addHandlerMBeansToPortComponent(PortComponent pcMBean, PortComponentDesc pcd) {
567
568         // iterates over the HandlerDesc list
569
for (Iterator JavaDoc i = pcd.getHandlers().iterator(); i.hasNext();) {
570             HandlerDesc hd = (HandlerDesc) i.next();
571
572             // creates the Handler MBean, and automatically
573
// add it to the PortComponent
574
Handler hMBean = createHandlerMBean(hd.getName(), pcMBean);
575
576             hMBean.setClassname(hd.getHandlerClassName());
577             hMBean.setName(hd.getName());
578             // soap-headers
579
List JavaDoc sh = hd.getSOAPHeaders();
580             // transform QName to String
581
String JavaDoc[] headers = new String JavaDoc[sh.size()];
582             int index = 0;
583             for (Iterator JavaDoc j = sh.iterator(); j.hasNext();) {
584                 // Stringify the QName
585
headers[index++] = ((QName JavaDoc) j.next()).toString();
586             }
587             hMBean.setSoapHeaders(headers);
588             // soap-roles
589
List JavaDoc sr = hd.getSOAPRoles();
590             hMBean.setSoapRoles((String JavaDoc[]) sr.toArray(new String JavaDoc[sr.size()]));
591
592             hMBean.setInitParams(hd.getInitParams());
593
594         }
595
596     }
597
598     /**
599      * @param name Handler name
600      * @param parent parent PortComponent
601      * @return Returns the creates Handler MBean
602      */

603     private static Handler createHandlerMBean(String JavaDoc name, PortComponent parent) {
604         Handler h = null;
605         try {
606             h = new Handler(WebServicesObjectName.handler(name, parent.getRealObjectName()).toString());
607         } catch (MalformedObjectNameException JavaDoc e) {
608             // should never happen
609
logger.log(BasicLevel.DEBUG, "Should never happen", e);
610         }
611         // add to the parent
612
parent.addHandlerMBean(h);
613         return h;
614     }
615
616     /**
617      * @param name PortComponent name
618      * @param parent parent Service
619      * @return Returns the created PortComponent MBean
620      */

621     private static PortComponent createPortComponentMBean(String JavaDoc name, Service parent) {
622         PortComponent pc = null;
623         try {
624             pc = new PortComponent(WebServicesObjectName.portComponent(name, parent.getRealObjectName()).toString());
625         } catch (MalformedObjectNameException JavaDoc e) {
626             // should never happen
627
logger.log(BasicLevel.DEBUG, "Should never happen", e);
628         }
629         // add to the parent
630
parent.addPortComponentMBean(pc);
631         return pc;
632     }
633
634     /**
635      * @param name Service name
636      * @param parent parent WebServices
637      * @return Returns the created Service MBean
638      */

639     private static Service createServiceMBean(String JavaDoc name, ObjectName JavaDoc parent) {
640         Service service = null;
641         try {
642             service = new Service(WebServicesObjectName.service(name, parent).toString());
643         } catch (MalformedObjectNameException JavaDoc e) {
644             // should never happen
645
logger.log(BasicLevel.DEBUG, "Should never happen", e);
646         }
647         return service;
648     }
649
650     /**
651      * Creates the endpointURL of a given PortComponentDesc.
652      * @param wsDD webservices.xml
653      * @param jpcd JaxRpcPortComponentDesc to analyze
654      * @param warURL URL of the war file containing the PortComponent
655      * @param contextRoot context-root of the webapp
656      * @return the endpointURL of a given PortComponentDesc.
657      * @throws WSServiceException When URL cannot be constructed.
658      */

659     private URL JavaDoc getEndpointURL(WSDeploymentDesc wsDD, JaxRpcPortComponentDesc jpcd, URL JavaDoc warURL, String JavaDoc contextRoot)
660             throws WSServiceException {
661
662         logger.log(BasicLevel.DEBUG, "get endpoint for JaxRpc Port Component");
663
664         return getEndpointURL(wsDD, jpcd.getWebDesc(), warURL, contextRoot, jpcd);
665
666     }
667
668     /**
669      * Creates the endpointURL of a given PortComponentDesc.
670      * @param wsDD webservices.xml
671      * @param spcd SSBPortComponentDesc to analyze
672      * @param warURL URL of the wabapp used to expose the Bean
673      * @param cl ejbjar classloader
674      * @param earCL application classloader
675      * @param contextRoot webapp context name
676      * @return the endpointURL of a given PortComponentDesc.
677      * @throws WSServiceException When URL cannot be created
678      */

679     private URL JavaDoc getEndpointURL(WSDeploymentDesc wsDD, SSBPortComponentDesc spcd, URL JavaDoc warURL, ClassLoader JavaDoc cl,
680             ClassLoader JavaDoc earCL, String JavaDoc contextRoot) throws WSServiceException {
681
682         logger.log(BasicLevel.DEBUG, "get endpoint for StatelessSessionBean Port Component");
683
684         WebContainerDeploymentDesc webDD = null;
685
686         try {
687             webDD = WebManagerWrapper.getDeploymentDesc(warURL, cl, earCL);
688         } catch (WebContainerDeploymentDescException e) {
689             String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.getEndpointURL.webDDException", warURL.getFile());
690             logger.log(BasicLevel.ERROR, err);
691             throw new WSServiceException(err, e);
692         }
693
694         return getEndpointURL(wsDD, webDD, warURL, contextRoot, spcd);
695
696     }
697
698     /**
699      * Returns the URL used to access the endpoint.
700      * @param wsDD webservices.xml
701      * @param webDD the WebContainer DD of the servlet
702      * @param warURL the url of the war containing the servlet dispatching the
703      * SOAP request to the servant.
704      * @param warContextRoot the application defined context-root for the webapp
705      * (can be null).
706      * @param pcd PortComponentDesc Port descriptor
707      * @return the URL used to access the endpoint.
708      * @throws WSServiceException When cannot create the endpoint URL.
709      */

710     private URL JavaDoc getEndpointURL(WSDeploymentDesc wsDD, WebContainerDeploymentDesc webDD, URL JavaDoc warURL,
711             String JavaDoc warContextRoot, PortComponentDesc pcd) throws WSServiceException {
712
713         // Resolve :
714
// - hostname
715
// - http/https port
716
// Priority order : 1. the ones specified in jonas-web.xml
717
// 2. default web container values (if any)
718
String JavaDoc servletName = pcd.getSibLink();
719         String JavaDoc pcName = pcd.getQName().getLocalPart();
720
721         logger.log(BasicLevel.DEBUG, "SOAP Servlet name '" + servletName + "'");
722
723         String JavaDoc hostname = webDD.getHost();
724         String JavaDoc port = webDD.getPort();
725         String JavaDoc scheme = "http";
726         String JavaDoc contextRoot = null;
727         String JavaDoc mapping = null;
728
729         if (wsDD.getContextRoot() != null && (pcd instanceof SSBPortComponentDesc)) {
730             contextRoot = wsDD.getContextRoot();
731         } else {
732             contextRoot = getContextRoot(warContextRoot, webDD, warURL);
733         }
734
735         boolean needPortName = true;
736         if (pcd.getEndpointURI() != null) {
737             mapping = pcd.getEndpointURI();
738             needPortName = false;
739         } else {
740             mapping = getServletMapping(servletName, webDD);
741         }
742
743         // get default host value
744
if (hostname == null) {
745             // get hostname
746
try {
747                 hostname = webService.getDefaultHost();
748             } catch (JWebContainerServiceException e) {
749                 String JavaDoc err = i18n
750                         .getMessage("AbsWebServicesServiceImpl.getEndpointURL.noDefaultHost", warURL.getFile());
751                 logger.log(BasicLevel.ERROR, err);
752                 throw new WSServiceException(err, e);
753             }
754         }
755
756         // get default port and scheme value
757
if (port == null) {
758             // get Http informations
759
try {
760                 port = webService.getDefaultHttpPort();
761                 scheme = "http";
762             } catch (JWebContainerServiceException e) {
763                 // Http Fails
764
// Try Https informations
765
try {
766                     port = webService.getDefaultHttpsPort();
767                     scheme = "https";
768                 } catch (JWebContainerServiceException e2) {
769                     String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.getEndpointURL.noDefaultHTTPPort", warURL
770                             .getFile());
771                     logger.log(BasicLevel.ERROR, err);
772                     throw new WSServiceException(err, e2);
773                 }
774             }
775         }
776
777         // construct URL
778
if (port.equals("80")) {
779             port = "";
780         } else {
781             port = ":" + port;
782         }
783
784         String JavaDoc url = null;
785         if (needPortName) {
786             String JavaDoc encodedPortName = null;
787             try {
788                 encodedPortName = URLEncoder.encode(pcName, "UTF-8");
789             } catch (UnsupportedEncodingException JavaDoc e) {
790                 // should never occurs since utf-8 is mandatory on all JVM
791
encodedPortName = pcName;
792             }
793             url = scheme + "://" + hostname + port + "/" + contextRoot + "/" + mapping + "/" + encodedPortName;
794         } else {
795             url = scheme + "://" + hostname + port + "/" + contextRoot + mapping;
796         }
797
798         URL JavaDoc endpoint = null;
799
800         try {
801             endpoint = new URL JavaDoc(url);
802         } catch (MalformedURLException JavaDoc mue) {
803             String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.getEndpointURL.endpointURLError", pcName, url);
804             logger.log(BasicLevel.ERROR, err);
805             throw new WSServiceException(err, mue);
806         }
807
808         if (logger.isLoggable(BasicLevel.DEBUG)) {
809             logger.log(BasicLevel.DEBUG, "Constructed URL for '" + pcName + "' : '" + endpoint + "'");
810         }
811
812         return endpoint;
813     }
814
815     /**
816      * Returns the contextRoot used for webapp access.
817      * @param ctxRoot The application specified context-root ("" if not).
818      * @param webDD The web DeploymentDesc of the dispatching webapp.
819      * @param warURL url of the webapp file.
820      * @return The contextRoot used for webapp access.
821      */

822     private static String JavaDoc getContextRoot(String JavaDoc ctxRoot, WebContainerDeploymentDesc webDD, URL JavaDoc warURL) {
823         // Set the right context root for the web application, the priority is
824
// the following :
825
// 1 - context-root of application.xml
826
// 2 - context-root of jonas-web.xml
827
// 3 - context-root is the name of the file without .war.
828
String JavaDoc contextRoot = null;
829
830         if ("".equals(ctxRoot)) {
831             String JavaDoc cRoot = webDD.getContextRoot();
832
833             if (cRoot == null) {
834                 String JavaDoc file = new File JavaDoc(warURL.getFile()).getName();
835
836                 if (file.toLowerCase().endsWith(".war")) {
837                     contextRoot = file.substring(0, file.length() - ".war".length());
838                 } else {
839                     //It's a directory which is deployed
840
contextRoot = file.substring(0, file.length());
841                 }
842             } else {
843                 contextRoot = cRoot;
844             }
845         } else {
846             contextRoot = ctxRoot;
847         }
848
849         return contextRoot;
850     }
851
852     /**
853      * Empty Method for WebServices (no running application).
854      * @throws ServiceException never thrown
855      */

856     public void doStop() throws ServiceException {
857     }
858
859     /**
860      * Empty Method for WebServices (no running application).
861      * @throws ServiceException never thrown
862      */

863     public void doStart() throws ServiceException {
864     }
865
866     /**
867      * Return the unique url servlet mapping.
868      * @param servlet the servlet name.
869      * @param webDD the web DeploymentDesc where mappings are stored.
870      * @return the unique url servlet mapping.
871      * @throws WSServiceException when multiple (or 0) mappings are found.
872      */

873     private String JavaDoc getServletMapping(String JavaDoc servlet, WebContainerDeploymentDesc webDD) throws WSServiceException {
874
875         List JavaDoc mappings = webDD.getServletMappings(servlet);
876
877         logger.log(BasicLevel.DEBUG, "mapping : " + mappings);
878
879         if (mappings == null) {
880             String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.getServletMapping.noMapping", servlet);
881             logger.log(BasicLevel.ERROR, err);
882             throw new WSServiceException(err);
883         }
884
885         if (mappings.size() != 1) {
886             String JavaDoc err = i18n.getMessage("AbsWebServicesServiceImpl.getServletMapping.1mappingOnly", servlet);
887             logger.log(BasicLevel.ERROR, err);
888             throw new WSServiceException(err);
889         }
890
891         String JavaDoc mapping = (String JavaDoc) mappings.get(0);
892
893         // keep only the first part of the mapping :
894
// /services/* becomes services
895
StringTokenizer JavaDoc st = new StringTokenizer JavaDoc(mapping, "/");
896         mapping = st.nextToken();
897
898         return mapping;
899
900     }
901
902     /**
903      * Remove WebServices descriptors associated to the given ClassLoader
904      * @param cl key ClassLoader
905      */

906     public void removeCache(ClassLoader JavaDoc cl) {
907         WSManagerWrapper.removeCache(cl);
908         removeDeploymentInfoStack(cl);
909     }
910
911     /**
912      * @return Returns the i18n.
913      */

914     protected static I18n getI18n() {
915         return i18n;
916     }
917
918     /**
919      * @return Returns the logger.
920      */

921     protected static Logger getLogger() {
922         return logger;
923     }
924
925     /**
926      * @see org.objectweb.jonas.ws.WebServicesService#completeWSDeployment(javax.naming.Context)
927      */

928     public void completeWSDeployment(Context JavaDoc ctx) throws WSServiceException {
929         /**
930          * 1. Get current deployer ClassLoader
931          * 2. Get associated Stack
932          * 3. For each DeployInfo element from the Stack
933          * a. Iterate through its ServiceDesc
934          * - create ServletEndpoints instance
935          * - fill it with PortComponentDesc info
936          * b. Bind ServletEndpoints instance
937          */

938         ClassLoader JavaDoc cl = null;
939         ObjectName JavaDoc parent = null;
940         Boolean JavaDoc isInEar = Boolean.FALSE;
941         try {
942             cl = (ClassLoader JavaDoc) ctx.lookup(WebServicesService.CLASSLOADER_CTX_PARAM);
943             parent = (ObjectName JavaDoc) ctx.lookup(WebServicesService.PARENT_OBJECTNAME_CTX_PARAM);
944             isInEar = (Boolean JavaDoc) ctx.lookup(WebServicesService.ISINEAR_CTX_PARAM);
945         } catch (NamingException JavaDoc ne) {
946             throw new WSServiceException("Cannot retrieve '" + WebServicesService.CLASSLOADER_CTX_PARAM + "' from given Context", ne);
947         }
948
949         Stack JavaDoc s = getDeploymentInfoStack(cl);
950
951         while ((s != null) && (!s.empty())) {
952
953             WSDeployInfo di = (WSDeployInfo) s.pop();
954             URL JavaDoc warURL = di.getWarURL();
955             WSDeploymentDesc wsdd = di.getDescriptor();
956             ObjectName JavaDoc parentON = parent;
957
958             if (isInEar.booleanValue()) {
959                 parentON = getParentModuleObjectName(parent, wsdd);
960             }
961
962             // Store the root webservices MBeans
963
List JavaDoc webservices = new ArrayList JavaDoc();
964             webservicesMBeans.put(warURL, webservices);
965
966             ContainerNaming naming = null;
967             try {
968                 naming = NamingManager.getInstance();
969             } catch (NamingException JavaDoc ne) {
970                 throw new WSServiceException("Cannot get NamingManager instance for " + wsdd.getDisplayName(), ne);
971             }
972             ClassLoader JavaDoc web = webService.getContextLinkedClassLoader(warURL);
973             Context JavaDoc c = naming.getComponentContext(web);
974             if (c == null) {
975                 throw new WSServiceException("Cannot get Component Context from ClassLoader : " + web);
976             }
977
978             List JavaDoc sds = wsdd.getServiceDescs();
979
980             // for each WSDL contained in the component
981
for (Iterator JavaDoc i = sds.iterator(); i.hasNext();) {
982                 ServiceDesc sd = (ServiceDesc) i.next();
983
984                 // serviceMBean
985
Service serviceMBean = createServiceMBean(sd.getName(), parentON);
986                 serviceMBean.setName(sd.getName());
987                 serviceMBean.setMappingFilename(sd.getMappingFilename());
988                 serviceMBean.setWsdlFilename(sd.getWsdlFilename());
989
990                 // add the MBeans to the registration list
991
webservices.add(serviceMBean);
992
993                 // get the endpoint URL for each port-component
994
// update the WSDL Definition
995
for (Iterator JavaDoc pc = sd.getPortComponents().iterator(); pc.hasNext();) {
996                     PortComponentDesc pcd = (PortComponentDesc) pc.next();
997                     try {
998                         c.rebind("comp/jonas/" + pcd.getSibLink() + "/dd", sd);
999                     } catch (NamingException JavaDoc ne) {
1000                        throw new WSServiceException("Cannot bind ServiceDesc instance for servlet '" + sd.getName()
1001                                + "'", ne);
1002                    }
1003
1004                    // Filing up MBeans
1005
PortComponent pcMBean = createPortComponentMBean(pcd.getName(), serviceMBean);
1006                    pcMBean.setEndpoint(pcd.getEndpointURL().toExternalForm());
1007                    pcMBean.setName(pcd.getName());
1008                    pcMBean.setServiceEndpointInterface(pcd.getServiceEndpointInterface().getName());
1009                    pcMBean.setWsdlPort(pcd.getQName().toString());
1010
1011                    if (pcd.hasBeanImpl()) {
1012                        // first, we must find the StatelessSessionBean MBean
1013
ObjectName JavaDoc ssbSearch = WebServicesObjectName.getStatelessSessionBeanQuery(parentON, pcd.getSibLink());
1014                        List JavaDoc onList = J2eeObjectName.queryObjectNames(ssbSearch);
1015
1016                        // should have only 1 element
1017
if (!onList.isEmpty()) {
1018                            ObjectName JavaDoc on = (ObjectName JavaDoc) onList.iterator().next();
1019                            pcMBean.setImplementationBean(on.toString());
1020                        }
1021                    } else {
1022                        // first, we must find the Servlet MBean
1023
ObjectName JavaDoc sSearch = WebServicesObjectName.getServletQuery(parentON, pcd.getSibLink());
1024                        List JavaDoc onList = J2eeObjectName.queryObjectNames(sSearch);
1025
1026                        // should have only 1 element
1027
if (!onList.isEmpty()) {
1028                            ObjectName JavaDoc on = (ObjectName JavaDoc) onList.iterator().next();
1029                            pcMBean.setImplementationBean(on.toString());
1030                        }
1031                    }
1032
1033                    addHandlerMBeansToPortComponent(pcMBean, pcd);
1034
1035                    // WSDL URL
1036
// The same WSDL is returned for each endpoint
1037
serviceMBean.setWsdlURL(pcd.getEndpointURL().toExternalForm() + "?JWSDL");
1038                }
1039
1040            }
1041
1042            // register MBeans
1043
for (Iterator JavaDoc l = webservices.iterator(); l.hasNext();) {
1044                Service service = (Service) l.next();
1045                service.register(this.mbeanServer);
1046            }
1047
1048        }
1049    }
1050
1051    /**
1052     * @param parent EAR ObjectName
1053     * @param wsdd WebServices Deployment Descriptor
1054     * @return Returns the parent Module ObjectName (WebModule or EJBModule)
1055     */

1056    private static ObjectName JavaDoc getParentModuleObjectName(ObjectName JavaDoc parent, WSDeploymentDesc wsdd) {
1057        // EAR case :
1058
// then the parent ObjectName is the EAR ObjectName
1059
// So we need to find either the WebModule or EJBModule
1060
// that is the real parent of WebServices
1061

1062        // for this, we will take the first PortComponent and
1063
// if this is a JaxRpcPCDesc, we will search for
1064
// a WebModule ObjectName containing the servlet-link
1065
// in the other case, we will search for an EJBModule
1066

1067        ObjectName JavaDoc result = null;
1068        ServiceDesc sd = (ServiceDesc) wsdd.getServiceDescs().iterator().next();
1069        PortComponentDesc pcd = (PortComponentDesc) sd.getPortComponents().iterator().next();
1070        String JavaDoc key = pcd.getSibLink();
1071        if (pcd.hasBeanImpl()) {
1072            // search for an EJBModule
1073
// first, we must find the StatelessSessionBean MBean
1074
ObjectName JavaDoc ssbSearch = WebServicesObjectName.getStatelessSessionBeanQuery(parent, key);
1075            List JavaDoc onList = J2eeObjectName.queryObjectNames(ssbSearch);
1076
1077            // should have only 1 element
1078
if (!onList.isEmpty()) {
1079                ObjectName JavaDoc ssb = (ObjectName JavaDoc) onList.iterator().next();
1080
1081                /// Once we have this ObjectName, we can easily get his parent
1082
// name via the EJBModule property :)
1083
ObjectName JavaDoc emSearch = WebServicesObjectName.getEJBModule(parent, ssb.getKeyProperty("EJBModule"));
1084                onList = J2eeObjectName.queryObjectNames(emSearch);
1085
1086                // We take the first result and we set it as parent ON
1087
result = (ObjectName JavaDoc) onList.iterator().next();
1088            } else {
1089                // onList is empty, so just keep the J2EEApplication as parent
1090
logger.log(BasicLevel.WARN, "Cannot find EJBModule MBean containing SSB " + key);
1091                result = parent;
1092            }
1093        } else {
1094            // search for WebModule
1095
// first, we must find the Servlet MBean
1096
ObjectName JavaDoc sSearch = WebServicesObjectName.getServletQuery(parent, key);
1097            List JavaDoc onList = J2eeObjectName.queryObjectNames(sSearch);
1098
1099            // should have only 1 element
1100
if (!onList.isEmpty()) {
1101                ObjectName JavaDoc servlet = (ObjectName JavaDoc) onList.iterator().next();
1102
1103                // / Once we have this ObjectName, we can easily get his parent
1104
// name via the WebModule property :)
1105
ObjectName JavaDoc wmSearch = WebServicesObjectName.getWebModule(parent, servlet.getKeyProperty("WebModule"));
1106                onList = J2eeObjectName.queryObjectNames(wmSearch);
1107
1108                // We take the first result and we set it as parent ON
1109
result = (ObjectName JavaDoc) onList.iterator().next();
1110            } else {
1111                // onList is empty, so just keep the J2EEApplication as parent
1112
logger.log(BasicLevel.WARN, "Cannot find WebModule MBean containing Servlet " + key);
1113                result = parent;
1114
1115            }
1116        }
1117        return result;
1118    }
1119
1120    /**
1121     * @param key
1122     * ClassLoader
1123     * @return Returns a Stack of DeployInfo associated to the given ClassLoader
1124     */

1125    private Stack JavaDoc getDeploymentInfoStack(ClassLoader JavaDoc key) {
1126        return (Stack JavaDoc) deployments.get(key);
1127    }
1128
1129    /**
1130     * Removes the Stack associated to the given ClassLoader
1131     * @param key ClassLoader
1132     */

1133    private void removeDeploymentInfoStack(ClassLoader JavaDoc key) {
1134        deployments.remove(key);
1135    }
1136
1137    /**
1138     * Store information about a webservices descriptor.
1139     * @author Guillaume Sauthier
1140     */

1141    public class WSDeployInfo {
1142
1143        /**
1144         * URL of the webapp
1145         */

1146        private URL JavaDoc war = null;
1147
1148        /**
1149         * WebServices descriptor
1150         */

1151        private WSDeploymentDesc wsdd = null;
1152
1153        /**
1154         * Creates a new WSDeployInfo instance with given parameters
1155         * @param war URL of the webapp
1156         * @param wsdd WebServices descriptor
1157         */

1158        public WSDeployInfo(URL JavaDoc war, WSDeploymentDesc wsdd) {
1159            this.war = war;
1160            this.wsdd = wsdd;
1161        }
1162
1163        /**
1164         * @return Returns the Webapp URL
1165         */

1166        public URL JavaDoc getWarURL() {
1167            return war;
1168        }
1169
1170        /**
1171         * @return Returns the WebServices Descriptor
1172         */

1173        public WSDeploymentDesc getDescriptor() {
1174            return wsdd;
1175        }
1176    }
1177
1178    /**
1179     * @see org.objectweb.jonas.ws.WebServicesService#undeployWebServices(javax.naming.Context)
1180     */

1181    public void undeployWebServices(Context JavaDoc ctx) throws WSServiceException {
1182
1183        URL JavaDoc url = null;
1184        try {
1185            url = (URL JavaDoc) ctx.lookup(WebServicesService.WARURL_CTX_PARAM);
1186        } catch (NamingException JavaDoc e) {
1187            // should never go here, but anyway ...
1188
throw new IllegalArgumentException JavaDoc(e.getMessage());
1189        }
1190
1191        List JavaDoc ws = (List JavaDoc) webservicesMBeans.get(url);
1192        if (ws != null) {
1193            // unregister if a webservices MBean has been found
1194
for (Iterator JavaDoc l = ws.iterator(); l.hasNext();) {
1195                Service service = (Service) l.next();
1196                service.unregister(this.mbeanServer);
1197            }
1198        }
1199
1200        // TODO unpublish WSDL ?
1201
}
1202
1203
1204}
Popular Tags