You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by th...@apache.org on 2005/09/01 07:09:35 UTC

svn commit: r265652 - in /webservices/kandula/trunk/java/src/org/apache/kandula/typemapping: CoordinationContext.java EndPointReference.java SimpleCoordinationContext.java xmlbeansimpl/XmlBeansTypeCoordinationContext.java

Author: thilina
Date: Wed Aug 31 22:09:19 2005
New Revision: 265652

URL: http://svn.apache.org/viewcvs?rev=265652&view=rev
Log:
Adding SimpleCoordinationContext.java

Added:
    webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/SimpleCoordinationContext.java
Removed:
    webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/EndPointReference.java
Modified:
    webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/CoordinationContext.java
    webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java

Modified: webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/CoordinationContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/CoordinationContext.java?rev=265652&r1=265651&r2=265652&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/CoordinationContext.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/CoordinationContext.java Wed Aug 31 22:09:19 2005
@@ -16,6 +16,8 @@
  */
 package org.apache.kandula.typemapping;
 
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.om.OMElement;
 import org.apache.kandula.typemapping.xmlbeansimpl.XmlBeansTypeCoordinationContext;
 
 /**
@@ -26,7 +28,7 @@
 
     public abstract String getCoordinationType();
 
-    public abstract EndPointReference getRegistrationService();
+    public abstract EndpointReference getRegistrationService();
 
     public abstract long getExpires();
     
@@ -34,15 +36,20 @@
 
     public abstract void setCoordinationType(String value);
 
-    public abstract void setRegistrationService(EndPointReference value);
+    public abstract void setRegistrationService(EndpointReference value);
 
     public abstract void setExpires(long value);
     
+    public abstract OMElement toOM();
+    
     public abstract Object getCoordinationContextType();
 
     public static final class Factory {
         public static CoordinationContext newInstance() {
-            return new XmlBeansTypeCoordinationContext();
+            return new SimpleCoordinationContext();
+        }
+        public static CoordinationContext newInstance(OMElement contextElement) {
+            return new SimpleCoordinationContext(contextElement);
         }
         public static CoordinationContext newInstance(Object contextType) {
             return new XmlBeansTypeCoordinationContext(contextType);

Added: webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/SimpleCoordinationContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/SimpleCoordinationContext.java?rev=265652&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/SimpleCoordinationContext.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/SimpleCoordinationContext.java Wed Aug 31 22:09:19 2005
@@ -0,0 +1,170 @@
+/*
+ * Copyright  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.
+ *
+ */
+package org.apache.kandula.typemapping;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AnyContentType;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.AddressingConstants.Final;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.kandula.Constants;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class SimpleCoordinationContext implements CoordinationContext {
+    String activityID;
+
+    String coordinationType;
+
+    long expires;
+
+    EndpointReference registrationServiceEpr;
+
+    OMElement contextElement = null;
+
+    public SimpleCoordinationContext() {
+        super();
+
+    }
+
+    public SimpleCoordinationContext(OMElement contextElement) {
+        super();
+        this.contextElement = contextElement;
+        activityID = contextElement.getFirstChildWithName(
+                new QName("Identifier")).getText();
+        coordinationType = contextElement.getFirstChildWithName(
+                new QName("CoordinationType")).getText();
+        OMElement registrationElement =  contextElement.getFirstChildWithName(
+                new QName("RegistrationService"));
+        registrationServiceEpr = new EndpointReference(registrationElement
+                .getFirstChildWithName(new QName("Address")).getText());
+        AnyContentType referenceProperties = new AnyContentType();
+        OMElement referencePropertiesElement = registrationElement
+                .getFirstChildWithName(new QName("ReferenceProperties"));
+        Iterator propertyIter = referencePropertiesElement.getChildElements();
+        while (propertyIter.hasNext()) {
+            OMElement element = (OMElement) propertyIter.next();
+            referenceProperties.addReferenceValue(element.getQName(), element
+                    .getText());
+        }
+        registrationServiceEpr.setReferenceProperties(referenceProperties);
+    }
+
+    public String getActivityID() {
+        return activityID;
+    }
+
+    public String getCoordinationType() {
+        return coordinationType;
+    }
+
+    public EndpointReference getRegistrationService() {
+        return this.registrationServiceEpr;
+    }
+
+    public long getExpires() {
+        return expires;
+    }
+
+    public void setActivityID(String value) {
+        this.activityID = value;
+
+    }
+
+    public void setCoordinationType(String value) {
+        this.coordinationType = value;
+
+    }
+
+    public void setRegistrationService(EndpointReference epr) {
+        this.registrationServiceEpr = epr;
+    }
+
+    public void setExpires(long value) {
+        this.expires = value;
+    }
+
+    public Object getCoordinationContextType() {
+        return this;
+    }
+
+    public OMElement toOM() {
+        if (contextElement != null) {
+            return contextElement;
+        } else {
+            SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
+            OMNamespace wsCoor = factory.createOMNamespace(Constants.WS_COOR,
+                    "wscoor");
+            OMElement contextElement = factory.createOMElement(
+                    "CoordinationContext", wsCoor);
+            if (this.expires != 0) {
+                OMElement expiresElement = factory.createOMElement("Expires",
+                        wsCoor);
+                expiresElement.setText(Long.toString(this.expires));
+                contextElement.addChild(expiresElement);
+            }
+            OMElement identifierElement = factory.createOMElement("Identifier",
+                    wsCoor);
+            identifierElement.setText(this.activityID);
+            contextElement.addChild(identifierElement);
+            OMElement coorTypeElement = factory.createOMElement(
+                    "CoordinationType", wsCoor);
+            coorTypeElement.setText(this.coordinationType);
+            contextElement.addChild(coorTypeElement);
+            OMElement registrationServiceElement = factory.createOMElement(
+                    "RegistrationService", wsCoor);
+            OMNamespace wsAddressing = factory.createOMNamespace(
+                    AddressingConstants.Submission.WSA_NAMESPACE,
+                    AddressingConstants.WSA_DEFAULT_PRFIX);
+            OMElement addressElement = factory.createOMElement("Address",
+                    wsAddressing);
+            addressElement.setText(registrationServiceEpr.getAddress());
+            registrationServiceElement.addChild(addressElement);
+            AnyContentType referenceValues = registrationServiceEpr
+                    .getReferenceProperties();
+            if (referenceValues != null) {
+                OMElement refPropertyElement = factory.createOMElement(
+                        "ReferenceProperties", wsAddressing);
+                registrationServiceElement.addChild(refPropertyElement);
+                Iterator iterator = referenceValues.getKeys();
+                while (iterator.hasNext()) {
+                    QName key = (QName) iterator.next();
+                    String value = referenceValues.getReferenceValue(key);
+                    OMElement omElement = factory.createOMElement(key,
+                            refPropertyElement);
+                    refPropertyElement.addChild(omElement);
+                    if (Final.WSA_NAMESPACE.equals(wsAddressing)) {
+                        omElement.addAttribute(
+                                Final.WSA_IS_REFERENCE_PARAMETER_ATTRIBUTE,
+                                Final.WSA_TYPE_ATTRIBUTE_VALUE, wsAddressing);
+                    }
+                    omElement.setText(value);
+                }
+            }
+            contextElement.addChild(registrationServiceElement);
+            return contextElement;
+        }
+    }
+}
\ No newline at end of file

Modified: webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java?rev=265652&r1=265651&r2=265652&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/typemapping/xmlbeansimpl/XmlBeansTypeCoordinationContext.java Wed Aug 31 22:09:19 2005
@@ -16,6 +16,8 @@
  */
 package org.apache.kandula.typemapping.xmlbeansimpl;
 
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.om.OMElement;
 import org.apache.kandula.typemapping.CoordinationContext;
 import org.apache.kandula.typemapping.EndPointReference;
 import org.xmlsoap.schemas.ws.x2002.x07.utility.AttributedDateTime;
@@ -50,7 +52,7 @@
         return contextType.getCoordinationType();
     }
 
-    public EndPointReference getRegistrationService() {
+    public EndpointReference getRegistrationService() {
         return null;//contextType.getRegistrationService().
     }
 
@@ -70,8 +72,8 @@
 
     }
 
-    public void setRegistrationService(EndPointReference value) {
-        contextType.setRegistrationService((EndpointReferenceType)value.getEndPointReferenceType());
+    public void setRegistrationService(EndpointReference value) {
+       // contextType.setRegistrationService((EndpointReferenceType)value.getEndPointReferenceType());
 
     }
 
@@ -83,6 +85,13 @@
 
     public Object getCoordinationContextType() {
         return contextType;
+    }
+    /* (non-Javadoc)
+     * @see org.apache.kandula.typemapping.CoordinationContext#toOM()
+     */
+    public OMElement toOM() {
+        // TODO Auto-generated method stub
+        return null;
     }
 
 }



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