01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999-2004 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * 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 5530 2004-09-29 15:13:04Z sauthieg $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas.ws.axis;
25:
26: import javax.naming.Context;
27: import javax.xml.namespace.QName;
28:
29: import org.apache.axis.AxisProperties;
30: import org.apache.axis.deployment.wsdd.WSDDConstants;
31: import org.apache.axis.deployment.wsdd.WSDDProvider;
32:
33: import org.objectweb.jonas_lib.loader.ThreadContextClassLoader;
34:
35: import org.objectweb.jonas.ws.AbsWebServicesServiceImpl;
36: import org.objectweb.jonas.ws.WSServiceException;
37:
38: import org.objectweb.util.monolog.api.BasicLevel;
39:
40: /**
41: * Implements commons methods declared within the abstract class. It's used
42: * AXIS classes for specific deployment aspects.
43: *
44: * @author Guillaume Sauthier
45: * @author Xavier Delplanque
46: */
47: public class AxisWSServiceImpl extends AbsWebServicesServiceImpl {
48:
49: /** Used to tell Axis engine to use a new EngineConfigurationFactory */
50: private static final String AXIS_CONFIG_FACTORY_PROP = "axis.EngineConfigFactory";
51:
52: /** The class name of the new Factory */
53: private static final String AXIS_MODULE_CONFIG_CLASS = "org.objectweb.jonas.ws.axis.JServletEngineConfigurationFactory";
54:
55: /**
56: * Init the AxisWSService.
57: *
58: * @param ctx Context for configuration.
59: *
60: * @throws WSServiceException when init fails.
61: */
62: public void doInit(Context ctx) throws WSServiceException {
63: super .doInit(ctx);
64:
65: getLogger().log(
66: BasicLevel.DEBUG,
67: "Adding " + AXIS_MODULE_CONFIG_CLASS
68: + " as ConfigurationFactory");
69:
70: //set our custom provider
71: QName javaURI = new QName(WSDDConstants.URI_WSDD_JAVA,
72: WSDDJOnASEJBProvider.PROVIDER_NAME);
73: WSDDProvider.registerProvider(javaURI,
74: new WSDDJOnASEJBProvider());
75:
76: // Add our Config Factory in Axis
77: AxisProperties.setProperty(AXIS_CONFIG_FACTORY_PROP,
78: AXIS_MODULE_CONFIG_CLASS);
79:
80: // Fix for Bug #300844
81: // Use a ClassLoader that will delegate to call-time real context ClassLoader
82: ClassLoader old = Thread.currentThread()
83: .getContextClassLoader();
84: Thread.currentThread().setContextClassLoader(
85: new ThreadContextClassLoader());
86: AxisProperties.getNameDiscoverer();
87: Thread.currentThread().setContextClassLoader(old);
88: }
89:
90: }
|