001    /*******************************************************************************
002     * Copyright (C) PicoContainer Organization. All rights reserved.
003     * ---------------------------------------------------------------------------
004     * The software in this package is published under the terms of the BSD style
005     * license a copy of which has been included with this distribution in the
006     * LICENSE.txt file.
007     ******************************************************************************/
008    package org.picocontainer.web.axis;
009    
010    import org.apache.axis.MessageContext;
011    import org.apache.axis.providers.java.RPCProvider;
012    import org.apache.axis.utils.cache.ClassCache;
013    import org.picocontainer.web.PicoServletContainerFilter;
014    
015    /**
016     * Axis provider for RPC-style services that uses the PicoServletContainerFilter
017     * to instantiate service classes and resolve their dependencies.
018     * 
019     * @author <a href="mailto:evan@bottch.com">Evan Bottcher</a>
020     */
021    @SuppressWarnings("serial")
022    public class PicoRPCProvider extends RPCProvider {
023    
024        protected Object makeNewServiceObject(MessageContext msgContext, String clsName) throws Exception {
025    
026            ClassLoader cl = msgContext.getClassLoader();
027            ClassCache cache = msgContext.getAxisEngine().getClassCache();
028            Class<?> svcClass = cache.lookup(clsName, cl).getJavaClass();
029    
030            return PicoServletContainerFilter.getRequestComponentForThread(svcClass);
031        }
032    
033    }