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/25 21:37:37 UTC
svn commit: r291467 [1/2] - in /webservices/kandula/trunk/java:
src/org/apache/kandula/ src/org/apache/kandula/context/at/
src/org/apache/kandula/context/coordination/
src/org/apache/kandula/initiator/ src/org/apache/kandula/utility/
src/org/apache/kan...
Author: thilina
Date: Sun Sep 25 12:36:21 2005
New Revision: 291467
URL: http://svn.apache.org/viewcvs?rev=291467&view=rev
Log:
adding New testing repositorries
adding Raw XML WS-AT stubs and skeletons
Improving TransactionManager.java
Added:
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/AbstractATNotifierStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLSkeleton.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLSkeleton.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorServiceListener.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantServiceListener.java
webservices/kandula/trunk/java/test-resources/testing-repository/services/ActivationCoordinator/
webservices/kandula/trunk/java/test-resources/testing-repository/services/ActivationCoordinator/META-INF/
webservices/kandula/trunk/java/test-resources/testing-repository/services/ActivationCoordinator/META-INF/services.xml
webservices/kandula/trunk/java/test-resources/testing-repository/services/RegistrationCoordinator/
webservices/kandula/trunk/java/test-resources/testing-repository/services/RegistrationCoordinator/META-INF/
webservices/kandula/trunk/java/test-resources/testing-repository/services/RegistrationCoordinator/META-INF/services.xml
Modified:
webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java
webservices/kandula/trunk/java/src/org/apache/kandula/context/at/ATActivityContext.java
webservices/kandula/trunk/java/src/org/apache/kandula/context/coordination/SimpleCoordinationContext.java
webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java
webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java
webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaListener.java
webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaUtils.java
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLAsyncMessageReceiver.java
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLSkeleton.java
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/RegistrationPortTypeRawXMLAsyncMessageReceiver.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/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java?rev=291467&r1=291466&r2=291467&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/Constants.java Sun Sep 25 12:36:21 2005
@@ -20,14 +20,51 @@
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
abstract public interface Constants {
+
+ //WS-Coordination URI's
public static final String WS_COOR = "http://schemas.xmlsoap.org/ws/2004/10/wscoor";
+
+ public static final String WS_COOR_CREATE_COORDINATIONCONTEXT = "http://schemas.xmlsoap.org/ws/2004/10/wscoor/CreateCoordinationContext";
+
+ public static final String WS_COOR_CREATE_COORDINATIONCONTEXT_RESPONSE = "http://schemas.xmlsoap.org/ws/2004/10/wscoor/CreateCoordinationContextResponse";
+
+ public static final String WS_COOR_REGISTER = "http://schemas.xmlsoap.org/ws/2004/10/wscoor/Register";
+
+ public static final String WS_COOR_REGISTER_RESPONSE = "http://schemas.xmlsoap.org/ws/2004/10/wscoor/RegisterResponse";
+
+ //WS-AT URI's
+
public static final String WS_AT = "http://schemas.xmlsoap.org/ws/2004/10/wsat";
- public static final String WS_BA = "http://schemas.xmlsoap.org/ws/2004/10/wsba";
+
public static final String WS_AT_COMPLETION = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Completion";
+
+ public static final String WS_AT_COMMIT = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Commit";
+
+ public static final String WS_AT_COMMITTED = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Committed";
+
+ public static final String WS_AT_ROLLBACK = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Rollback";
+
+ public static final String WS_AT_ABORTED = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Aborted";
+
public static final String WS_AT_DURABLE2PC = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Durable2PC";
+
public static final String WS_AT_VOLATILE2PC = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Volatile2PC";
+
+ public static final String WS_AT_PREPARE = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Prepare";
+
+ public static final String WS_AT_PREPARED = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Preapared";
+
+ public static final String WS_AT_REPLAY = "http://schemas.xmlsoap.org/ws/2004/10/wsat/Replay";
+
+ public static final String WS_AT_READONLY = "http://schemas.xmlsoap.org/ws/2004/10/wsat/ReadOnly";
+
public static final String SUB_VOLATILE_REGISTERED = "registered for volatile 2PC";
+
public static final String SUB_DURABLE_REGISTERED = "registered for durable 2PC";
+
+ //WS-BA URI's
+
+ public static final String WS_BA = "http://schemas.xmlsoap.org/ws/2004/10/wsba";
-}
+}
\ No newline at end of file
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/context/at/ATActivityContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/context/at/ATActivityContext.java?rev=291467&r1=291466&r2=291467&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/context/at/ATActivityContext.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/context/at/ATActivityContext.java Sun Sep 25 12:36:21 2005
@@ -52,6 +52,8 @@
private EndpointReference parentEPR;
public static String REQUESTER_ID = "requesterID";
+
+ public static String COORDINATION_EPR = "coordinationEPR";
public static String ACTIVATION_EPR = "activationEPR";
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/context/coordination/SimpleCoordinationContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/context/coordination/SimpleCoordinationContext.java?rev=291467&r1=291466&r2=291467&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/context/coordination/SimpleCoordinationContext.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/context/coordination/SimpleCoordinationContext.java Sun Sep 25 12:36:21 2005
@@ -25,6 +25,7 @@
import org.apache.axis2.om.OMNamespace;
import org.apache.axis2.soap.SOAPFactory;
import org.apache.kandula.Constants;
+import org.apache.kandula.utility.KandulaUtils;
import javax.xml.namespace.QName;
import java.util.Iterator;
@@ -58,18 +59,7 @@
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);
+ registrationServiceEpr = KandulaUtils.endpointFromOM(registrationElement);
}
public String getActivityID() {
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java?rev=291467&r1=291466&r2=291467&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/initiator/TransactionManager.java Sun Sep 25 12:36:21 2005
@@ -16,7 +16,7 @@
*/
package org.apache.kandula.initiator;
-import java.rmi.RemoteException;
+import java.io.IOException;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.kandula.context.AbstractContext;
@@ -27,6 +27,7 @@
import org.apache.kandula.storage.StorageFactory;
import org.apache.kandula.storage.Store;
import org.apache.kandula.utility.EndpointReferenceFactory;
+import org.apache.kandula.wsat.completion.CompletionCoordinatorPortTypeRawXMLStub;
import org.apache.kandula.wscoor.ActivationCoordinatorPortTypeRawXMLStub;
import org.apache.kandula.wscoor.RegistrationCoordinatorPortTypeRawXMLStub;
@@ -45,12 +46,12 @@
public TransactionManager(String coordinationType,
EndpointReference coordinatorEPR) throws AbstractKandulaException {
threadInfo = new ThreadLocal();
- ATInitiatorTransaction transaction = new ATInitiatorTransaction(coordinatorEPR);
+ //ATInitiatorTransaction transaction = new ATInitiatorTransaction(coordinatorEPR);
AbstractContext context = ContextFactory.getInstance().createActivity(
coordinationType, coordinatorEPR);
if (threadInfo.get() != null)
throw new IllegalStateException();
- threadInfo.set(transaction);
+ threadInfo.set(context.getProperty(ATActivityContext.REQUESTER_ID));
//TODO remove this when we get replyTo reference properties correctly
tempID = (String) context.getProperty(ATActivityContext.REQUESTER_ID);
Store store = StorageFactory.getInstance().getStore();
@@ -65,7 +66,6 @@
AbstractContext context = getTransaction();
String id = (String) context
.getProperty(ATActivityContext.REQUESTER_ID);
- threadInfo.set(id);
ActivationCoordinatorPortTypeRawXMLStub activationCoordinator = new ActivationCoordinatorPortTypeRawXMLStub(
".", (EndpointReference) context
.getProperty(ATActivityContext.ACTIVATION_EPR));
@@ -79,28 +79,26 @@
".", context.getCoordinationContext().getRegistrationService());
EndpointReference registrationRequeterPortEPR = EndpointReferenceFactory
.getInstance().getCompletionParticipantEndpoint(id);
- registrationCoordinator.RegisterOperation(
+ registrationCoordinator.registerOperation(
org.apache.kandula.Constants.WS_AT_COMPLETION,
registrationRequeterPortEPR, id);
- while (true) {
+ while (context.getProperty(ATActivityContext.COORDINATION_EPR)==null) {
Thread.sleep(10);
}
}
- public void commit() throws RemoteException {
- // Transaction tx= getTransaction();
- // if (tx == null)
- // throw new IllegalStateException();
- // forget();
- // tx.commit();
+ public void commit() throws AbstractKandulaException, IOException {
+ AbstractContext context = getTransaction();
+ EndpointReference coordinationEPR = (EndpointReference)context.getProperty(ATActivityContext.COORDINATION_EPR);
+ CompletionCoordinatorPortTypeRawXMLStub stub = new CompletionCoordinatorPortTypeRawXMLStub(".",coordinationEPR);
+ stub.commitOperation();
}
- public void rollback() throws RemoteException {
- // Transaction tx= getTransaction();
- // if (tx == null)
- // throw new IllegalStateException();
- // forget();
- // tx.rollback();
+ public void rollback() throws AbstractKandulaException, IOException {
+ AbstractContext context = getTransaction();
+ EndpointReference coordinationEPR = (EndpointReference)context.getProperty(ATActivityContext.COORDINATION_EPR);
+ CompletionCoordinatorPortTypeRawXMLStub stub = new CompletionCoordinatorPortTypeRawXMLStub(".",coordinationEPR);
+ stub.rollbackOperation();
}
// public Transaction suspend() {
@@ -120,7 +118,7 @@
// threadInfo.set(null);
// }
- public AbstractContext getTransaction() throws AbstractKandulaException {
+ private AbstractContext getTransaction() throws AbstractKandulaException {
Object key = threadInfo.get();
AbstractContext context = (AbstractContext) StorageFactory.getInstance().getStore()
.get(key);
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java?rev=291467&r1=291466&r2=291467&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/utility/EndpointReferenceFactory.java Sun Sep 25 12:36:21 2005
@@ -16,11 +16,16 @@
*/
package org.apache.kandula.utility;
-import org.apache.axis2.addressing.AnyContentType;
-import org.apache.axis2.addressing.EndpointReference;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.util.Properties;
import javax.xml.namespace.QName;
-import java.util.Properties;
+
+import org.apache.axis2.addressing.AnyContentType;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.kandula.wsat.completion.CompletionInitiatorServiceListener;
/**
* @author Dasarath Weeratunge
@@ -43,25 +48,25 @@
String location = null;
private EndpointReferenceFactory() {
-// InputStream in = getClass().getClassLoader().getResourceAsStream(
-// PROPERTY_FILE);
-// properties = new Properties();
-// try {
-// properties.load(in);
-// in.close();
-// String host = properties.getProperty(HOST_PROPERTY);
-// if (host == null)
-// host = InetAddress.getLocalHost().getHostAddress();
-// location = properties.getProperty(PROTOCOL_PROPERTY) + "://" + host
-// + ":" + properties.getProperty(PORT_PROPERTY);
-// } catch (Exception e) {
-// if (e instanceof RuntimeException)
-// throw (RuntimeException) e;
-// else
-// throw new RuntimeException(e);
-// }
+ InputStream in = getClass().getClassLoader().getResourceAsStream(
+ PROPERTY_FILE);
+ properties = new Properties();
+ try {
+ properties.load(in);
+ in.close();
+ String host = properties.getProperty(HOST_PROPERTY);
+ if (host == null)
+ host = InetAddress.getLocalHost().getHostAddress();
+ location = properties.getProperty(PROTOCOL_PROPERTY) + "://" + host
+ + ":" + properties.getProperty(PORT_PROPERTY);
+ } catch (Exception e) {
+ if (e instanceof RuntimeException)
+ throw (RuntimeException) e;
+ else
+ throw new RuntimeException(e);
+ }
}
-
+
public static EndpointReferenceFactory getInstance() {
if (instance == null)
instance = new EndpointReferenceFactory();
@@ -79,10 +84,9 @@
return epr;
}
- public EndpointReference getCompletionParticipantEndpoint(String id) {
- //TODO set this somehow reading the conf file
- EndpointReference epr = new EndpointReference(
- "http://localhost:5059/axis/services/CompletionParticipant");
+ public EndpointReference getCompletionParticipantEndpoint(String id) throws IOException {
+ CompletionInitiatorServiceListener serviceListener = CompletionInitiatorServiceListener.getInstance();
+ EndpointReference epr = serviceListener.getEpr();
AnyContentType refProperties = new AnyContentType();
refProperties.addReferenceValue(
new QName("http://ws.apache.org/Kandula", "id"), id);
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaListener.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaListener.java?rev=291467&r1=291466&r2=291467&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaListener.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaListener.java Sun Sep 25 12:36:21 2005
@@ -18,12 +18,16 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.OperationDescription;
+import org.apache.axis2.description.Parameter;
import org.apache.axis2.description.ParameterImpl;
import org.apache.axis2.description.ServiceDescription;
import org.apache.axis2.receivers.AbstractMessageReceiver;
import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
import org.apache.axis2.transport.http.SimpleHTTPServer;
import org.apache.axis2.util.Utils;
+import org.apache.kandula.Constants;
+import org.apache.wsdl.WSDLService;
import javax.xml.namespace.QName;
import java.io.IOException;
@@ -83,25 +87,12 @@
* @throws AxisFault To add services with only one operation, which is the
* frequent case in reponses
*/
- public void addService(QName serviceName, QName operationName,
- String className) throws AxisFault {
- ServiceDescription service = new ServiceDescription(serviceName);
- service.addParameter(new ParameterImpl(
- AbstractMessageReceiver.SERVICE_CLASS, className));
- service.setFileName(className);
+ public void addService(ServiceDescription service) throws AxisFault {
org.apache.axis2.description.OperationDescription responseOperationDesc;
- operations = new org.apache.axis2.description.OperationDescription[1];
-
- responseOperationDesc = new org.apache.axis2.description.OperationDescription();
- responseOperationDesc.setName(operationName);
- responseOperationDesc
- .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
- operations[0] = responseOperationDesc;
- service.addOperation(responseOperationDesc);
+
service.setClassLoader(Thread.currentThread().getContextClassLoader());
responseConfigurationContext.getAxisConfiguration().addService(service);
- responseConfigurationContext.createServiceContext(serviceName);
Utils.resolvePhases(receiver.getSystemContext().getAxisConfiguration(),
service);
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaUtils.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaUtils.java?rev=291467&r1=291466&r2=291467&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaUtils.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/utility/KandulaUtils.java Sun Sep 25 12:36:21 2005
@@ -36,6 +36,7 @@
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class KandulaUtils {
+
public static void endpointToOM(EndpointReference epr, OMElement parentEPR, SOAPFactory factory) {
OMNamespace wsAddressing = factory.createOMNamespace(
AddressingConstants.Submission.WSA_NAMESPACE,
@@ -64,6 +65,24 @@
omElement.setText(value);
}
}
+ }
+
+ public static EndpointReference endpointFromOM(OMElement eprElement)
+ {
+ EndpointReference epr;
+ epr = new EndpointReference(eprElement
+ .getFirstChildWithName(new QName("Address")).getText());
+ AnyContentType referenceProperties = new AnyContentType();
+ OMElement referencePropertiesElement = eprElement
+ .getFirstChildWithName(new QName("ReferenceProperties"));
+ Iterator propertyIter = referencePropertiesElement.getChildElements();
+ while (propertyIter.hasNext()) {
+ OMElement element = (OMElement) propertyIter.next();
+ referenceProperties.addReferenceValue(element.getQName(), element
+ .getText());
+ }
+ epr.setReferenceProperties(referenceProperties);
+ return epr;
}
/**
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/AbstractATNotifierStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/AbstractATNotifierStub.java?rev=291467&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/AbstractATNotifierStub.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/AbstractATNotifierStub.java Sun Sep 25 12:36:21 2005
@@ -0,0 +1,58 @@
+/*
+ * 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.wsat;
+
+import java.io.IOException;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.clientapi.MessageSender;
+import org.apache.axis2.clientapi.Stub;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.kandula.Constants;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public abstract class AbstractATNotifierStub extends Stub {
+ protected static org.apache.axis2.description.OperationDescription[] operations;
+ public AbstractATNotifierStub() {
+ super();
+ }
+ protected void notify(String localName, String action, int opIndex,
+ EndpointReference replyToEPR) throws IOException {
+ org.apache.axis2.context.MessageContext messageContext = getMessageContext();
+ org.apache.axis2.soap.SOAPEnvelope env = super.createEnvelope();
+ org.apache.axis2.soap.SOAPFactory factory = OMAbstractFactory
+ .getSOAP12Factory();
+ OMNamespace wsAT = factory.createOMNamespace(Constants.WS_AT, "wsat");
+ OMElement request = factory.createOMElement(localName, wsAT);
+ env.getBody().addChild(request);
+ messageContext.setEnvelope(env);
+
+ MessageSender messageSender = new MessageSender(_serviceContext);
+ messageSender.setTo(this.toEPR);
+ if (replyToEPR != null) {
+ messageSender.setReplyTo(replyToEPR);
+ }
+ messageSender.setWsaAction(action);
+ messageSender
+ .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ messageSender.send(operations[opIndex], messageContext);
+ }
+}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLSkeleton.java?rev=291467&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLSkeleton.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLSkeleton.java Sun Sep 25 12:36:21 2005
@@ -0,0 +1,93 @@
+package org.apache.kandula.wsat.completion;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.om.OMElement;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.coordinator.Coordinator;
+import org.apache.kandula.faults.AbstractKandulaException;
+
+/**
+ * Auto generated java skeleton for the service by the Axis code generator
+ */
+
+public class CompletionCoordinatorPortTypeRawXMLSkeleton {
+
+ /**
+ * @param requestElement
+ * @throws AbstractKandulaException
+ */
+ public OMElement commitOperation(OMElement requestElement) throws AxisFault {
+ AbstractContext context;
+ System.out.println("Visited Commit operation");
+ // /*
+ // * Extracting data from the incoming message
+ // */
+ // String coordinationType = requestElement.getFirstChildWithName(
+ // new QName("CoordinationType")).getText();
+ // OMElement expiresElement = requestElement
+ // .getFirstChildWithName(new QName("Expires"));
+ // String expires = null;
+ // long expiresL = 0;
+ // if (expiresElement != null) {
+ // expires = expiresElement.getText();
+ // if ((expires != null) && (expires.equals(""))) {
+ // expiresL = Long.parseLong(expires);
+ // }
+ // }
+ //
+ // /*
+ // * Creating the Coordination Context
+ // */
+ // try {
+ // Coordinator coordinator = new Coordinator();
+ // context = coordinator.createCoordinationContext(coordinationType,
+ // expiresL);
+ // return context.getCoordinationContext().toOM();
+ // } catch (AbstractKandulaException e) {
+ // AxisFault fault = new AxisFault(e);
+ // fault.setFaultCode(e.getFaultCode());
+ // throw fault;
+ // }
+ return null;
+ }
+
+ public OMElement rollbackOperation(OMElement requestElement)
+ throws AxisFault {
+ AbstractContext context;
+ System.out.println("Visited Commit operation");
+ ///*
+ // * Extracting data from the incoming message
+ // */
+ //String coordinationType = requestElement.getFirstChildWithName(
+ // new QName("CoordinationType")).getText();
+ //OMElement expiresElement = requestElement
+ // .getFirstChildWithName(new QName("Expires"));
+ //String expires = null;
+ //long expiresL = 0;
+ //if (expiresElement != null) {
+ // expires = expiresElement.getText();
+ // if ((expires != null) && (expires.equals(""))) {
+ // expiresL = Long.parseLong(expires);
+ // }
+ //}
+ //
+ ///*
+ // * Creating the Coordination Context
+ // */
+ //try {
+ // Coordinator coordinator = new Coordinator();
+ // context = coordinator.createCoordinationContext(coordinationType,
+ // expiresL);
+ // return context.getCoordinationContext().toOM();
+ //} catch (AbstractKandulaException e) {
+ // AxisFault fault = new AxisFault(e);
+ // fault.setFaultCode(e.getFaultCode());
+ // throw fault;
+ //}
+ return null;
+ }
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java?rev=291467&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java Sun Sep 25 12:36:21 2005
@@ -0,0 +1,70 @@
+package org.apache.kandula.wsat.completion;
+
+import java.io.IOException;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.clientapi.MessageSender;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.kandula.Constants;
+import org.apache.kandula.wsat.AbstractATNotifierStub;
+
+public class CompletionCoordinatorPortTypeRawXMLStub extends
+ AbstractATNotifierStub {
+ public static final String AXIS2_HOME = ".";
+
+ static {
+
+ //creating the Service
+ _service = new org.apache.axis2.description.ServiceDescription(
+ new javax.xml.namespace.QName(Constants.WS_AT,
+ "CompletionCoordinatorPortType"));
+
+ //creating the operations
+ org.apache.axis2.description.OperationDescription operation;
+ operations = new org.apache.axis2.description.OperationDescription[2];
+
+ operation = new org.apache.axis2.description.OperationDescription();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "commitOperation"));
+ operations[0] = operation;
+ _service.addOperation(operation);
+
+ operation = new org.apache.axis2.description.OperationDescription();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "rollbackOperation"));
+ operations[1] = operation;
+ _service.addOperation(operation);
+ }
+
+ /**
+ * Constructor
+ * @throws AxisFault
+ */
+ public CompletionCoordinatorPortTypeRawXMLStub(String axis2Home,
+ EndpointReference targetEndpoint) throws AxisFault {
+ this.toEPR = targetEndpoint;
+ //creating the configuration
+ _configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
+ .buildClientConfigurationContext(axis2Home);
+ _configurationContext.getAxisConfiguration().addService(_service);
+ _serviceContext = _service.getParent().getServiceGroupContext(
+ _configurationContext).getServiceContext(
+ _service.getName().getLocalPart());
+ }
+
+ public void commitOperation() throws IOException {
+ //TODO must send reply to epr
+ this.notify("Commit", Constants.WS_AT_COMMIT, 0, null);
+
+ }
+
+ public void rollbackOperation() throws IOException {
+ //TODO must send reply to EPR
+ this.notify("Rollback", Constants.WS_AT_ROLLBACK, 1, null);
+
+ }
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLSkeleton.java?rev=291467&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLSkeleton.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLSkeleton.java Sun Sep 25 12:36:21 2005
@@ -0,0 +1,57 @@
+package org.apache.kandula.wsat.completion;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.om.OMElement;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.initiator.TransactionManager;
+import org.apache.kandula.storage.StorageFactory;
+import org.apache.kandula.context.coordination.CoordinationContext;
+
+/*
+ * Copyright 2004,2005 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 <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+
+public class CompletionInitiatorPortTypeRawXMLSkeleton {
+ private MessageContext msgContext;
+
+ public void init(MessageContext context) {
+ this.msgContext = context;
+ }
+
+ public OMElement committedOperation(OMElement requestElement) {
+ if ("CoordinationContext".equals(requestElement.getLocalName())) {
+ msgContext.getMessageInformationHeaders().getReferenceParameters();
+ CoordinationContext coordinationContext = CoordinationContext.Factory.newContext(requestElement);
+ AbstractContext context = (AbstractContext)StorageFactory.getInstance().getStore().get(TransactionManager.tempID);
+ // context.setCoordinationContext(coordinationContext);
+ }
+ return null;
+ }
+ public OMElement abortedOperation(OMElement requestElement) {
+ if ("CoordinationContext".equals(requestElement.getLocalName())) {
+ msgContext.getMessageInformationHeaders().getReferenceParameters();
+ CoordinationContext coordinationContext = CoordinationContext.Factory.newContext(requestElement);
+ AbstractContext context = (AbstractContext)StorageFactory.getInstance().getStore().get(TransactionManager.tempID);
+ //context.setCoordinationContext(coordinationContext);
+ }
+ return null;
+ }
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java?rev=291467&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java Sun Sep 25 12:36:21 2005
@@ -0,0 +1,60 @@
+package org.apache.kandula.wsat.completion;
+
+import java.io.IOException;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.kandula.Constants;
+import org.apache.kandula.wsat.AbstractATNotifierStub;
+
+public class CompletionInitiatorPortTypeRawXMLStub extends
+ AbstractATNotifierStub {
+ public static final String AXIS2_HOME = ".";
+
+ static {
+
+ //creating the Service
+ _service = new org.apache.axis2.description.ServiceDescription(
+ new javax.xml.namespace.QName(Constants.WS_AT,
+ "CompletionInitiatorPortType"));
+
+ //creating the operations
+ org.apache.axis2.description.OperationDescription operation;
+ operations = new org.apache.axis2.description.OperationDescription[2];
+
+ operation = new org.apache.axis2.description.OperationDescription();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "committedOperation"));
+ operations[0] = operation;
+ _service.addOperation(operation);
+
+ operation = new org.apache.axis2.description.OperationDescription();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "abortedOperation"));
+ operations[1] = operation;
+ _service.addOperation(operation);
+ }
+
+ /**
+ * Constructor
+ */
+ public CompletionInitiatorPortTypeRawXMLStub(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 = _service.getParent().getServiceGroupContext(
+ _configurationContext).getServiceContext(
+ _service.getName().getLocalPart());
+ }
+
+ public void committedOperation() throws IOException {
+ this.notify("Committed", Constants.WS_AT_COMMITTED, 0, null);
+ }
+
+ public void abortedOperation() throws IOException {
+ this.notify("Aborted", Constants.WS_AT_ABORTED, 1, null);
+ }
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorServiceListener.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorServiceListener.java?rev=291467&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorServiceListener.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorServiceListener.java Sun Sep 25 12:36:21 2005
@@ -0,0 +1,97 @@
+/*
+ * 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.wsat.completion;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.description.ParameterImpl;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.receivers.AbstractMessageReceiver;
+import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
+import org.apache.kandula.Constants;
+import org.apache.kandula.utility.KandulaListener;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class CompletionInitiatorServiceListener {
+
+ private static CompletionInitiatorServiceListener instance = null;
+ private EndpointReference epr=null;
+
+ private CompletionInitiatorServiceListener() {
+ super();
+ }
+
+ public static CompletionInitiatorServiceListener getInstance() {
+ if (instance == null) {
+ instance = new CompletionInitiatorServiceListener();
+ }
+ return instance;
+ }
+
+ public EndpointReference getEpr() throws IOException
+ {
+ if (epr==null)
+ {
+ this.epr = setupListener();
+ }
+ return this.epr;
+ }
+ private EndpointReference setupListener() throws IOException {
+ QName serviceName = new QName("CompletionInitiatorPortType");
+ String className = CompletionInitiatorPortTypeRawXMLSkeleton.class
+ .getName();
+ ServiceDescription service = new ServiceDescription(serviceName);
+ service.addParameter(new ParameterImpl(
+ AbstractMessageReceiver.SERVICE_CLASS, className));
+ service.setFileName(className);
+
+ QName committedOperationName = new QName(Constants.WS_COOR,
+ "committedOperation");
+ org.apache.axis2.description.OperationDescription committedOperationDesc;
+ String committedMapping = Constants.WS_AT_COMMITTED;
+ committedOperationDesc = new org.apache.axis2.description.OperationDescription();
+ committedOperationDesc.setName(committedOperationName);
+ committedOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+ // Adding the WSA Action mapping to the operation
+ service.addMapping(committedMapping, committedOperationDesc);
+ service.addOperation(committedOperationDesc);
+
+ QName abortedOperationName = new QName(Constants.WS_COOR,
+ "abortedOperation");
+ org.apache.axis2.description.OperationDescription abortedOperationDesc;
+ String abortedMapping = Constants.WS_AT_ABORTED;
+ abortedOperationDesc = new org.apache.axis2.description.OperationDescription();
+ abortedOperationDesc.setName(abortedOperationName);
+ abortedOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+ // Adding the WSA Action mapping to the operation
+ service.addMapping(abortedMapping, abortedOperationDesc);
+ service.addOperation(abortedOperationDesc);
+
+ KandulaListener listener = KandulaListener.getInstance();
+ listener.addService(service);
+ listener.start();
+ return new EndpointReference(listener.getHost()
+ + serviceName.getLocalPart());
+ }
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java?rev=291467&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java Sun Sep 25 12:36:21 2005
@@ -0,0 +1,69 @@
+package org.apache.kandula.wsat.twopc;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.om.OMElement;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.coordinator.Coordinator;
+import org.apache.kandula.faults.AbstractKandulaException;
+
+/**
+ * Auto generated java skeleton for the service by the Axis code generator
+ */
+
+public class CoordinatorPortTypeRawXMLSkeleton {
+
+ /**
+ * @param requestElement
+ * @throws AbstractKandulaException
+ */
+ public OMElement preparedOperation(OMElement requestElement)
+ throws AxisFault {
+ AbstractContext context;
+ System.out.println("Visited Commit operation");
+ return null;
+ }
+ /**
+ * @param requestElement
+ * @throws AbstractKandulaException
+ */
+ public OMElement abortedOperation(OMElement requestElement)
+ throws AxisFault {
+ AbstractContext context;
+ System.out.println("Visited Commit operation");
+ return null;
+ }
+ /**
+ * @param requestElement
+ * @throws AbstractKandulaException
+ */
+ public OMElement readOnlyOperation(OMElement requestElement)
+ throws AxisFault {
+ AbstractContext context;
+ System.out.println("Visited Commit operation");
+ return null;
+ }
+ /**
+ * @param requestElement
+ * @throws AbstractKandulaException
+ */
+ public OMElement committedOperation(OMElement requestElement)
+ throws AxisFault {
+ AbstractContext context;
+ System.out.println("Visited Commit operation");
+ return null;
+ }
+ /**
+ * @param requestElement
+ * @throws AbstractKandulaException
+ */
+ public OMElement replayOperation(OMElement requestElement)
+ throws AxisFault {
+ AbstractContext context;
+ System.out.println("Visited Commit operation");
+ return null;
+ }
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java?rev=291467&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java Sun Sep 25 12:36:21 2005
@@ -0,0 +1,95 @@
+package org.apache.kandula.wsat.twopc;
+
+import java.io.IOException;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.clientapi.MessageSender;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.kandula.Constants;
+import org.apache.kandula.wsat.AbstractATNotifierStub;
+
+public class CoordinatorPortTypeRawXMLStub extends AbstractATNotifierStub {
+ public static final String AXIS2_HOME = ".";
+
+ static {
+
+ //creating the Service
+ _service = new org.apache.axis2.description.ServiceDescription(
+ new javax.xml.namespace.QName(Constants.WS_AT,
+ "CoordinatorPortType"));
+
+ //creating the operations
+ org.apache.axis2.description.OperationDescription operation;
+ operations = new org.apache.axis2.description.OperationDescription[5];
+
+ operation = new org.apache.axis2.description.OperationDescription();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "PreparedOperation"));
+ operations[0] = operation;
+ _service.addOperation(operation);
+
+ operation = new org.apache.axis2.description.OperationDescription();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "AbortedOperation"));
+ operations[1] = operation;
+ _service.addOperation(operation);
+ operation = new org.apache.axis2.description.OperationDescription();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "ReadOnlyOperation"));
+ operations[2] = operation;
+ _service.addOperation(operation);
+
+ operation = new org.apache.axis2.description.OperationDescription();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "CommittedOperation"));
+ operations[3] = operation;
+ _service.addOperation(operation);
+ operation = new org.apache.axis2.description.OperationDescription();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "ReplayOperation"));
+ operations[4] = operation;
+ _service.addOperation(operation);
+ }
+
+ /**
+ * Constructor
+ */
+ public CoordinatorPortTypeRawXMLStub(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 = _service.getParent().getServiceGroupContext(
+ _configurationContext).getServiceContext(
+ _service.getName().getLocalPart());
+ }
+
+ public void preparedOperation() throws IOException {
+ // must send reply to epr
+ this.notify("Prepared", Constants.WS_AT_PREPARED, 0, null);
+ }
+
+ public void abortedOperation() throws IOException {
+ this.notify("Aborted", Constants.WS_AT_ABORTED, 1, null);
+ }
+
+ public void readOnlyOperation() throws IOException {
+ this.notify("ReadOnly", Constants.WS_AT_READONLY, 2, null);
+
+ }
+
+ public void committedOperation() throws IOException {
+ this.notify("Committed", Constants.WS_AT_COMMITTED, 3, null);
+
+ }
+
+ public void replayOperation() throws IOException {
+ //must send reply to epr
+ this.notify("Replay", Constants.WS_AT_REPLAY, 4, null);
+ }
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java?rev=291467&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java Sun Sep 25 12:36:21 2005
@@ -0,0 +1,54 @@
+package org.apache.kandula.wsat.twopc;
+
+import java.io.IOException;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.om.OMElement;
+import org.apache.kandula.Constants;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.initiator.TransactionManager;
+import org.apache.kandula.storage.StorageFactory;
+import org.apache.kandula.context.coordination.CoordinationContext;
+
+/*
+ * Copyright 2004,2005 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 <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+
+public class ParticipantPortTypeRawXMLSkeleton {
+ private MessageContext msgContext;
+
+ public void init(MessageContext context) {
+ this.msgContext = context;
+ }
+
+ public OMElement prepareOperation(OMElement requestEle){
+ return null;
+
+ }
+
+ public OMElement commitOperation(OMElement requestEle) {
+ return null;
+ }
+
+ public OMElement rollbackOperation(OMElement requestEle){
+ return null;
+ }
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java?rev=291467&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java Sun Sep 25 12:36:21 2005
@@ -0,0 +1,74 @@
+package org.apache.kandula.wsat.twopc;
+
+import java.io.IOException;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.kandula.Constants;
+import org.apache.kandula.wsat.AbstractATNotifierStub;
+
+public class ParticipantPortTypeRawXMLStub extends AbstractATNotifierStub {
+ public static final String AXIS2_HOME = ".";
+
+ static {
+
+ //creating the Service
+ _service = new org.apache.axis2.description.ServiceDescription(
+ new javax.xml.namespace.QName(Constants.WS_AT,
+ "ParticipantPortType"));
+
+ //creating the operations
+ org.apache.axis2.description.OperationDescription operation;
+ operations = new org.apache.axis2.description.OperationDescription[3];
+
+ operation = new org.apache.axis2.description.OperationDescription();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "prepareOperation"));
+ operations[0] = operation;
+ _service.addOperation(operation);
+
+ operation = new org.apache.axis2.description.OperationDescription();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "committOperation"));
+ operations[1] = operation;
+ _service.addOperation(operation);
+
+ operation = new org.apache.axis2.description.OperationDescription();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "rollbackOperation"));
+ operations[2] = operation;
+ _service.addOperation(operation);
+ }
+
+ /**
+ * Constructor
+ */
+ public ParticipantPortTypeRawXMLStub(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 = _service.getParent().getServiceGroupContext(
+ _configurationContext).getServiceContext(
+ _service.getName().getLocalPart());
+ }
+
+ public void prepareOperation() throws IOException {
+ //TODO must send reply TO epr
+ this.notify("Prepare", Constants.WS_AT_PREPARE, 0, null);
+
+ }
+
+ public void commitOperation() throws IOException {
+ //TODO must send reply to epr
+ this.notify("Commit", Constants.WS_AT_COMMIT, 1, null);
+
+ }
+
+ public void rollbackOperation() throws IOException {
+ //TODO must send reply to epr
+ this.notify("Rollback", Constants.WS_AT_ROLLBACK, 2, null);
+ }
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantServiceListener.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantServiceListener.java?rev=291467&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantServiceListener.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantServiceListener.java Sun Sep 25 12:36:21 2005
@@ -0,0 +1,111 @@
+/*
+ * 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.wsat.twopc;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.description.ParameterImpl;
+import org.apache.axis2.description.ServiceDescription;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.receivers.AbstractMessageReceiver;
+import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
+import org.apache.kandula.Constants;
+import org.apache.kandula.utility.KandulaListener;
+import org.apache.kandula.wsat.completion.CompletionInitiatorPortTypeRawXMLSkeleton;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class ParticipantServiceListener {
+
+ private static ParticipantServiceListener instance = null;
+
+ private EndpointReference epr = null;
+
+ private ParticipantServiceListener() {
+ super();
+ }
+
+ public static ParticipantServiceListener getInstance() {
+ if (instance == null) {
+ instance = new ParticipantServiceListener();
+ }
+ return instance;
+ }
+
+ public EndpointReference getEpr() throws IOException {
+ if (epr == null) {
+ this.epr = setupListener();
+ }
+ return this.epr;
+ }
+
+ private EndpointReference setupListener() throws IOException {
+ QName serviceName = new QName("ParticipantPortType");
+ String className = ParticipantPortTypeRawXMLSkeleton.class
+ .getName();
+ ServiceDescription service = new ServiceDescription(serviceName);
+ service.addParameter(new ParameterImpl(
+ AbstractMessageReceiver.SERVICE_CLASS, className));
+ service.setFileName(className);
+
+ QName prepareOperationName = new QName(Constants.WS_COOR,
+ "prepareOperation");
+ org.apache.axis2.description.OperationDescription prepareOperationDesc;
+ String prepareMapping = Constants.WS_AT_PREPARE;
+ prepareOperationDesc = new org.apache.axis2.description.OperationDescription();
+ prepareOperationDesc.setName(prepareOperationName);
+ prepareOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+ // Adding the WSA Action mapping to the operation
+ service.addMapping(prepareMapping, prepareOperationDesc);
+ service.addOperation(prepareOperationDesc);
+
+ QName commitOperationName = new QName(Constants.WS_COOR,
+ "commitOperation");
+ org.apache.axis2.description.OperationDescription commitOperationDesc;
+ String commitMapping = Constants.WS_AT_COMMIT;
+ commitOperationDesc = new org.apache.axis2.description.OperationDescription();
+ commitOperationDesc.setName(commitOperationName);
+ commitOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+ // Adding the WSA Action mapping to the operation
+ service.addMapping(commitMapping, commitOperationDesc);
+ service.addOperation(commitOperationDesc);
+
+ QName rollbackOperationName = new QName(Constants.WS_COOR,
+ "rollbackOperation");
+ org.apache.axis2.description.OperationDescription rollbackOperationDesc;
+ String rollbackMapping = Constants.WS_AT_ROLLBACK;
+ rollbackOperationDesc = new org.apache.axis2.description.OperationDescription();
+ rollbackOperationDesc.setName(rollbackOperationName);
+ rollbackOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+ // Adding the WSA Action mapping to the operation
+ service.addMapping(rollbackMapping, rollbackOperationDesc);
+ service.addOperation(rollbackOperationDesc);
+
+ KandulaListener listener = KandulaListener.getInstance();
+ listener.addService(service);
+ listener.start();
+ return new EndpointReference(listener.getHost()
+ + serviceName.getLocalPart());
+ }
+}
\ No newline at end of file
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java?rev=291467&r1=291466&r2=291467&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java Sun Sep 25 12:36:21 2005
@@ -16,12 +16,17 @@
*/
package org.apache.kandula.wscoor;
+import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.addressing.AnyContentType;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.clientapi.MessageSender;
+import org.apache.axis2.description.ParameterImpl;
+import org.apache.axis2.description.ServiceDescription;
import org.apache.axis2.om.OMAbstractFactory;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.receivers.AbstractMessageReceiver;
+import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
import org.apache.kandula.Constants;
import org.apache.kandula.utility.KandulaListener;
@@ -64,15 +69,44 @@
* Constructor
*/
public ActivationCoordinatorPortTypeRawXMLStub(String axis2Home,
- EndpointReference targetEndpoint) throws java.lang.Exception {
+ 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());
+ _serviceContext = _service.getParent().getServiceGroupContext(
+ _configurationContext).getServiceContext(
+ _service.getName().getLocalPart());
+
+ }
+
+ public void createCoordinationContextOperation(String coordinationType,
+ String id) throws IOException {
+
+ EndpointReference replyToEpr;
+
+ org.apache.axis2.context.MessageContext messageContext = getMessageContext();
+ messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
+ AddressingConstants.Submission.WSA_NAMESPACE);
+ org.apache.axis2.soap.SOAPEnvelope env = createSOAPEnvelope(coordinationType);
+ messageContext.setEnvelope(env);
+
+ replyToEpr = setupListener();
+ AnyContentType refProperties = new AnyContentType();
+ refProperties.addReferenceValue(new QName(
+ "http://ws.apache.org/kandula", "id"), id);
+ replyToEpr.setReferenceParameters(refProperties);
+
+ MessageSender messageSender = new MessageSender(_serviceContext);
+ messageSender.setReplyTo(replyToEpr);
+ messageSender.setTo(this.toEPR);
+ messageSender
+ .setWsaAction(Constants.WS_COOR_CREATE_COORDINATIONCONTEXT);
+ messageSender
+ .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ messageSender.send(operations[0], messageContext);
}
@@ -93,35 +127,32 @@
return env;
}
- public void createCoordinationContextOperation(String coordinationType,
- String id) throws IOException {
-
+ private EndpointReference setupListener() throws IOException {
QName serviceName = new QName("ActivationRequesterPortType");
QName operationName = new QName(Constants.WS_COOR,
- "CreateCoordinationContextOperation");
+ "createCoordinationContextResponseOperation");
+ org.apache.axis2.description.OperationDescription responseOperationDesc;
+ String className = ActivationRequesterPortTypeRawXMLSkeleton.class
+ .getName();
+ String mapping = Constants.WS_COOR_CREATE_COORDINATIONCONTEXT_RESPONSE;
+
KandulaListener listener = KandulaListener.getInstance();
- listener.addService(serviceName, operationName,
- ActivationRequesterPortTypeRawXMLSkeleton.class.getName());
+ ServiceDescription service = new ServiceDescription(serviceName);
+ service.addParameter(new ParameterImpl(
+ AbstractMessageReceiver.SERVICE_CLASS, className));
+ service.setFileName(className);
+
+ responseOperationDesc = new org.apache.axis2.description.OperationDescription();
+ responseOperationDesc.setName(operationName);
+ responseOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+
+ // Adding the WSA Action mapping to the operation
+ service.addMapping(mapping, responseOperationDesc);
+ service.addOperation(responseOperationDesc);
+ listener.addService(service);
listener.start();
-
- MessageSender messageSender = new MessageSender(_serviceContext);
- org.apache.axis2.context.MessageContext messageContext = getMessageContext();
- EndpointReference replyToEpr = new EndpointReference(listener.getHost()
+ return new EndpointReference(listener.getHost()
+ serviceName.getLocalPart());
- AnyContentType refProperties = new AnyContentType();
- refProperties.addReferenceValue(new QName(
- "http://ws.apache.org/kandula", "id"), id);
- replyToEpr.setReferenceParameters(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);
-
}
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLAsyncMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLAsyncMessageReceiver.java?rev=291467&r1=291466&r2=291467&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLAsyncMessageReceiver.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLAsyncMessageReceiver.java Sun Sep 25 12:36:21 2005
@@ -17,7 +17,9 @@
package org.apache.kandula.wscoor;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.DependencyManager;
import org.apache.axis2.om.OMElement;
+import org.apache.kandula.Constants;
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
@@ -34,6 +36,9 @@
// get the implementation class for the Web Service
Object obj = getTheImplementationObject(msgContext);
+
+ //Inject the Message Context if it is asked for
+ DependencyManager.configureBusinessLogicProvider(obj, msgContext, newMsgContext);
ActivationPortTypeRawXMLSkeleton skel = (ActivationPortTypeRawXMLSkeleton) obj;
//Out Envelop
@@ -45,12 +50,12 @@
String methodName;
if (op.getName() != null
& (methodName = op.getName().getLocalPart()) != null) {
- if (methodName.equals("CreateCoordinationContextOperation")) {
+ if (methodName.equals("createCoordinationContextOperation")) {
OMElement response = null;
//doc style
response = skel
- .CreateCoordinationContextOperation((org.apache.axis2.om.OMElement) msgContext
+ .createCoordinationContextOperation((org.apache.axis2.om.OMElement) msgContext
.getEnvelope().getBody().getFirstChild()
.detach());
@@ -61,8 +66,7 @@
envelope.getBody().setFirstChild(response);
}
newMsgContext.setEnvelope(envelope);
- newMsgContext.setSoapAction("CreateCoordinationContextOperation");
- // callback.handleResult(newMsgContext);
+ newMsgContext.setWSAAction(Constants.WS_COOR_CREATE_COORDINATIONCONTEXT_RESPONSE);
}
} catch (Exception e) {
throw AxisFault.makeFault(e);
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLSkeleton.java?rev=291467&r1=291466&r2=291467&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationPortTypeRawXMLSkeleton.java Sun Sep 25 12:36:21 2005
@@ -3,7 +3,11 @@
import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;
+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;
import org.apache.kandula.context.AbstractContext;
import org.apache.kandula.coordinator.Coordinator;
import org.apache.kandula.faults.AbstractKandulaException;
@@ -20,7 +24,7 @@
* @param requestElement
* @throws AbstractKandulaException
*/
- public OMElement CreateCoordinationContextOperation(OMElement requestElement)
+ public OMElement createCoordinationContextOperation(OMElement requestElement)
throws AxisFault {
AbstractContext context;
@@ -47,7 +51,12 @@
Coordinator coordinator = new Coordinator();
context = coordinator.createCoordinationContext(coordinationType,
expiresL);
- return context.getCoordinationContext().toOM();
+ SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
+ OMNamespace wsCoor = factory.createOMNamespace(Constants.WS_COOR,
+ "wscoor");
+ OMElement responseEle = factory.createOMElement("CreateCoordinationContextResponse",wsCoor);
+ responseEle.addChild(context.getCoordinationContext().toOM());
+ return responseEle;
} catch (AbstractKandulaException e) {
AxisFault fault = new AxisFault(e);
fault.setFaultCode(e.getFaultCode());
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=291467&r1=291466&r2=291467&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 25 12:36:21 2005
@@ -36,10 +36,11 @@
this.msgContext = context;
}
- public OMElement CreateCoordinationContextOperation(OMElement requestElement) {
- if ("CoordinationContext".equals(requestElement.getLocalName())) {
+ public OMElement createCoordinationContextResponseOperation(OMElement responseElement) {
+ OMElement response = responseElement.getFirstElement();
+ if ("CoordinationContext".equals(response.getLocalName())) {
msgContext.getMessageInformationHeaders().getReferenceParameters();
- CoordinationContext coordinationContext = CoordinationContext.Factory.newContext(requestElement);
+ CoordinationContext coordinationContext = CoordinationContext.Factory.newContext(response);
AbstractContext context = (AbstractContext)StorageFactory.getInstance().getStore().get(TransactionManager.tempID);
context.setCoordinationContext(coordinationContext);
}
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=291467&r1=291466&r2=291467&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 25 12:36:21 2005
@@ -3,9 +3,13 @@
import org.apache.axis2.addressing.AnyContentType;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.clientapi.MessageSender;
+import org.apache.axis2.description.ParameterImpl;
+import org.apache.axis2.description.ServiceDescription;
import org.apache.axis2.om.OMAbstractFactory;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.receivers.AbstractMessageReceiver;
+import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
import org.apache.kandula.Constants;
import org.apache.kandula.utility.KandulaListener;
import org.apache.kandula.utility.KandulaUtils;
@@ -13,7 +17,6 @@
import javax.xml.namespace.QName;
import java.io.IOException;
-
public class RegistrationCoordinatorPortTypeRawXMLStub extends
org.apache.axis2.clientapi.Stub {
public static final String AXIS2_HOME = ".";
@@ -45,15 +48,41 @@
* Constructor
*/
public RegistrationCoordinatorPortTypeRawXMLStub(String axis2Home,
- EndpointReference targetEndpoint) throws java.lang.Exception {
+ 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());
+ _serviceContext = _service.getParent().getServiceGroupContext(
+ _configurationContext).getServiceContext(
+ _service.getName().getLocalPart());
+ }
+
+ public void registerOperation(String protocolType, EndpointReference epr,
+ String id) throws IOException {
+
+ EndpointReference replyToEpr;
+
+ org.apache.axis2.context.MessageContext messageContext = getMessageContext();
+ org.apache.axis2.soap.SOAPEnvelope env = createSOAPEnvelope(
+ protocolType, epr);
+ messageContext.setEnvelope(env);
+
+ replyToEpr = setupListener();
+ AnyContentType refProperties = new AnyContentType();
+ refProperties.addReferenceValue(new QName(
+ "http://ws.apache.org/kandula", id), id);
+ replyToEpr.setReferenceProperties(refProperties);
+ MessageSender messageSender = new MessageSender(_serviceContext);
+ messageSender.setReplyTo(replyToEpr);
+ messageSender.setTo(this.toEPR);
+ messageSender.setWsaAction(Constants.WS_COOR_REGISTER);
+
+ messageSender
+ .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ messageSender.send(_operations[0], messageContext);
}
private org.apache.axis2.soap.SOAPEnvelope createSOAPEnvelope(
@@ -63,55 +92,46 @@
.getSOAP12Factory();
OMNamespace wsCoor = factory.createOMNamespace(Constants.WS_COOR,
"wscoor");
- OMElement request = factory
- .createOMElement("Register", 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);
+ OMElement protocolService = factory.createOMElement(
+ "ParticipantProtocolService", wsCoor);
KandulaUtils.endpointToOM(epr, protocolService, factory);
request.addChild(protocolService);
env.getBody().addChild(request);
return env;
- // protocolidentifier
- //protocolservice
}
- public void RegisterOperation(String protocolType, EndpointReference epr,
- String id) throws IOException {
-
+ private EndpointReference setupListener() throws IOException {
QName serviceName = new QName("RegistrationRequesterPortType");
- QName operationName = new QName(Constants.WS_COOR, "RegisterOperation");
+ QName operationName = new QName(Constants.WS_COOR,
+ "registerResponseOperation");
+ org.apache.axis2.description.OperationDescription responseOperationDesc;
+ String className = RegistrationRequesterPortTypeRawXMLSkeleton.class
+ .getName();
+ String mapping = Constants.WS_COOR_REGISTER_RESPONSE;
+
KandulaListener listener = KandulaListener.getInstance();
- listener.addService(serviceName, operationName,
- RegistrationRequesterPortTypeRawXMLSkeleton.class.getName());
- //listener.stop();
+ ServiceDescription service = new ServiceDescription(serviceName);
+ service.addParameter(new ParameterImpl(
+ AbstractMessageReceiver.SERVICE_CLASS, className));
+ service.setFileName(className);
+
+ responseOperationDesc = new org.apache.axis2.description.OperationDescription();
+ responseOperationDesc.setName(operationName);
+ responseOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+
+ // Adding the WSA Action mapping to the operation
+ service.addMapping(mapping, responseOperationDesc);
+ service.addOperation(responseOperationDesc);
+ listener.addService(service);
listener.start();
-
- MessageSender messageSender = new MessageSender(_serviceContext);
- org.apache.axis2.context.MessageContext messageContext = getMessageContext();
- EndpointReference replyToEpr = new EndpointReference(listener.getHost()
+ return 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);
-
}
-
}
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLAsyncMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLAsyncMessageReceiver.java?rev=291467&r1=291466&r2=291467&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLAsyncMessageReceiver.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationPortTypeRawXMLAsyncMessageReceiver.java Sun Sep 25 12:36:21 2005
@@ -19,6 +19,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.engine.DependencyManager;
import org.apache.axis2.om.OMElement;
+import org.apache.kandula.Constants;
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
@@ -49,12 +50,12 @@
String methodName;
if (op.getName() != null
& (methodName = op.getName().getLocalPart()) != null) {
- if (methodName.equals("RegisterOperation")) {
+ if (methodName.equals("registerOperation")) {
OMElement response = null;
//doc style
response = skel
- .RegisterOperation((org.apache.axis2.om.OMElement) msgContext
+ .registerOperation((org.apache.axis2.om.OMElement) msgContext
.getEnvelope().getBody().getFirstChild()
.detach());
@@ -65,8 +66,7 @@
envelope.getBody().setFirstChild(response);
}
newMsgContext.setEnvelope(envelope);
- newMsgContext.setSoapAction("RegisterOperation");
- // callback.handleResult(newMsgContext);
+ newMsgContext.setWSAAction(Constants.WS_COOR_REGISTER_RESPONSE);
}
} catch (Exception e) {
throw AxisFault.makeFault(e);
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=291467&r1=291466&r2=291467&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 25 12:36:21 2005
@@ -29,6 +29,7 @@
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMNamespace;
import org.apache.axis2.soap.SOAPFactory;
+import org.apache.kandula.Constants;
import org.apache.kandula.coordinator.Coordinator;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.utility.KandulaUtils;
@@ -44,7 +45,7 @@
this.msgContext = msgContext;
}
- public OMElement RegisterOperation(OMElement request)
+ public OMElement registerOperation(OMElement request)
throws AxisFault {
String protocolIdentifier;
@@ -59,18 +60,7 @@
OMElement participantEPRElement = request
.getFirstChildWithName(new QName("ParticipantProtocolService"));
//Extracting the participant EPR
- 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);
+ participantEPR = KandulaUtils.endpointFromOM(participantEPRElement);
//have to extract the reference parameter "id". Axis2 does not support
ArrayList list = msgContext.getMessageInformationHeaders()
@@ -85,7 +75,12 @@
Coordinator coordinator = new Coordinator();
EndpointReference epr = coordinator.registerParticipant(activityId,
protocolIdentifier, participantEPR);
- return toOM(epr);
+ SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
+ OMNamespace wsCoor = factory.createOMNamespace(Constants.WS_COOR,
+ "wscoor");
+ OMElement responseEle = factory.createOMElement("RegisterResponse",wsCoor);
+ responseEle.addChild(toOM(epr));
+ return responseEle;
} catch (AbstractKandulaException e) {
AxisFault fault = new AxisFault(e);
fault.setFaultCode(e.getFaultCode());
---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org