[jbossws-commits] JBossWS SVN: r9448 - in stack/native/trunk/modules: core/src/main/java/org/jboss/ws/core/jaxws and 6 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Sat Feb 28 09:33:21 EST 2009


Author: alessio.soldano at jboss.com
Date: 2009-02-28 09:33:21 -0500 (Sat, 28 Feb 2009)
New Revision: 9448

Added:
   stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/wsaddressing/
   stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/wsaddressing/EndpointReferenceUtil.java
   stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/wsaddressing/NativeEndpointReference.java
   stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/wsaddressing/package-info.java
Removed:
   stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/EndpointReferenceUtil.java
Modified:
   stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonBindingProvider.java
   stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java
   stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java
   stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
   stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeWebServiceContext.java
   stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/EndpointReference.java
   stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/RespectBindingFeature.java
   stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java
   stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java
Log:
[JBWS-2452][JBCTS-902] Fix signature test failures + using internal endpoint reference implementation to build W3CEndpointReference instances


Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonBindingProvider.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonBindingProvider.java	2009-02-27 18:24:18 UTC (rev 9447)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/CommonBindingProvider.java	2009-02-28 14:33:21 UTC (rev 9448)
@@ -32,10 +32,10 @@
 import org.jboss.logging.Logger;
 import org.jboss.ws.core.jaxrpc.SOAP11BindingJAXRPC;
 import org.jboss.ws.core.jaxrpc.SOAP12BindingJAXRPC;
-import org.jboss.ws.core.jaxws.binding.EndpointReferenceUtil;
 import org.jboss.ws.core.jaxws.binding.HTTPBindingJAXWS;
 import org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS;
 import org.jboss.ws.core.jaxws.binding.SOAP12BindingJAXWS;
+import org.jboss.ws.core.jaxws.wsaddressing.EndpointReferenceUtil;
 import org.jboss.ws.metadata.config.Configurable;
 import org.jboss.ws.metadata.umdm.EndpointMetaData;
 import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;

Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/EndpointReferenceUtil.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/EndpointReferenceUtil.java	2009-02-27 18:24:18 UTC (rev 9447)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/binding/EndpointReferenceUtil.java	2009-02-28 14:33:21 UTC (rev 9448)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.ws.core.jaxws.binding;
-
-import javax.xml.ws.EndpointReference;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.wsaddressing.W3CEndpointReference;
-
-/**
- * Transforms an EPR to an instance of a given EndpointReference class 
- * 
- * @since 12-Jan-2009
- * @author alessio.soldano at jboss.com
- *
- */
-public class EndpointReferenceUtil {
-   
-   public static <T extends EndpointReference> T transform(Class<T> clazz, EndpointReference epr) {
-       assert epr != null;
-       if (clazz.isAssignableFrom(W3CEndpointReference.class)) {
-           if (epr instanceof W3CEndpointReference) {
-               return (T) epr;
-           }
-           else
-           {
-              throw new WebServiceException("Unsupported EndpointReference: " + epr);
-           }
-       }
-       //transformations from different types of EndpointReference could be supported in future...
-       
-       throw new WebServiceException("EndpointReference of type " + clazz + " not supported.");
-   }
-}

Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java	2009-02-27 18:24:18 UTC (rev 9447)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/EndpointImpl.java	2009-02-28 14:33:21 UTC (rev 9448)
@@ -41,7 +41,7 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
-import org.jboss.ws.core.jaxws.binding.EndpointReferenceUtil;
+import org.jboss.ws.core.jaxws.wsaddressing.EndpointReferenceUtil;
 import org.jboss.wsf.spi.SPIProvider;
 import org.jboss.wsf.spi.SPIProviderResolver;
 import org.jboss.wsf.spi.http.HttpContext;

Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java	2009-02-27 18:24:18 UTC (rev 9447)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ProviderImpl.java	2009-02-28 14:33:21 UTC (rev 9448)
@@ -36,8 +36,9 @@
 import javax.xml.ws.spi.Provider;
 import javax.xml.ws.spi.ServiceDelegate;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
-import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
 
+import org.jboss.ws.core.jaxws.wsaddressing.EndpointReferenceUtil;
+import org.jboss.ws.core.jaxws.wsaddressing.NativeEndpointReference;
 import org.jboss.wsf.common.DOMUtils;
 import org.w3c.dom.Element;
 
@@ -112,13 +113,14 @@
    public W3CEndpointReference createW3CEndpointReference(String address, QName serviceName, QName portName, List<Element> metadata, String wsdlDocumentLocation,
          List<Element> referenceParameters)
    {
-      W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
-      builder = builder.address(address).serviceName(serviceName).endpointName(portName).wsdlDocumentLocation(wsdlDocumentLocation);
-      for (Element el : metadata)
-         builder = builder.metadata(el);
-      for (Element el : referenceParameters)
-         builder = builder.referenceParameter(el);
-      return builder.build();
+      NativeEndpointReference epr = new NativeEndpointReference();
+      epr.setAddress(address);
+      epr.setServiceName(serviceName);
+      epr.setEndpointName(portName);
+      epr.setMetadata(metadata);
+      epr.setWsdlLocation(wsdlDocumentLocation);
+      epr.setReferenceParameters(referenceParameters);
+      return EndpointReferenceUtil.transform(W3CEndpointReference.class, epr);
    }
 
    @Override
@@ -126,12 +128,10 @@
    {
       URL wsdlLocation = null;
       QName serviceName = null;
-      if (epr instanceof W3CEndpointReference)
-      {
-         W3CEndpointReference w3c = (W3CEndpointReference)epr;
-         wsdlLocation = w3c.getWsdlLocation();
-         serviceName = w3c.getServiceName();
-      }
+      NativeEndpointReference nepr = EndpointReferenceUtil.transform(NativeEndpointReference.class, epr);
+      
+      wsdlLocation = nepr.getWsdlLocation();
+      serviceName = nepr.getServiceName();
       ServiceDelegate delegate = createServiceDelegate(wsdlLocation, serviceName, Service.class);
       return delegate.getPort(epr, sei, features);
    }

Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java	2009-02-27 18:24:18 UTC (rev 9447)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java	2009-02-28 14:33:21 UTC (rev 9448)
@@ -50,7 +50,6 @@
 import javax.xml.ws.addressing.ReferenceParameters;
 import javax.xml.ws.handler.HandlerResolver;
 import javax.xml.ws.spi.ServiceDelegate;
-import javax.xml.ws.wsaddressing.W3CEndpointReference;
 
 import org.jboss.logging.Logger;
 import org.jboss.ws.core.StubExt;
@@ -60,6 +59,8 @@
 import org.jboss.ws.core.jaxws.client.DispatchImpl;
 import org.jboss.ws.core.jaxws.client.ServiceObjectFactoryJAXWS;
 import org.jboss.ws.core.jaxws.handler.HandlerResolverImpl;
+import org.jboss.ws.core.jaxws.wsaddressing.EndpointReferenceUtil;
+import org.jboss.ws.core.jaxws.wsaddressing.NativeEndpointReference;
 import org.jboss.ws.extensions.wsrm.api.RMProvider;
 import org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder;
 import org.jboss.ws.metadata.builder.jaxws.JAXWSMetaDataBuilder;
@@ -471,11 +472,8 @@
    public <T> Dispatch<T> createDispatch(EndpointReference epr, Class<T> type, Mode mode, WebServiceFeature... features)
    {
       QName portName = null;
-      if (epr instanceof W3CEndpointReference)
-      {
-         W3CEndpointReference w3c = (W3CEndpointReference)epr;
-         portName = w3c.getEndpointName();
-      }
+      NativeEndpointReference nepr = EndpointReferenceUtil.transform(NativeEndpointReference.class, epr);
+      portName = nepr.getEndpointName();
       
       Dispatch<T> dispatch = createDispatch(portName, type, mode);
       initAddressingProperties(dispatch, epr);
@@ -495,11 +493,8 @@
    public Dispatch<Object> createDispatch(EndpointReference epr, JAXBContext context, Mode mode, WebServiceFeature... features)
    {
       QName portName = null;
-      if (epr instanceof W3CEndpointReference)
-      {
-         W3CEndpointReference w3c = (W3CEndpointReference)epr;
-         portName = w3c.getEndpointName();
-      }
+      NativeEndpointReference nepr = EndpointReferenceUtil.transform(NativeEndpointReference.class, epr);
+      portName = nepr.getEndpointName();
 
       Dispatch<Object> dispatch = createDispatch(portName, context, mode);
       initAddressingProperties(dispatch, epr);
@@ -551,33 +546,26 @@
       AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
       AddressingProperties addrProps = builder.newAddressingProperties();
       reqContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addrProps);
-
-      if (epr instanceof W3CEndpointReference)
+      
+      NativeEndpointReference nepr = EndpointReferenceUtil.transform(NativeEndpointReference.class, epr);
+      try
       {
-         try
+         if (nepr.getAddress() != null)
+            addrProps.setTo(builder.newURI(nepr.getAddress()));
+
+         List<Element> w3cRefParams = nepr.getReferenceParameters();
+         if (w3cRefParams != null)
          {
-            W3CEndpointReference w3cepr = (W3CEndpointReference)epr;
-            if (w3cepr.getAddress() != null)
-               addrProps.setTo(builder.newURI(w3cepr.getAddress()));
-            
-            List<Element> w3cRefParams = w3cepr.getReferenceParameters();
-            if (w3cRefParams != null)
+            ReferenceParameters refParams = addrProps.getReferenceParameters();
+            for (Element w3cRefParam : w3cRefParams)
             {
-               ReferenceParameters refParams = addrProps.getReferenceParameters();
-               for (Element w3cRefParam : w3cRefParams)
-               {
-                  refParams.addElement(w3cRefParam);
-               }
+               refParams.addElement(w3cRefParam);
             }
          }
-         catch (URISyntaxException ex)
-         {
-            throw new IllegalArgumentException(ex);
-         }
       }
-      else
+      catch (URISyntaxException ex)
       {
-         throw new IllegalArgumentException("Unsupported EPR type: " + epr);
+         throw new IllegalArgumentException(ex);
       }
    }
 }

Added: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/wsaddressing/EndpointReferenceUtil.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/wsaddressing/EndpointReferenceUtil.java	                        (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/wsaddressing/EndpointReferenceUtil.java	2009-02-28 14:33:21 UTC (rev 9448)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ws.core.jaxws.wsaddressing;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+
+/**
+ * Transforms an EPR to an instance of a given EndpointReference class 
+ * 
+ * @since 12-Jan-2009
+ * @author alessio.soldano at jboss.com
+ *
+ */
+public class EndpointReferenceUtil {
+   
+   public static <T extends EndpointReference> T transform(Class<T> clazz, EndpointReference epr)
+   {
+      assert epr != null;
+      if (clazz.isAssignableFrom(W3CEndpointReference.class))
+      {
+         if (epr instanceof W3CEndpointReference)
+         {
+            return (T)epr;
+         }
+         else if (epr instanceof NativeEndpointReference)
+         {
+            return (T)W3CEndpointReference.readFrom(getSourceFromEndpointReference(epr));
+         }
+         else
+         {
+            throw new WebServiceException("Unsupported EndpointReference: " + epr);
+         }
+      }
+      else if (clazz.isAssignableFrom(NativeEndpointReference.class))
+      {
+         return (T)NativeEndpointReference.readFrom(getSourceFromEndpointReference(epr));
+      }
+      //transformations from different types of EndpointReference could be supported in future...
+
+      throw new WebServiceException("EndpointReference of type " + clazz + " not supported.");
+   }
+   
+   private static Source getSourceFromEndpointReference(EndpointReference epr)
+   {
+      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+      StreamResult result = new StreamResult(outputStream);
+      epr.writeTo(result);
+      return new StreamSource(new ByteArrayInputStream(outputStream.toByteArray()));
+   }
+}


Property changes on: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/wsaddressing/EndpointReferenceUtil.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/wsaddressing/NativeEndpointReference.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/wsaddressing/NativeEndpointReference.java	                        (rev 0)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/wsaddressing/NativeEndpointReference.java	2009-02-28 14:33:21 UTC (rev 9448)
@@ -0,0 +1,322 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ws.core.jaxws.wsaddressing;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.annotation.XmlAnyAttribute;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.WebServiceException;
+
+import org.w3c.dom.Element;
+
+/**
+ * Internal representation of the W3CEndpointReference.
+ * This allows the W3CEndpointReference to programmatically
+ * build an EndpointReference specifying every parameter.
+ * Instances of this class are converted to (and can be
+ * created from) W3CEndpointReference using the
+ * @see EndpointReferenceUtil class.
+ * 
+ * @author alessio.soldano at jboss.com
+ * @since 28-Feb-2009
+ * 
+ */
+
+// XmlRootElement allows this class to be marshalled on its own
+ at XmlRootElement(name = "EndpointReference", namespace = NativeEndpointReference.NS)
+ at XmlType(name = "EndpointReferenceType", namespace = NativeEndpointReference.NS)
+public final class NativeEndpointReference extends EndpointReference
+{
+   protected static final String NS = "http://www.w3.org/2005/08/addressing";
+   
+   private final static JAXBContext jc = getJaxbContext();
+   
+   // private but necessary properties for databinding
+   @XmlElement(name = "Address", namespace = NS)
+   private Address address;
+   @XmlElement(name = "ReferenceParameters", namespace = NS)
+   private Elements referenceParameters;
+   @XmlElement(name = "Metadata", namespace = NS)
+   private Elements metadata;
+   @XmlAnyAttribute
+   Map<QName, String> attributes;
+   @XmlAnyElement
+   List<Element> elements;
+
+   // not marshalled
+   private QName serviceName;
+   private QName endpointName;
+   private URL wsdlLocation;
+   
+   public NativeEndpointReference()
+   {
+   }
+
+   /**
+    * Creates an EPR from infoset representation
+    *
+    * @param source A source object containing valid XmlInfoset
+    * instance consistent with the W3C WS-Addressing Core
+    * recommendation.
+    *
+    * @throws WebServiceException
+    *   If the source does NOT contain a valid W3C WS-Addressing
+    *   EndpointReference.
+    * @throws NullPointerException
+    *   If the <code>null</code> <code>source</code> value is given
+    */
+   public NativeEndpointReference(Source source)
+   {
+      try
+      {
+         NativeEndpointReference epr = jc.createUnmarshaller().unmarshal(source, NativeEndpointReference.class).getValue();
+         this.address = epr.address;
+         this.metadata = epr.metadata;
+         this.referenceParameters = epr.referenceParameters;
+      }
+      catch (JAXBException e)
+      {
+         throw new WebServiceException("Error unmarshalling NativeEndpointReference ", e);
+      }
+      catch (ClassCastException e)
+      {
+         throw new WebServiceException("Source did not contain NativeEndpointReference", e);
+      }
+   }
+
+   @XmlTransient
+   public String getAddress()
+   {
+      return address != null ? address.getUri() : null;
+   }
+
+   public void setAddress(String address)
+   {
+      this.address = new Address(address);
+   }
+   
+   @XmlTransient
+   public QName getServiceName()
+   {
+      return serviceName;
+   }
+
+   public void setServiceName(QName serviceName)
+   {
+      this.serviceName = serviceName;
+   }
+
+   @XmlTransient
+   public QName getEndpointName()
+   {
+      return endpointName;
+   }
+
+   public void setEndpointName(QName endpointName)
+   {
+      this.endpointName = endpointName;
+   }
+
+   @XmlTransient
+   public List<Element> getMetadata()
+   {
+      return metadata != null ? metadata.getElements() : null;
+   }
+
+   public void setMetadata(List<Element> metadata)
+   {
+      this.metadata = new Elements(metadata);
+   }
+
+   @XmlTransient
+   public URL getWsdlLocation()
+   {
+      return wsdlLocation;
+   }
+
+   public void setWsdlLocation(String wsdlLocation)
+   {
+      try
+      {
+         this.wsdlLocation = wsdlLocation != null ? new URL(wsdlLocation) : null;
+      }
+      catch (MalformedURLException e)
+      {
+         throw new IllegalArgumentException("Invalid URL: " + wsdlLocation);
+      }
+   }
+
+   @XmlTransient
+   public List<Element> getReferenceParameters()
+   {
+      return referenceParameters != null ? referenceParameters.getElements() : null;
+   }
+
+   public void setReferenceParameters(List<Element> metadata)
+   {
+      this.referenceParameters = new Elements(metadata);
+   }
+   
+   /**
+    * Directly read a NativeEndpointReference from the given source
+    * instead of leveraging the Provider's readEndpointReference method.
+    * 
+    * @param eprInfoset
+    * @return
+    */
+   public static EndpointReference readFrom(Source eprInfoset)
+   {
+      if (eprInfoset == null)
+         throw new NullPointerException("Provided eprInfoset cannot be null");
+      try
+      {
+         return new NativeEndpointReference(eprInfoset);
+      }
+      catch (Exception e)
+      {
+         throw new WebServiceException(e);
+      }
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void writeTo(Result result)
+   {
+      try
+      {
+         Marshaller marshaller = jc.createMarshaller();
+         marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
+         marshaller.marshal(this, result);
+      }
+      catch (JAXBException e)
+      {
+         throw new WebServiceException("Error marshalling NativeEndpointReference. ", e);
+      }
+   }
+
+   private static JAXBContext getJaxbContext()
+   {
+      try
+      {
+         return JAXBContext.newInstance(new Class[] { NativeEndpointReference.class });
+      }
+      catch (JAXBException ex)
+      {
+         throw new WebServiceException("Cannot obtain JAXB context", ex);
+      }
+   }
+
+   private static class Address
+   {
+      @XmlValue
+      String uri;
+      @XmlAnyAttribute
+      Map<QName, String> attributes;
+      
+      protected Address()
+      {
+      }
+
+      public Address(String uri)
+      {
+         this.uri = uri;
+      }
+
+      @XmlTransient
+      public String getUri()
+      {
+         return uri;
+      }
+
+      public void setUri(String uri)
+      {
+         this.uri = uri;
+      }
+
+      @XmlTransient
+      public Map<QName, String> getAttributes()
+      {
+         return attributes;
+      }
+
+      public void setAttributes(Map<QName, String> attributes)
+      {
+         this.attributes = attributes;
+      }
+   }
+
+   private static class Elements
+   {
+      @XmlAnyElement
+      List<Element> elements;
+      @XmlAnyAttribute
+      Map<QName, String> attributes;
+      
+      protected Elements()
+      {
+      }
+
+      public Elements(List<Element> elements)
+      {
+         this.elements = elements;
+      }
+
+      @XmlTransient
+      public List<Element> getElements()
+      {
+         return elements;
+      }
+
+      public void setElements(List<Element> elements)
+      {
+         this.elements = elements;
+      }
+
+      @XmlTransient
+      public Map<QName, String> getAttributes()
+      {
+         return attributes;
+      }
+
+      public void setAttributes(Map<QName, String> attributes)
+      {
+         this.attributes = attributes;
+      }
+   }
+}


Property changes on: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/wsaddressing/NativeEndpointReference.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeWebServiceContext.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeWebServiceContext.java	2009-02-27 18:24:18 UTC (rev 9447)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/wsf/stack/jbws/NativeWebServiceContext.java	2009-02-28 14:33:21 UTC (rev 9448)
@@ -29,7 +29,7 @@
 import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
 
 import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.jaxws.binding.EndpointReferenceUtil;
+import org.jboss.ws.core.jaxws.wsaddressing.EndpointReferenceUtil;
 import org.jboss.ws.metadata.umdm.EndpointMetaData;
 import org.jboss.wsf.spi.invocation.ExtensibleWebServiceContext;
 import org.w3c.dom.Element;

Modified: stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/EndpointReference.java
===================================================================
--- stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/EndpointReference.java	2009-02-27 18:24:18 UTC (rev 9447)
+++ stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/EndpointReference.java	2009-02-28 14:33:21 UTC (rev 9448)
@@ -23,6 +23,7 @@
 
 import java.io.StringWriter;
 
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamResult;
@@ -79,7 +80,7 @@
  * @see Service
  * @since JAX-WS 2.1
  */
-//@XmlTransient // to treat this class like Object as far as databinding is concerned (proposed JAXB 2.1 feature)
+ at XmlTransient // to treat this class like Object as far as databinding is concerned (proposed JAXB 2.1 feature)
 public abstract class EndpointReference
 {
    //

Modified: stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/RespectBindingFeature.java
===================================================================
--- stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/RespectBindingFeature.java	2009-02-27 18:24:18 UTC (rev 9447)
+++ stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/RespectBindingFeature.java	2009-02-28 14:33:21 UTC (rev 9448)
@@ -94,7 +94,7 @@
     * 
     * Constant value identifying the RespectBindingFeature
     */
-   public static final String ID = "javax.xml.ws.InspectBindingFeature";
+   public static final String ID = "javax.xml.ws.RespectBindingFeature";
 
    /**
     * Create an <code>RespectBindingFeature</code>.

Modified: stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java
===================================================================
--- stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java	2009-02-27 18:24:18 UTC (rev 9447)
+++ stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java	2009-02-28 14:33:21 UTC (rev 9448)
@@ -21,7 +21,6 @@
  */
 package javax.xml.ws.wsaddressing;
 
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.List;
 import java.util.Map;
@@ -82,11 +81,6 @@
    Map<QName, String> attributes;
    @XmlAnyElement
    List<Element> elements;
-
-   // not marshalled
-   private QName serviceName;
-   private QName endpointName;
-   private URL wsdlLocation;
    
    protected W3CEndpointReference()
    {
@@ -124,79 +118,6 @@
       }
    }
 
-   @XmlTransient
-   public String getAddress()
-   {
-      return address != null ? address.getUri() : null;
-   }
-
-   void setAddress(String address)
-   {
-      this.address = new Address(address);
-   }
-   
-   @XmlTransient
-   public QName getServiceName()
-   {
-      return serviceName;
-   }
-
-   public void setServiceName(QName serviceName)
-   {
-      this.serviceName = serviceName;
-   }
-
-   @XmlTransient
-   public QName getEndpointName()
-   {
-      return endpointName;
-   }
-
-   public void setEndpointName(QName endpointName)
-   {
-      this.endpointName = endpointName;
-   }
-
-   @XmlTransient
-   public List<Element> getMetadata()
-   {
-      return metadata != null ? metadata.getElements() : null;
-   }
-
-   public void setMetadata(List<Element> metadata)
-   {
-      this.metadata = new Elements(metadata);
-   }
-
-   @XmlTransient
-   public URL getWsdlLocation()
-   {
-      return wsdlLocation;
-   }
-
-   public void setWsdlLocation(String wsdlLocation)
-   {
-      try
-      {
-         this.wsdlLocation = wsdlLocation != null ? new URL(wsdlLocation) : null;
-      }
-      catch (MalformedURLException e)
-      {
-         throw new IllegalArgumentException("Invalid URL: " + wsdlLocation);
-      }
-   }
-
-   @XmlTransient
-   public List<Element> getReferenceParameters()
-   {
-      return referenceParameters != null ? referenceParameters.getElements() : null;
-   }
-
-   public void setReferenceParameters(List<Element> metadata)
-   {
-      this.referenceParameters = new Elements(metadata);
-   }
-
    /**
     * {@inheritDoc}
     */

Modified: stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java
===================================================================
--- stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java	2009-02-27 18:24:18 UTC (rev 9447)
+++ stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java	2009-02-28 14:33:21 UTC (rev 9448)
@@ -26,6 +26,7 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.WebServiceException;
+import javax.xml.ws.spi.Provider;
 
 import org.w3c.dom.Element;
 
@@ -260,13 +261,8 @@
     */
    public W3CEndpointReference build()
    {
-      W3CEndpointReference epr = new W3CEndpointReference();
-      epr.setAddress(address);
-      epr.setServiceName(serviceName);
-      epr.setEndpointName(endpointName);
-      epr.setMetadata(metadata);
-      epr.setWsdlLocation(wsdlLocation);
-      epr.setReferenceParameters(parameters);
-      return epr;
+      return Provider.provider().createW3CEndpointReference(address,
+            serviceName, endpointName, metadata, wsdlLocation,
+            parameters);
    }
 }

Added: stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/wsaddressing/package-info.java
===================================================================
--- stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/wsaddressing/package-info.java	                        (rev 0)
+++ stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/wsaddressing/package-info.java	2009-02-28 14:33:21 UTC (rev 9448)
@@ -0,0 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.
+ */
+ at javax.xml.bind.annotation.XmlSchema(namespace = "http://www.w3.org/2005/08/addressing",
+                                     location = "http://www.w3.org/2006/03/addressing/ws-addr.xsd")
+package javax.xml.ws.wsaddressing;
\ No newline at end of file


Property changes on: stack/native/trunk/modules/jaxws/src/main/java/javax/xml/ws/wsaddressing/package-info.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jbossws-commits mailing list