KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > web > wrapper > catalina55 > CatalinaJWebContainerServiceWrapper


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 2004 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: CatalinaJWebContainerServiceWrapper.java,v 1.1 2005/03/21 15:02:45 benoitf Exp $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.jonas.web.wrapper.catalina55;
26
27 import java.lang.reflect.InvocationTargetException JavaDoc;
28 import java.lang.reflect.Method JavaDoc;
29 import java.net.URL JavaDoc;
30 import java.net.URLClassLoader JavaDoc;
31 import java.rmi.RemoteException JavaDoc;
32 import java.util.Hashtable JavaDoc;
33 import java.util.List JavaDoc;
34 import java.util.Map JavaDoc;
35 import java.util.Set JavaDoc;
36
37 import javax.naming.Context JavaDoc;
38
39 import org.objectweb.jonas.web.wrapper.CatalinaJWebContainerService;
40 import org.objectweb.jonas.server.LoaderManager;
41 import org.objectweb.jonas.service.ServiceException;
42 import org.objectweb.jonas.web.AbsJWebContainerServiceImplMBean;
43 import org.objectweb.jonas.web.JWebContainerServiceException;
44 import org.objectweb.jonas.web.War;
45
46
47 /**
48  * Wrap the Catalina 5.0 Web Container Service because Catalina use Digester to parse its server.xml
49  *
50  * @author Guillaume Sauthier
51  */

52 public class CatalinaJWebContainerServiceWrapper implements CatalinaJWebContainerService, AbsJWebContainerServiceImplMBean {
53
54     /**
55      * Catalina ClassLoader
56      */

57     private ClassLoader JavaDoc catalinaLoader = null;
58
59     /**
60      * CatalinaJWebContainerService instance
61      */

62     private Object JavaDoc catalinaService = null;
63
64     /**
65      * cached Method Map
66      */

67     private Map JavaDoc methods = null;
68
69     /**
70      * Catalina service classname
71      */

72     private static final String JavaDoc CATALINA_SERVICE_CLASSNAME = "org.objectweb.jonas.web.catalina55.CatalinaJWebContainerServiceImpl";
73
74     /**
75      * Construct the instance and init the service.
76      * @throws ServiceException when Catalina Loader cannot be found
77      */

78     public CatalinaJWebContainerServiceWrapper() throws ServiceException {
79         LoaderManager lm = LoaderManager.getInstance();
80         try {
81             catalinaLoader = lm.getCatalinaLoader();
82         } catch (Exception JavaDoc e) {
83             // TODO add i18n error message
84
throw new ServiceException("Cannot get Catalina ClassLoader", e);
85         }
86         methods = new Hashtable JavaDoc();
87
88         if (catalinaService == null) {
89             catalinaService = getCatalinaServiceInstance();
90         }
91
92     }
93
94     /**
95      * Deploy the given wars of an ear file with the specified parent
96      * classloader (ejb classloader or ear classloader). (This method
97      * is only used for the ear applications, not for the
98      * web applications).
99      * @param ctx the context containing the configuration
100      * to deploy the wars.<BR>
101      * This context contains the following parameters :<BR>
102      * - urls the list of the urls of the wars to deploy.<BR>
103      * - earURL the URL of the ear application file.<BR>
104      * - parentClassLoader the parent classLoader of the wars.<BR>
105      * - earClassLoader the ear classLoader of the j2ee app.<BR>
106      * - altDDs the optional URI of deployment descriptor.<BR>
107      * - contextRoots the optional context root of the wars.<BR>
108      * @throws JWebContainerServiceException if an error occurs during
109      * the deployment.
110      */

111     public void deployWars(Context JavaDoc ctx) throws JWebContainerServiceException {
112
113         if (catalinaService == null) {
114             catalinaService = getCatalinaServiceInstance();
115         }
116
117         // method invokation
118
Method JavaDoc m = (Method JavaDoc) methods.get("deployWars");
119         if (m == null) {
120             m = getMethod("deployWars", new Class JavaDoc[] {Context JavaDoc.class});
121         }
122
123         invoke(m, new Object JavaDoc[] {ctx});
124     }
125
126     /**
127      * Get the war identified by its URL (.war).
128      * @param url the URL of the war to get.
129      * @return the war indentified by its URL, or null if the war is not found.
130      */

131     public War getWar(URL JavaDoc url) {
132
133         if (catalinaService == null) {
134             catalinaService = getCatalinaServiceInstance();
135         }
136
137         // method invokation
138
Method JavaDoc m = (Method JavaDoc) methods.get("getWar");
139         if (m == null) {
140             m = getMethod("getWar", new Class JavaDoc[] {URL JavaDoc.class});
141         }
142
143         return (War) invoke(m, new Object JavaDoc[] {url});
144
145     }
146     /**
147      * Invoke a method with the given args
148      * @param m method to invoke
149      * @param params arguments
150      * @return the object if any
151      */

152     private Object JavaDoc invoke(Method JavaDoc m, Object JavaDoc[] params) {
153         ClassLoader JavaDoc old = null;
154         try {
155             old = Thread.currentThread().getContextClassLoader();
156             Thread.currentThread().setContextClassLoader(catalinaLoader);
157             return m.invoke(catalinaService, params);
158         } catch (InvocationTargetException JavaDoc e) {
159             if (e.getTargetException() instanceof Error JavaDoc) {
160                 throw (Error JavaDoc) e.getTargetException();
161             } else if (e.getTargetException() instanceof ServiceException) {
162                 throw (ServiceException) e.getTargetException();
163             } else {
164 // TODO add i18n error message
165
throw new ServiceException("Problems when invoking " + m.getName(), e.getTargetException());
166             }
167         } catch (Exception JavaDoc e) {
168 // TODO add i18n error message
169
throw new ServiceException("Problems when invoking " + m.getName(), e);
170         } finally {
171             if (old != null) {
172                 Thread.currentThread().setContextClassLoader(old);
173             }
174         }
175     }
176
177     /**
178      * Gets the method object for a given method name /types
179      * @param methodName name of the method
180      * @param paramTypes arguments
181      * @throws ServiceException if the method cannot be retrieved
182      * @return the wanted method
183      */

184     private Method JavaDoc getMethod(String JavaDoc methodName, Class JavaDoc[] paramTypes) throws ServiceException {
185         try {
186             Method JavaDoc m = catalinaService.getClass().getMethod(methodName, paramTypes);
187             methods.put(methodName, m);
188             return m;
189         } catch (Exception JavaDoc e) {
190             throw new ServiceException("Problems when retrieving " + methodName + " method", e);
191         }
192     }
193
194     /**
195      * @return Returns a new CatalinaService instance
196      * @throws ServiceException if the instance cannot be retrieved
197      */

198     private Object JavaDoc getCatalinaServiceInstance() throws ServiceException {
199         try {
200             Class JavaDoc service = catalinaLoader.loadClass(CATALINA_SERVICE_CLASSNAME);
201             return service.newInstance();
202         } catch (Exception JavaDoc e) {
203             throw new JWebContainerServiceException("Problems when loading " + CATALINA_SERVICE_CLASSNAME, e);
204         }
205     }
206
207     /**
208      * Undeploy the given wars of an ear file with the specified parent
209      * classloader (ejb classloader or ear classloader). (This method
210      * is only used for the ear applications, not for the
211      * war applications).
212      * @param urls the list of the urls of the wars to undeploy.
213      */

214     public void unDeployWars(URL JavaDoc[] urls) {
215
216         if (catalinaService == null) {
217             catalinaService = getCatalinaServiceInstance();
218         }
219         // method invokation
220
Method JavaDoc m = (Method JavaDoc) methods.get("unDeployWars");
221         if (m == null) {
222             m = getMethod("unDeployWars", new Class JavaDoc[] {URL JavaDoc[].class});
223         }
224
225         invoke(m, new Object JavaDoc[] {urls});
226
227     }
228
229     /**
230      * Make a cleanup of the cache of deployment descriptor. This method must
231      * be invoked after the ear deployment by the EAR service.
232      * @param earClassLoader the ClassLoader of the ear application to
233      * remove from the cache.
234      */

235     public void removeCache(ClassLoader JavaDoc earClassLoader) {
236
237         if (catalinaService == null) {
238             catalinaService = getCatalinaServiceInstance();
239         }
240         // method invokation
241
Method JavaDoc m = (Method JavaDoc) methods.get("removeCache");
242         if (m == null) {
243             m = getMethod("removeCache", new Class JavaDoc[] {ClassLoader JavaDoc.class});
244         }
245
246         invoke(m, new Object JavaDoc[] {earClassLoader});
247
248     }
249
250     /**
251      * Register a WAR by delegating the operation to the registerWar()
252      * method. This is used for JMX management.
253      * @param fileName the name of the war to deploy.
254      * @throws RemoteException if rmi call failed.
255      * @throws JWebContainerServiceException if the registration failed.
256      */

257     public void registerWarMBean(String JavaDoc fileName) throws RemoteException JavaDoc, JWebContainerServiceException {
258
259         if (catalinaService == null) {
260             catalinaService = getCatalinaServiceInstance();
261         }
262         // method invokation
263
Method JavaDoc m = (Method JavaDoc) methods.get("registerWarMBean");
264         if (m == null) {
265             m = getMethod("registerWarMBean", new Class JavaDoc[] {String JavaDoc.class});
266         }
267
268         invoke(m, new Object JavaDoc[] {fileName});
269
270     }
271
272     /**
273      * Unregister a WAR by delegating the operation to the unRegisterWar()
274      * method. This is used for JMX management.
275      * @param fileName the name of the war to undeploy.
276      * @throws RemoteException if rmi call failed.
277      * @throws JWebContainerServiceException if the unregistration failed.
278      */

279     public void unRegisterWarMBean(String JavaDoc fileName) throws RemoteException JavaDoc, JWebContainerServiceException {
280
281         if (catalinaService == null) {
282             catalinaService = getCatalinaServiceInstance();
283         }
284         // method invokation
285
Method JavaDoc m = (Method JavaDoc) methods.get("unRegisterWarMBean");
286         if (m == null) {
287             m = getMethod("unRegisterWarMBean", new Class JavaDoc[] {String JavaDoc.class});
288         }
289
290         invoke(m, new Object JavaDoc[] {fileName});
291
292     }
293
294     /**
295      * Return the list of installed web applications.
296      * The WAR files or the directories with expanded web application are searched
297      * in JONAS_BASE/webapps and all webapps directories 'autoload'.
298      * @return The list of WAR files or the directories with expanded web application found
299      * @throws Exception if the list can't be retrieved
300      */

301     public List JavaDoc getInstalledWars() throws Exception JavaDoc {
302
303         if (catalinaService == null) {
304             catalinaService = getCatalinaServiceInstance();
305         }
306         // method invokation
307
Method JavaDoc m = (Method JavaDoc) methods.get("getInstalledWars");
308         if (m == null) {
309             m = getMethod("getInstalledWars", new Class JavaDoc[] {});
310         }
311
312         return (List JavaDoc) invoke(m, new Object JavaDoc[] {});
313
314     }
315
316     /**
317      * @return current number of wars deployed in the JOnAS server
318      */

319     public Integer JavaDoc getCurrentNumberOfWars() {
320
321         if (catalinaService == null) {
322             catalinaService = getCatalinaServiceInstance();
323         }
324         // method invokation
325
Method JavaDoc m = (Method JavaDoc) methods.get("getCurrentNumberOfWars");
326         if (m == null) {
327             m = getMethod("getCurrentNumberOfWars", new Class JavaDoc[] {});
328         }
329
330         return (Integer JavaDoc) invoke(m, new Object JavaDoc[] {});
331
332     }
333
334     /**
335      * This method is added temporarily. It will disapear when Wars will have their associated MBeans
336      * (when Wars will become manageable)
337      * @return the names of the wars currently deployed in the JOnAS server
338      */

339     public Set JavaDoc getWarNames() {
340
341         if (catalinaService == null) {
342             catalinaService = getCatalinaServiceInstance();
343         }
344         // method invokation
345
Method JavaDoc m = (Method JavaDoc) methods.get("getWarNames");
346         if (m == null) {
347             m = getMethod("getWarNames", new Class JavaDoc[] {});
348         }
349
350         return (Set JavaDoc) invoke(m, new Object JavaDoc[] {});
351
352     }
353
354     /**
355      * Test if the specified filename is already deployed or not
356      * @param fileName the name of the war file.
357      * @return true if the war is deployed, else false.
358      */

359     public boolean isWarLoaded(String JavaDoc fileName) {
360
361         if (catalinaService == null) {
362             catalinaService = getCatalinaServiceInstance();
363         }
364         // method invokation
365
Method JavaDoc m = (Method JavaDoc) methods.get("isWarLoaded");
366         if (m == null) {
367             m = getMethod("isWarLoaded", new Class JavaDoc[] {String JavaDoc.class});
368         }
369
370         return ((Boolean JavaDoc) invoke(m, new Object JavaDoc[] {fileName})).booleanValue();
371
372     }
373
374     /**
375      * Gets the name of the server which is the web container
376      * @return the name of the server which is the web container
377      */

378     public String JavaDoc getServerName() {
379
380         if (catalinaService == null) {
381             catalinaService = getCatalinaServiceInstance();
382         }
383         // method invokation
384
Method JavaDoc m = (Method JavaDoc) methods.get("getServerName");
385         if (m == null) {
386             m = getMethod("getServerName", new Class JavaDoc[] {});
387         }
388
389         return (String JavaDoc) invoke(m, new Object JavaDoc[] {});
390
391     }
392
393     /**
394      * Gets the version of the server which is the web container
395      * @return the version of the server which is the web container
396      */

397     public String JavaDoc getServerVersion() {
398
399         if (catalinaService == null) {
400             catalinaService = getCatalinaServiceInstance();
401         }
402         // method invokation
403
Method JavaDoc m = (Method JavaDoc) methods.get("getServerVersion");
404         if (m == null) {
405             m = getMethod("getServerVersion", new Class JavaDoc[] {});
406         }
407
408         return (String JavaDoc) invoke(m, new Object JavaDoc[] {});
409
410     }
411
412     /**
413      * Return the list of all loaded web applications.
414      *
415      * @return The list of deployed web applications
416      */

417     public List JavaDoc getDeployedWars() {
418
419         if (catalinaService == null) {
420             catalinaService = getCatalinaServiceInstance();
421         }
422         // method invokation
423
Method JavaDoc m = (Method JavaDoc) methods.get("getDeployedWars");
424         if (m == null) {
425             m = getMethod("getDeployedWars", new Class JavaDoc[] {});
426         }
427
428         return (List JavaDoc) invoke(m, new Object JavaDoc[] {});
429
430     }
431
432     /**
433      * Return the list of installed web applications ready to deploy.
434      *
435      * @return The list of deployable web applications
436      * @throws Exception if the list can't be retrieved
437      */

438     public List JavaDoc getDeployableWars() throws Exception JavaDoc {
439
440         if (catalinaService == null) {
441             catalinaService = getCatalinaServiceInstance();
442         }
443         // method invokation
444
Method JavaDoc m = (Method JavaDoc) methods.get("getDeployableWars");
445         if (m == null) {
446             m = getMethod("getDeployableWars", new Class JavaDoc[] {});
447         }
448
449         return (List JavaDoc) invoke(m, new Object JavaDoc[] {});
450
451     }
452
453     /**
454      * Return the list of "autoload" directories for web applications.
455      * @return The list of all "autoload" directories
456      */

457     public List JavaDoc getAutoloadDirectories() {
458
459         if (catalinaService == null) {
460             catalinaService = getCatalinaServiceInstance();
461         }
462         // method invokation
463
Method JavaDoc m = (Method JavaDoc) methods.get("getAutoloadDirectories");
464         if (m == null) {
465             m = getMethod("getAutoloadDirectories", new Class JavaDoc[] {});
466         }
467
468         return (List JavaDoc) invoke(m, new Object JavaDoc[] {});
469
470     }
471
472     /**
473      * Return the WebApps directory.
474      * @return The WebApps directory
475      */

476     public String JavaDoc getWebappsDirectory() {
477
478         if (catalinaService == null) {
479             catalinaService = getCatalinaServiceInstance();
480         }
481         // method invokation
482
Method JavaDoc m = (Method JavaDoc) methods.get("getWebappsDirectory");
483         if (m == null) {
484             m = getMethod("getWebappsDirectory", new Class JavaDoc[] {});
485         }
486
487         return (String JavaDoc) invoke(m, new Object JavaDoc[] {});
488
489     }
490
491     /**
492      * Initialize the Catalina service.
493      * @param ctx the configuration context of the service.
494      * @throws ServiceException if the initialization failed.
495      * @see org.objectweb.jonas.service.Service#init(javax.naming.Context)
496      */

497     public void init(Context JavaDoc ctx) throws ServiceException {
498
499         if (catalinaService == null) {
500             catalinaService = getCatalinaServiceInstance();
501         }
502         // method invokation
503
Method JavaDoc m = (Method JavaDoc) methods.get("init");
504         if (m == null) {
505             m = getMethod("init", new Class JavaDoc[] {Context JavaDoc.class});
506         }
507
508         invoke(m, new Object JavaDoc[] {ctx});
509
510     }
511
512     /**
513      * Start the Catalina service in a new thread
514      * @throws ServiceException if the startup failed.
515      * @see org.objectweb.jonas.service.Service#start()
516      */

517     public void start() throws ServiceException {
518
519         if (catalinaService == null) {
520             catalinaService = getCatalinaServiceInstance();
521         }
522         // method invokation
523
Method JavaDoc m = (Method JavaDoc) methods.get("start");
524         if (m == null) {
525             m = getMethod("start", new Class JavaDoc[] {});
526         }
527
528         invoke(m, new Object JavaDoc[] {});
529     }
530
531     /**
532      * Stop the Catalina service.
533      * @throws ServiceException if the stop failed.
534      * @see org.objectweb.jonas.service.Service#stop()
535      */

536     public void stop() throws ServiceException {
537
538         if (catalinaService == null) {
539             catalinaService = getCatalinaServiceInstance();
540         }
541         // method invokation
542
Method JavaDoc m = (Method JavaDoc) methods.get("stop");
543         if (m == null) {
544             m = getMethod("stop", new Class JavaDoc[] {});
545         }
546
547         invoke(m, new Object JavaDoc[] {});
548
549     }
550
551     /**
552      * @return true if the service is started, false otherwise
553      */

554     public boolean isStarted() {
555
556         if (catalinaService == null) {
557             catalinaService = getCatalinaServiceInstance();
558         }
559         // method invokation
560
Method JavaDoc m = (Method JavaDoc) methods.get("isStarted");
561         if (m == null) {
562             m = getMethod("isStarted", new Class JavaDoc[] {});
563         }
564
565         return ((Boolean JavaDoc) invoke(m, new Object JavaDoc[] {})).booleanValue();
566
567     }
568
569     /**
570      * Set the service's name
571      * @param name to set
572      */

573     public void setName(String JavaDoc name) {
574
575         if (catalinaService == null) {
576             catalinaService = getCatalinaServiceInstance();
577         }
578         // method invokation
579
Method JavaDoc m = (Method JavaDoc) methods.get("setName");
580         if (m == null) {
581             m = getMethod("setName", new Class JavaDoc[] {String JavaDoc.class});
582         }
583
584         invoke(m, new Object JavaDoc[] {name});
585
586     }
587
588     /**
589      * @return the service's name
590      */

591     public String JavaDoc getName() {
592
593         if (catalinaService == null) {
594             catalinaService = getCatalinaServiceInstance();
595         }
596         // method invokation
597
Method JavaDoc m = (Method JavaDoc) methods.get("getName");
598         if (m == null) {
599             m = getMethod("getName", new Class JavaDoc[] {});
600         }
601
602         return (String JavaDoc) invoke(m, new Object JavaDoc[] {});
603
604     }
605
606     /**
607      * Return the Default host name of the web container.
608      * @return the Default host name of the web container.
609      * @throws JWebContainerServiceException when it is impossible to get the Default Host.
610      */

611     public String JavaDoc getDefaultHost() throws JWebContainerServiceException {
612
613         if (catalinaService == null) {
614             catalinaService = getCatalinaServiceInstance();
615         }
616         // method invokation
617
Method JavaDoc m = (Method JavaDoc) methods.get("getDefaultHost");
618         if (m == null) {
619             m = getMethod("getDefaultHost", new Class JavaDoc[] {});
620         }
621
622         return (String JavaDoc) invoke(m, new Object JavaDoc[] {});
623
624     }
625
626     /**
627      * Return the Default HTTP port number of the web container (can
628      * be null if multiple HTTP connector has been set).
629      * @return the Default HTTP port number of the web container.
630      * @throws JWebContainerServiceException when it is impossible to get the Default Http port.
631      */

632     public String JavaDoc getDefaultHttpPort() throws JWebContainerServiceException {
633
634         if (catalinaService == null) {
635             catalinaService = getCatalinaServiceInstance();
636         }
637         // method invokation
638
Method JavaDoc m = (Method JavaDoc) methods.get("getDefaultHttpPort");
639         if (m == null) {
640             m = getMethod("getDefaultHttpPort", new Class JavaDoc[] {});
641         }
642
643         return (String JavaDoc) invoke(m, new Object JavaDoc[] {});
644
645     }
646
647     /**
648      * Return the Default HTTPS port number of the web container (can
649      * be null if multiple HTTPS connector has been set).
650      * @return the Default HTTPS port number of the web container.
651      * @throws JWebContainerServiceException when it is impossible to get the Default Https port.
652      */

653     public String JavaDoc getDefaultHttpsPort() throws JWebContainerServiceException {
654
655         if (catalinaService == null) {
656             catalinaService = getCatalinaServiceInstance();
657         }
658         // method invokation
659
Method JavaDoc m = (Method JavaDoc) methods.get("getDefaultHttpsPort");
660         if (m == null) {
661             m = getMethod("getDefaultHttpsPort", new Class JavaDoc[] {});
662         }
663
664         return (String JavaDoc) invoke(m, new Object JavaDoc[] {});
665
666     }
667
668     /**
669      * Return the class loader of the given warURL. Unpack the associated war
670      * and build the loader if it's not in the cache.
671      * @param warURL the url of the war we want to get the loader
672      * @param earAppName the name of the ear application containing
673      * the war. May be null in non ear case.
674      * @param parentLoader the ejb class loader of the ear.
675      * May be null in non ear case.
676      * @return the class loader of the given warURL.
677      * @throws JWebContainerServiceException if the process failed.
678      */

679     public URLClassLoader JavaDoc getClassLoader(URL JavaDoc warURL, String JavaDoc earAppName, ClassLoader JavaDoc parentLoader) throws JWebContainerServiceException {
680
681         if (catalinaService == null) {
682             catalinaService = getCatalinaServiceInstance();
683         }
684         // method invokation
685
Method JavaDoc m = (Method JavaDoc) methods.get("getClassLoader");
686         if (m == null) {
687             m = getMethod("getClassLoader", new Class JavaDoc[] {URL JavaDoc.class, String JavaDoc.class, ClassLoader JavaDoc.class});
688         }
689
690         return (URLClassLoader JavaDoc) invoke(m, new Object JavaDoc[] {warURL, earAppName, parentLoader});
691
692     }
693
694     /**
695      * The server is started ?
696      * @return boolean true if the catalina container is running.
697      */

698     public boolean isTomcatStarted() {
699
700         if (catalinaService == null) {
701             catalinaService = getCatalinaServiceInstance();
702         }
703         // method invokation
704
Method JavaDoc m = (Method JavaDoc) methods.get("isTomcatStarted");
705         if (m == null) {
706             m = getMethod("isTomcatStarted", new Class JavaDoc[] {});
707         }
708
709         return ((Boolean JavaDoc) invoke(m, new Object JavaDoc[] {})).booleanValue();
710
711     }
712
713     /**
714      * @param url the URL of the webapp
715      * @return Returns the ClassLoader used to link a JNDI environnment to a webapp
716      */

717     public ClassLoader JavaDoc getContextLinkedClassLoader(URL JavaDoc url) {
718
719         if (catalinaService == null) {
720             catalinaService = getCatalinaServiceInstance();
721         }
722         // method invokation
723
Method JavaDoc m = (Method JavaDoc) methods.get("getContextLinkedClassLoader");
724         if (m == null) {
725             m = getMethod("getContextLinkedClassLoader", new Class JavaDoc[] {URL JavaDoc.class});
726         }
727
728         return (ClassLoader JavaDoc) invoke(m, new Object JavaDoc[] {url});
729
730     }
731
732 }
733
Popular Tags