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/11 15:39:12 UTC

svn commit: r280131 - /webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/

Author: thilina
Date: Sun Sep 11 06:38:16 2005
New Revision: 280131

URL: http://svn.apache.org/viewcvs?rev=280131&view=rev
Log:
deleting the data-binded generated files
Adding RawXML registration stubs and skeletons

Removed:
    webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeMessageReceiver.java
    webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLCallback.java
    webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeSkeleton.java
    webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeMessageReceiver.java
    webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLMessageReceiver.java
    webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeSkeleton.java
Modified:
    webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java
    webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java
    webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLSkeleton.java
    webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java

Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java?rev=280131&r1=280130&r2=280131&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java Sun Sep 11 06:38:16 2005
@@ -32,7 +32,7 @@
  */
 
 public class ActivationRequesterPortTypeRawXMLSkeleton {
-    MessageContext msgContext;
+    private MessageContext msgContext;
 
     public void init(MessageContext context) {
         this.msgContext = context;

Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java?rev=280131&r1=280130&r2=280131&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java Sun Sep 11 06:38:16 2005
@@ -1,4 +1,4 @@
-    package org.apache.kandula.wscoor;
+package org.apache.kandula.wscoor;
 
 import java.io.IOException;
 
@@ -12,97 +12,110 @@
 import org.apache.axis2.om.OMNamespace;
 import org.apache.kandula.Constants;
 import org.apache.kandula.utility.KandulaListener;
+import org.apache.kandula.utility.KandulaUtils;
 
-    /*
-     *  Auto generated java implementation by the Axis code generator
-    */
-
-    public class RegistrationCoordinatorPortTypeRawXMLStub extends org.apache.axis2.clientapi.Stub{
-        public static final String AXIS2_HOME = ".";
-        protected static org.apache.axis2.description.OperationDescription[] _operations;
-
-        static{
-
-           //creating the Service
-           _service = new org.apache.axis2.description.ServiceDescription(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2003/09/wscoor","RegistrationCoordinatorPortType"));
-
-           //creating the operations
-           org.apache.axis2.description.OperationDescription __operation;
-           _operations = new org.apache.axis2.description.OperationDescription[1];
-      
-          __operation = new org.apache.axis2.description.OperationDescription();
-          __operation.setName(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2003/09/wscoor", "RegisterOperation"));
-          _operations[0]=__operation;
-          _service.addOperation(__operation);
-          
-     
-       }
-
-       /**
-        * Constructor
-        */
-        public RegistrationCoordinatorPortTypeRawXMLStub(String axis2Home,String targetEndpoint) throws java.lang.Exception {
-			this.toEPR = new org.apache.axis2.addressing.EndpointReference(targetEndpoint);
-		    //creating the configuration
-           _configurationContext = new org.apache.axis2.context.ConfigurationContextFactory().buildClientConfigurationContext(axis2Home);
-           _configurationContext.getAxisConfiguration().addService(_service);
-           _serviceContext = _configurationContext.createServiceContext(_service.getName());
-
-	    }
-
-
-        private org.apache.axis2.soap.SOAPEnvelope createSOAPEnvelope(
-                String coordinationType) {
-            org.apache.axis2.soap.SOAPEnvelope env = super.createEnvelope();
-            org.apache.axis2.soap.SOAPFactory factory = OMAbstractFactory
-                    .getSOAP12Factory();
-            OMNamespace wsCoor = factory.createOMNamespace(Constants.WS_COOR,
-                    "wscoor");
-            OMElement request = factory.createOMElement(
-                    "CreateCoordinationContext", wsCoor);
-            OMElement coorType = factory
-                    .createOMElement("CoordinationType", wsCoor);
-            coorType.setText(coordinationType);
-            request.addChild(coorType);
-            env.getBody().addChild(request);
-            return env;
-        }
-
-        public void RegisterOperation(String coordinationType,
-                String id) throws IOException {
-
-            QName serviceName = new QName("RegistrationRequesterPortType");
-            QName operationName = new QName(Constants.WS_COOR,
-                    "RegisterOperation");
-            KandulaListener listener = KandulaListener.getInstance();
-            listener.addService(serviceName, operationName,
-                    RegistrationRequesterPortTypeRawXMLSkeleton.class.getName());
-            listener.start();
-
-            MessageSender messageSender = new MessageSender(_serviceContext);
-            org.apache.axis2.context.MessageContext messageContext = getMessageContext();
-            EndpointReference replyToEpr = new EndpointReference(listener.getHost()
-                    + serviceName.getLocalPart());
-            AnyContentType refProperties = new AnyContentType();
-            refProperties.addReferenceValue(new QName(
-                    "http://ws.apache.org/kandula", id), id);
-            replyToEpr.setReferenceProperties(refProperties);
-            //  messageSender.
-            messageSender.setReplyTo(replyToEpr);
-            messageSender.setTo(this.toEPR);
-            messageSender.setSoapAction("CreateCoordinationContextOperation");
-            //_call.setWsaAction("CreateCoordinationContextOperation");
-            org.apache.axis2.soap.SOAPEnvelope env = createSOAPEnvelope(coordinationType);
-            messageContext.setEnvelope(env);
-            messageSender
-                    .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
-            messageSender.send(_operations[0], messageContext);
-
-        }
-
-     
-      
- 
-      
+/*
+ *  Auto generated java implementation by the Axis code generator
+ */
+
+public class RegistrationCoordinatorPortTypeRawXMLStub extends
+        org.apache.axis2.clientapi.Stub {
+    public static final String AXIS2_HOME = ".";
+
+    protected static org.apache.axis2.description.OperationDescription[] _operations;
+
+    static {
+
+        //creating the Service
+        _service = new org.apache.axis2.description.ServiceDescription(
+                new javax.xml.namespace.QName(
+                        "http://schemas.xmlsoap.org/ws/2003/09/wscoor",
+                        "RegistrationCoordinatorPortType"));
+
+        //creating the operations
+        org.apache.axis2.description.OperationDescription __operation;
+        _operations = new org.apache.axis2.description.OperationDescription[1];
+
+        __operation = new org.apache.axis2.description.OperationDescription();
+        __operation.setName(new javax.xml.namespace.QName(
+                "http://schemas.xmlsoap.org/ws/2003/09/wscoor",
+                "RegisterOperation"));
+        _operations[0] = __operation;
+        _service.addOperation(__operation);
+
+    }
+
+    /**
+     * Constructor
+     */
+    public RegistrationCoordinatorPortTypeRawXMLStub(String axis2Home,
+            EndpointReference targetEndpoint) throws java.lang.Exception {
+        this.toEPR = targetEndpoint;
+        //creating the configuration
+        _configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
+                .buildClientConfigurationContext(axis2Home);
+        _configurationContext.getAxisConfiguration().addService(_service);
+        _serviceContext = _configurationContext.createServiceContext(_service
+                .getName());
+
+    }
+
+    private org.apache.axis2.soap.SOAPEnvelope createSOAPEnvelope(
+            String protocolType,EndpointReference epr) {
+        org.apache.axis2.soap.SOAPEnvelope env = super.createEnvelope();
+        org.apache.axis2.soap.SOAPFactory factory = OMAbstractFactory
+                .getSOAP12Factory();
+        OMNamespace wsCoor = factory.createOMNamespace(Constants.WS_COOR,
+                "wscoor");
+        OMElement request = factory
+                .createOMElement("Register", wsCoor);
+        OMElement protocolTypeElement = factory.createOMElement(
+                "ProtocolIdentifier", wsCoor);
+        protocolTypeElement.setText(protocolType);
+        request.addChild(protocolTypeElement);
+        
+        OMElement protocolService = factory.createOMElement("ParticipantProtocolService",wsCoor);
+        KandulaUtils.endpointToOM(epr,protocolService,factory);
+        request.addChild(protocolService);
+        env.getBody().addChild(request);
+        return env;
+        // protocolidentifier
+        //protocolservice
     }
-    
\ No newline at end of file
+
+    public void RegisterOperation(String protocolType, EndpointReference epr,
+            String id) throws IOException {
+
+        QName serviceName = new QName("RegistrationRequesterPortType");
+        QName operationName = new QName(Constants.WS_COOR, "RegisterOperation");
+        KandulaListener listener = KandulaListener.getInstance();
+        listener.addService(serviceName, operationName,
+                RegistrationRequesterPortTypeRawXMLSkeleton.class.getName());
+        //listener.stop();
+        listener.start();
+
+        MessageSender messageSender = new MessageSender(_serviceContext);
+        org.apache.axis2.context.MessageContext messageContext = getMessageContext();
+        EndpointReference replyToEpr = new EndpointReference(listener.getHost()
+                + serviceName.getLocalPart());
+        AnyContentType refProperties = new AnyContentType();
+        refProperties.addReferenceValue(new QName(
+                "http://ws.apache.org/kandula", id), id);
+        //replyToEpr.setReferenceProperties(refProperties);
+        //  messageSender.
+        messageSender.setReplyTo(replyToEpr);
+        messageSender.setTo(this.toEPR);
+        messageSender.setSoapAction("RegisterOperation");
+        //_call.setWsaAction("CreateCoordinationContextOperation");
+        org.apache.axis2.soap.SOAPEnvelope env = createSOAPEnvelope(protocolType,epr);
+        messageContext.setEnvelope(env);
+
+        System.out.println("visited registration send");
+
+        messageSender
+                .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+        messageSender.send(_operations[0], messageContext);
+
+    }
+
+}
\ No newline at end of file

Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLSkeleton.java?rev=280131&r1=280130&r2=280131&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLSkeleton.java Sun Sep 11 06:38:16 2005
@@ -16,16 +16,78 @@
  */
 package org.apache.kandula.wscoor;
 
+import java.util.ArrayList;
+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.context.MessageContext;
+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.KandulaException;
+import org.apache.kandula.coordinator.CoordinatorImpl;
+import org.apache.kandula.participant.standalone.TransactionManager;
+import org.apache.kandula.utility.KandulaUtils;
 
 /**
  * @author <a href="mailto:thilina@apache.org"> Thilina Gunarathne </a>
  */
 
 public class RegistrationPortTypeRawXMLSkeleton {
+    private MessageContext msgContext;
+
+    public void init(MessageContext msgContext) {
+        this.msgContext = msgContext;
+    }
+
+    public OMElement RegisterOperation(OMElement request)
+            throws KandulaException {
+
+        String protocolIdentifier = request.getFirstChildWithName(
+                new QName("ProtocolIdentifier")).getText();
+        OMElement participantEPRElement = request
+                .getFirstChildWithName(new QName("ParticipantProtocolService"));
+        EndpointReference participantEPR = new EndpointReference(
+                participantEPRElement.getFirstChildWithName(
+                        new QName("Address")).getText());
+        AnyContentType referenceProperties = new AnyContentType();
+        OMElement referencePropertiesElement = participantEPRElement
+                .getFirstChildWithName(new QName("ReferenceProperties"));
+        Iterator propertyIter = referencePropertiesElement.getChildElements();
+        while (propertyIter.hasNext()) {
+            OMElement element = (OMElement) propertyIter.next();
+            referenceProperties.addReferenceValue(element.getQName(), element
+                    .getText());
+        }
+        participantEPR.setReferenceProperties(referenceProperties);
+
+        //have to extract the reference parameter "id". Axis2 does not support
+        ArrayList list = msgContext.getMessageInformationHeaders()
+                .getReferenceParameters();
+
+        CoordinatorImpl coordinator = new CoordinatorImpl();
+        EndpointReference epr = coordinator.registerParticipant(
+                TransactionManager.tempID, protocolIdentifier, participantEPR);
+        System.out.println("visited registration skeleton");
+        return toOM(epr);
+    }
 
-    public OMElement RegisterOperation(OMElement request) {
-        //Todo fill this with the necessary business logic
-        return null;
+    private OMElement toOM(EndpointReference epr) {
+        SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
+        OMNamespace wsCoor = factory.createOMNamespace(
+                org.apache.kandula.Constants.WS_COOR, "wscoor");
+        OMElement protocolService = factory.createOMElement(
+                "CoordinatorProtocolService", wsCoor);
+        OMElement coordinatorProtocolService = factory.createOMElement(
+                "CoordinatorProtocolService", wsCoor);
+        KandulaUtils.endpointToOM(epr,coordinatorProtocolService,factory);
+        protocolService.addChild(coordinatorProtocolService);
+        return protocolService;
     }
 }

Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java?rev=280131&r1=280130&r2=280131&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java Sun Sep 11 06:38:16 2005
@@ -32,7 +32,7 @@
  */
 
 public class RegistrationRequesterPortTypeRawXMLSkeleton {
-    MessageContext msgContext;
+    private MessageContext msgContext;
 
     public void init(MessageContext context) {
         this.msgContext = context;



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