You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jarek Gawor <jg...@gmail.com> on 2010/05/25 06:12:49 UTC
Re: svn commit: r947901 [1/3] - in /geronimo/server/trunk:
framework/configs/geronimo-gbean-deployer-bootstrap/src/main/history/
framework/configs/jsr88-cli/src/main/history/ framework/configs/jsr88-deploymentfactory/src/main/history/
framework/confi
I think you forgot to add a class: BundleAwareReference.java
Jarek
On Mon, May 24, 2010 at 11:26 PM, <xu...@apache.org> wrote:
> Author: xuhaihong
> Date: Tue May 25 03:26:52 2010
> New Revision: 947901
>
> URL: http://svn.apache.org/viewvc?rev=947901&view=rev
> Log:
> a. remove the use of configurationUrl \n b. Add a BundleAwareReference interface
>
> Modified:
> geronimo/server/trunk/framework/configs/geronimo-gbean-deployer-bootstrap/src/main/history/dependencies.xml
> geronimo/server/trunk/framework/configs/jsr88-cli/src/main/history/dependencies.xml
> geronimo/server/trunk/framework/configs/jsr88-deploymentfactory/src/main/history/dependencies.xml
> geronimo/server/trunk/framework/configs/online-deployer/src/main/history/dependencies.xml
> geronimo/server/trunk/framework/configs/shutdown/src/main/history/dependencies.xml
> geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
> geronimo/server/trunk/framework/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/enc/EnterpriseNamingContext.java
> geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
> geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
> geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java
> geronimo/server/trunk/plugins/axis2/geronimo-axis2/pom.xml
> geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
> geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
> geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/client/Axis2ServiceReference.java
> geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
> geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainerFactoryGBean.java
> geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/Axis2WebServiceContainerTest.java
> geronimo/server/trunk/plugins/bval/bval-deployer/src/main/history/dependencies.xml
> geronimo/server/trunk/plugins/client/client/src/main/history/dependencies.xml
> geronimo/server/trunk/plugins/client/geronimo-client/src/main/java/org/apache/geronimo/client/StaticJndiContextPlugin.java
> geronimo/server/trunk/plugins/connector-1_6/transaction-1_6/src/main/history/dependencies.xml
> geronimo/server/trunk/plugins/corba/geronimo-corba/src/main/java/org/apache/geronimo/corba/StandardServant.java
> geronimo/server/trunk/plugins/cxf/geronimo-cxf-builder/src/main/java/org/apache/geronimo/cxf/builder/CXFBuilder.java
> geronimo/server/trunk/plugins/cxf/geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/EJBEndpoint.java
> geronimo/server/trunk/plugins/cxf/geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/EJBWebServiceContainer.java
> geronimo/server/trunk/plugins/cxf/geronimo-cxf-ejb/src/main/java/org/apache/geronimo/cxf/ejb/EJBWebServiceGBean.java
> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java
> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/client/CXFServiceReference.java
> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOEndpoint.java
> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainer.java
> geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainerFactoryGBean.java
> geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/jndi/ApplicationJndi.java
> geronimo/server/trunk/plugins/j2ee/geronimo-j2ee/src/main/java/org/apache/geronimo/j2ee/jndi/WebContextSource.java
> geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/test/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilderTest.java
> geronimo/server/trunk/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml
> geronimo/server/trunk/plugins/j2ee/jsr88-ear-configurer/src/main/history/dependencies.xml
> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSServiceBuilder.java
> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/pom.xml
> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/JAXWSUtils.java
> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/annotations/EJBAnnotationHandler.java
> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/client/JAXWSServiceReference.java
> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerChainBuilder.java
> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/main/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerResolver.java
> geronimo/server/trunk/plugins/jaxws/geronimo-jaxws/src/test/java/org/apache/geronimo/jaxws/handler/GeronimoHandlerResolverTest.java
> geronimo/server/trunk/plugins/jetty8/geronimo-jetty8/src/test/java/org/apache/geronimo/jetty8/AbstractWebModuleTest.java
> geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/deployment/ClusteredStatefulDeployment.java
> geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbDeployment.java
> geronimo/server/trunk/plugins/openejb/openejb/src/main/history/dependencies.xml
> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
>
> Modified: geronimo/server/trunk/framework/configs/geronimo-gbean-deployer-bootstrap/src/main/history/dependencies.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/geronimo-gbean-deployer-bootstrap/src/main/history/dependencies.xml?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/framework/configs/geronimo-gbean-deployer-bootstrap/src/main/history/dependencies.xml (original)
> +++ geronimo/server/trunk/framework/configs/geronimo-gbean-deployer-bootstrap/src/main/history/dependencies.xml Tue May 25 03:26:52 2010
> @@ -22,6 +22,11 @@
> <type>jar</type>
> </dependency>
> <dependency>
> + <groupId>org.apache.felix</groupId>
> + <artifactId>org.apache.felix.configadmin</artifactId>
> + <type>jar</type>
> + </dependency>
> + <dependency>
> <groupId>org.apache.geronimo.bundles</groupId>
> <artifactId>jaxb-impl</artifactId>
> <type>jar</type>
> @@ -68,6 +73,11 @@
> </dependency>
> <dependency>
> <groupId>org.apache.geronimo.framework</groupId>
> + <artifactId>geronimo-pax-logging</artifactId>
> + <type>jar</type>
> + </dependency>
> + <dependency>
> + <groupId>org.apache.geronimo.framework</groupId>
> <artifactId>geronimo-service-builder</artifactId>
> <type>jar</type>
> </dependency>
>
> Modified: geronimo/server/trunk/framework/configs/jsr88-cli/src/main/history/dependencies.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/jsr88-cli/src/main/history/dependencies.xml?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/framework/configs/jsr88-cli/src/main/history/dependencies.xml (original)
> +++ geronimo/server/trunk/framework/configs/jsr88-cli/src/main/history/dependencies.xml Tue May 25 03:26:52 2010
> @@ -22,6 +22,11 @@
> <type>jar</type>
> </dependency>
> <dependency>
> + <groupId>org.apache.felix</groupId>
> + <artifactId>org.apache.felix.configadmin</artifactId>
> + <type>jar</type>
> + </dependency>
> + <dependency>
> <groupId>org.apache.felix.gogo</groupId>
> <artifactId>org.apache.felix.gogo.commands</artifactId>
> <type>jar</type>
> @@ -93,6 +98,11 @@
> </dependency>
> <dependency>
> <groupId>org.apache.geronimo.framework</groupId>
> + <artifactId>geronimo-pax-logging</artifactId>
> + <type>jar</type>
> + </dependency>
> + <dependency>
> + <groupId>org.apache.geronimo.framework</groupId>
> <artifactId>geronimo-plugin</artifactId>
> <type>jar</type>
> </dependency>
>
> Modified: geronimo/server/trunk/framework/configs/jsr88-deploymentfactory/src/main/history/dependencies.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/jsr88-deploymentfactory/src/main/history/dependencies.xml?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/framework/configs/jsr88-deploymentfactory/src/main/history/dependencies.xml (original)
> +++ geronimo/server/trunk/framework/configs/jsr88-deploymentfactory/src/main/history/dependencies.xml Tue May 25 03:26:52 2010
> @@ -22,6 +22,11 @@
> <type>jar</type>
> </dependency>
> <dependency>
> + <groupId>org.apache.felix</groupId>
> + <artifactId>org.apache.felix.configadmin</artifactId>
> + <type>jar</type>
> + </dependency>
> + <dependency>
> <groupId>org.apache.geronimo.bundles</groupId>
> <artifactId>jaxb-impl</artifactId>
> <type>jar</type>
> @@ -73,6 +78,11 @@
> </dependency>
> <dependency>
> <groupId>org.apache.geronimo.framework</groupId>
> + <artifactId>geronimo-pax-logging</artifactId>
> + <type>jar</type>
> + </dependency>
> + <dependency>
> + <groupId>org.apache.geronimo.framework</groupId>
> <artifactId>geronimo-plugin</artifactId>
> <type>jar</type>
> </dependency>
>
> Modified: geronimo/server/trunk/framework/configs/online-deployer/src/main/history/dependencies.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/online-deployer/src/main/history/dependencies.xml?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/framework/configs/online-deployer/src/main/history/dependencies.xml (original)
> +++ geronimo/server/trunk/framework/configs/online-deployer/src/main/history/dependencies.xml Tue May 25 03:26:52 2010
> @@ -22,6 +22,11 @@
> <type>jar</type>
> </dependency>
> <dependency>
> + <groupId>org.apache.felix</groupId>
> + <artifactId>org.apache.felix.configadmin</artifactId>
> + <type>jar</type>
> + </dependency>
> + <dependency>
> <groupId>org.apache.geronimo.bundles</groupId>
> <artifactId>jaxb-impl</artifactId>
> <type>jar</type>
> @@ -58,6 +63,11 @@
> </dependency>
> <dependency>
> <groupId>org.apache.geronimo.framework</groupId>
> + <artifactId>geronimo-pax-logging</artifactId>
> + <type>jar</type>
> + </dependency>
> + <dependency>
> + <groupId>org.apache.geronimo.framework</groupId>
> <artifactId>geronimo-plugin</artifactId>
> <type>jar</type>
> </dependency>
>
> Modified: geronimo/server/trunk/framework/configs/shutdown/src/main/history/dependencies.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/shutdown/src/main/history/dependencies.xml?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/framework/configs/shutdown/src/main/history/dependencies.xml (original)
> +++ geronimo/server/trunk/framework/configs/shutdown/src/main/history/dependencies.xml Tue May 25 03:26:52 2010
> @@ -22,6 +22,11 @@
> <type>jar</type>
> </dependency>
> <dependency>
> + <groupId>org.apache.felix</groupId>
> + <artifactId>org.apache.felix.configadmin</artifactId>
> + <type>jar</type>
> + </dependency>
> + <dependency>
> <groupId>org.apache.felix.gogo</groupId>
> <artifactId>org.apache.felix.gogo.commands</artifactId>
> <type>jar</type>
> @@ -93,6 +98,11 @@
> </dependency>
> <dependency>
> <groupId>org.apache.geronimo.framework</groupId>
> + <artifactId>geronimo-pax-logging</artifactId>
> + <type>jar</type>
> + </dependency>
> + <dependency>
> + <groupId>org.apache.geronimo.framework</groupId>
> <artifactId>geronimo-plugin</artifactId>
> <type>jar</type>
> </dependency>
>
> Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java (original)
> +++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java Tue May 25 03:26:52 2010
> @@ -43,7 +43,6 @@ import org.apache.geronimo.gbean.GBeanDa
> import org.apache.geronimo.gbean.GReferenceInfo;
> import org.apache.geronimo.gbean.InvalidConfigurationException;
> import org.apache.geronimo.gbean.ReferencePatterns;
> -import org.apache.geronimo.gbean.GAttributeInfo;
> import org.apache.geronimo.kernel.ClassLoading;
> import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
> import org.apache.geronimo.kernel.GBeanNotFoundException;
> @@ -90,7 +89,7 @@ public final class ConfigurationUtil {
>
> configurationMarshaler = marshaler;
> }
> -
> +
> private static File bootDirectory;
>
> private static File getStartupDirectory() {
> @@ -111,17 +110,17 @@ public final class ConfigurationUtil {
> } else {
> log.error("Cound not determine the installation directory of Apache Geronimo, because the startup jar could not be found in the current class loader.");
> }
> -
> +
> return directory;
> }
> -
> +
> private static File getBootDirectory() {
> if (bootDirectory == null) {
> bootDirectory = getStartupDirectory();
> - }
> + }
> return bootDirectory;
> }
> -
> +
> public static ConfigurationMarshaler createConfigurationMarshaler(String marshalerClass) throws Exception {
> ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
> Class clazz = null;
> @@ -184,7 +183,7 @@ public final class ConfigurationUtil {
> AbstractName abstractName = Configuration.getConfigurationAbstractName(configId);
> GBeanData gbeanData = new GBeanData(abstractName, Configuration.class);
> gbeanData.setAttribute("configurationData", configurationData);
> -
> +
> Collection repositories = null;
> ArtifactResolver artifactResolver = null;
> if (enableBootRepo) {
> @@ -231,7 +230,7 @@ public final class ConfigurationUtil {
> public static void writeConfigInfo(PrintWriter writer, ConfigurationData configurationData) {
> writeConfigInfo("", writer, configurationData);
> }
> -
> +
> private static void writeConfigInfo(String prefix, PrintWriter writer, ConfigurationData configurationData) {
> writer.println(prefix+"id=" + configurationData.getId());
> writer.println(prefix+"type=" + configurationData.getModuleType());
> @@ -324,8 +323,8 @@ public final class ConfigurationUtil {
> }
> return (AbstractName) names.iterator().next();
> }
> -
> -
> +
> +
> /**
> * Gets a reference or proxy to the ConfigurationManager running in the specified kernel.
> *
> @@ -357,7 +356,7 @@ public final class ConfigurationUtil {
> throw new IllegalStateException("More than one Configuration Manager was found in the kernel");
> }
> AbstractName configurationManagerName = (AbstractName) names.iterator().next();
> - return (EditableConfigurationManager) kernel.getProxyManager().createProxy(configurationManagerName, EditableConfigurationManager.class);
> + return kernel.getProxyManager().createProxy(configurationManagerName, EditableConfigurationManager.class);
> }
>
> public static void releaseConfigurationManager(Kernel kernel, ConfigurationManager configurationManager) {
> @@ -516,7 +515,7 @@ public final class ConfigurationUtil {
> }
> if (e instanceof Error) {
> throw (Error) e;
> - }
> + }
> if (e instanceof InvalidConfigException) {
> throw (InvalidConfigException) e;
> }
>
> Modified: geronimo/server/trunk/framework/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/enc/EnterpriseNamingContext.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/enc/EnterpriseNamingContext.java?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/framework/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/enc/EnterpriseNamingContext.java (original)
> +++ geronimo/server/trunk/framework/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/enc/EnterpriseNamingContext.java Tue May 25 03:26:52 2010
> @@ -27,11 +27,13 @@ import javax.naming.NamingException;
> import javax.transaction.UserTransaction;
>
> import org.apache.geronimo.kernel.Kernel;
> +import org.apache.geronimo.naming.reference.BundleAwareReference;
> import org.apache.geronimo.naming.reference.ClassLoaderAwareReference;
> import org.apache.geronimo.naming.reference.EntryFactory;
> import org.apache.geronimo.naming.reference.KernelAwareReference;
> import org.apache.xbean.naming.context.ImmutableContext;
> import org.apache.xbean.naming.context.ImmutableFederatedContext;
> +import org.osgi.framework.Bundle;
>
> /**
> * @version $Rev$ $Date$
> @@ -45,7 +47,8 @@ public final class EnterpriseNamingConte
> return new ImmutableFederatedContext("java:", contexts);
> }
>
> - public static Context livenReferences(Map<String, Object> componentContext, UserTransaction userTransaction, Kernel kernel, ClassLoader classLoader, String prefix) throws NamingException {
> + public static Context livenReferences(Map<String, Object> componentContext, UserTransaction userTransaction, Kernel kernel, ClassLoader classLoader, Bundle bundle, String prefix)
> + throws NamingException {
> Map<String, Object> map = new HashMap<String, Object>();
> boolean containsEnv = false;
> if (componentContext != null) {
> @@ -65,6 +68,9 @@ public final class EnterpriseNamingConte
> if (value instanceof ClassLoaderAwareReference) {
> ((ClassLoaderAwareReference) value).setClassLoader(classLoader);
> }
> + if (value instanceof BundleAwareReference) {
> + ((BundleAwareReference) value).setBundle(bundle);
> + }
> map.put(name, value);
> }
> }
>
> Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java (original)
> +++ geronimo/server/trunk/plugins/axis2/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java Tue May 25 03:26:52 2010
> @@ -25,7 +25,6 @@ import java.util.Collection;
> import java.util.Collections;
> import java.util.HashMap;
> import java.util.Map;
> -import java.util.jar.JarFile;
>
> import org.apache.geronimo.axis2.pojo.POJOWebServiceContainerFactoryGBean;
> import org.apache.geronimo.common.DeploymentException;
> @@ -33,6 +32,7 @@ import org.apache.geronimo.deployment.De
> import org.apache.geronimo.gbean.GBeanData;
> import org.apache.geronimo.gbean.GBeanInfo;
> import org.apache.geronimo.gbean.GBeanInfoBuilder;
> +import org.apache.geronimo.gbean.annotation.AnnotationGBeanInfoBuilder;
> import org.apache.geronimo.j2ee.deployment.Module;
> import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
> import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> @@ -50,6 +50,7 @@ import org.apache.geronimo.xbeans.javaee
> import org.apache.geronimo.xbeans.javaee6.WebservicesType;
> import org.apache.xmlbeans.XmlCursor;
> import org.apache.xmlbeans.XmlObject;
> +import org.osgi.framework.Bundle;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
>
> @@ -59,24 +60,27 @@ import org.slf4j.LoggerFactory;
> public class Axis2Builder extends JAXWSServiceBuilder {
>
> private static final Logger log = LoggerFactory.getLogger(Axis2Builder.class);
> -
> +
> protected Collection<WsdlGenerator> wsdlGenerators;
> -
> - public Axis2Builder(Environment defaultEnviroment,
> - Collection<WsdlGenerator> wsdlGenerators) {
> +
> + private GBeanInfo defaultContainerFactoryGBeanInfo;
> +
> + public Axis2Builder(Environment defaultEnviroment, Collection<WsdlGenerator> wsdlGenerators) {
> super(defaultEnviroment);
> this.wsdlGenerators = wsdlGenerators;
> this.webServiceFinder = new WARWebServiceFinder();
> + AnnotationGBeanInfoBuilder annotationGBeanInfoBuilder = new AnnotationGBeanInfoBuilder(POJOWebServiceContainerFactoryGBean.class);
> + defaultContainerFactoryGBeanInfo = annotationGBeanInfoBuilder.buildGBeanInfo();
> }
> -
> +
> public Axis2Builder(){
> super(null);
> }
> -
> +
> protected GBeanInfo getContainerFactoryGBeanInfo() {
> - return POJOWebServiceContainerFactoryGBean.GBEAN_INFO;
> + return defaultContainerFactoryGBeanInfo;
> }
> -
> +
> protected Map<String, PortInfo> parseWebServiceDescriptor(InputStream in,
> URL wsDDUrl,
> Deployable deployable,
> @@ -91,7 +95,7 @@ public class Axis2Builder extends JAXWSS
>
> try {
> XmlObject xobj = XmlObject.Factory.parse(in);
> -
> +
> cursor = xobj.newCursor();
> cursor.toStartDoc();
> cursor.toFirstChild();
> @@ -164,7 +168,7 @@ public class Axis2Builder extends JAXWSS
> } else {
> log.debug("Descriptor ignored (not a Java EE 5 descriptor)");
> }
> -
> +
> return map;
> } catch (FileNotFoundException e) {
> return Collections.emptyMap();
> @@ -193,7 +197,7 @@ public class Axis2Builder extends JAXWSS
> }
> return in;
> }
> -
> +
> protected WsdlGenerator getWsdlGenerator() throws DeploymentException {
> if (this.wsdlGenerators == null || this.wsdlGenerators.isEmpty()) {
> throw new DeploymentException("Wsdl generator not found");
> @@ -201,21 +205,20 @@ public class Axis2Builder extends JAXWSS
> return this.wsdlGenerators.iterator().next();
> }
> }
> -
> +
> @Override
> - protected void initialize(GBeanData targetGBean, Class serviceClass, PortInfo portInfo, Module module)
> - throws DeploymentException {
> + protected void initialize(GBeanData targetGBean, Class serviceClass, PortInfo portInfo, Module module, Bundle bundle) throws DeploymentException {
> String serviceName = (portInfo.getServiceName() == null ? serviceClass.getName() : portInfo.getServiceName());
> - if (isWsdlSet(portInfo, serviceClass)) {
> + if (isWsdlSet(portInfo, serviceClass, bundle)) {
> log.debug("Service " + serviceName + " has WSDL.");
> return;
> }
> -
> +
> if (isHTTPBinding(portInfo, serviceClass)) {
> log.debug("Service " + serviceName + " has HTTPBinding.");
> return;
> }
> -
> +
> if (JAXWSUtils.isWebServiceProvider(serviceClass)) {
> throw new DeploymentException("WSDL must be specified for @WebServiceProvider service " + serviceName);
> }
> @@ -223,28 +226,28 @@ public class Axis2Builder extends JAXWSS
> log.debug("Service " + serviceName + " does not have WSDL. Generating WSDL...");
>
> WsdlGenerator wsdlGenerator = getWsdlGenerator();
> -
> +
> WsdlGeneratorOptions options = new WsdlGeneratorOptions();
> options.setSAAJ(WsdlGeneratorOptions.SAAJ.Axis2);
> -
> +
> // set wsdl service
> if (portInfo.getWsdlService() == null) {
> options.setWsdlService(JAXWSUtils.getServiceQName(serviceClass));
> } else {
> options.setWsdlService(portInfo.getWsdlService());
> }
> -
> +
> // set wsdl port
> if (portInfo.getWsdlPort() != null) {
> options.setWsdlPort(portInfo.getWsdlPort());
> }
> -
> +
> String wsdlFile = wsdlGenerator.generateWsdl(module, serviceClass.getName(), module.getEarContext(), options);
> portInfo.setWsdlFile(wsdlFile);
> -
> +
> log.debug("Generated " + wsdlFile + " for service " + serviceName);
> - }
> -
> + }
> +
> public static final GBeanInfo GBEAN_INFO;
>
> static {
>
> Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java (original)
> +++ geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceContainer.java Tue May 25 03:26:52 2010
> @@ -17,8 +17,6 @@
>
> package org.apache.geronimo.axis2.ejb;
>
> -import java.net.URL;
> -
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import javax.naming.NamingException;
> @@ -34,6 +32,7 @@ import org.apache.geronimo.jaxws.JAXWSUt
> import org.apache.geronimo.jaxws.JNDIResolver;
> import org.apache.geronimo.jaxws.PortInfo;
> import org.apache.openejb.DeploymentInfo;
> +import org.osgi.framework.Bundle;
>
> /**
> * @version $Rev$ $Date$
> @@ -41,25 +40,24 @@ import org.apache.openejb.DeploymentInfo
> public class EJBWebServiceContainer extends Axis2WebServiceContainer {
>
> private DeploymentInfo deploymnetInfo;
> -
> +
> public EJBWebServiceContainer(PortInfo portInfo,
> String endpointClassName,
> - ClassLoader classLoader,
> + Bundle bundle,
> Context context,
> - URL configurationBaseUrl,
> DeploymentInfo deploymnetInfo) {
> - super(portInfo, endpointClassName, classLoader, context, configurationBaseUrl);
> + super(portInfo, endpointClassName, bundle, context);
> this.deploymnetInfo = deploymnetInfo;
> }
> -
> +
> @Override
> - public void init() throws Exception {
> + public void init() throws Exception {
> super.init();
> -
> +
> String rootContext = null;
> String servicePath = null;
> String location = trimContext(this.portInfo.getLocation());
> - int pos = location.indexOf('/');
> + int pos = location.indexOf('/');
> if (pos > 0) {
> rootContext = location.substring(0, pos);
> servicePath = location.substring(pos + 1);
> @@ -67,39 +65,39 @@ public class EJBWebServiceContainer exte
> rootContext = "/";
> servicePath = location;
> }
> -
> +
> this.configurationContext.setServicePath(servicePath);
> - //need to setContextRoot after servicePath as cachedServicePath is only built
> + //need to setContextRoot after servicePath as cachedServicePath is only built
> //when setContextRoot is called.
> - this.configurationContext.setContextRoot(rootContext);
> -
> + this.configurationContext.setContextRoot(rootContext);
> +
> // configure handlers
> try {
> configureHandlers();
> } catch (Exception e) {
> throw new WebServiceException("Error configuring handlers", e);
> }
> -
> +
> this.factoryRegistry = new GeronimoFactoryRegistry();
> this.factoryRegistry.put(EndpointLifecycleManager.class, new EJBEndpointLifecycleManager());
> }
> -
> +
> @Override
> protected AxisServiceGenerator createServiceGenerator() {
> AxisServiceGenerator serviceGenerator = super.createServiceGenerator();
> serviceGenerator.setCatalogName(JAXWSUtils.DEFAULT_CATALOG_EJB);
> - EJBMessageReceiver messageReceiver =
> + EJBMessageReceiver messageReceiver =
> new EJBMessageReceiver(this, this.endpointClass, this.deploymnetInfo);
> serviceGenerator.setMessageReceiver(messageReceiver);
> return serviceGenerator;
> }
> -
> +
> public synchronized void injectHandlers() {
> if (this.annotationProcessor != null) {
> // assume injection was already done
> return;
> }
> -
> +
> WebServiceContext wsContext = null;
> try {
> InitialContext ctx = new InitialContext();
> @@ -107,16 +105,16 @@ public class EJBWebServiceContainer exte
> } catch (NamingException e) {
> throw new WebServiceException("Failed to lookup WebServiceContext", e);
> }
> -
> +
> this.annotationProcessor = new JAXWSAnnotationProcessor(new JNDIResolver(), wsContext);
> super.injectHandlers();
> }
> -
> +
> @Override
> public void destroy() {
> // call handler preDestroy
> destroyHandlers();
> -
> +
> super.destroy();
> }
> }
>
> Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java (original)
> +++ geronimo/server/trunk/plugins/axis2/geronimo-axis2-ejb/src/main/java/org/apache/geronimo/axis2/ejb/EJBWebServiceGBean.java Tue May 25 03:26:52 2010
> @@ -17,27 +17,25 @@
>
> package org.apache.geronimo.axis2.ejb;
>
> -import java.net.URL;
> import java.util.Collection;
> import java.util.Properties;
>
> import javax.naming.Context;
>
> -import org.apache.geronimo.gbean.GBeanInfo;
> -import org.apache.geronimo.gbean.GBeanInfoBuilder;
> import org.apache.geronimo.gbean.GBeanLifecycle;
> -import org.apache.geronimo.gbean.annotation.ParamReference;
> +import org.apache.geronimo.gbean.annotation.GBean;
> import org.apache.geronimo.gbean.annotation.ParamAttribute;
> +import org.apache.geronimo.gbean.annotation.ParamReference;
> import org.apache.geronimo.gbean.annotation.ParamSpecial;
> import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
> -import org.apache.geronimo.gbean.annotation.GBean;
> import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
> import org.apache.geronimo.jaxws.PortInfo;
> import org.apache.geronimo.kernel.Kernel;
> import org.apache.geronimo.openejb.EjbDeployment;
> -import org.apache.geronimo.webservices.SoapHandler;
> import org.apache.geronimo.security.jaas.ConfigurationFactory;
> +import org.apache.geronimo.webservices.SoapHandler;
> import org.apache.openejb.DeploymentInfo;
> +import org.osgi.framework.Bundle;
>
> /**
> * @version $Rev$ $Date$
> @@ -53,7 +51,7 @@ public class EJBWebServiceGBean implemen
> public EJBWebServiceGBean(@ParamReference(name="EjbDeployment")EjbDeployment ejbDeploymentContext,
> @ParamAttribute(name="portInfo")PortInfo portInfo,
> @ParamSpecial(type = SpecialAttributeType.kernel)Kernel kernel,
> - @ParamAttribute(name="configurationBaseUrl")URL configurationBaseUrl,
> + @ParamSpecial(type = SpecialAttributeType.bundle)Bundle bundle,
> @ParamReference(name="WebServiceContainer")Collection<SoapHandler> webContainers,
> @ParamAttribute(name="policyContextID")String policyContextID,
> @ParamReference(name="ConfigurationFactory")ConfigurationFactory configurationFactory,
> @@ -65,31 +63,29 @@ public class EJBWebServiceGBean implemen
> if (ejbDeploymentContext == null || webContainers == null || webContainers.isEmpty() || portInfo == null) {
> return;
> }
> -
> +
> this.soapHandler = webContainers.iterator().next();
> this.location = portInfo.getLocation();
> -
> +
> assert this.location != null : "null location received";
> -
> - String beanClassName = ejbDeploymentContext.getBeanClass().getName();
> +
> + String beanClassName = ejbDeploymentContext.getBeanClass().getName();
> ClassLoader classLoader = ejbDeploymentContext.getClassLoader();
> DeploymentInfo deploymnetInfo = ejbDeploymentContext.getDeploymentInfo();
> - Context context = deploymnetInfo.getJndiEnc();
> + Context context = deploymnetInfo.getJndiEnc();
>
> - this.container =
> - new EJBWebServiceContainer(portInfo, beanClassName, classLoader,
> - context, configurationBaseUrl, deploymnetInfo);
> + this.container = new EJBWebServiceContainer(portInfo, beanClassName, bundle, context, deploymnetInfo);
> this.container.init();
> -
> - soapHandler.addWebService(this.location,
> - virtualHosts,
> +
> + soapHandler.addWebService(this.location,
> + virtualHosts,
> this.container,
> policyContextID,
> configurationFactory,
> - realmName,
> + realmName,
> authMethod,
> properties,
> - classLoader);
> + classLoader);
> }
>
> public void doStart() throws Exception {
> @@ -98,7 +94,7 @@ public class EJBWebServiceGBean implemen
> public void doStop() throws Exception {
> if (this.soapHandler != null) {
> this.soapHandler.removeWebService(this.location);
> - }
> + }
> if (this.container != null) {
> this.container.destroy();
> }
> @@ -106,5 +102,5 @@ public class EJBWebServiceGBean implemen
>
> public void doFail() {
> }
> -
> +
> }
>
> Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/pom.xml
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/pom.xml?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/plugins/axis2/geronimo-axis2/pom.xml (original)
> +++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/pom.xml Tue May 25 03:26:52 2010
> @@ -112,7 +112,15 @@
> <dependency>
> <groupId>org.apache.woden</groupId>
> <artifactId>woden-api</artifactId>
> - </dependency>
> + </dependency>
> +
> + <dependency>
> + <groupId>org.apache.geronimo.framework</groupId>
> + <artifactId>geronimo-kernel</artifactId>
> + <version>${project.version}</version>
> + <classifier>tests</classifier>
> + <scope>test</scope>
> + </dependency>
> </dependencies>
>
> </project>
>
> Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java (original)
> +++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java Tue May 25 03:26:52 2010
> @@ -78,6 +78,8 @@ import org.apache.geronimo.jaxws.ServerJ
> import org.apache.geronimo.jaxws.annotations.AnnotationException;
> import org.apache.geronimo.webservices.WebServiceContainer;
> import org.apache.geronimo.webservices.saaj.SAAJUniverse;
> +import org.apache.xbean.osgi.bundle.util.BundleClassLoader;
> +import org.osgi.framework.Bundle;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
>
> @@ -91,40 +93,37 @@ public abstract class Axis2WebServiceCon
> public static final String REQUEST = Axis2WebServiceContainer.class.getName() + "@Request";
> public static final String RESPONSE = Axis2WebServiceContainer.class.getName() + "@Response";
>
> - private transient final ClassLoader classLoader;
> -
> + private transient final Bundle bundle;
> +
> protected String endpointClassName;
> protected org.apache.geronimo.jaxws.PortInfo portInfo;
> protected ConfigurationContext configurationContext;
> protected JNDIResolver jndiResolver;
> protected Class endpointClass;
> protected AxisService service;
> - protected URL configurationBaseUrl;
> protected WSDLQueryHandler wsdlQueryHandler;
> protected Binding binding;
> protected JAXWSAnnotationProcessor annotationProcessor;
> protected Context context;
> protected String address;
> - protected GeronimoFactoryRegistry factoryRegistry;
> + protected GeronimoFactoryRegistry factoryRegistry;
>
> public Axis2WebServiceContainer(PortInfo portInfo,
> String endpointClassName,
> - ClassLoader classLoader,
> - Context context,
> - URL configurationBaseUrl) {
> - this.classLoader = classLoader;
> + Bundle bundle,
> + Context context) {
> this.endpointClassName = endpointClassName;
> this.portInfo = portInfo;
> - this.configurationBaseUrl = configurationBaseUrl;
> + this.bundle = bundle;
> this.context = context;
> this.jndiResolver = new ServerJNDIResolver(context);
> }
>
> public void init() throws Exception {
> - this.endpointClass = classLoader.loadClass(this.endpointClassName);
> -
> + this.endpointClass = bundle.loadClass(this.endpointClassName);
> +
> Axis2ConfigGBean.registerClientConfigurationFactory();
> -
> +
> GeronimoConfigurator configurator = new GeronimoConfigurator("META-INF/geronimo-axis2.xml");
> configurationContext = ConfigurationContextFactory.createConfigurationContext(configurator);
>
> @@ -133,8 +132,8 @@ public abstract class Axis2WebServiceCon
> // if already set, annotation should not overwrite it.
> if (portInfo.getWsdlFile() == null || portInfo.getWsdlFile().equals("")) {
> // getwsdllocation from annotation if it exists
> - if (JAXWSUtils.containsWsdlLocation(this.endpointClass, classLoader)) {
> - portInfo.setWsdlFile(JAXWSUtils.getServiceWsdlLocation(this.endpointClass, classLoader));
> + if (JAXWSUtils.containsWsdlLocation(this.endpointClass, bundle)) {
> + portInfo.setWsdlFile(JAXWSUtils.getServiceWsdlLocation(this.endpointClass, bundle));
> }
> }
>
> @@ -142,7 +141,7 @@ public abstract class Axis2WebServiceCon
> serviceGen.setConfigurationContext(configurationContext);
> if (portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().equals("")) {
> // WSDL file has been provided
> - service = serviceGen.getServiceFromWSDL(portInfo, endpointClass, configurationBaseUrl);
> + service = serviceGen.getServiceFromWSDL(portInfo, endpointClass, bundle);
> } else {
> // No WSDL, let Axis2 handle it.
> service = serviceGen.getServiceFromClass(this.endpointClass);
> @@ -152,28 +151,28 @@ public abstract class Axis2WebServiceCon
> configurationContext.getAxisConfiguration().addService(service);
>
> this.wsdlQueryHandler = new WSDLQueryHandler(this.service);
> -
> +
> /*
> * This replaces HandlerLifecycleManagerFactory for all web services.
> * This should be ok as we do our own handler instance managment and injection.
> * Also, this does not affect service-ref clients, as we install our own
> * HandlerResolver.
> - */
> - FactoryRegistry.setFactory(HandlerLifecycleManagerFactory.class,
> - new GeronimoHandlerLifecycleManagerFactory());
> -
> - FactoryRegistry.setFactory(EndpointLifecycleManagerFactory.class,
> - new GeronimoEndpointLifecycleManagerFactory());
> -
> + */
> + FactoryRegistry.setFactory(HandlerLifecycleManagerFactory.class,
> + new GeronimoHandlerLifecycleManagerFactory());
> +
> + FactoryRegistry.setFactory(EndpointLifecycleManagerFactory.class,
> + new GeronimoEndpointLifecycleManagerFactory());
> +
> configureAddressing();
> -
> - this.service.addParameter(new Parameter(org.apache.axis2.jaxws.spi.Constants.CACHE_CLASSLOADER, classLoader));
> - }
> +
> + this.service.addParameter(new Parameter(org.apache.axis2.jaxws.spi.Constants.CACHE_CLASSLOADER, new BundleClassLoader(bundle)));
> + }
>
> static String getBaseUri(URI request) {
> return request.getScheme() + "://" + request.getHost() + ":" + request.getPort() + request.getPath();
> }
> -
> +
> synchronized void updateAddress(Request request) {
> if (this.address == null) {
> String requestAddress = getBaseUri(request.getURI());
> @@ -181,7 +180,7 @@ public abstract class Axis2WebServiceCon
> this.address = requestAddress;
> }
> }
> -
> +
> protected AxisServiceGenerator createServiceGenerator() {
> return new AxisServiceGenerator();
> }
> @@ -200,7 +199,7 @@ public abstract class Axis2WebServiceCon
> try {
> doService(request, response);
> } finally {
> - // unset saaj universe
> + // unset saaj universe
> universe.unset();
> // unset factory registry
> GeronimoFactoryRegistry.setGeronimoFactoryRegistry(oldRegistry);
> @@ -208,14 +207,14 @@ public abstract class Axis2WebServiceCon
> }
>
> protected void doService(final Request request, final Response response)
> - throws Exception {
> + throws Exception {
>
> if (LOG.isDebugEnabled()) {
> LOG.debug("Target URI: " + request.getURI());
> }
>
> updateAddress(request);
> -
> +
> MessageContext msgContext = new MessageContext();
> msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTP);
> msgContext.setProperty(MessageContext.REMOTE_ADDR, request.getRemoteAddr());
> @@ -239,12 +238,12 @@ public abstract class Axis2WebServiceCon
> msgContext.setServiceGroupContextId(UUIDGenerator.getUUID());
> msgContext.setServerSide(true);
> msgContext.setAxisService(this.service);
> -
> +
> doService2(request, response, msgContext);
> } catch (AxisFault e) {
> LOG.debug(e.getMessage(), e);
> handleFault(msgContext, response, e);
> - } catch (Throwable e) {
> + } catch (Throwable e) {
> String msg = "Exception occurred while trying to invoke service method doService()";
> LOG.error(msg, e);
> handleFault(msgContext, response, new AxisFault(msg, e));
> @@ -259,7 +258,7 @@ public abstract class Axis2WebServiceCon
> } else {
> response.setStatusCode(HttpURLConnection.HTTP_INTERNAL_ERROR);
> }
> -
> +
> msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream());
> msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, new Axis2TransportInfo(response));
>
> @@ -277,7 +276,7 @@ public abstract class Axis2WebServiceCon
> }
> }
> }
> -
> +
> protected String getServicePath(String contextRoot) {
> String location = this.portInfo.getLocation();
> if (location != null && location.startsWith(contextRoot)) {
> @@ -285,7 +284,7 @@ public abstract class Axis2WebServiceCon
> }
> return null;
> }
> -
> +
> public static String trimContext(String contextPath) {
> if (contextPath != null) {
> if (contextPath.startsWith("/")) {
> @@ -297,11 +296,11 @@ public abstract class Axis2WebServiceCon
> }
> return contextPath;
> }
> -
> +
> public void doService2(Request request,
> Response response,
> MessageContext msgContext) throws Exception {
> -
> +
> if (request.getMethod() == Request.GET) {
> processGETRequest(request, response, this.service, msgContext);
> } else if (request.getMethod() == Request.POST) {
> @@ -329,7 +328,7 @@ public abstract class Axis2WebServiceCon
> response.setStatusCode(HttpURLConnection.HTTP_ACCEPTED);
> }
> }
> -
> +
> public void destroy() {
> if (this.configurationContext != null) {
> try {
> @@ -339,7 +338,7 @@ public abstract class Axis2WebServiceCon
> }
> }
> }
> -
> +
> public static class Axis2TransportInfo implements OutTransportInfo {
> private Response response;
>
> @@ -351,7 +350,7 @@ public abstract class Axis2WebServiceCon
> response.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, contentType);
> }
> }
> -
> +
> protected void processGETRequest(Request request, Response response, AxisService service, MessageContext msgContext) throws Exception{
> String query = request.getURI().getQuery();
> if (query != null &&
> @@ -359,12 +358,10 @@ public abstract class Axis2WebServiceCon
> query.startsWith("xsd") || query.startsWith("XSD"))) {
> // wsdl or xsd request
>
> - if (portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().equals("")) {
> - URL wsdlURL = AxisServiceGenerator.getWsdlURL(portInfo.getWsdlFile(),
> - configurationBaseUrl,
> - classLoader);
> - this.wsdlQueryHandler.writeResponse(request.getURI().toString(),
> - wsdlURL.toString(),
> + if (portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().equals("")) {
> + URL wsdlURL = AxisServiceGenerator.getWsdlURL(portInfo.getWsdlFile(), bundle);
> + this.wsdlQueryHandler.writeResponse(request.getURI().toString(),
> + wsdlURL.toString(),
> response.getOutputStream());
> } else {
> throw new Exception("Service does not have WSDL");
> @@ -376,16 +373,16 @@ public abstract class Axis2WebServiceCon
> pw.write("Hi, this is '" + service.getName() + "' web service.");
> pw.write("</body></html>");
> pw.flush();
> - } else {
> + } else {
> // REST request
> - processURLRequest(request, response, service, msgContext);
> + processURLRequest(request, response, service, msgContext);
> }
> }
>
> protected void processPOSTRequest(Request request, Response response, AxisService service, MessageContext msgContext) throws Exception {
> processXMLRequest(request, response, service, msgContext);
> }
> -
> +
> protected void setMsgContextProperties(Request request, Response response, AxisService service, MessageContext msgContext) {
> msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream());
> msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, new Axis2TransportInfo(response));
> @@ -404,30 +401,30 @@ public abstract class Axis2WebServiceCon
>
> ServletContext servletContext =
> (ServletContext)request.getAttribute(WebServiceContainer.SERVLET_CONTEXT);
> - msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, servletContext);
> -
> + msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, servletContext);
> +
> if (servletRequest != null) {
> - msgContext.setProperty(MessageContext.TRANSPORT_HEADERS,
> + msgContext.setProperty(MessageContext.TRANSPORT_HEADERS,
> new TransportHeaders(servletRequest));
> }
> -
> +
> if (this.binding != null) {
> - msgContext.setProperty(JAXWSMessageReceiver.PARAM_BINDING, this.binding);
> + msgContext.setProperty(JAXWSMessageReceiver.PARAM_BINDING, this.binding);
> }
> -
> +
> msgContext.setTo(new EndpointReference(request.getURI().toString()));
> }
> -
> - protected void processXMLRequest(Request request,
> - Response response,
> - AxisService service,
> +
> + protected void processXMLRequest(Request request,
> + Response response,
> + AxisService service,
> MessageContext msgContext) throws Exception {
> String contentType = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
> String soapAction = request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
> if (soapAction == null) {
> soapAction = "\"\"";
> }
> -
> +
> ConfigurationContext configurationContext = msgContext.getConfigurationContext();
> configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
>
> @@ -435,31 +432,31 @@ public abstract class Axis2WebServiceCon
>
> if (!HTTPTransportUtils.isRESTRequest(contentType)) {
> HTTPTransportUtils.processHTTPPostRequest(msgContext,
> - request.getInputStream(),
> - response.getOutputStream(),
> - contentType,
> - soapAction,
> + request.getInputStream(),
> + response.getOutputStream(),
> + contentType,
> + soapAction,
> request.getURI().getPath());
> } else {
> - RESTUtil.processXMLRequest(msgContext,
> + RESTUtil.processXMLRequest(msgContext,
> request.getInputStream(),
> - response.getOutputStream(),
> + response.getOutputStream(),
> contentType);
> }
> }
> -
> +
> protected void processURLRequest(Request request,
> Response response,
> AxisService service,
> MessageContext msgContext) throws Exception {
> String contentType = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
> -
> +
> ConfigurationContext configurationContext = msgContext.getConfigurationContext();
> configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
> -
> +
> setMsgContextProperties(request, response, service, msgContext);
> -
> - InvocationResponse processed = RESTUtil.processURLRequest(msgContext,
> +
> + InvocationResponse processed = RESTUtil.processURLRequest(msgContext,
> response.getOutputStream(),
> contentType);
>
> @@ -470,28 +467,28 @@ public abstract class Axis2WebServiceCon
> pw.write(s);
> pw.flush();
> }
> - }
> -
> + }
> +
> protected void configureAddressing() throws Exception {
> EndpointDescription desc = AxisServiceGenerator.getEndpointDescription(this.service);
> -
> +
> QName serviceName = desc.getServiceQName();
> QName portName = desc.getPortQName();
> EndpointKey key = new EndpointKey(serviceName, portName);
> -
> +
> EndpointContextMapManager.setEndpointContextMap(null);
> EndpointContextMap map = EndpointContextMapManager.getEndpointContextMap();
> map.put(key, this.service);
> -
> +
> configurationContext.setProperty(org.apache.axis2.jaxws.Constants.ENDPOINT_CONTEXT_MAP, map);
> }
> -
> +
> /*
> * Gets the right handlers for the port/service/bindings and performs injection.
> */
> protected void configureHandlers() throws Exception {
> EndpointDescription desc = AxisServiceGenerator.getEndpointDescription(this.service);
> -
> +
> String xml = this.portInfo.getHandlersAsXML();
> HandlerChainsType handlerChains = null;
> if (xml != null) {
> @@ -499,14 +496,14 @@ public abstract class Axis2WebServiceCon
> handlerChains = DescriptionUtils.loadHandlerChains(in, null);
> desc.setHandlerChain(handlerChains);
> }
> -
> +
> if (LOG.isDebugEnabled()) {
> logHandlers(desc.getHandlerChain());
> }
> -
> +
> this.binding = BindingUtils.createBinding(desc);
> -
> - DescriptionUtils.registerHandlerHeaders(desc.getAxisService(), this.binding.getHandlerChain());
> +
> + DescriptionUtils.registerHandlerHeaders(desc.getAxisService(), this.binding.getHandlerChain());
> }
>
> private void logHandlers(HandlerChainsType handlerChains) {
> @@ -517,11 +514,11 @@ public abstract class Axis2WebServiceCon
> }
>
> for (HandlerChainType chains : handlerChains.getHandlerChain()) {
> - LOG.debug("Handler chain: " + chains.getServiceNamePattern() + " " +
> + LOG.debug("Handler chain: " + chains.getServiceNamePattern() + " " +
> chains.getPortNamePattern() + " " + chains.getProtocolBindings());
> if (chains.getHandler() != null) {
> - for (HandlerType chain : chains.getHandler()) {
> - LOG.debug(" Handler: " + chain.getHandlerName().getValue() + " " +
> + for (HandlerType chain : chains.getHandler()) {
> + LOG.debug(" Handler: " + chain.getHandlerName().getValue() + " " +
> chain.getHandlerClass().getValue());
> }
> }
> @@ -538,7 +535,7 @@ public abstract class Axis2WebServiceCon
> throw new WebServiceException("Handler annotation failed", e);
> }
> }
> -
> +
> protected void destroyHandlers() {
> if (this.annotationProcessor != null) {
> // call handlers preDestroy
> @@ -548,10 +545,10 @@ public abstract class Axis2WebServiceCon
> }
> }
> }
> -
> +
> protected void injectResources(Object instance) throws AnnotationException {
> this.annotationProcessor.processAnnotations(instance);
> this.annotationProcessor.invokePostConstruct(instance);
> }
> -
> +
> }
>
> Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java (original)
> +++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java Tue May 25 03:26:52 2010
> @@ -57,6 +57,8 @@ import org.apache.axis2.wsdl.WSDLUtil;
> import org.apache.geronimo.jaxws.JAXWSUtils;
> import org.apache.geronimo.jaxws.PortInfo;
> import org.apache.ws.commons.schema.utils.NamespaceMap;
> +import org.apache.xbean.osgi.bundle.util.BundleUtils;
> +import org.osgi.framework.Bundle;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
>
> @@ -70,29 +72,29 @@ public class AxisServiceGenerator
> private MessageReceiver messageReceiver;
> private ConfigurationContext configurationContext;
> private String catalogName;
> -
> +
> public AxisServiceGenerator(){
> this.messageReceiver = new JAXWSMessageReceiver();
> }
> -
> +
> public void setMessageReceiver(MessageReceiver messageReceiver) {
> this.messageReceiver = messageReceiver;
> }
> -
> +
> public void setConfigurationContext(ConfigurationContext configurationContext) {
> this.configurationContext = configurationContext;
> }
> -
> +
> public void setCatalogName(String catalogName) {
> this.catalogName = catalogName;
> }
> -
> +
> public AxisService getServiceFromClass(Class endpointClass) throws Exception {
> - ServiceDescription serviceDescription =
> - DescriptionFactory.createServiceDescription(endpointClass);
> + ServiceDescription serviceDescription =
> + DescriptionFactory.createServiceDescription(endpointClass);
> EndpointDescription[] edArray = serviceDescription.getEndpointDescriptions();
> AxisService service = edArray[0].getAxisService();
> -
> +
> if (service.getNameSpacesMap() == null) {
> NamespaceMap map = new NamespaceMap();
> map.put(Java2WSDLConstants.AXIS2_NAMESPACE_PREFIX,
> @@ -101,89 +103,89 @@ public class AxisServiceGenerator
> Java2WSDLConstants.URI_2001_SCHEMA_XSD);
> service.setNameSpacesMap(map);
> }
> -
> +
> String endpointClassName = endpointClass.getName();
> ClassLoader classLoader = endpointClass.getClassLoader();
> -
> +
> service.addParameter(new Parameter(Constants.SERVICE_CLASS, endpointClassName));
> service.setClassLoader(classLoader);
> -
> +
> for(Iterator<AxisOperation> opIterator = service.getOperations() ; opIterator.hasNext() ;){
> AxisOperation operation = opIterator.next();
> operation.setMessageReceiver(this.messageReceiver);
> }
> -
> - Parameter serviceDescriptionParam =
> +
> + Parameter serviceDescriptionParam =
> new Parameter(EndpointDescription.AXIS_SERVICE_PARAMETER, edArray[0]);
> service.addParameter(serviceDescriptionParam);
> -
> +
> return service;
> }
> -
> - public AxisService getServiceFromWSDL(PortInfo portInfo, Class endpointClass, URL configurationBaseUrl) throws Exception {
> +
> + public AxisService getServiceFromWSDL(PortInfo portInfo, Class endpointClass, Bundle bundle) throws Exception {
> String wsdlFile = portInfo.getWsdlFile();
> if (wsdlFile == null || wsdlFile.equals("")) {
> throw new Exception("WSDL file is required.");
> }
> -
> +
> String endpointClassName = endpointClass.getName();
> ClassLoader classLoader = endpointClass.getClassLoader();
> -
> +
> QName serviceQName = portInfo.getWsdlService();
> if (serviceQName == null) {
> serviceQName = JAXWSUtils.getServiceQName(endpointClass);
> }
> -
> +
> QName portQName = portInfo.getWsdlPort();
> if (portQName == null) {
> portQName = JAXWSUtils.getPortQName(endpointClass);
> }
> -
> +
> OASISCatalogManager catalogManager = new OASISCatalogManager();
> - URL catalogURL = JAXWSUtils.getOASISCatalogURL(configurationBaseUrl, classLoader, this.catalogName);
> + URL catalogURL = JAXWSUtils.getOASISCatalogURL(bundle, this.catalogName);
> if (catalogURL != null) {
> catalogManager.setCatalogFiles(catalogURL.toString());
> }
> - URL wsdlURL = getWsdlURL(wsdlFile, configurationBaseUrl, classLoader);
> + URL wsdlURL = getWsdlURL(wsdlFile, bundle);
> WSDL4JWrapper wsdlWrapper = new WSDL4JWrapper(wsdlURL, this.configurationContext, catalogManager);
> - Definition wsdlDefinition = wsdlWrapper.getDefinition();
> -
> + Definition wsdlDefinition = wsdlWrapper.getDefinition();
> +
> Service wsdlService = wsdlDefinition.getService(serviceQName);
> if (wsdlService == null) {
> throw new Exception("Service '" + serviceQName + "' not found in WSDL");
> }
> -
> +
> Port port = wsdlService.getPort(portQName.getLocalPart());
> if (port == null) {
> throw new Exception("Port '" + portQName.getLocalPart() + "' not found in WSDL");
> }
> -
> +
> String protocolBinding = null;
> if (portInfo.getProtocolBinding() != null) {
> protocolBinding = JAXWSUtils.getBindingURI(portInfo.getProtocolBinding());
> } else {
> protocolBinding = getBindingFromWSDL(port);
> }
> -
> +
> Class endPointClass = classLoader.loadClass(endpointClassName);
> JavaClassToDBCConverter converter = new JavaClassToDBCConverter(endPointClass);
> HashMap<String, DescriptionBuilderComposite> dbcMap = converter.produceDBC();
> -
> +
> DescriptionBuilderComposite dbc = dbcMap.get(endpointClassName);
> dbc.setClassLoader(classLoader);
> dbc.setWsdlDefinition(wsdlDefinition);
> dbc.setClassName(endpointClassName);
> dbc.setCustomWsdlGenerator(new WSDLGeneratorImpl(wsdlDefinition));
> dbc.setCatalogManager(catalogManager);
> -
> +
> if (dbc.getWebServiceAnnot() != null) { //information specified in .wsdl should overwrite annotation.
> WebServiceAnnot serviceAnnot = dbc.getWebServiceAnnot();
> serviceAnnot.setPortName(portQName.getLocalPart());
> serviceAnnot.setServiceName(serviceQName.getLocalPart());
> serviceAnnot.setTargetNamespace(serviceQName.getNamespaceURI());
> processServiceBinding(dbc, protocolBinding);
> - } else if (dbc.getWebServiceProviderAnnot() != null) {
> - WebServiceProviderAnnot serviceProviderAnnot = dbc.getWebServiceProviderAnnot();
> + } else if (dbc.getWebServiceProviderAnnot() != null) {
> + WebServiceProviderAnnot serviceProviderAnnot = dbc.getWebServiceProviderAnnot();
> serviceProviderAnnot.setPortName(portQName.getLocalPart());
> serviceProviderAnnot.setServiceName(serviceQName.getLocalPart());
> serviceProviderAnnot.setTargetNamespace(serviceQName.getNamespaceURI());
> @@ -193,12 +195,12 @@ public class AxisServiceGenerator
> if (portInfo.isMTOMEnabled() != null) {
> dbc.setIsMTOMEnabled(portInfo.isMTOMEnabled().booleanValue());
> }
> -
> - AxisService service = getService(dbcMap);
> -
> +
> + AxisService service = getService(dbcMap);
> +
> service.setName(serviceQName.getLocalPart());
> service.setEndpointName(portQName.getLocalPart());
> -
> +
> for(Iterator<AxisOperation> opIterator = service.getOperations() ; opIterator.hasNext() ;){
> AxisOperation operation = opIterator.next();
> operation.setMessageReceiver(this.messageReceiver);
> @@ -216,7 +218,7 @@ public class AxisServiceGenerator
> return service;
> }
>
> - private String getBindingFromWSDL(Port port) {
> + private String getBindingFromWSDL(Port port) {
> Binding binding = port.getBinding();
> List extElements = binding.getExtensibilityElements();
> Iterator extElementsIterator = extElements.iterator();
> @@ -227,7 +229,7 @@ public class AxisServiceGenerator
> SOAPBinding sp = (SOAPBinding)o;
> if (sp.getElementType().getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/soap/")) {
> bindingS = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING;
> - }
> + }
> } else if (o instanceof SOAP12Binding) {
> SOAP12Binding sp = (SOAP12Binding)o;
> if (sp.getElementType().getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/soap12/")) {
> @@ -237,7 +239,7 @@ public class AxisServiceGenerator
> HTTPBinding sp = (HTTPBinding)o;
> if (sp.getElementType().getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/http/")) {
> bindingS = javax.xml.ws.http.HTTPBinding.HTTP_BINDING;
> - }
> + }
> }
> }
> return bindingS;
> @@ -267,14 +269,14 @@ public class AxisServiceGenerator
> private AxisService getService(HashMap<String, DescriptionBuilderComposite> dbcMap) {
> return getEndpointDescription(dbcMap).getAxisService();
> }
> -
> +
> private EndpointDescription getEndpointDescription(HashMap<String, DescriptionBuilderComposite> dbcMap) {
> List<ServiceDescription> serviceDescList = DescriptionFactory.createServiceDescriptionFromDBCMap(dbcMap, this.configurationContext);
> if (serviceDescList == null || serviceDescList.isEmpty()) {
> throw new RuntimeException("No service");
> }
> ServiceDescription serviceDescription = serviceDescList.get(0);
> - EndpointDescription[] edArray = serviceDescription.getEndpointDescriptions();
> + EndpointDescription[] edArray = serviceDescription.getEndpointDescriptions();
> if (edArray == null || edArray.length == 0) {
> throw new RuntimeException("No endpoint");
> }
> @@ -287,7 +289,7 @@ public class AxisServiceGenerator
> public WSDLGeneratorImpl(Definition def) {
> this.def = def;
> }
> -
> +
> public WsdlComposite generateWsdl(String implClass, EndpointDescription endpointDesc)
> throws WebServiceException {
> // Need WSDL generation code
> @@ -299,44 +301,40 @@ public class AxisServiceGenerator
> return composite;
> }
> }
> -
> - public static URL getWsdlURL(String wsdlFile, URL configurationBaseUrl, ClassLoader classLoader) {
> +
> + public static URL getWsdlURL(String wsdlFile, Bundle bundle) {
> + if (wsdlFile == null) {
> + return null;
> + }
> URL wsdlURL = null;
> - if (wsdlFile != null) {
> - try {
> - wsdlURL = new URL(wsdlFile);
> - } catch (MalformedURLException e) {
> - // Not a URL, try as a resource
> - wsdlURL = classLoader.getResource(wsdlFile);
> -
> - if (wsdlURL == null && configurationBaseUrl != null) {
> - // Cannot get it as a resource, try with
> - // configurationBaseUrl
> - try {
> - wsdlURL = new URL(configurationBaseUrl, wsdlFile);
> - } catch (MalformedURLException ee) {
> - // ignore
> - }
> - }
> + try {
> + wsdlURL = new URL(wsdlFile);
> + } catch (MalformedURLException e) {
> + // Not a URL, try as a resource
> + wsdlURL = bundle.getResource(wsdlFile);
> + if (wsdlURL == null) {
> + // Cannot get it as a resource, try with
> + // configurationBaseUrl
> + wsdlURL = BundleUtils.getEntry(bundle, wsdlFile);
> }
> }
> return wsdlURL;
> }
> -
> +
> public static EndpointDescription getEndpointDescription(AxisService service) {
> Parameter param = service.getParameter(EndpointDescription.AXIS_SERVICE_PARAMETER);
> return (param == null) ? null : (EndpointDescription) param.getValue();
> }
> -
> +
> public static boolean isSOAP11(AxisService service) {
> EndpointDescription desc = AxisServiceGenerator.getEndpointDescription(service);
> return javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING.equals(desc.getBindingType()) ||
> javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(desc.getBindingType());
> }
> -
> +
> public static boolean isHTTP(AxisService service) {
> EndpointDescription desc = AxisServiceGenerator.getEndpointDescription(service);
> return javax.xml.ws.http.HTTPBinding.HTTP_BINDING.equals(desc.getBindingType());
> }
> -
> +
> }
>
> Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/client/Axis2ServiceReference.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/client/Axis2ServiceReference.java?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/client/Axis2ServiceReference.java (original)
> +++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/client/Axis2ServiceReference.java Tue May 25 03:26:52 2010
> @@ -29,8 +29,6 @@ import org.apache.axis2.jaxws.catalog.im
> import org.apache.axis2.jaxws.context.WebServiceContextImpl;
> import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
> import org.apache.axis2.jaxws.spi.ServiceDelegate;
> -import org.slf4j.Logger;
> -import org.slf4j.LoggerFactory;
> import org.apache.geronimo.gbean.AbstractName;
> import org.apache.geronimo.jaxws.HandlerChainsUtils;
> import org.apache.geronimo.jaxws.JAXWSAnnotationProcessor;
> @@ -40,6 +38,8 @@ import org.apache.geronimo.jaxws.client.
> import org.apache.geronimo.jaxws.client.PortMethodInterceptor;
> import org.apache.geronimo.jaxws.handler.GeronimoHandlerResolver;
> import org.apache.geronimo.xbeans.javaee.HandlerChainsType;
> +import org.slf4j.Logger;
> +import org.slf4j.LoggerFactory;
>
> /**
> * @version $Rev$ $Date$
> @@ -92,7 +92,7 @@ public class Axis2ServiceReference exten
> JAXWSAnnotationProcessor annotationProcessor =
> new JAXWSAnnotationProcessor(new JNDIResolver(), new WebServiceContextImpl());
> GeronimoHandlerResolver handlerResolver =
> - new GeronimoHandlerResolver(classLoader, serviceClass, getHandlerChains(), annotationProcessor);
> + new GeronimoHandlerResolver(bundle, serviceClass, getHandlerChains(), annotationProcessor);
> return handlerResolver;
> }
>
>
> Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java?rev=947901&r1=947900&r2=947901&view=diff
> ==============================================================================
> --- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java (original)
> +++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/pojo/POJOWebServiceContainer.java Tue May 25 03:26:52 2010
> @@ -19,7 +19,6 @@ package org.apache.geronimo.axis2.pojo;
>
> import java.io.PrintWriter;
> import java.net.HttpURLConnection;
> -import java.net.URL;
>
> import javax.naming.Context;
> import javax.xml.ws.WebServiceException;
> @@ -43,6 +42,7 @@ import org.apache.geronimo.jaxws.JAXWSAn
> import org.apache.geronimo.jaxws.JAXWSUtils;
> import org.apache.geronimo.jaxws.PortInfo;
> import org.apache.geronimo.jaxws.annotations.AnnotationHolder;
> +import org.osgi.framework.Bundle;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
>
> @@ -52,53 +52,52 @@ import org.slf4j.LoggerFactory;
> public class POJOWebServiceContainer extends Axis2WebServiceContainer
> {
> private static final Logger LOG = LoggerFactory.getLogger(POJOWebServiceContainer.class);
> -
> +
> private Object endpointInstance;
> private String contextRoot;
> private AnnotationHolder holder;
> -
> +
> public POJOWebServiceContainer(PortInfo portInfo,
> String endpointClassName,
> - ClassLoader classLoader,
> + Bundle bundle,
> Context context,
> - URL configurationBaseUrl,
> AnnotationHolder holder,
> String contextRoot) {
> - super(portInfo, endpointClassName, classLoader, context, configurationBaseUrl);
> + super(portInfo, endpointClassName, bundle, context);
> this.holder = holder;
> this.contextRoot = contextRoot;
> }
> -
> +
> @Override
> - public void init() throws Exception {
> + public void init() throws Exception {
> super.init();
> -
> +
> /*
> - * This replaces EndpointDispatcherFactory for all web services.
> - * This is because we do our own endpoint instance management and injection.
> + * This replaces EndpointDispatcherFactory for all web services.
> + * This is because we do our own endpoint instance management and injection.
> * This does not affect EJB web services as the EJB container does not use the FactoryRegistry
> * to lookup the EndpointDispatcherFactory.
> */
> - FactoryRegistry.setFactory(EndpointDispatcherFactory.class,
> + FactoryRegistry.setFactory(EndpointDispatcherFactory.class,
> new POJOEndpointDispatcherFactory());
> -
> +
> String servicePath = trimContext(getServicePath(this.contextRoot));
> this.configurationContext.setServicePath(servicePath);
> - //need to setContextRoot after servicePath as cachedServicePath is only built
> + //need to setContextRoot after servicePath as cachedServicePath is only built
> //when setContextRoot is called.
> String rootContext = trimContext(this.contextRoot);
> - this.configurationContext.setContextRoot(rootContext);
> -
> + this.configurationContext.setContextRoot(rootContext);
> +
> // instantiate and inject resources into service
> try {
> - this.endpointInstance = this.holder.newInstance(this.endpointClass.getName(),
> - this.endpointClass.getClassLoader(),
> + this.endpointInstance = this.holder.newInstance(this.endpointClass.getName(),
> + this.endpointClass.getClassLoader(),
> this.context);
> } catch (Exception e) {
> throw new WebServiceException("Service resource injection failed", e);
> }
> -
> - this.annotationProcessor =
> +
> + this.annotationProcessor =
> new JAXWSAnnotationProcessor(this.jndiResolver, new POJOWebServiceContext());
>
> // configure and inject handlers
> @@ -108,22 +107,22 @@ public class POJOWebServiceContainer ext
> } catch (Exception e) {
> throw new WebServiceException("Error configuring handlers", e);
> }
> -
> +
> this.factoryRegistry = new GeronimoFactoryRegistry();
> this.factoryRegistry.put(EndpointLifecycleManager.class, new POJOEndpointLifecycleManager());
> }
> -
> +
> @Override
> protected AxisServiceGenerator createServiceGenerator() {
> AxisServiceGenerator serviceGenerator = super.createServiceGenerator();
> serviceGenerator.setCatalogName(JAXWSUtils.DEFAULT_CATALOG_WEB);
> return serviceGenerator;
> }
> -
> +
> @Override
> - protected void processXMLRequest(Request request,
> - Response response,
> - AxisService service,
> + protected void processXMLRequest(Request request,
> + Response response,
> + AxisService service,
> MessageContext msgContext) throws Exception {
> String contentType = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
> String soapAction = request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
> @@ -133,12 +132,12 @@ public class POJOWebServiceContainer ext
>
> ConfigurationContext configurationContext = msgContext.getConfigurationContext();
> configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
> -
> +
> setMsgContextProperties(request, response, service, msgContext);
>
> ServiceContext serviceContext = msgContext.getServiceContext();
> serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, this.endpointInstance);
> -
> +
> try {
> if (!HTTPTransportUtils.isRESTRequest(contentType)) {
> HTTPTransportUtils.processHTTPPostRequest(msgContext,
> @@ -148,44 +147,44 @@ public class POJOWebServiceContainer ext
> soapAction,
> request.getURI().getPath());
> } else {
> - RESTUtil.processXMLRequest(msgContext,
> + RESTUtil.processXMLRequest(msgContext,
> request.getInputStream(),
> - response.getOutputStream(),
> + response.getOutputStream(),
> contentType);
> }
> - } finally {
> + } finally {
> // de-associate JAX-WS MessageContext with the thread
> // (association happens in POJOEndpointLifecycleManager.createService() call)
> POJOWebServiceContext.clear();
> - }
> + }
> }
> -
> +
> @Override
> protected void processURLRequest(Request request,
> Response response,
> AxisService service,
> MessageContext msgContext) throws Exception {
> String contentType = request.getHeader(HTTPConstants.HEADER_CONTENT_TYPE);
> -
> +
> ConfigurationContext configurationContext = msgContext.getConfigurationContext();
> configurationContext.fillServiceContextAndServiceGroupContext(msgContext);
> -
> +
> setMsgContextProperties(request, response, service, msgContext);
> -
> +
> ServiceContext serviceContext = msgContext.getServiceContext();
> serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, this.endpointInstance);
> -
> +
> InvocationResponse processed = null;
> try {
> - processed = RESTUtil.processURLRequest(msgContext,
> + processed = RESTUtil.processURLRequest(msgContext,
> response.getOutputStream(),
> contentType);
> - } finally {
> + } finally {
> // de-associate JAX-WS MessageContext with the thread
> // (association happens in POJOEndpointLifecycleManager.createService() call)
> POJOWebServiceContext.clear();
> }
> -
> +
> if (!processed.equals(InvocationResponse.CONTINUE)) {
> response.setStatusCode(HttpURLConnection.HTTP_OK);
> String s = HTTPTransportReceiver.getServicesHTML(configurationContext);
> @@ -194,21 +193,21 @@ public class POJOWebServiceContainer ext
> pw.flush();
> }
> }
> -
> +
> @Override
> public void destroy() {
> // call handler preDestroy
> destroyHandlers();
> -
> +
> // call service preDestroy
> if (this.endpointInstance != null) {
> try {
> this.holder.destroyInstance(this.endpointInstance);
> } catch (Exception e) {
> - LOG.warn("Error calling @PreDestroy method", e);
> + LOG.warn("Error calling @PreDestroy method", e);
> }
> }
> -
> +
> super.destroy();
> }
> }
>
>
>