axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davidills...@apache.org
Subject svn commit: r487160 - in /webservices/axis2/trunk/java/modules/kernel: src/org/apache/axis2/addressing/EndpointReference.java src/org/apache/axis2/addressing/EndpointReferenceHelper.java test/org/apache/axis2/addressing/EndpointReferenceHelperTest.java
Date Thu, 14 Dec 2006 10:22:10 GMT
Author: davidillsley
Date: Thu Dec 14 02:22:09 2006
New Revision: 487160

URL: http://svn.apache.org/viewvc?view=rev&rev=487160
Log:
Add support for EndpointReference Address element attributes per the addressing schema

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java
    webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/addressing/EndpointReferenceHelperTest.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java?view=diff&rev=487160&r1=487159&r2=487160
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReference.java
Thu Dec 14 02:22:09 2006
@@ -57,6 +57,7 @@
 
     private String name;
     private String address;
+    private ArrayList addressAttributes;
     private ArrayList metaData;
     private Map referenceParameters;
     private ArrayList extensibleElements;
@@ -119,6 +120,14 @@
         this.address = address;
     }
 
+    public ArrayList getAddressAttributes(){
+        return addressAttributes;
+    }
+    
+    public void setAddressAttributes(ArrayList al){
+        addressAttributes = al;
+    }
+    
     /**
      * hasAnonymousAddress
      * 
@@ -266,7 +275,19 @@
      * @deprecated use {@link org.apache.axis2.addressing.EndpointReferenceHelper#fromOM(OMElement)}
instead.
      */
     public void fromOM(OMElement eprOMElement) {
-        setAddress(eprOMElement.getFirstChildWithName(new QName("Address")).getText());
+        OMElement addressElement = eprOMElement.getFirstChildWithName(new QName("Address"));
+        setAddress(addressElement.getText());
+        Iterator allAddrAttributes = addressElement.getAllAttributes();
+        if (addressAttributes == null) {
+            addressAttributes = new ArrayList();
+        }
+
+        while (allAddrAttributes.hasNext()) {
+            OMAttribute attribute = (OMAttribute) allAddrAttributes.next();
+            addressAttributes.add(attribute);
+        }
+        
+        
         OMElement refParamElement = eprOMElement.getFirstChildWithName(new QName(AddressingConstants.EPR_REFERENCE_PARAMETERS));
 
         if (refParamElement != null) {
@@ -327,6 +348,14 @@
             OMNamespace wsaNS = fac.createOMNamespace(AddressingConstants.Final.WSA_NAMESPACE,
AddressingConstants.WSA_DEFAULT_PREFIX);
             OMElement addressE = fac.createOMElement(AddressingConstants.EPR_ADDRESS, wsaNS,
epr);
             addressE.setText(address);
+            
+            if (addressAttributes != null) {
+                Iterator attrIter = addressAttributes.iterator();
+                while (attrIter.hasNext()) {
+                    OMAttribute omAttributes = (OMAttribute) attrIter.next();
+                    addressE.addAttribute(omAttributes);
+                }
+            }
             
             if (this.metaData != null) {
                 OMElement metadataE = fac.createOMElement(AddressingConstants.Final.WSA_METADATA,
wsaNS, epr);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java?view=diff&rev=487160&r1=487159&r2=487160
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java
Thu Dec 14 02:22:09 2006
@@ -15,6 +15,7 @@
 */
 package org.apache.axis2.addressing;
 
+import java.util.ArrayList;
 import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -187,6 +188,15 @@
             String address = epr.getAddress();
             addressE.setText(address);
             
+            ArrayList addressAttributes = epr.getAddressAttributes();
+            if (addressAttributes != null) {
+                Iterator attrIter = addressAttributes.iterator();
+                while (attrIter.hasNext()) {
+                    OMAttribute omAttributes = (OMAttribute) attrIter.next();
+                    addressE.addAttribute(omAttributes);
+                }
+            }
+            
             List metaData = epr.getMetaData();
             if (metaData != null && AddressingConstants.Final.WSA_NAMESPACE.equals(addressingNamespace))
{
                 OMElement metadataE = factory.createOMElement(AddressingConstants.Final.WSA_METADATA,
wsaNS, eprElement);
@@ -240,6 +250,13 @@
                 //We need to identify the address element again in order to ensure
                 //that it is not included with the extensibility elements.
                 epr.setAddress(eprChildElement.getText());
+                Iterator allAddrAttributes = eprChildElement.getAllAttributes();
+                ArrayList addressAttributes = new ArrayList();
+                while (allAddrAttributes.hasNext()) {
+                    OMAttribute attribute = (OMAttribute) allAddrAttributes.next();
+                    addressAttributes.add(attribute);
+                }
+                epr.setAddressAttributes(addressAttributes);
             }
             else if (map.get(AddressingConstants.EPR_REFERENCE_PARAMETERS).equals(qname))
{
                 Iterator iterator = eprChildElement.getChildElements();

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/addressing/EndpointReferenceHelperTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/addressing/EndpointReferenceHelperTest.java?view=diff&rev=487160&r1=487159&r2=487160
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/addressing/EndpointReferenceHelperTest.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/addressing/EndpointReferenceHelperTest.java
Thu Dec 14 02:22:09 2006
@@ -54,12 +54,21 @@
         epr.addReferenceParameter(rp1Qname,"rp1");
         epr.addReferenceParameter(rp2Qname,"rp2");
         
+        ArrayList addressAttributes = new ArrayList();
+        addressAttributes.add(attr1);
+        addressAttributes.add(attr2);
+        epr.setAddressAttributes(addressAttributes);
+        
         OMElement om = EndpointReferenceHelper.toOM(omf, epr, new QName("http://nsurl","localName","prefix"),
AddressingConstants.Final.WSA_NAMESPACE);
         
         //Test deserialize using fromOM(OMElement)
         EndpointReference deser = EndpointReferenceHelper.fromOM(om);
         
         assertEquals(epr.getAddress(),deser.getAddress());
+        ArrayList addrAttrs = deser.getAddressAttributes();
+        assertEquals(attr1,addrAttrs.get(0));
+        assertEquals(attr2,addrAttrs.get(1));
+        
         ArrayList attrs = deser.getAttributes();
         assertEquals(attr1,attrs.get(0));
         assertEquals(attr2,attrs.get(1));
@@ -81,6 +90,10 @@
         EndpointReferenceHelper.fromOM(deser, om, AddressingConstants.Final.WSA_NAMESPACE);
         
         assertEquals(epr.getAddress(),deser.getAddress());
+        addrAttrs = deser.getAddressAttributes();
+        assertEquals(attr1,addrAttrs.get(0));
+        assertEquals(attr2,addrAttrs.get(1));
+        
         attrs = deser.getAttributes();
         assertEquals(attr1,attrs.get(0));
         assertEquals(attr2,attrs.get(1));
@@ -132,6 +145,11 @@
         epr.addReferenceParameter(rp1Qname,"rp1");
         epr.addReferenceParameter(rp2Qname,"rp2");
         
+        ArrayList addressAttributes = new ArrayList();
+        addressAttributes.add(attr1);
+        addressAttributes.add(attr2);
+        epr.setAddressAttributes(addressAttributes);
+        
         OMElement om = EndpointReferenceHelper.toOM(omf, epr, new QName("http://nsurl","localName","prefix"),
AddressingConstants.Submission.WSA_NAMESPACE);
         
         //Add some reference properties.
@@ -148,6 +166,10 @@
         EndpointReference deser = EndpointReferenceHelper.fromOM(om);
         
         assertEquals(epr.getAddress(),deser.getAddress());
+        ArrayList addrAttrs = deser.getAddressAttributes();
+        assertEquals(attr1,addrAttrs.get(0));
+        assertEquals(attr2,addrAttrs.get(1));
+        
         ArrayList attrs = deser.getAttributes();
         assertEquals(attr1,attrs.get(0));
         assertEquals(attr2,attrs.get(1));
@@ -173,6 +195,10 @@
         EndpointReferenceHelper.fromOM(deser, om, AddressingConstants.Submission.WSA_NAMESPACE);
         
         assertEquals(epr.getAddress(),deser.getAddress());
+        addrAttrs = deser.getAddressAttributes();
+        assertEquals(attr1,addrAttrs.get(0));
+        assertEquals(attr2,addrAttrs.get(1));
+        
         attrs = deser.getAttributes();
         assertEquals(attr1,attrs.get(0));
         assertEquals(attr2,attrs.get(1));



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message