All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.objectweb.jonas.ws.axis.AxisWSServiceImpl Maven / Gradle / Ivy

The newest version!
/**
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 1999-2004 Bull S.A.
 * Contact: [email protected]
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id: AxisWSServiceImpl.java 10587 2007-06-11 11:57:36Z sauthieg $
 * --------------------------------------------------------------------------
*/

package org.objectweb.jonas.ws.axis;

import javax.naming.Context;
import javax.xml.namespace.QName;

import org.apache.axis.AxisProperties;
import org.apache.axis.deployment.wsdd.WSDDConstants;
import org.apache.axis.deployment.wsdd.WSDDProvider;

import org.objectweb.jonas.loader.ThreadContextClassLoader;

import org.objectweb.jonas.ws.WSServiceException;
import org.objectweb.jonas.ws.base.AbsWebServicesServiceImpl;

import org.objectweb.util.monolog.api.BasicLevel;

/**
 * Implements commons methods declared within the abstract class. It's used
 * AXIS classes for specific deployment aspects.
 *
 * @author Guillaume Sauthier
 * @author Xavier Delplanque
 */
public class AxisWSServiceImpl extends AbsWebServicesServiceImpl {

    /** Used to tell Axis engine to use a new EngineConfigurationFactory */
    private static final String AXIS_CONFIG_FACTORY_PROP =
        "axis.EngineConfigFactory";

    /** The class name of the new Factory */
    private static final String AXIS_MODULE_CONFIG_CLASS =
        "org.objectweb.jonas.ws.axis.JServletEngineConfigurationFactory";

    /**
     * Init the AxisWSService.
     *
     * @param ctx Context for configuration.
     *
     * @throws WSServiceException when init fails.
     */
    public void doInit(Context ctx) throws WSServiceException {
        super.doInit(ctx);

        getLogger().log(BasicLevel.DEBUG, "Adding " + AXIS_MODULE_CONFIG_CLASS + " as ConfigurationFactory");

        //set our custom provider
        QName javaURI = new QName(WSDDConstants.URI_WSDD_JAVA, WSDDJOnASEJBProvider.PROVIDER_NAME);
        WSDDProvider.registerProvider(javaURI, new WSDDJOnASEJBProvider());

        // Add our Config Factory in Axis
        AxisProperties.setProperty(AXIS_CONFIG_FACTORY_PROP,
                                   AXIS_MODULE_CONFIG_CLASS);

        // Fix for Bug #300844
        // Use a ClassLoader that will delegate to call-time real context ClassLoader
        ClassLoader old = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(new ThreadContextClassLoader());
        AxisProperties.getNameDiscoverer();
        Thread.currentThread().setContextClassLoader(old);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy