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.MsgProvider;
012 import org.apache.axis.utils.cache.ClassCache;
013 import org.picocontainer.web.PicoServletContainerFilter;
014
015 /**
016 * Axis provider for message-style services that uses the
017 * PicoServletContainerFilter to instantiate service classes and resolve their
018 * dependencies.
019 *
020 * @author <a href="mailto:evan@bottch.com">Evan Bottcher</a>
021 */
022 @SuppressWarnings("serial")
023 public class PicoMsgProvider extends MsgProvider {
024
025 protected Object makeNewServiceObject(MessageContext msgContext, String clsName) throws Exception {
026
027 ClassLoader cl = msgContext.getClassLoader();
028 ClassCache cache = msgContext.getAxisEngine().getClassCache();
029 Class<?> svcClass = cache.lookup(clsName, cl).getJavaClass();
030
031 return PicoServletContainerFilter.getRequestComponentForThread(svcClass);
032 }
033
034 }