KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > net > axis > ServiceClassLoaderAwareWSDDHandlerProvider


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 // $Id: ServiceClassLoaderAwareWSDDHandlerProvider.java,v 1.5.6.1 2005/03/02 14:19:53 tdiesler Exp $
9
package org.jboss.net.axis;
10
11 import org.jboss.axis.EngineConfiguration;
12 import org.jboss.axis.Handler;
13 import org.jboss.axis.deployment.wsdd.WSDDService;
14 import org.jboss.axis.deployment.wsdd.providers.WSDDHandlerProvider;
15
16 /**
17  * <p>
18  * A subclass of the official handler provider that
19  * is able to load the specified handler classes from
20  * the service deployment classloader.
21  * </p>
22  * @author jung
23  * @since 12.03.2003
24  * @version $Revision: 1.5.6.1 $
25  */

26
27 public class ServiceClassLoaderAwareWSDDHandlerProvider
28         extends WSDDHandlerProvider
29 {
30
31    /* (non-Javadoc)
32     * @see org.jboss.axis.deployment.wsdd.WSDDProvider#newProviderInstance(org.jboss.axis.deployment.wsdd.WSDDService, org.jboss.axis.EngineConfiguration)
33     */

34    public Handler newProviderInstance(WSDDService arg0,
35                                       EngineConfiguration arg1)
36            throws Exception JavaDoc
37    {
38
39       Deployment deployment = (Deployment)arg0.getParametersTable().
40               get(Constants.SERVICE_DEPLOYMENT_PARAMETER);
41
42       if (deployment != null)
43       {
44          ClassLoader JavaDoc loader = deployment.getDeploymentLoader();
45          ClassLoader JavaDoc old = Thread.currentThread().getContextClassLoader();
46          Thread.currentThread().setContextClassLoader(loader);
47          try
48          {
49             return super.newProviderInstance(arg0, arg1);
50          }
51          finally
52          {
53             Thread.currentThread().setContextClassLoader(old);
54          }
55       }
56       else
57       {
58          return super.newProviderInstance(arg0, arg1);
59       }
60    }
61
62 }
63
Popular Tags