axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r355556 - in /webservices/axis2/trunk/java/modules: addressing/src/org/apache/axis2/handlers/addressing/ addressing/test/org/apache/axis2/handlers/addressing/ core/src/org/apache/axis2/addressing/ core/test/org/apache/axis2/addressing/
Date Fri, 09 Dec 2005 18:01:21 GMT
Author: chinthaka
Date: Fri Dec  9 10:01:06 2005
New Revision: 355556

URL: http://svn.apache.org/viewcvs?rev=355556&view=rev
Log:
Slowly cleaning up addressing stuff. Its not complete yet. But need to commit this to get
ready for the hackathon.

Added:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalOutHandler.java
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingHandler.java
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionOutHandler.java
Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTest.java
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/EndpointReference.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/ServiceName.java
    webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/addressing/EndpointReferenceTypeTest.java

Added: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java?rev=355556&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java
(added)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java
Fri Dec  9 10:01:06 2005
@@ -0,0 +1,23 @@
+package org.apache.axis2.handlers.addressing;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public class AddressingFinalInHandler extends AddressingInHandler {
+
+}

Added: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalOutHandler.java?rev=355556&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalOutHandler.java
(added)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalOutHandler.java
Fri Dec  9 10:01:06 2005
@@ -0,0 +1,23 @@
+package org.apache.axis2.handlers.addressing;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public class AddressingFinalOutHandler extends AddressingOutHandler{
+
+}

Added: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingHandler.java?rev=355556&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingHandler.java
(added)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingHandler.java
Fri Dec  9 10:01:06 2005
@@ -0,0 +1,35 @@
+package org.apache.axis2.handlers.addressing;
+
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public abstract class AddressingHandler extends AbstractHandler implements AddressingConstants
{
+
+    // this parameter has to be set by the module deployer.
+    protected boolean isAddressingOptional = true;
+
+    protected String addressingNamespace = null;
+
+    protected Log logger = LogFactory.getLog(getClass());
+
+}

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java?rev=355556&r1=355555&r2=355556&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
Fri Dec  9 10:01:06 2005
@@ -19,30 +19,22 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.AnyContentType;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.MessageInformationHeaders;
 import org.apache.axis2.addressing.RelatesTo;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceGroupContext;
-import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.axis2.om.OMAttribute;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.soap.SOAPHeader;
 import org.apache.axis2.soap.SOAPHeaderBlock;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
 import java.util.Iterator;
 
-public class AddressingInHandler extends AbstractHandler implements AddressingConstants {
+public class AddressingInHandler extends AddressingHandler {
     // this parameter has to be set by the module deployer.
-    private boolean isAddressingOptional = true;
-    protected String addressingNamespace = null;
-
-    private Log logger = LogFactory.getLog(getClass());
 
     public void invoke(MessageContext msgContext) throws AxisFault {
         logger.debug("Starting Addressing IN Handler .........");
@@ -254,25 +246,14 @@
             if (checkElement(new QName(addressingNamespace, AddressingConstants.EPR_ADDRESS),
eprChildElement.getQName())) {
                 epr.setAddress(eprChildElement.getText());
             } else if (checkElement(new QName(addressingNamespace, AddressingConstants.EPR_REFERENCE_PARAMETERS),
eprChildElement.getQName())) {
-                AnyContentType anyContentType = new AnyContentType();
-                if (epr.getReferenceParameters() == null) {
-                    epr.setReferenceParameters(anyContentType);
-                }
+
                 Iterator referenceParameters = eprChildElement.getChildElements();
                 while (referenceParameters.hasNext()) {
                     OMElement element = (OMElement) referenceParameters.next();
-                    epr.getReferenceParameters().addReferenceValue(element.getQName(), element.getText());
+                    epr.addReferenceParameter(element);
                 }
             } else if (checkElement(new QName(addressingNamespace, AddressingConstants.Final.WSA_METADATA),
eprChildElement.getQName())) {
-                AnyContentType anyContentType = new AnyContentType();
-                if (epr.getMetadata() == null) {
-                    epr.setMetadata(anyContentType);
-                }
-                Iterator metadataChildren = eprChildElement.getChildElements();
-                while (metadataChildren.hasNext()) {
-                    OMElement element = (OMElement) metadataChildren.next();
-                    epr.getMetadata().addReferenceValue(element.getQName(), element.getText());
-                }
+                epr.setMetaData(eprChildElement);
             }
         }
     }

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java?rev=355556&r1=355555&r2=355556&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
Fri Dec  9 10:01:06 2005
@@ -19,12 +19,10 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.AnyContentType;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.MessageInformationHeaders;
 import org.apache.axis2.addressing.ServiceName;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMNamespace;
@@ -34,12 +32,10 @@
 
 import javax.xml.namespace.QName;
 import java.util.Iterator;
+import java.util.Map;
 
-public class AddressingOutHandler
-        extends AbstractHandler
-        implements AddressingConstants {
+public class AddressingOutHandler extends AddressingHandler {
 
-    private boolean isAddressingEnabled = true;
 
     // IN message, if any, has messageId and replyTo and faultTo addresses that needs to
be used
     // in the OUT message. User may sometimes override these values, at his discretion .The
following
@@ -53,7 +49,7 @@
     public void invoke(MessageContext msgContext) throws AxisFault {
 
 
-        if (!isAddressingEnabled || msgContext.getMessageInformationHeaders() == null) {
+        if (msgContext.getMessageInformationHeaders() == null) {
             return;
         }
 
@@ -109,10 +105,8 @@
                 toHeaderBlock.setText(address);
             }
 
-            AnyContentType referenceParameters = epr.getReferenceParameters();
-            if (referenceParameters != null) {
-                processAnyContentType(referenceParameters, soapHeader);
-            }
+            processReferenceInformation(epr.getAllReferenceParameters(), soapHeader);
+            processReferenceInformation(epr.getAllReferenceProperties(), soapHeader);
 
             addToHeader(epr, soapHeader);
         }
@@ -137,10 +131,7 @@
             // add the service group id as a reference parameter
             String serviceGroupContextId = msgContext.getServiceGroupContextId();
             if (serviceGroupContextId != null && !"".equals(serviceGroupContextId))
{
-                if (epr.getReferenceParameters() == null) {
-                    epr.setReferenceParameters(new AnyContentType());
-                }
-                epr.getReferenceParameters().addReferenceValue(new QName(Constants.AXIS2_NAMESPACE_URI,
+                epr.addReferenceParameter(new QName(Constants.AXIS2_NAMESPACE_URI,
                         Constants.SERVICE_GROUP_ID, Constants.AXIS2_NAMESPACE_PREFIX), serviceGroupContextId);
             }
             addToSOAPHeader(epr, AddressingConstants.WSA_REPLY_TO, soapHeader);
@@ -222,26 +213,26 @@
         addToHeader(epr, soapHeaderBlock);
 
 
-        AnyContentType referenceParameters = epr.getReferenceParameters();
+        Map referenceParameters = epr.getAllReferenceParameters();
         if (referenceParameters != null) {
             OMElement reference =
                     OMAbstractFactory.getOMFactory().createOMElement(
                             EPR_REFERENCE_PARAMETERS,
                             addressingNamespaceObject);
             soapHeaderBlock.addChild(reference);
-            processAnyContentType(referenceParameters, reference);
+            processReferenceInformation(referenceParameters, reference);
 
         }
 
         if (Submission.WSA_NAMESPACE.equals(addressingNamespace)) {
-            AnyContentType referenceProperties = epr.getReferenceProperties();
+            Map referenceProperties = epr.getAllReferenceProperties();
             if (referenceProperties != null) {
                 OMElement reference =
                         OMAbstractFactory.getOMFactory().createOMElement(
                                 Submission.EPR_REFERENCE_PROPERTIES,
                                 addressingNamespaceObject);
                 soapHeader.addChild(reference);
-                processAnyContentType(referenceParameters, reference);
+                processReferenceInformation(referenceParameters, reference);
             }
 
         }
@@ -250,67 +241,57 @@
 
     private void addToHeader(EndpointReference epr, OMElement parentElement) {
 
+        if (addressingNamespace.equals(Submission.WSA_NAMESPACE)) {
+            QName portType = epr.getPortType();
+            if (portType != null) {
+                OMElement interfaceName =
+                        OMAbstractFactory.getOMFactory().createOMElement(Submission.EPR_PORT_TYPE,
addressingNamespaceObject);
+                interfaceName.addChild(
+                        OMAbstractFactory.getOMFactory().createText(
+                                portType.getPrefix() + ":" +
+                                        portType.getLocalPart()));
+                parentElement.addChild(interfaceName);
+            }
 
-        QName interfaceQName = epr.getInterfaceName();
-        if (interfaceQName != null) {
-            OMElement interfaceName =
-                    OMAbstractFactory.getOMFactory().createOMElement(
-                            addressingNamespace.equals(
-                                    Submission.WSA_NAMESPACE) ?
-                                    Submission.EPR_PORT_TYPE : Final.WSA_INTERFACE_NAME,
-                            addressingNamespaceObject);
-            interfaceName.addChild(
-                    OMAbstractFactory.getOMFactory().createText(
-                            interfaceQName.getPrefix() + ":" +
-                                    interfaceQName.getLocalPart()));
-            parentElement.addChild(interfaceName);
-        }
-
-        ServiceName serviceName = epr.getServiceName();
-        if (serviceName != null) {
-            OMElement serviceNameElement =
-                    OMAbstractFactory.getOMFactory().createOMElement(
-                            EPR_SERVICE_NAME,
-                            addressingNamespaceObject);
-            serviceNameElement.addAttribute(
-                    addressingNamespace.equals(Submission.WSA_NAMESPACE) ?
-                            Submission.EPR_SERVICE_NAME_PORT_NAME :
-                            Final.WSA_SERVICE_NAME_ENDPOINT_NAME,
-                    serviceName.getEndpointName(),
-                    addressingNamespaceObject);
-            serviceNameElement.addChild(
-                    OMAbstractFactory.getOMFactory().createText(
-                            serviceName.getName().getPrefix()
-                                    + ":"
-                                    + serviceName.getName().getLocalPart()));
-            parentElement.addChild(serviceNameElement);
+            ServiceName serviceName = epr.getServiceName();
+            if (serviceName != null) {
+                OMElement serviceNameElement =
+                        OMAbstractFactory.getOMFactory().createOMElement(
+                                EPR_SERVICE_NAME,
+                                addressingNamespaceObject);
+                serviceNameElement.addAttribute(Submission.EPR_SERVICE_NAME_PORT_NAME, serviceName.getPortName(),
+                        addressingNamespaceObject);
+                serviceNameElement.addChild(
+                        OMAbstractFactory.getOMFactory().createText(
+                                serviceName.getName().getPrefix()
+                                        + ":"
+                                        + serviceName.getName().getLocalPart()));
+                parentElement.addChild(serviceNameElement);
+            }
         }
 
 
     }
 
 
-    private void processAnyContentType
-            (AnyContentType
-                    referenceValues,
-             OMElement
-                     parentElement) {
-        if (referenceValues != null) {
-            Iterator iterator = referenceValues.getKeys();
+    /**
+     * This will add reference parameters and/or reference properties in to the message
+     *
+     * @param referenceInformation
+     */
+    private void processReferenceInformation(Map referenceInformation, OMElement parent)
{
+        if (referenceInformation != null && parent != null) {
+            Iterator iterator = referenceInformation.keySet().iterator();
             while (iterator.hasNext()) {
                 QName key = (QName) iterator.next();
-                String value = referenceValues.getReferenceValue(key);
-                OMElement omElement =
-                        OMAbstractFactory.getOMFactory().createOMElement(key,
-                                parentElement);
+                OMElement omElement = (OMElement) referenceInformation.get(key);
+
                 if (Final.WSA_NAMESPACE.equals(addressingNamespace)) {
-                    omElement.addAttribute(
-                            Final.WSA_IS_REFERENCE_PARAMETER_ATTRIBUTE,
-                            Final.WSA_TYPE_ATTRIBUTE_VALUE,
+                    omElement.addAttribute(Final.WSA_IS_REFERENCE_PARAMETER_ATTRIBUTE, Final.WSA_TYPE_ATTRIBUTE_VALUE,
                             addressingNamespaceObject);
 
                 }
-                omElement.setText(value);
+                parent.addChild(omElement);
             }
         }
     }

Added: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java?rev=355556&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java
(added)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java
Fri Dec  9 10:01:06 2005
@@ -0,0 +1,23 @@
+package org.apache.axis2.handlers.addressing;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public class AddressingSubmissionInHandler extends AddressingInHandler {
+
+}

Added: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionOutHandler.java?rev=355556&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionOutHandler.java
(added)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionOutHandler.java
Fri Dec  9 10:01:06 2005
@@ -0,0 +1,23 @@
+package org.apache.axis2.handlers.addressing;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public class AddressingSubmissionOutHandler extends AddressingOutHandler {
+
+}

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTest.java?rev=355556&r1=355555&r2=355556&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTest.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInHandlerTest.java
Fri Dec  9 10:01:06 2005
@@ -18,7 +18,6 @@
 
 import junit.framework.TestCase;
 import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.AnyContentType;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.MessageInformationHeaders;
 import org.apache.axis2.handlers.util.TestUtil;
@@ -29,6 +28,7 @@
 import org.apache.commons.logging.LogFactory;
 
 import javax.xml.namespace.QName;
+import java.util.Map;
 
 public class AddressingInHandlerTest extends TestCase {
     private Log log = LogFactory.getLog(getClass());
@@ -106,15 +106,15 @@
                             AddressingConstants.Final.WSA_NAMESPACE);
             assertNotNull(messageInformationHeaders);
             assertNotNull(messageInformationHeaders.getTo());
-            assertNotNull(messageInformationHeaders.getTo().getReferenceParameters());
-            AnyContentType referenceParameters = messageInformationHeaders.getTo().getReferenceParameters();
+
+            Map allReferenceParameters = messageInformationHeaders.getTo().getAllReferenceParameters();
+            assertNotNull(allReferenceParameters);
             QName qName = new QName("http://ws.apache.org/namespaces/axis2", "ParamOne",
"axis2");
-            assertNotNull(referenceParameters.getReferenceValue(qName));
+            assertNotNull(allReferenceParameters.get(qName));
 
         } catch (Exception e) {
             e.printStackTrace();
-
-            log.info(e.getMessage());
+            log.error(e.getMessage());
             fail(" An Exception has occured " + e.getMessage());
         }
     }

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java?rev=355556&r1=355555&r2=355556&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java
Fri Dec  9 10:01:06 2005
@@ -19,7 +19,6 @@
 import junit.framework.TestCase;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.AnyContentType;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.ServiceName;
 import org.apache.axis2.context.MessageContext;
@@ -51,7 +50,7 @@
     public void testAddToSOAPHeader() throws Exception {
         EndpointReference replyTo = new EndpointReference("http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous");
         EndpointReference epr = new EndpointReference("http://www.to.org/service/");
-        epr.setInterfaceName(
+        epr.setPortType(
                 new QName("http://www.from.org/service/port/",
                         "Port",
                         "portNS"));
@@ -62,15 +61,13 @@
                                 "serviceNS"),
                         "port"));
 
-        AnyContentType anyContentType = new AnyContentType();
         for (int i = 0; i < 5; i++) {
-            anyContentType.addReferenceValue(
+            epr.addReferenceParameter(
                     new QName(Submission.WSA_NAMESPACE, "Reference" + i),
                     "Value " + i * 100);
 
         }
 
-        epr.setReferenceParameters(anyContentType);
 
         SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
         SOAPEnvelope defaultEnvelope = factory.getDefaultEnvelope();
@@ -93,23 +90,18 @@
     public void testHeaderCreationFromMsgCtxtInformation() throws Exception {
         msgCtxt = new MessageContext(null);
 
-        AnyContentType referenceValues = new AnyContentType();
-
         EndpointReference epr = new EndpointReference("http://www.from.org/service/");
-        referenceValues.addReferenceValue(new QName("Reference2"),
+        epr.addReferenceParameter(new QName("Reference2"),
                 "Value 200");
-        epr.setReferenceParameters(referenceValues);
         msgCtxt.setFrom(epr);
 
         epr = new EndpointReference("http://www.to.org/service/");
-        referenceValues = new AnyContentType();
-        referenceValues.addReferenceValue(
+        epr.addReferenceParameter(
                 new QName("http://reference.org", "Reference4", "myRef"),
                 "Value 400");
-        referenceValues.addReferenceValue(
+        epr.addReferenceParameter(
                 new QName("http://reference.org", "Reference3", "myRef"),
                 "Value 300");
-        epr.setReferenceParameters(referenceValues);
 
         epr.setServiceName(
                 new ServiceName(
@@ -118,7 +110,7 @@
                                 "serviceNS"),
                         "port"));
 
-        epr.setInterfaceName(
+        epr.setPortType(
                 new QName("http://www.from.org/service/port/",
                         "Port",
                         "portNS"));

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/EndpointReference.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/EndpointReference.java?rev=355556&r1=355555&r2=355556&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/EndpointReference.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/EndpointReference.java
Fri Dec  9 10:01:06 2005
@@ -15,44 +15,33 @@
  */
 package org.apache.axis2.addressing;
 
+import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
 
 import javax.xml.namespace.QName;
 import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * Class EndpointReference
- * TODO : Policy has not been integrated to this
+ * Contents of this class differs between WS-A Submission and WS-Final. Without having a
+ * inheritance hierarchy for this small difference, lets have all the properties in the same
class.
  */
 public class EndpointReference implements Serializable {
-    /**
-     * Required property. may be a logical address or identifier for the service endpoint
-     */
-    private String address;
-
-    /**
-     * Field interfaceName
-     */
-    private QName interfaceName;
-
-    /**
-     * Field referenceProperties
-     */
-    private AnyContentType referenceProperties;
 
-    /**
-     * Field referenceParameters
-     */
-    private AnyContentType referenceParameters;
+    // Commons properties
+    private String address;
+    private Map referenceParameters;
 
-    /**
-     * Field serviceName
-     */
+    // Properties from WS-A Submission version
+    private Map referenceProperties;
+    private QName portType;
     private ServiceName serviceName;
+    private OMElement policy;
 
-    private OMElement policies;
-
-    private AnyContentType metadata;
+    // Properties from WS-A Final
+    private OMElement metaData;
 
     /**
      * @param address
@@ -78,90 +67,141 @@
     }
 
     /**
-     * Method getInterfaceName
+     * Method getServiceName
      */
-    public QName getInterfaceName() {
-        return interfaceName;
+    public ServiceName getServiceName() {
+        return serviceName;
     }
 
     /**
-     * Method setInterfaceName
+     * Method setServiceName
      *
-     * @param interfaceName
+     * @param serviceName
      */
-    public void setInterfaceName(QName interfaceName) {
-        this.interfaceName = interfaceName;
+    public void setServiceName(ServiceName serviceName) {
+        this.serviceName = serviceName;
     }
 
-    /**
-     * Method getReferenceProperties
-     */
-    public AnyContentType getReferenceProperties() {
-        return referenceProperties;
+    public OMElement getPolicy() {
+        return policy;
     }
 
-    /**
-     * Method setReferenceProperties
-     *
-     * @param referenceProperties
-     */
-    public void setReferenceProperties(AnyContentType referenceProperties) {
-        this.referenceProperties = referenceProperties;
+    public void setPolicy(OMElement policy) {
+        this.policy = policy;
     }
 
     /**
-     * Method getReferenceParameters
+     * This will return a Map of reference parameters with QName as the key and an OMElement
+     * as the value
+     *
+     * @return
      */
-    public AnyContentType getReferenceParameters() {
+    public Map getAllReferenceParameters() {
         return referenceParameters;
     }
 
     /**
-     * Method setReferenceParameters
+     * Set a Map with QName as the key and an OMElement
+     * as the value
      *
      * @param referenceParameters
      */
-    public void setReferenceParameters(AnyContentType referenceParameters) {
+    public void setReferenceParameters(Map referenceParameters) {
         this.referenceParameters = referenceParameters;
     }
 
     /**
-     * Method getServiceName
+     * This will return a Map of reference properties with QName as the key and an OMElement
+     * as the value
+     *
+     * @return
      */
-    public ServiceName getServiceName() {
-        return serviceName;
+    public Map getAllReferenceProperties() {
+        return referenceProperties;
     }
 
     /**
-     * Method setServiceName
+     * Set a Map with QName as the key and an OMElement
+     * as the value
      *
-     * @param serviceName
+     * @param referenceProperties
      */
-    public void setServiceName(ServiceName serviceName) {
-        this.serviceName = serviceName;
+    public void setReferenceProperties(HashMap referenceProperties) {
+        this.referenceProperties = referenceProperties;
     }
 
-    public OMElement getPolicies() {
-        return policies;
+    public QName getPortType() {
+        return portType;
     }
 
-    public void setPolicies(OMElement policies) {
-        this.policies = policies;
+    public void setPortType(QName portType) {
+        this.portType = portType;
     }
 
-    public AnyContentType getMetadata() {
-        return metadata;
+    public OMElement getMetaData() {
+        return metaData;
     }
 
-    public void setMetadata(AnyContentType metadata) {
-        this.metadata = metadata;
+    public void setMetaData(OMElement metaData) {
+        this.metaData = metaData;
     }
 
+
+    /**
+     *
+     * @param qname
+     * @param value - the text of the OMElement. Remember that this is a convenient method
for the user,
+     * which has limited capability. If you want more power use @See EndpointReference#addReferenceParameter(OMElement)
+     */
     public void addReferenceParameter(QName qname, String value) {
-        if (getReferenceParameters() == null) {
-            setReferenceParameters(new AnyContentType());
+        if (qname == null) {
+            return;
+        }
+        OMElement omElement = OMAbstractFactory.getOMFactory().createOMElement(qname, null);
+        omElement.setText(value);
+        addReferenceParameter(omElement);
+    }
+
+    /**
+     *
+     * @param omElement
+     */
+    public void addReferenceParameter(OMElement omElement) {
+        if (omElement == null) {
+            return;
+        }
+        if (referenceParameters == null) {
+            referenceParameters = new HashMap();
+        }
+        referenceParameters.put(omElement.getQName(), omElement);
+    }
+
+    /**
+     * Remember that reference properties are only supported in WS-A Submission version.
+     * @param qname
+     * @param value
+     */
+    public void addReferenceProperty(QName qname, String value) {
+        if (qname == null) {
+            return;
+        }
+        OMElement omElement = OMAbstractFactory.getOMFactory().createOMElement(qname, null);
+        omElement.setText(value);
+        addReferenceProperty(omElement);
+    }
+
+    /**
+     * Remember that reference properties are only supported in WS-A Submission version.
+     * @param omElement
+     */
+    public void addReferenceProperty(OMElement omElement) {
+        if (omElement == null) {
+            return;
+        }
+        if (referenceProperties == null) {
+            referenceProperties = new HashMap();
         }
-        referenceParameters.addReferenceValue(qname, value);
+        referenceProperties.put(omElement.getQName(), omElement);
     }
 
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/ServiceName.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/ServiceName.java?rev=355556&r1=355555&r2=355556&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/ServiceName.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/addressing/ServiceName.java
Fri Dec  9 10:01:06 2005
@@ -16,21 +16,20 @@
 package org.apache.axis2.addressing;
 
 import javax.xml.namespace.QName;
-import java.io.Serializable;
 
 /**
  * Class ServiceName
  */
-public class ServiceName implements Serializable{
+public class ServiceName {
     /**
      * Field name
      */
     private QName name;
 
     /**
-     * Field endpointName
+     * Field portName
      */
-    private String endpointName;
+    private String portName;
 
     /**
      * @param name
@@ -45,7 +44,7 @@
      */
     public ServiceName(QName name, String portName) {
         this.name = name;
-        this.endpointName = portName;
+        this.portName = portName;
     }
 
     /**
@@ -67,20 +66,20 @@
     }
 
     /**
-     * Method getEndpointName
+     * Method getPortName
      *
      * @return
      */
-    public String getEndpointName() {
-        return endpointName;
+    public String getPortName() {
+        return portName;
     }
 
     /**
-     * Method setEndpointName
+     * Method setPortName
      *
-     * @param endpointName
+     * @param portName
      */
-    public void setEndpointName(String endpointName) {
-        this.endpointName = endpointName;
+    public void setPortName(String portName) {
+        this.portName = portName;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/addressing/EndpointReferenceTypeTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/addressing/EndpointReferenceTypeTest.java?rev=355556&r1=355555&r2=355556&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/addressing/EndpointReferenceTypeTest.java
(original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/addressing/EndpointReferenceTypeTest.java
Fri Dec  9 10:01:06 2005
@@ -17,8 +17,10 @@
 package org.apache.axis2.addressing;
 
 import junit.framework.TestCase;
+import org.apache.axis2.om.OMElement;
 
 import javax.xml.namespace.QName;
+import java.util.Map;
 
 
 public class EndpointReferenceTypeTest extends TestCase {
@@ -52,28 +54,25 @@
 
     public void testGetAndSetPortType() {
         QName portType = new QName("www.someport.com", "port");
-        endpointReference.setInterfaceName(portType);
+        endpointReference.setPortType(portType);
         assertEquals("PortType not set/get properly",
                 portType,
-                endpointReference.getInterfaceName());
+                endpointReference.getPortType());
     }
 
     public void testGetAndSetReferenceProperties() {
-        AnyContentType anyContentType = new AnyContentType();
         for (int i = 0; i < 10; i++) {
-            anyContentType.addReferenceValue(
+            endpointReference.addReferenceProperty(
                     new QName("http://www.opensouce.lk/" + i, "" + i),
                     "value " + i * 100);
         }
-        endpointReference.setReferenceProperties(anyContentType);
 
-        AnyContentType retrievedAnyContentType = endpointReference.getReferenceProperties();
+        Map retrievedReferenceProperties = endpointReference.getAllReferenceProperties();
         for (int i = 0; i < 10; i++) {
-            String value = retrievedAnyContentType.getReferenceValue(
-                    new QName("http://www.opensouce.lk/" + i, "" + i));
+            OMElement referenceProperty = (OMElement) retrievedReferenceProperties.get(new
QName("http://www.opensouce.lk/" + i, "" + i));
             assertEquals(
                     "Input value differs from what is taken out from AnyContentType",
-                    value,
+                    referenceProperty.getText(),
                     "value " + i * 100);
         }
 
@@ -82,19 +81,18 @@
     public void testGetAndSetReferenceParameters() {
         AnyContentType anyContentType = new AnyContentType();
         for (int i = 0; i < 10; i++) {
-            anyContentType.addReferenceValue(
+            endpointReference.addReferenceParameter(
                     new QName("http://www.opensouce.lk/" + i, "" + i),
                     "value " + i * 50);
         }
-        endpointReference.setReferenceParameters(anyContentType);
 
-        AnyContentType retrievedAnyContentType = endpointReference.getReferenceParameters();
+        Map retrievedReferenceParameters = endpointReference.getAllReferenceParameters();
         for (int i = 0; i < 10; i++) {
-            String value = retrievedAnyContentType.getReferenceValue(
+            OMElement referenceParameter = (OMElement) retrievedReferenceParameters.get(
                     new QName("http://www.opensouce.lk/" + i, "" + i));
             assertEquals(
                     "Input value differs from what is taken out from AnyContentType",
-                    value,
+                    referenceParameter.getText(),
                     "value " + i * 50);
         }
     }
@@ -118,8 +116,8 @@
                 serviceName.getName(),
                 retrievedServiceName.getName());
         assertEquals("ServiceName portName has not been get/set properly",
-                serviceName.getEndpointName(),
-                retrievedServiceName.getEndpointName());
+                serviceName.getPortName(),
+                retrievedServiceName.getPortName());
     }
 
 }



Mime
View raw message