You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/06/12 21:23:47 UTC

svn commit: r784242 - in /cxf/sandbox/geronimo-jaxws_2.2_spec: TODO src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java

Author: dkulp
Date: Fri Jun 12 19:23:46 2009
New Revision: 784242

URL: http://svn.apache.org/viewvc?rev=784242&view=rev
Log:
Update the W3CEndpointReference stuff

Modified:
    cxf/sandbox/geronimo-jaxws_2.2_spec/TODO
    cxf/sandbox/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java
    cxf/sandbox/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java

Modified: cxf/sandbox/geronimo-jaxws_2.2_spec/TODO
URL: http://svn.apache.org/viewvc/cxf/sandbox/geronimo-jaxws_2.2_spec/TODO?rev=784242&r1=784241&r2=784242&view=diff
==============================================================================
--- cxf/sandbox/geronimo-jaxws_2.2_spec/TODO (original)
+++ cxf/sandbox/geronimo-jaxws_2.2_spec/TODO Fri Jun 12 19:23:46 2009
@@ -16,7 +16,3 @@
 INFO: 8000: javax.xml.ws.spi.http.HttpContext: Class javax.xml.ws.spi.http.HttpContext added
 INFO: 8000: javax.xml.ws.spi.http.HttpExchange: Class javax.xml.ws.spi.http.HttpExchange added
 INFO: 8000: javax.xml.ws.spi.http.HttpHandler: Class javax.xml.ws.spi.http.HttpHandler added
-INFO: 7011: javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder: Method 'public javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder attribute(javax.xml.namespace.QName, java.lang.String)' has been added
-INFO: 7011: javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder: Method 'public javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder element(org.w3c.dom.Element)' has been added
-INFO: 7011: javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder: Method 'public javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder interfaceName(javax.xml.namespace.QName)' has been added
-INFO: 7003: javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder: Method 'public java.lang.String toString()' has been removed, but an inherited definition exists.

Modified: cxf/sandbox/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java?rev=784242&r1=784241&r2=784242&view=diff
==============================================================================
--- cxf/sandbox/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java (original)
+++ cxf/sandbox/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java Fri Jun 12 19:23:46 2009
@@ -155,7 +155,7 @@
         @XmlSchemaType(name = "anyURI")
         protected String value;
         @XmlAnyAttribute
-        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+        protected Map<QName, String> otherAttributes = new HashMap<QName, String>();
         
         public AttributedURIType() {
         }
@@ -189,7 +189,7 @@
         @XmlAnyElement(lax = true)
         protected List<Object> any;
         @XmlAnyAttribute
-        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+        protected Map<QName, String> otherAttributes = new HashMap<QName, String>();
         
         public ReferenceParametersType() {
         }
@@ -223,7 +223,7 @@
         @XmlAnyElement(lax = true)
         protected List<Object> any;
         @XmlAnyAttribute
-        private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+        protected Map<QName, String> otherAttributes = new HashMap<QName, String>();
         
         public MetadataType() {
         }

Modified: cxf/sandbox/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java?rev=784242&r1=784241&r2=784242&view=diff
==============================================================================
--- cxf/sandbox/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java (original)
+++ cxf/sandbox/geronimo-jaxws_2.2_spec/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java Fri Jun 12 19:23:46 2009
@@ -24,15 +24,20 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.spi.Provider;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 public final class W3CEndpointReferenceBuilder {
     private String address;
     private QName serviceName;
     private QName endpointName;
+    private QName interfaceName;
     private String wsdlDocumentLocation;
     private List<Element> referenceParameters;
     private List<Element> metadataElements;
+    private List<Element> elements;
+    private Map<QName, String> attributes;
     
     public W3CEndpointReferenceBuilder() {
     }
@@ -90,18 +95,64 @@
         return this;
     }
     
-    public W3CEndpointReference build() {
-        return Provider.provider().createW3CEndpointReference(address,
-                serviceName,
-                endpointName,
-                metadataElements,
-                wsdlDocumentLocation,
-                referenceParameters);
+    /**
+     * @since 2.2
+     */
+    public W3CEndpointReferenceBuilder attribute(QName name, String value) {
+        if (name == null || value == null) {
+            throw new IllegalArgumentException("An attribute name or value cannot be null.");
+        }
+        
+        if (this.attributes == null) {
+            this.attributes = new HashMap<QName, String>();
+        }
+        attributes.put(name, value);
+        return this;
+    }
+    /**
+     * @since 2.2
+     */
+    public W3CEndpointReferenceBuilder element(Element el) {
+        if (el == null) {
+            throw new IllegalArgumentException("An element cannot be null.");
+        }
+        
+        if (this.elements == null) {
+            this.elements = new ArrayList<Element>();
+        }
+        elements.add(el);
+        return this;
+    }
+    /**
+     * @since 2.2
+     */
+    public W3CEndpointReferenceBuilder interfaceName(QName iname) {
+        interfaceName = iname;
+        return this;
     }
 
-    @Override
-    public String toString() {
-        // TODO Auto-generated method stub
-        return super.toString();
+    
+    public W3CEndpointReference build() {
+        try {
+            //JAX-WS 2.2 runtime
+            return Provider.provider().createW3CEndpointReference(address, 
+                                                                  interfaceName, 
+                                                                  serviceName,
+                                                                  endpointName,
+                                                                  metadataElements,
+                                                                  wsdlDocumentLocation,
+                                                                  referenceParameters,
+                                                                  elements,
+                                                                  attributes);            
+        } catch (UnsupportedOperationException ex) {
+            //Probably a JAX-WS 2.1 runtime
+            return Provider.provider().createW3CEndpointReference(address,
+                                                                  serviceName,
+                                                                  endpointName,
+                                                                  metadataElements,
+                                                                  wsdlDocumentLocation,
+                                                                  referenceParameters);
+        }
     }
+
 }