JBossWS SVN: r15492 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-01-18 07:57:33 -0500 (Wed, 18 Jan 2012)
New Revision: 15492
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
Log:
- [JBWS-3415] Move processWSDDContribution(..) method to JAXWSServerMetaDataBuilder and invoke it from JAXWSProviderMetaDataBuilder too
- [JBWS-3416] Re-use WebServiceMetadata from AS integration layer
- [JBWS-3417] Process wsdl file/location override through WebServicesMetadata
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2012-01-18 11:38:32 UTC (rev 15491)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2012-01-18 12:57:33 UTC (rev 15492)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2012, 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.
*
@@ -57,6 +57,7 @@
*
* @author Thomas.Diesler(a)jboss.org
* @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
+ * @author alessio.soldano(a)jboss.com
* @since 23-Jul-2005
*/
public class JAXWSProviderMetaDataBuilder extends JAXWSServerMetaDataBuilder
@@ -134,6 +135,9 @@
// process handler chain
processHandlerChain(sepMetaData, sepClass);
+
+ //process webservices.xml contributions
+ processWSDDContribution(dep, sepMetaData);
// process config
processEndpointConfig(dep, sepMetaData, sepClass, linkName);
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2012-01-18 11:38:32 UTC (rev 15491)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2012-01-18 12:57:33 UTC (rev 15492)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2012, 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.
*
@@ -26,23 +26,36 @@
import java.util.ResourceBundle;
import javax.jws.WebService;
+import javax.xml.ws.RespectBindingFeature;
import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.soap.AddressingFeature;
+import javax.xml.ws.soap.MTOMFeature;
import org.jboss.ws.api.annotation.EndpointConfig;
import org.jboss.ws.api.annotation.WebContext;
import org.jboss.ws.api.util.BundleUtils;
+import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXWS;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.metadata.j2ee.EJBArchiveMetaData;
import org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
+import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory;
+import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
/**
* Builds ServiceEndpointMetaData for a JAX-WS endpoint.
*
* @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
* @author Thomas.Diesler(a)jboss.com
+ * @author alessio.soldano(a)jboss.com
*/
public abstract class JAXWSServerMetaDataBuilder extends JAXWSMetaDataBuilder
{
@@ -169,4 +182,94 @@
// secure wsdl access
sepMetaData.setSecureWSDLAccess(anWebContext.secureWSDLAccess());
}
+
+ /**
+ * With JAX-WS the use of webservices.xml is optional since the annotations can be used
+ * to specify most of the information specified in this deployment descriptor file.
+ * The deployment descriptors are only used to override or augment the annotation member attributes.
+ * @param sepMetaData
+ */
+ protected void processWSDDContribution(Deployment dep, ServerEndpointMetaData sepMetaData)
+ {
+ WebservicesMetaData webservices = dep.getAttachment(WebservicesMetaData.class);
+ if (webservices != null)
+ {
+ for (WebserviceDescriptionMetaData wsDesc : webservices.getWebserviceDescriptions())
+ {
+ for (PortComponentMetaData portComp : wsDesc.getPortComponents())
+ {
+ // We match portComp's by SEI first and portQName second
+ // In the first case the portComp may override the portQName that derives from the annotation
+ String portCompSEI = portComp.getServiceEndpointInterface();
+ boolean doesMatch = portCompSEI != null ? portCompSEI.equals(sepMetaData.getServiceEndpointInterfaceName()) : false;
+ if (!doesMatch)
+ {
+ doesMatch = portComp.getWsdlPort().equals(sepMetaData.getPortName());
+ }
+
+ if (doesMatch)
+ {
+
+ log.debug("Processing 'webservices.xml' contributions on EndpointMetaData");
+
+ // PortQName overrides
+ if (portComp.getWsdlPort() != null)
+ {
+ if (log.isDebugEnabled())
+ log.debug("Override EndpointMetaData portName " + sepMetaData.getPortName() + " with " + portComp.getWsdlPort());
+ sepMetaData.setPortName(portComp.getWsdlPort());
+ }
+
+ // HandlerChain contributions
+ UnifiedHandlerChainsMetaData chainWrapper = portComp.getHandlerChains();
+ if (chainWrapper != null)
+ {
+ for (UnifiedHandlerChainMetaData handlerChain : chainWrapper.getHandlerChains())
+ {
+ for (UnifiedHandlerMetaData uhmd : handlerChain.getHandlers())
+ {
+ if (log.isDebugEnabled())
+ log.debug("Contribute handler from webservices.xml: " + uhmd.getHandlerName());
+ HandlerMetaDataJAXWS hmd = HandlerMetaDataJAXWS.newInstance(uhmd, HandlerType.ENDPOINT);
+ sepMetaData.addHandler(hmd);
+ }
+ }
+ }
+
+ // MTOM settings
+ if (portComp.isMtomEnabled())
+ {
+ log.debug("Enabling MTOM");
+ MTOMFeature feature = new MTOMFeature(true, portComp.getMtomThreshold());
+ sepMetaData.getFeatures().addFeature(feature);
+ }
+
+ if (portComp.isAddressingEnabled())
+ { log.debug("Enabling Addressing");
+ AddressingFeature.Responses responses = getAddressFeatureResponses(portComp.getAddressingResponses());
+ AddressingFeature feature = new AddressingFeature(true, portComp.isAddressingRequired(), responses);
+ sepMetaData.getFeatures().addFeature(feature);
+ }
+
+ if (portComp.isRespectBindingEnabled())
+ {
+ log.debug("Enabling RespectBinding Feature");
+ RespectBindingFeature feature = new RespectBindingFeature(true);
+ sepMetaData.getFeatures().addFeature(feature);
+ }
+
+ //wsdlLocation override
+ String wsdlFile = portComp.getWebserviceDescription().getWsdlFile();
+ if (wsdlFile != null)
+ {
+ if (log.isDebugEnabled())
+ log.debug("Override wsdlFile location with " + wsdlFile);
+ sepMetaData.getServiceMetaData().setWsdlFile(wsdlFile);
+ }
+ }
+ }
+ }
+
+ }
+ }
}
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2012-01-18 11:38:32 UTC (rev 15491)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2012-01-18 12:57:33 UTC (rev 15492)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2012, 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.
*
@@ -35,10 +35,7 @@
import javax.jws.soap.SOAPMessageHandlers;
import javax.management.ObjectName;
import javax.xml.namespace.QName;
-import javax.xml.ws.RespectBindingFeature;
import javax.xml.ws.WebServiceProvider;
-import javax.xml.ws.soap.AddressingFeature;
-import javax.xml.ws.soap.MTOMFeature;
import org.jboss.ws.WSException;
import org.jboss.ws.annotation.Documentation;
@@ -49,7 +46,6 @@
import org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder;
import org.jboss.ws.metadata.builder.MetaDataBuilder;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXWS;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
@@ -71,14 +67,6 @@
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
-import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
/**
* An abstract annotation meta data builder.
@@ -86,6 +74,7 @@
* @author Thomas.Diesler(a)jboss.org
* @author <a href="mailto:jason.greene@jboss.com">Jason T. Greene</a>
* @author Heiko.Braun(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
*
* @since 15-Oct-2005
*/
@@ -214,7 +203,7 @@
processHandlerChain(sepMetaData, seiClass);
// process webservices.xml contributions
- processWSDDContribution(sepMetaData);
+ processWSDDContribution(dep, sepMetaData);
//setup web service feature contributions
epFeatureProcessor.setupEndpointFeatures(sepMetaData);
@@ -323,88 +312,6 @@
return wsdlEndpoint;
}
- /**
- * With JAX-WS the use of webservices.xml is optional since the annotations can be used
- * to specify most of the information specified in this deployment descriptor file.
- * The deployment descriptors are only used to override or augment the annotation member attributes.
- * @param sepMetaData
- */
- private void processWSDDContribution(ServerEndpointMetaData sepMetaData)
- {
- WebservicesMetaData webservices = WebservicesFactory.loadFromVFSRoot(sepMetaData.getRootFile());
- if (webservices != null)
- {
- for (WebserviceDescriptionMetaData wsDesc : webservices.getWebserviceDescriptions())
- {
- for (PortComponentMetaData portComp : wsDesc.getPortComponents())
- {
- // We match portComp's by SEI first and portQName second
- // In the first case the portComp may override the portQName that derives from the annotation
- String portCompSEI = portComp.getServiceEndpointInterface();
- boolean doesMatch = portCompSEI != null ? portCompSEI.equals(sepMetaData.getServiceEndpointInterfaceName()) : false;
- if (!doesMatch)
- {
- doesMatch = portComp.getWsdlPort().equals(sepMetaData.getPortName());
- }
-
- if (doesMatch)
- {
-
- log.debug("Processing 'webservices.xml' contributions on EndpointMetaData");
-
- // PortQName overrides
- if (portComp.getWsdlPort() != null)
- {
- if (log.isDebugEnabled())
- log.debug("Override EndpointMetaData portName " + sepMetaData.getPortName() + " with " + portComp.getWsdlPort());
- sepMetaData.setPortName(portComp.getWsdlPort());
- }
-
- // HandlerChain contributions
- UnifiedHandlerChainsMetaData chainWrapper = portComp.getHandlerChains();
- if (chainWrapper != null)
- {
- for (UnifiedHandlerChainMetaData handlerChain : chainWrapper.getHandlerChains())
- {
- for (UnifiedHandlerMetaData uhmd : handlerChain.getHandlers())
- {
- if (log.isDebugEnabled())
- log.debug("Contribute handler from webservices.xml: " + uhmd.getHandlerName());
- HandlerMetaDataJAXWS hmd = HandlerMetaDataJAXWS.newInstance(uhmd, HandlerType.ENDPOINT);
- sepMetaData.addHandler(hmd);
- }
- }
- }
-
- // MTOM settings
- if (portComp.isMtomEnabled())
- {
- log.debug("Enabling MTOM");
- MTOMFeature feature = new MTOMFeature(true, portComp.getMtomThreshold());
- sepMetaData.getFeatures().addFeature(feature);
- }
-
- if (portComp.isAddressingEnabled())
- { log.debug("Enabling Addressing");
- AddressingFeature.Responses responses = getAddressFeatureResponses(portComp.getAddressingResponses());
- AddressingFeature feature = new AddressingFeature(true, portComp.isAddressingRequired(), responses);
- sepMetaData.getFeatures().addFeature(feature);
- }
-
- if (portComp.isRespectBindingEnabled())
- {
- log.debug("Enabling RespectBinding Feature");
- RespectBindingFeature feature = new RespectBindingFeature(true);
- sepMetaData.getFeatures().addFeature(feature);
- }
-
- }
- }
- }
-
- }
- }
-
private EndpointResult processWebService(Deployment dep, UnifiedMetaData wsMetaData, Class<?> sepClass, String linkName) throws ClassNotFoundException, IOException
{
WebService anWebService = sepClass.getAnnotation(WebService.class);