KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > ws > axis > AxisWSServiceImpl


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-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: AxisWSServiceImpl.java,v 1.10 2004/09/29 15:13:04 sauthieg Exp $
23  * --------------------------------------------------------------------------
24 */

25
26 package org.objectweb.jonas.ws.axis;
27
28 import javax.naming.Context JavaDoc;
29 import javax.xml.namespace.QName JavaDoc;
30
31 import org.apache.axis.AxisProperties;
32 import org.apache.axis.deployment.wsdd.WSDDConstants;
33 import org.apache.axis.deployment.wsdd.WSDDProvider;
34
35 import org.objectweb.jonas_lib.loader.ThreadContextClassLoader;
36
37 import org.objectweb.jonas.ws.AbsWebServicesServiceImpl;
38 import org.objectweb.jonas.ws.WSServiceException;
39
40 import org.objectweb.util.monolog.api.BasicLevel;
41
42 /**
43  * Implements commons methods declared within the abstract class. It's used
44  * AXIS classes for specific deployment aspects.
45  *
46  * @author Guillaume Sauthier
47  * @author Xavier Delplanque
48  */

49 public class AxisWSServiceImpl extends AbsWebServicesServiceImpl {
50
51     /** Used to tell Axis engine to use a new EngineConfigurationFactory */
52     private static final String JavaDoc AXIS_CONFIG_FACTORY_PROP =
53         "axis.EngineConfigFactory";
54
55     /** The class name of the new Factory */
56     private static final String JavaDoc AXIS_MODULE_CONFIG_CLASS =
57         "org.objectweb.jonas.ws.axis.JServletEngineConfigurationFactory";
58
59     /**
60      * Init the AxisWSService.
61      *
62      * @param ctx Context for configuration.
63      *
64      * @throws WSServiceException when init fails.
65      */

66     public void doInit(Context JavaDoc ctx) throws WSServiceException {
67         super.doInit(ctx);
68
69         getLogger().log(BasicLevel.DEBUG, "Adding " + AXIS_MODULE_CONFIG_CLASS + " as ConfigurationFactory");
70
71         //set our custom provider
72
QName JavaDoc javaURI = new QName JavaDoc(WSDDConstants.URI_WSDD_JAVA, WSDDJOnASEJBProvider.PROVIDER_NAME);
73         WSDDProvider.registerProvider(javaURI, new WSDDJOnASEJBProvider());
74
75         // Add our Config Factory in Axis
76
AxisProperties.setProperty(AXIS_CONFIG_FACTORY_PROP,
77                                    AXIS_MODULE_CONFIG_CLASS);
78
79         // Fix for Bug #300844
80
// Use a ClassLoader that will delegate to call-time real context ClassLoader
81
ClassLoader JavaDoc old = Thread.currentThread().getContextClassLoader();
82         Thread.currentThread().setContextClassLoader(new ThreadContextClassLoader());
83         AxisProperties.getNameDiscoverer();
84         Thread.currentThread().setContextClassLoader(old);
85     }
86
87 }
88
Popular Tags