Author: alessio.soldano(a)jboss.com
Date: 2010-04-01 12:07:54 -0400 (Thu, 01 Apr 2010)
New Revision: 11924
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/handler/
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/handler/JaxwsNamespaceHandler.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/parser/
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/parser/JaxwsEndpointDefinitionParser.java
Removed:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSServiceFactoryBean.java
Modified:
stack/cxf/trunk/modules/client/src/main/resources/META-INF/spring.handlers
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java
Log:
[JBWS-2971] Removing JBossWSServiceFactoryBean and providing proper integration through
customized Spring NamespaceHandlerSupport
Modified: stack/cxf/trunk/modules/client/src/main/resources/META-INF/spring.handlers
===================================================================
--- stack/cxf/trunk/modules/client/src/main/resources/META-INF/spring.handlers 2010-04-01
15:42:48 UTC (rev 11923)
+++ stack/cxf/trunk/modules/client/src/main/resources/META-INF/spring.handlers 2010-04-01
16:07:54 UTC (rev 11924)
@@ -42,6 +42,7 @@
#
#
http\://cxf.apache.org/jaxws=org.apache.cxf.jaxws.spring.NamespaceHandler
+http\://cxf.apache.org/jaxws=org.jboss.wsf.stack.cxf.spring.handler.JaxwsNamespaceHandler
#
#
# Licensed to the Apache Software Foundation (ASF) under one
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java 2010-04-01
15:42:48 UTC (rev 11923)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/DescriptorDeploymentAspect.java 2010-04-01
16:07:54 UTC (rev 11924)
@@ -171,7 +171,7 @@
boolean mtomEnabled = isMtomEnabled(ep.getTargetBeanClass());
- DDEndpoint ddep = new DDEndpoint(id, address, implementor, mtomEnabled,
JBossWSServiceFactoryBean.class.getName());
+ DDEndpoint ddep = new DDEndpoint(id, address, implementor, mtomEnabled);
if (depType == DeploymentType.JAXWS_EJB3)
{
Deleted:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSServiceFactoryBean.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSServiceFactoryBean.java 2010-04-01
15:42:48 UTC (rev 11923)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSServiceFactoryBean.java 2010-04-01
16:07:54 UTC (rev 11924)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This 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 (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.wsf.stack.cxf;
-
-import java.io.IOException;
-
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.endpoint.Endpoint;
-import org.apache.cxf.endpoint.EndpointException;
-import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
-import org.apache.cxf.service.Service;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.jboss.logging.Logger;
-
-/**
- * A service factory bean that performs additional operations
- * required by the JBossWS integration when creating a service.
- *
- * @author alessio.soldano(a)jboss.com
- * @since 30-Mar-2010
- *
- */
-public class JBossWSServiceFactoryBean extends JaxWsServiceFactoryBean
-{
- private WSDLFilePublisher wsdlPublisher;
-
- @Override
- public Endpoint createEndpoint(EndpointInfo ei) throws EndpointException
- {
- Endpoint endpoint = super.createEndpoint(ei);
- Service service = endpoint.getService();
- // Publish wsdl after endpoint deployment, as required by JSR-109, section 8.2
- if (wsdlPublisher != null)
- {
- String wsdlLocation = isFromWsdl() ? getWsdlURL() : null;
- try
- {
- wsdlPublisher.publishWsdlFiles(service.getName(), wsdlLocation,
BusFactory.getThreadDefaultBus(false), service.getServiceInfos());
- }
- catch (IOException ioe)
- {
- throw new RuntimeException("Error while publishing wsdl for service
" + service.getName(), ioe);
- }
- }
- else
- {
- Logger.getLogger(JBossWSServiceFactoryBean.class).warn("WSDLPublisher not
configured, unable to publish contract!");
- }
- return endpoint;
- }
-
- public void setWsdlPublisher(WSDLFilePublisher wsdlPublisher)
- {
- this.wsdlPublisher = wsdlPublisher;
- }
-
-}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java 2010-04-01
15:42:48 UTC (rev 11923)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/JBossWSServerCXFConfigurer.java 2010-04-01
16:07:54 UTC (rev 11924)
@@ -26,9 +26,9 @@
import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
import org.jboss.wsf.spi.binding.BindingCustomization;
-import org.jboss.wsf.stack.cxf.JBossWSServiceFactoryBean;
import org.jboss.wsf.stack.cxf.WSDLFilePublisher;
import org.jboss.wsf.stack.cxf.client.configuration.JBossWSCXFConfigurer;
+import org.jboss.wsf.stack.cxf.deployment.EndpointImpl;
/**
* A JBossWSCXFConfigured to be used on server side
@@ -50,14 +50,24 @@
super(delegate, customization);
this.wsdlPublisher = wsdlPublisher;
}
+
+ @Override
+ protected void internalConfigure(Object beanInstance)
+ {
+ super.internalConfigure(beanInstance);
+ if (beanInstance instanceof EndpointImpl)
+ {
+ configureEndpoint((EndpointImpl)beanInstance);
+ }
+ }
@Override
protected synchronized void configureEndpointFactory(AbstractWSDLBasedEndpointFactory
factory)
{
- ReflectionServiceFactoryBean serviceFactory = factory.getServiceFactory();
//Configure binding customization
if (customization != null)
{
+ ReflectionServiceFactoryBean serviceFactory = factory.getServiceFactory();
//customize default databinding (early pulls in ServiceFactory default
databinding and configure it, as it's lazily loaded)
serviceFactory.reset();
DataBinding serviceFactoryDataBinding = serviceFactory.getDataBinding(true);
@@ -74,12 +84,16 @@
setBindingCustomization(factory.getDataBinding(), customization);
}
}
+ //add other configurations here below
+ }
+
+ protected synchronized void configureEndpoint(EndpointImpl endpoint)
+ {
//Configure wsdl file publisher
- if (wsdlPublisher != null && serviceFactory instanceof
JBossWSServiceFactoryBean)
+ if (wsdlPublisher != null)
{
- ((JBossWSServiceFactoryBean)serviceFactory).setWsdlPublisher(wsdlPublisher);
+ endpoint.setWsdlPublisher(wsdlPublisher);
}
- //add other configurations here below
}
public void setWsdlPublisher(WSDLFilePublisher wsdlPublisher)
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java 2010-04-01
16:07:54 UTC (rev 11924)
@@ -0,0 +1,128 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf.deployment;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
+import org.apache.cxf.service.Service;
+import org.jboss.logging.Logger;
+import org.jboss.wsf.stack.cxf.WSDLFilePublisher;
+
+/**
+ * An extension of @see org.apache.cxf.jaxws.EndpointImpl for dealing with
+ * JBossWS integration needs.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 01-Apr-2010
+ *
+ */
+public class EndpointImpl extends org.apache.cxf.jaxws.EndpointImpl
+{
+ private WSDLFilePublisher wsdlPublisher;
+
+ public EndpointImpl(Object implementor)
+ {
+ super(implementor);
+ }
+
+ public EndpointImpl(Bus bus, Object implementor)
+ {
+ super(bus, implementor);
+ }
+
+ @Override
+ protected void doPublish(String addr)
+ {
+ super.doPublish(addr);
+ //allow for configuration so that the wsdlPublisher can be set be the
JBossWSCXFConfigurer
+ configureObject(this);
+ //publish the wsdl to data/wsdl
+ publishContractToFilesystem();
+ }
+
+ /**
+ * Publish the contract to a file using the configured wsdl publisher
+ *
+ * @param endpoint
+ */
+ protected void publishContractToFilesystem()
+ {
+ // Publish wsdl after endpoint deployment, as required by JSR-109, section 8.2
+ if (wsdlPublisher != null)
+ {
+ Endpoint endpoint = getServer().getEndpoint();
+ Service service = endpoint.getService();
+ try
+ {
+ JaxWsImplementorInfo info = new JaxWsImplementorInfo(getImplementorClass());
+ wsdlPublisher.publishWsdlFiles(service.getName(), info.getWsdlLocation(),
BusFactory.getThreadDefaultBus(false), service.getServiceInfos());
+ }
+ catch (IOException ioe)
+ {
+ throw new RuntimeException("Error while publishing wsdl for service
" + service.getName(), ioe);
+ }
+ }
+ else
+ {
+ Logger.getLogger(this.getClass()).warn("WSDLPublisher not configured,
unable to publish contract!");
+ }
+ }
+
+ private void configureObject(Object instance)
+ {
+ Configurer configurer = getBus().getExtension(Configurer.class);
+ if (null != configurer)
+ {
+ configurer.configureBean(instance);
+ }
+ }
+
+ @Override
+ public String getBeanName()
+ {
+ QName endpointName = this.getEndpointName();
+ if (endpointName == null)
+ {
+ JaxWsImplementorInfo implInfo = new
JaxWsImplementorInfo(getImplementorClass());
+ endpointName = implInfo.getEndpointName();
+ }
+ return endpointName.toString() + ".jaxws-endpoint";
+ }
+
+ public WSDLFilePublisher getWsdlPublisher()
+ {
+ return wsdlPublisher;
+ }
+
+ public void setWsdlPublisher(WSDLFilePublisher wsdlPublisher)
+ {
+ this.wsdlPublisher = wsdlPublisher;
+ }
+
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/EndpointImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java 2010-04-01
15:42:48 UTC (rev 11923)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/services/DDEndpoint.java 2010-04-01
16:07:54 UTC (rev 11924)
@@ -37,15 +37,13 @@
private String implementor;
private String invoker;
private boolean mtomEnabled;
- private String serviceFactory;
- public DDEndpoint(String id, String address, String implementor, boolean mtomEnabled,
String serviceFactory)
+ public DDEndpoint(String id, String address, String implementor, boolean mtomEnabled)
{
this.id = id;
this.address = address;
this.implementor = implementor;
this.mtomEnabled = mtomEnabled;
- this.serviceFactory = serviceFactory;
}
public void setInvoker(String invoker)
@@ -60,8 +58,6 @@
writer.write(" implementor='" + this.implementor +
"'");
writer.write(">");
- writer.write("<jaxws:serviceFactory><bean class='" +
this.serviceFactory + "'/></jaxws:serviceFactory>");
-
if (this.mtomEnabled)
{
writer.write("<jaxws:binding>");
@@ -85,7 +81,6 @@
str.append("\n implementor=" + this.implementor);
str.append("\n invoker=" + this.invoker);
str.append("\n mtomEnabled=" + this.mtomEnabled);
- str.append("\n serviceFactory=" + this.serviceFactory);
return str.toString();
}
}
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/handler/JaxwsNamespaceHandler.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/handler/JaxwsNamespaceHandler.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/handler/JaxwsNamespaceHandler.java 2010-04-01
16:07:54 UTC (rev 11924)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf.spring.handler;
+
+import org.apache.cxf.jaxws.spring.NamespaceHandler;
+import org.jboss.wsf.stack.cxf.spring.parser.JaxwsEndpointDefinitionParser;
+
+/**
+ * A Spring namespace handler that extends the handler
+ * configured by CXF for the jaxws ns, allowing for
+ * different beans to be associated to elements by
+ * default.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 01-Apr-2010
+ *
+ */
+public class JaxwsNamespaceHandler extends NamespaceHandler
+{
+ @Override
+ public void init() {
+ super.init();
+ registerBeanDefinitionParser("endpoint", new
JaxwsEndpointDefinitionParser());
+ }
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/handler/JaxwsNamespaceHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/parser/JaxwsEndpointDefinitionParser.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/parser/JaxwsEndpointDefinitionParser.java
(rev 0)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/parser/JaxwsEndpointDefinitionParser.java 2010-04-01
16:07:54 UTC (rev 11924)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf.spring.parser;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor;
+import org.apache.cxf.jaxws.spring.EndpointDefinitionParser;
+import org.jboss.wsf.stack.cxf.deployment.EndpointImpl;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+/**
+ * A parser for jaxws-endpoint beans that extends the CXF default one
+ * allowing for a custom Endpoint implementation class to be used.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 01-Apr-2010
+ *
+ */
+public class JaxwsEndpointDefinitionParser extends EndpointDefinitionParser
+{
+ public JaxwsEndpointDefinitionParser()
+ {
+ super();
+ setBeanClass(JBossWSSpringEndpointImpl.class);
+ }
+
+ public static class JBossWSSpringEndpointImpl extends EndpointImpl implements
ApplicationContextAware
+ {
+
+ public JBossWSSpringEndpointImpl(Object implementor)
+ {
+ super((Bus)null, implementor);
+ }
+
+ public JBossWSSpringEndpointImpl(Bus bus, Object implementor)
+ {
+ super(bus, implementor);
+ }
+
+ public void setApplicationContext(ApplicationContext ctx) throws BeansException
+ {
+ if (getBus() == null)
+ {
+ Bus bus = BusFactory.getThreadDefaultBus();
+ BusWiringBeanFactoryPostProcessor.updateBusReferencesInContext(bus, ctx);
+ setBus(bus);
+ }
+ }
+ }
+}
Property changes on:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/spring/parser/JaxwsEndpointDefinitionParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF