You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kandula-dev@ws.apache.org by th...@apache.org on 2006/01/31 13:28:25 UTC
svn commit: r373804 [3/4] - in /webservices/kandula/trunk/java/src: ./
org/apache/kandula/ org/apache/kandula/context/
org/apache/kandula/context/at/ org/apache/kandula/context/coordination/
org/apache/kandula/coordinator/ org/apache/kandula/coordinato...
Modified: 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=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLSkeleton.java Tue Jan 31 04:25:53 2006
@@ -24,58 +24,62 @@
import org.apache.kandula.coordinator.at.ATCoordinator;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.storage.StorageFactory;
+
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class CompletionCoordinatorPortTypeRawXMLSkeleton {
- private MessageContext msgContext;
+ private MessageContext msgContext;
+
+ public void init(MessageContext context) {
+ this.msgContext = context;
+ }
- public void init(MessageContext context) {
- this.msgContext = context;
- }
- /**
- * @param requestElement
- * @throws AxisFault
- */
- public OMElement commitOperation(OMElement requestElement) throws AxisFault {
- AbstractContext context;
- String activityId;
- //log.info("Visited Commit operation");
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- OMElement header = msgContext.getEnvelope().getHeader();
- activityId = header.getFirstChildWithName(
- Constants.TRANSACTION_ID_PARAMETER).getText();
- // TODO do we need to check the incoming message
- try {
- ATCoordinator coordinator = new ATCoordinator();
- coordinator.commitOperation(activityId);
- } catch (AbstractKandulaException e) {
- AxisFault fault = new AxisFault(e);
- fault.setFaultCode(e.getFaultCode());
- throw fault;
- }
- return null;
- }
+ /**
+ * @param requestElement
+ * @throws AxisFault
+ */
+ public OMElement commitOperation(OMElement requestElement) throws AxisFault {
+ AbstractContext context;
+ String activityId;
+ //log.info("Visited Commit operation");
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ OMElement header = msgContext.getEnvelope().getHeader();
+ activityId = header.getFirstChildWithName(
+ Constants.TRANSACTION_ID_PARAMETER).getText();
+ // TODO do we need to check the incoming message
+ try {
+ ATCoordinator coordinator = new ATCoordinator();
+ coordinator.commitOperation(activityId);
+ } 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;
- String activityId;
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- //log.info("Visited rollback operation");
- OMElement header = msgContext.getEnvelope().getHeader();
- activityId = header.getFirstChildWithName(
- Constants.TRANSACTION_ID_PARAMETER).getText();
- try {
- ATCoordinator coordinator = new ATCoordinator();
- coordinator.commitOperation(activityId);
- } 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;
+ String activityId;
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ //log.info("Visited rollback operation");
+ OMElement header = msgContext.getEnvelope().getHeader();
+ activityId = header.getFirstChildWithName(
+ Constants.TRANSACTION_ID_PARAMETER).getText();
+ try {
+ ATCoordinator coordinator = new ATCoordinator();
+ coordinator.commitOperation(activityId);
+ } catch (AbstractKandulaException e) {
+ AxisFault fault = new AxisFault(e);
+ fault.setFaultCode(e.getFaultCode());
+ throw fault;
+ }
+ return null;
+ }
}
Modified: 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=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java Tue Jan 31 04:25:53 2006
@@ -24,64 +24,53 @@
import org.apache.kandula.Constants;
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.wsat.AbstractATNotifierStub;
+
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class CompletionCoordinatorPortTypeRawXMLStub extends
- AbstractATNotifierStub {
- public static final String AXIS2_HOME = ".";
-
- static {
+ AbstractATNotifierStub {
+ public static final String AXIS2_HOME = ".";
- //creating the Service
- _service = new AxisService(
- new javax.xml.namespace.QName(Constants.WS_AT,
- "CompletionCoordinatorPortType"));
-
- //creating the operations
- AxisOperation operation;
- operations = new AxisOperation[2];
-
- operation = new OutOnlyAxisOperation();
- operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
- "commitOperation"));
- operations[0] = operation;
- _service.addOperation(operation);
-
- operation = new OutOnlyAxisOperation();
- 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 AbstractKandulaException {
- //TODO must send reply to epr
- this.notify("Commit", Constants.WS_AT_COMMIT, 0, null);
-
- }
-
- public void rollbackOperation() throws AbstractKandulaException {
- //TODO must send reply to EPR
- this.notify("Rollback", Constants.WS_AT_ROLLBACK, 1, null);
+ /**
+ * Constructor
+ *
+ * @throws AxisFault
+ */
+ public CompletionCoordinatorPortTypeRawXMLStub(String axis2Home,
+ String axis2Xml, EndpointReference targetEndpoint)
+ throws AbstractKandulaException {
+ super(axis2Home, axis2Xml, new AxisService(
+ "CompletionCoordinatorPortType"));
+ this.toEPR = targetEndpoint;
+
+ //creating the operations
+ AxisOperation operation;
+ operations = new AxisOperation[2];
+
+ operation = new OutOnlyAxisOperation();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "commitOperation"));
+ operations[0] = operation;
+ service.addOperation(operation);
+
+ operation = new OutOnlyAxisOperation();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "rollbackOperation"));
+ operations[1] = operation;
+ service.addOperation(operation);
+ }
+
+ public void commitOperation() throws AbstractKandulaException {
+ //TODO must send reply to epr
+ this.notify("Commit", Constants.WS_AT_COMMIT, 0, null);
+
+ }
+
+ public void rollbackOperation() throws AbstractKandulaException {
+ //TODO must send reply to EPR
+ this.notify("Rollback", Constants.WS_AT_ROLLBACK, 1, null);
- }
+ }
}
Modified: 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=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLSkeleton.java Tue Jan 31 04:25:53 2006
@@ -28,31 +28,33 @@
*/
public class CompletionInitiatorPortTypeRawXMLSkeleton {
- private MessageContext msgContext;
+ private MessageContext msgContext;
- public void init(MessageContext context) {
- this.msgContext = context;
- }
+ public void init(MessageContext context) {
+ this.msgContext = context;
+ }
- public OMElement committedOperation(OMElement requestElement) {
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- OMElement header = msgContext.getEnvelope().getHeader();
- String requesterID = header.getFirstChildWithName(
- Constants.REQUESTER_ID_PARAMETER).getText();
- AbstractContext context = (AbstractContext) StorageFactory
- .getInstance().getStore().get(requesterID);
- context.setStatus(Status.ParticipantStatus.STATUS_COMMITED);
- return null;
- }
+ public OMElement committedOperation(OMElement requestElement) {
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ OMElement header = msgContext.getEnvelope().getHeader();
+ String requesterID = header.getFirstChildWithName(
+ Constants.REQUESTER_ID_PARAMETER).getText();
+ AbstractContext context = (AbstractContext) StorageFactory
+ .getInstance().getInitiatorStore().get(requesterID);
+ context.setStatus(Status.ParticipantStatus.STATUS_COMMITED);
+ return null;
+ }
- public OMElement abortedOperation(OMElement requestElement) {
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- OMElement header = msgContext.getEnvelope().getHeader();
- String requesterID = header.getFirstChildWithName(
- Constants.REQUESTER_ID_PARAMETER).getText();
- AbstractContext context = (AbstractContext) StorageFactory
- .getInstance().getStore().get(requesterID);
- context.setStatus(Status.ParticipantStatus.STATUS_ABORTED);
- return null;
- }
+ public OMElement abortedOperation(OMElement requestElement) {
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ OMElement header = msgContext.getEnvelope().getHeader();
+ String requesterID = header.getFirstChildWithName(
+ Constants.REQUESTER_ID_PARAMETER).getText();
+ AbstractContext context = (AbstractContext) StorageFactory
+ .getInstance().getInitiatorStore().get(requesterID);
+ context.setStatus(Status.ParticipantStatus.STATUS_ABORTED);
+ return null;
+ }
}
Modified: 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=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java Tue Jan 31 04:25:53 2006
@@ -16,76 +16,59 @@
*/
package org.apache.kandula.wsat.completion;
-import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.deployment.DeploymentException;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.OutOnlyAxisOperation;
import org.apache.kandula.Constants;
import org.apache.kandula.faults.AbstractKandulaException;
-import org.apache.kandula.faults.KandulaGeneralException;
+import org.apache.kandula.utility.EndpointReferenceFactory;
import org.apache.kandula.wsat.AbstractATNotifierStub;
+
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class CompletionInitiatorPortTypeRawXMLStub extends
- AbstractATNotifierStub {
- public static final String AXIS2_HOME = ".";
-
- static {
+ AbstractATNotifierStub {
+ public static final String AXIS2_HOME = ".";
- //creating the Service
- _service = new AxisService(
- new javax.xml.namespace.QName(Constants.WS_AT,
- "CompletionInitiatorPortType"));
-
- //creating the operations
- AxisOperation operation;
- operations = new AxisOperation[2];
-
- operation = new OutOnlyAxisOperation();
- operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
- "committedOperation"));
- operations[0] = operation;
- _service.addOperation(operation);
-
- operation = new OutOnlyAxisOperation();
- operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
- "abortedOperation"));
- operations[1] = operation;
- _service.addOperation(operation);
- }
-
- /**
- * Constructor
- *
- * @throws AbstractKandulaException
- */
- public CompletionInitiatorPortTypeRawXMLStub(String axis2Home,
- EndpointReference targetEndpoint) throws AbstractKandulaException {
- this.toEPR = targetEndpoint;
- try {
- //creating the configuration
- _configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
- .buildClientConfigurationContext(axis2Home);
- _configurationContext.getAxisConfiguration().addService(_service);
- } catch (DeploymentException e) {
- throw new KandulaGeneralException(e);
- } catch (AxisFault e1) {
- throw new KandulaGeneralException(e1);
- }
- _serviceContext = _service.getParent().getServiceGroupContext(
- _configurationContext).getServiceContext(
- _service.getName().getLocalPart());
- }
-
- public void committedOperation() throws AbstractKandulaException {
- this.notify("Committed", Constants.WS_AT_COMMITTED, 0, null);
- }
-
- public void abortedOperation() throws AbstractKandulaException {
- this.notify("Aborted", Constants.WS_AT_ABORTED, 1, null);
- }
+ /**
+ * Constructor
+ *
+ * @throws AbstractKandulaException
+ */
+ public CompletionInitiatorPortTypeRawXMLStub(
+ EndpointReference targetEndpoint) throws AbstractKandulaException {
+ super(EndpointReferenceFactory.getInstance().getCoordinatorRepo(),
+ EndpointReferenceFactory.getInstance()
+ .getCoordinatorAxis2Conf(), new AxisService(
+ "CompletionInitiatorPortType"));
+ this.toEPR = targetEndpoint;
+
+ //creating the operations
+ AxisOperation operation;
+ operations = new AxisOperation[2];
+
+ operation = new OutOnlyAxisOperation();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "committedOperation"));
+ operations[0] = operation;
+ service.addOperation(operation);
+
+ operation = new OutOnlyAxisOperation();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "abortedOperation"));
+ operations[1] = operation;
+ service.addOperation(operation);
+
+ }
+
+ public void committedOperation() throws AbstractKandulaException {
+ this.notify("Committed", Constants.WS_AT_COMMITTED, 0, null);
+ }
+
+ public void abortedOperation() throws AbstractKandulaException {
+ this.notify("Aborted", Constants.WS_AT_ABORTED, 1, null);
+ }
}
Modified: 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=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorServiceListener.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorServiceListener.java Tue Jan 31 04:25:53 2006
@@ -35,65 +35,64 @@
*/
public class CompletionInitiatorServiceListener {
- private static CompletionInitiatorServiceListener instance = null;
+ private static CompletionInitiatorServiceListener instance = null;
- private EndpointReference epr = 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();
- AxisService service = new AxisService(serviceName);
- service.addParameter(new ParameterImpl(
- AbstractMessageReceiver.SERVICE_CLASS, className));
- service.setFileName(className);
-
- QName committedOperationName = new QName(Constants.WS_COOR,
- "committedOperation");
- AxisOperation committedOperationDesc;
- String committedMapping = Constants.WS_AT_COMMITTED;
- committedOperationDesc = new InOnlyAxisOperation();
- 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");
- AxisOperation abortedOperationDesc;
- String abortedMapping = Constants.WS_AT_ABORTED;
- abortedOperationDesc = new InOnlyAxisOperation();
- 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());
- }
+ 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 {
+ String className = CompletionInitiatorPortTypeRawXMLSkeleton.class
+ .getName();
+ String serviceName = "CompletionInitiatorPortType";
+ AxisService service = new AxisService(serviceName);
+ service.addParameter(new ParameterImpl(
+ AbstractMessageReceiver.SERVICE_CLASS, className));
+ service.setFileName(className);
+
+ QName committedOperationName = new QName(Constants.WS_COOR,
+ "committedOperation");
+ AxisOperation committedOperationDesc;
+ String committedMapping = Constants.WS_AT_COMMITTED;
+ committedOperationDesc = new InOnlyAxisOperation();
+ committedOperationDesc.setName(committedOperationName);
+ committedOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+ // Adding the WSA Action mapping to the operation
+ service.mapActionToOperation(committedMapping, committedOperationDesc);
+ service.addOperation(committedOperationDesc);
+
+ QName abortedOperationName = new QName(Constants.WS_COOR,
+ "abortedOperation");
+ AxisOperation abortedOperationDesc;
+ String abortedMapping = Constants.WS_AT_ABORTED;
+ abortedOperationDesc = new InOnlyAxisOperation();
+ abortedOperationDesc.setName(abortedOperationName);
+ abortedOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+ // Adding the WSA Action mapping to the operation
+ service.mapActionToOperation(abortedMapping, abortedOperationDesc);
+ service.addOperation(abortedOperationDesc);
+
+ KandulaListener listener = KandulaListener.getInstance();
+ listener.addService(service);
+ listener.start();
+ return new EndpointReference(listener.getHost() + serviceName);
+ }
}
Modified: 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=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java Tue Jan 31 04:25:53 2006
@@ -25,106 +25,112 @@
import org.apache.kandula.faults.AbstractKandulaException;
import org.apache.kandula.participant.Vote;
import org.apache.kandula.storage.StorageFactory;
+
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class CoordinatorPortTypeRawXMLSkeleton {
- private MessageContext msgContext;
+ private MessageContext msgContext;
+
+ public void init(MessageContext context) {
+ this.msgContext = context;
+ }
+
+ /**
+ * @param requestElement
+ * @throws AbstractKandulaException
+ */
+ public OMElement preparedOperation(OMElement requestElement)
+ throws AxisFault {
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ OMElement header = msgContext.getEnvelope().getHeader();
+ String activityId = header.getFirstChildWithName(
+ Constants.TRANSACTION_ID_PARAMETER).getText();
+ String enlistmentId = header.getFirstChildWithName(
+ Constants.ENLISTMENT_ID_PARAMETER).getText();
+ ATCoordinator coordinator = new ATCoordinator();
+ try {
+ coordinator.countVote(activityId, Vote.PREPARED, enlistmentId);
+ } catch (AbstractKandulaException e) {
+ AxisFault fault = new AxisFault(e);
+ fault.setFaultCode(e.getFaultCode());
+ throw fault;
+ }
+ return null;
+ }
+
+ /**
+ * @param requestElement
+ * @throws AbstractKandulaException
+ */
+ public OMElement abortedOperation(OMElement requestElement)
+ throws AxisFault {
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ OMElement header = msgContext.getEnvelope().getHeader();
+ String activityId = header.getFirstChildWithName(
+ Constants.TRANSACTION_ID_PARAMETER).getText();
+ String enlistmentId = header.getFirstChildWithName(
+ Constants.ENLISTMENT_ID_PARAMETER).getText();
+ ATCoordinator coordinator = new ATCoordinator();
+ try {
+ coordinator.countVote(activityId, Vote.ABORT, enlistmentId);
+ } catch (AbstractKandulaException e) {
+ AxisFault fault = new AxisFault(e);
+ fault.setFaultCode(e.getFaultCode());
+ throw fault;
+ }
+ return null;
+ }
+
+ /**
+ * @param requestElement
+ * @throws AbstractKandulaException
+ */
+ public OMElement readOnlyOperation(OMElement requestElement)
+ throws AxisFault {
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ OMElement header = msgContext.getEnvelope().getHeader();
+ String activityId = header.getFirstChildWithName(
+ Constants.TRANSACTION_ID_PARAMETER).getText();
+ String enlistmentId = header.getFirstChildWithName(
+ Constants.ENLISTMENT_ID_PARAMETER).getText();
+ ATCoordinator coordinator = new ATCoordinator();
+ try {
+ coordinator.countVote(activityId, Vote.READ_ONLY, enlistmentId);
+ } catch (AbstractKandulaException e) {
+ AxisFault fault = new AxisFault(e);
+ fault.setFaultCode(e.getFaultCode());
+ throw fault;
+ }
+ return null;
+ }
+
+ /**
+ * @param requestElement
+ * @throws AbstractKandulaException
+ */
+ public OMElement committedOperation(OMElement requestElement)
+ throws AxisFault {
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ AbstractContext context;
+ System.out.println("Visited Committed operation");
+ return null;
+ }
- public void init(MessageContext context) {
- this.msgContext = context;
- }
-
- /**
- * @param requestElement
- * @throws AbstractKandulaException
- */
- public OMElement preparedOperation(OMElement requestElement)
- throws AxisFault {
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- OMElement header = msgContext.getEnvelope().getHeader();
- String activityId = header.getFirstChildWithName(
- Constants.TRANSACTION_ID_PARAMETER).getText();
- String enlistmentId = header.getFirstChildWithName(
- Constants.ENLISTMENT_ID_PARAMETER).getText();
- ATCoordinator coordinator = new ATCoordinator();
- try {
- coordinator.countVote(activityId, Vote.PREPARED, enlistmentId);
- } catch (AbstractKandulaException e) {
- AxisFault fault = new AxisFault(e);
- fault.setFaultCode(e.getFaultCode());
- throw fault;
- }
- return null;
- }
-
- /**
- * @param requestElement
- * @throws AbstractKandulaException
- */
- public OMElement abortedOperation(OMElement requestElement)
- throws AxisFault {
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- OMElement header = msgContext.getEnvelope().getHeader();
- String activityId = header.getFirstChildWithName(
- Constants.TRANSACTION_ID_PARAMETER).getText();
- String enlistmentId = header.getFirstChildWithName(
- Constants.ENLISTMENT_ID_PARAMETER).getText();
- ATCoordinator coordinator = new ATCoordinator();
- try {
- coordinator.countVote(activityId, Vote.ABORT, enlistmentId);
- } catch (AbstractKandulaException e) {
- AxisFault fault = new AxisFault(e);
- fault.setFaultCode(e.getFaultCode());
- throw fault;
- }
- return null;
- }
-
- /**
- * @param requestElement
- * @throws AbstractKandulaException
- */
- public OMElement readOnlyOperation(OMElement requestElement)
- throws AxisFault {
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- OMElement header = msgContext.getEnvelope().getHeader();
- String activityId = header.getFirstChildWithName(
- Constants.TRANSACTION_ID_PARAMETER).getText();
- String enlistmentId = header.getFirstChildWithName(
- Constants.ENLISTMENT_ID_PARAMETER).getText();
- ATCoordinator coordinator = new ATCoordinator();
- try {
- coordinator.countVote(activityId, Vote.READ_ONLY, enlistmentId);
- } catch (AbstractKandulaException e) {
- AxisFault fault = new AxisFault(e);
- fault.setFaultCode(e.getFaultCode());
- throw fault;
- }
- return null;
- }
-
- /**
- * @param requestElement
- * @throws AbstractKandulaException
- */
- public OMElement committedOperation(OMElement requestElement)
- throws AxisFault {
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- AbstractContext context;
- System.out.println("Visited Committed operation");
- return null;
- }
-
- /**
- * @param requestElement
- * @throws AbstractKandulaException
- */
- public OMElement replayOperation(OMElement requestElement) throws AxisFault {
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- AbstractContext context;
- System.out.println("Visited Replay operation");
- return null;
- }
+ /**
+ * @param requestElement
+ * @throws AbstractKandulaException
+ */
+ public OMElement replayOperation(OMElement requestElement) throws AxisFault {
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ AbstractContext context;
+ System.out.println("Visited Replay operation");
+ return null;
+ }
}
Modified: 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=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java Tue Jan 31 04:25:53 2006
@@ -22,95 +22,83 @@
import org.apache.axis2.description.OutOnlyAxisOperation;
import org.apache.kandula.Constants;
import org.apache.kandula.faults.AbstractKandulaException;
-import org.apache.kandula.faults.KandulaGeneralException;
+import org.apache.kandula.utility.EndpointReferenceFactory;
import org.apache.kandula.wsat.AbstractATNotifierStub;
+
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class CoordinatorPortTypeRawXMLStub extends AbstractATNotifierStub {
- public static final String AXIS2_HOME = ".";
-
- static {
+ public static final String AXIS2_HOME = ".";
- //creating the Service
- _service = new AxisService(
- new javax.xml.namespace.QName(Constants.WS_AT,
- "CoordinatorPortType"));
-
- //creating the operations
- AxisOperation operation;
- operations = new AxisOperation[5];
-
- operation = new OutOnlyAxisOperation();
- operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
- "PreparedOperation"));
- operations[0] = operation;
- _service.addOperation(operation);
-
- operation = new OutOnlyAxisOperation();
- operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
- "AbortedOperation"));
- operations[1] = operation;
- _service.addOperation(operation);
- operation = new OutOnlyAxisOperation();
- operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
- "ReadOnlyOperation"));
- operations[2] = operation;
- _service.addOperation(operation);
-
- operation = new OutOnlyAxisOperation();
- operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
- "CommittedOperation"));
- operations[3] = operation;
- _service.addOperation(operation);
- operation = new OutOnlyAxisOperation();
- 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 AbstractKandulaException {
- this.toEPR = targetEndpoint;
- try {
- //creating the configuration
- _configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
- .buildClientConfigurationContext(axis2Home);
- _configurationContext.getAxisConfiguration().addService(_service);
- } catch (Exception e) {
- throw new KandulaGeneralException(e);
- }
- _serviceContext = _service.getParent().getServiceGroupContext(
- _configurationContext).getServiceContext(
- _service.getName().getLocalPart());
- }
-
- public void preparedOperation() throws AbstractKandulaException {
- // must send reply to epr
- this.notify("Prepared", Constants.WS_AT_PREPARED, 0, null);
- }
-
- public void abortedOperation() throws AbstractKandulaException {
- this.notify("Aborted", Constants.WS_AT_ABORTED, 1, null);
- }
-
- public void readOnlyOperation() throws AbstractKandulaException {
- this.notify("ReadOnly", Constants.WS_AT_READONLY, 2, null);
-
- }
-
- public void committedOperation() throws AbstractKandulaException {
- this.notify("Committed", Constants.WS_AT_COMMITTED, 3, null);
-
- }
-
- public void replayOperation() throws AbstractKandulaException {
- //must send reply to epr
- this.notify("Replay", Constants.WS_AT_REPLAY, 4, null);
- }
+ /**
+ * Constructor
+ */
+ public CoordinatorPortTypeRawXMLStub(EndpointReference targetEndpoint)
+ throws AbstractKandulaException {
+ super(
+ EndpointReferenceFactory.getInstance()
+ .getParticipantRepository(), EndpointReferenceFactory
+ .getInstance().getParticipantAxis2Conf(),
+ new AxisService("CoordinatorPortType"));
+ this.toEPR = targetEndpoint;
+
+ //creating the operations
+ AxisOperation operation;
+ operations = new AxisOperation[5];
+
+ operation = new OutOnlyAxisOperation();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "PreparedOperation"));
+ operations[0] = operation;
+ service.addOperation(operation);
+
+ operation = new OutOnlyAxisOperation();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "AbortedOperation"));
+ operations[1] = operation;
+ service.addOperation(operation);
+ operation = new OutOnlyAxisOperation();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "ReadOnlyOperation"));
+ operations[2] = operation;
+ service.addOperation(operation);
+
+ operation = new OutOnlyAxisOperation();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "CommittedOperation"));
+ operations[3] = operation;
+ service.addOperation(operation);
+ operation = new OutOnlyAxisOperation();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "ReplayOperation"));
+ operations[4] = operation;
+ service.addOperation(operation);
+
+ }
+
+ public void preparedOperation() throws AbstractKandulaException {
+ // must send reply to epr
+ this.notify("Prepared", Constants.WS_AT_PREPARED, 0, null);
+ }
+
+ public void abortedOperation() throws AbstractKandulaException {
+ this.notify("Aborted", Constants.WS_AT_ABORTED, 1, null);
+ }
+
+ public void readOnlyOperation() throws AbstractKandulaException {
+ this.notify("ReadOnly", Constants.WS_AT_READONLY, 2, null);
+
+ }
+
+ public void committedOperation() throws AbstractKandulaException {
+ this.notify("Committed", Constants.WS_AT_COMMITTED, 3, null);
+
+ }
+
+ public void replayOperation() throws AbstractKandulaException {
+ //must send reply to epr
+ this.notify("Replay", Constants.WS_AT_REPLAY, 4, null);
+ }
}
Modified: 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=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java Tue Jan 31 04:25:53 2006
@@ -31,62 +31,67 @@
*/
public class ParticipantPortTypeRawXMLSkeleton {
- private MessageContext msgContext;
+ private MessageContext msgContext;
- public void init(MessageContext context) {
- this.msgContext = context;
- }
+ public void init(MessageContext context) {
+ this.msgContext = context;
+ }
- public OMElement prepareOperation(OMElement requestEle) throws AxisFault {
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- OMElement header = msgContext.getEnvelope().getHeader();
- String requesterID = header.getFirstChildWithName(
- Constants.REQUESTER_ID_PARAMETER).getText();
- Store store = StorageFactory.getInstance().getStore();
- AbstractContext context = (AbstractContext)store.get(requesterID);
- ParticipantTransactionManager txManager = new ParticipantTransactionManager();
- try {
- txManager.prepare(context);
- } catch (AbstractKandulaException e) {
- AxisFault fault = new AxisFault(e);
- fault.setFaultCode(e.getFaultCode());
- throw fault;
- }
- return null;
+ public OMElement prepareOperation(OMElement requestEle) throws AxisFault {
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ OMElement header = msgContext.getEnvelope().getHeader();
+ String requesterID = header.getFirstChildWithName(
+ Constants.REQUESTER_ID_PARAMETER).getText();
+ Store store = StorageFactory.getInstance().getStore();
+ AbstractContext context = (AbstractContext) store.get(requesterID);
+ ParticipantTransactionManager txManager = new ParticipantTransactionManager();
+ try {
+ txManager.prepare(context);
+ } catch (AbstractKandulaException e) {
+ AxisFault fault = new AxisFault(e);
+ fault.setFaultCode(e.getFaultCode());
+ throw fault;
+ }
+ return null;
- }
+ }
- public OMElement commitOperation(OMElement requestEle) throws AxisFault {
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- OMElement header = msgContext.getEnvelope().getHeader();
- String requesterID = header.getFirstChildWithName(
- Constants.REQUESTER_ID_PARAMETER).getText();
- Store store = StorageFactory.getInstance().getStore();
- AbstractContext context = (AbstractContext)store.get(requesterID);
- ParticipantTransactionManager txManager = new ParticipantTransactionManager();
- try {
- txManager.commit(context);
- } catch (AbstractKandulaException e) {
- AxisFault fault = new AxisFault(e);
- fault.setFaultCode(e.getFaultCode());
- throw fault;
- }return null;
- }
+ public OMElement commitOperation(OMElement requestEle) throws AxisFault {
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ OMElement header = msgContext.getEnvelope().getHeader();
+ String requesterID = header.getFirstChildWithName(
+ Constants.REQUESTER_ID_PARAMETER).getText();
+ Store store = StorageFactory.getInstance().getStore();
+ AbstractContext context = (AbstractContext) store.get(requesterID);
+ ParticipantTransactionManager txManager = new ParticipantTransactionManager();
+ try {
+ txManager.commit(context);
+ } catch (AbstractKandulaException e) {
+ AxisFault fault = new AxisFault(e);
+ fault.setFaultCode(e.getFaultCode());
+ throw fault;
+ }
+ return null;
+ }
- public OMElement rollbackOperation(OMElement requestEle) throws AxisFault {
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- OMElement header = msgContext.getEnvelope().getHeader();
- String requesterID = header.getFirstChildWithName(
- Constants.REQUESTER_ID_PARAMETER).getText();
- Store store = StorageFactory.getInstance().getStore();
- AbstractContext context = (AbstractContext)store.get(requesterID);
- ParticipantTransactionManager txManager = new ParticipantTransactionManager();
- try {
- txManager.rollback(context);
- } catch (AbstractKandulaException e) {
- AxisFault fault = new AxisFault(e);
- fault.setFaultCode(e.getFaultCode());
- throw fault;
- }return null;
- }
+ public OMElement rollbackOperation(OMElement requestEle) throws AxisFault {
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ OMElement header = msgContext.getEnvelope().getHeader();
+ String requesterID = header.getFirstChildWithName(
+ Constants.REQUESTER_ID_PARAMETER).getText();
+ Store store = StorageFactory.getInstance().getStore();
+ AbstractContext context = (AbstractContext) store.get(requesterID);
+ ParticipantTransactionManager txManager = new ParticipantTransactionManager();
+ try {
+ txManager.rollback(context);
+ } catch (AbstractKandulaException e) {
+ AxisFault fault = new AxisFault(e);
+ fault.setFaultCode(e.getFaultCode());
+ throw fault;
+ }
+ return null;
+ }
}
Modified: 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=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java Tue Jan 31 04:25:53 2006
@@ -16,94 +16,76 @@
*/
package org.apache.kandula.wsat.twopc;
-import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.deployment.DeploymentException;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.OutOnlyAxisOperation;
import org.apache.kandula.Constants;
import org.apache.kandula.faults.AbstractKandulaException;
-import org.apache.kandula.faults.KandulaGeneralException;
+import org.apache.kandula.utility.EndpointReferenceFactory;
import org.apache.kandula.wsat.AbstractATNotifierStub;
+
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class ParticipantPortTypeRawXMLStub extends AbstractATNotifierStub {
- public static final String AXIS2_HOME = ".";
-
- static {
+ public static final String AXIS2_HOME = ".";
- //creating the Service
- _service = new AxisService(
- new javax.xml.namespace.QName(Constants.WS_AT,
- "ParticipantPortType"));
-
- //creating the operations
- AxisOperation operation;
- operations = new AxisOperation[3];
-
- operation = new OutOnlyAxisOperation();
- operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
- "prepareOperation"));
- operations[0] = operation;
- _service.addOperation(operation);
-
- operation = new OutOnlyAxisOperation();
- operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
- "commitOperation"));
- operations[1] = operation;
- _service.addOperation(operation);
-
- operation = new OutOnlyAxisOperation();
- operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
- "rollbackOperation"));
- operations[2] = operation;
- _service.addOperation(operation);
- }
-
- /**
- * Constructor
- */
- public ParticipantPortTypeRawXMLStub(String axis2Home)
- throws AbstractKandulaException {
-
- //creating the configuration
- try {
- _configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
- .buildClientConfigurationContext(axis2Home);
- _configurationContext.getAxisConfiguration().addService(_service);
- } catch (DeploymentException e) {
- throw new KandulaGeneralException(e);
- } catch (AxisFault e1) {
- throw new KandulaGeneralException(e1);
- }
- _serviceContext = _service.getParent().getServiceGroupContext(
- _configurationContext).getServiceContext(
- _service.getName().getLocalPart());
- }
-
- public void prepareOperation(EndpointReference targetEndpoint)
- throws AbstractKandulaException {
- //TODO must send reply TO epr
- this.toEPR = targetEndpoint;
- this.notify("Prepare", Constants.WS_AT_PREPARE, 0, null);
-
- }
-
- public void commitOperation(EndpointReference targetEndpoint)
- throws AbstractKandulaException {
- //TODO must send reply to epr
- this.toEPR = targetEndpoint;
- this.notify("Commit", Constants.WS_AT_COMMIT, 1, null);
-
- }
-
- public void rollbackOperation(EndpointReference targetEndpoint)
- throws AbstractKandulaException {
- //TODO must send reply to epr
- this.toEPR = targetEndpoint;
- this.notify("Rollback", Constants.WS_AT_ROLLBACK, 2, null);
- }
+ /**
+ * Constructor
+ *
+ * @throws AbstractKandulaException
+ */
+ public ParticipantPortTypeRawXMLStub() throws AbstractKandulaException {
+ super(EndpointReferenceFactory.getInstance().getCoordinatorRepo(),
+ EndpointReferenceFactory.getInstance()
+ .getCoordinatorAxis2Conf(), new AxisService(
+ "ParticipantPortType"));
+
+ //creating the operations
+ AxisOperation operation;
+ operations = new AxisOperation[3];
+
+ operation = new OutOnlyAxisOperation();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "prepareOperation"));
+ operations[0] = operation;
+ service.addOperation(operation);
+
+ operation = new OutOnlyAxisOperation();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "commitOperation"));
+ operations[1] = operation;
+ service.addOperation(operation);
+
+ operation = new OutOnlyAxisOperation();
+ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
+ "rollbackOperation"));
+ operations[2] = operation;
+ service.addOperation(operation);
+ }
+
+ public void prepareOperation(EndpointReference targetEndpoint)
+ throws AbstractKandulaException {
+ //TODO must send reply TO epr
+ this.toEPR = targetEndpoint;
+ this.notify("Prepare", Constants.WS_AT_PREPARE, 0, null);
+
+ }
+
+ public void commitOperation(EndpointReference targetEndpoint)
+ throws AbstractKandulaException {
+ //TODO must send reply to epr
+ this.toEPR = targetEndpoint;
+ this.notify("Commit", Constants.WS_AT_COMMIT, 1, null);
+
+ }
+
+ public void rollbackOperation(EndpointReference targetEndpoint)
+ throws AbstractKandulaException {
+ //TODO must send reply to epr
+ this.toEPR = targetEndpoint;
+ this.notify("Rollback", Constants.WS_AT_ROLLBACK, 2, null);
+ }
}
Modified: 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=373804&r1=373803&r2=373804&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantServiceListener.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantServiceListener.java Tue Jan 31 04:25:53 2006
@@ -35,76 +35,75 @@
*/
public class ParticipantServiceListener {
- private static ParticipantServiceListener instance = null;
+ private static ParticipantServiceListener instance = null;
- private EndpointReference epr = 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();
- AxisService service = new AxisService(serviceName);
- service.addParameter(new ParameterImpl(
- AbstractMessageReceiver.SERVICE_CLASS, className));
- service.setFileName(className);
-
- QName prepareOperationName = new QName(Constants.WS_COOR,
- "prepareOperation");
- AxisOperation prepareOperationDesc;
- String prepareMapping = Constants.WS_AT_PREPARE;
- prepareOperationDesc = new InOnlyAxisOperation();
- 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");
- AxisOperation commitOperationDesc;
- String commitMapping = Constants.WS_AT_COMMIT;
- commitOperationDesc = new InOnlyAxisOperation();
- 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");
- AxisOperation rollbackOperationDesc;
- String rollbackMapping = Constants.WS_AT_ROLLBACK;
- rollbackOperationDesc = new InOnlyAxisOperation();
- 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());
- }
+ 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 {
+ String className = ParticipantPortTypeRawXMLSkeleton.class.getName();
+ String serviceName = "ParticipantPortType";
+ AxisService service = new AxisService(serviceName);
+ service.addParameter(new ParameterImpl(
+ AbstractMessageReceiver.SERVICE_CLASS, className));
+ service.setFileName(className);
+
+ QName prepareOperationName = new QName(Constants.WS_COOR,
+ "prepareOperation");
+ AxisOperation prepareOperationDesc;
+ String prepareMapping = Constants.WS_AT_PREPARE;
+ prepareOperationDesc = new InOnlyAxisOperation();
+ prepareOperationDesc.setName(prepareOperationName);
+ prepareOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+ // Adding the WSA Action mapping to the operation
+ service.mapActionToOperation(prepareMapping, prepareOperationDesc);
+ service.addOperation(prepareOperationDesc);
+
+ QName commitOperationName = new QName(Constants.WS_COOR,
+ "commitOperation");
+ AxisOperation commitOperationDesc;
+ String commitMapping = Constants.WS_AT_COMMIT;
+ commitOperationDesc = new InOnlyAxisOperation();
+ commitOperationDesc.setName(commitOperationName);
+ commitOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+ // Adding the WSA Action mapping to the operation
+ service.mapActionToOperation(commitMapping, commitOperationDesc);
+ service.addOperation(commitOperationDesc);
+
+ QName rollbackOperationName = new QName(Constants.WS_COOR,
+ "rollbackOperation");
+ AxisOperation rollbackOperationDesc;
+ String rollbackMapping = Constants.WS_AT_ROLLBACK;
+ rollbackOperationDesc = new InOnlyAxisOperation();
+ rollbackOperationDesc.setName(rollbackOperationName);
+ rollbackOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+ // Adding the WSA Action mapping to the operation
+ service.mapActionToOperation(rollbackMapping, rollbackOperationDesc);
+ service.addOperation(rollbackOperationDesc);
+
+ KandulaListener listener = KandulaListener.getInstance();
+ listener.addService(service);
+ listener.start();
+ return new EndpointReference(listener.getHost() + serviceName);
+ }
}
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=373804&r1=373803&r2=373804&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 Tue Jan 31 04:25:53 2006
@@ -20,12 +20,19 @@
import javax.xml.namespace.QName;
+import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.AnyContentType;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.MessageSender;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.deployment.DeploymentException;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
import org.apache.axis2.description.InOnlyAxisOperation;
import org.apache.axis2.description.OutInAxisOperation;
import org.apache.axis2.description.ParameterImpl;
@@ -35,6 +42,8 @@
import org.apache.axis2.receivers.AbstractMessageReceiver;
import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
import org.apache.kandula.Constants;
+import org.apache.kandula.faults.KandulaGeneralException;
+import org.apache.kandula.utility.EPRHandlingUtils;
import org.apache.kandula.utility.KandulaListener;
/**
@@ -42,120 +51,122 @@
*/
public class ActivationCoordinatorPortTypeRawXMLStub extends
- org.apache.axis2.client.Stub {
+ org.apache.axis2.client.Stub {
- public static final String AXIS2_HOME = ".";
+ public static final String AXIS2_HOME = ".";
- protected static org.apache.axis2.description.AxisOperation[] operations;
+ protected AxisService service;
- static {
+ protected ConfigurationContext configurationContext;
- //creating the Service
- _service = new AxisService(
- new javax.xml.namespace.QName(
- "http://schemas.xmlsoap.org/ws/2003/09/wscoor",
- "ActivationCoordinatorPortType"));
-
- //creating the operations
- AxisOperation operationDesc;
- operations = new org.apache.axis2.description.AxisOperation[1];
-
- operationDesc = new OutInAxisOperation();
- operationDesc.setName(new javax.xml.namespace.QName(
- "http://schemas.xmlsoap.org/ws/2003/09/wscoor",
- "CreateCoordinationContextOperation"));
- operations[0] = operationDesc;
- _service.addOperation(operationDesc);
-
- }
-
- /**
- * Constructor
- */
- public ActivationCoordinatorPortTypeRawXMLStub(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 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 refParameters = new AnyContentType();
- refParameters.addReferenceValue(Constants.REQUESTER_ID_PARAMETER, id);
- replyToEpr.setReferenceParameters(refParameters);
-
- 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);
-
- }
-
- 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;
- }
-
- private EndpointReference setupListener() throws IOException {
- QName serviceName = new QName("ActivationRequesterPortType");
- QName operationName = new QName(Constants.WS_COOR,
- "createCoordinationContextResponseOperation");
- org.apache.axis2.description.AxisOperation responseOperationDesc;
- String className = ActivationRequesterPortTypeRawXMLSkeleton.class
- .getName();
- String mapping = Constants.WS_COOR_CREATE_COORDINATIONCONTEXT_RESPONSE;
-
- KandulaListener listener = KandulaListener.getInstance();
- AxisService service = new AxisService(serviceName);
- service.addParameter(new ParameterImpl(
- AbstractMessageReceiver.SERVICE_CLASS, className));
- service.setFileName(className);
-
- responseOperationDesc = new InOnlyAxisOperation();
- 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();
- return new EndpointReference(listener.getHost()
- + serviceName.getLocalPart());
- }
+ protected ServiceContext serviceContext;
+
+ protected EndpointReference toEPR;
+
+ protected AxisOperation[] operations;
+
+ /**
+ * Constructor
+ */
+ public ActivationCoordinatorPortTypeRawXMLStub(String axis2Home,
+ String axis2Xml, EndpointReference targetEndpoint)
+ throws java.lang.Exception {
+ this.toEPR = targetEndpoint;
+ service = new AxisService("ActivationCoordinatorPortType");
+ try {
+ configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
+ .createConfigurationContextFromFileSystem(axis2Home,
+ axis2Xml);
+ configurationContext.getAxisConfiguration().addService(service);
+ } catch (DeploymentException e) {
+ throw new KandulaGeneralException(e);
+ } catch (AxisFault e1) {
+ throw new KandulaGeneralException(e1);
+ }
+ ServiceGroupContext sgc = new ServiceGroupContext(
+ this.configurationContext, (AxisServiceGroup) this.service
+ .getParent());
+ this.serviceContext = new ServiceContext(service, sgc);
+
+ //creating the operations
+ AxisOperation operationDesc;
+ operations = new org.apache.axis2.description.AxisOperation[1];
+
+ operationDesc = new OutInAxisOperation();
+ operationDesc.setName(new javax.xml.namespace.QName(
+ "http://schemas.xmlsoap.org/ws/2003/09/wscoor",
+ "CreateCoordinationContextOperation"));
+ operations[0] = operationDesc;
+ service.addOperation(operationDesc);
+
+ }
+
+ public void createCoordinationContextOperation(String coordinationType,
+ String id) throws IOException {
+
+ EndpointReference replyToEpr;
+ MessageContext messageContext = new MessageContext();
+ Options options = new Options();
+ messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
+ AddressingConstants.Submission.WSA_NAMESPACE);
+ org.apache.axis2.soap.SOAPEnvelope env = createSOAPEnvelope(coordinationType);
+ messageContext.setEnvelope(env);
+ replyToEpr = setupListener();
+ EPRHandlingUtils.addReferenceProperty(replyToEpr,
+ Constants.REQUESTER_ID_PARAMETER, id);
+ options.setReplyTo(replyToEpr);
+ options.setTo(this.toEPR);
+ options.setAction(Constants.WS_COOR_CREATE_COORDINATIONCONTEXT);
+ // messageSender
+ // .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ OperationClient client = operations[0].createClient(serviceContext,
+ options);
+ client.addMessageContext(messageContext);
+ client.execute(false);
+ }
+
+ private org.apache.axis2.soap.SOAPEnvelope createSOAPEnvelope(
+ String coordinationType) {
+ org.apache.axis2.soap.SOAPFactory factory = OMAbstractFactory
+ .getSOAP12Factory();
+ org.apache.axis2.soap.SOAPEnvelope env = factory.getDefaultEnvelope();
+ 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;
+ }
+
+ private EndpointReference setupListener() throws IOException {
+ String serviceName = "ActivationRequesterPortType";
+ QName operationName = new QName(Constants.WS_COOR,
+ "createCoordinationContextResponseOperation");
+ org.apache.axis2.description.AxisOperation responseOperationDesc;
+ String className = ActivationRequesterPortTypeRawXMLSkeleton.class
+ .getName();
+ String mapping = Constants.WS_COOR_CREATE_COORDINATIONCONTEXT_RESPONSE;
+
+ KandulaListener listener = KandulaListener.getInstance();
+ AxisService service = new AxisService(serviceName);
+ service.addParameter(new ParameterImpl(
+ AbstractMessageReceiver.SERVICE_CLASS, className));
+ service.setFileName(className);
+
+ responseOperationDesc = new InOnlyAxisOperation();
+ responseOperationDesc.setName(operationName);
+ responseOperationDesc
+ .setMessageReceiver(new RawXMLINOnlyMessageReceiver());
+
+ // Adding the WSA Action mapping to the operation
+ service.mapActionToOperation(mapping, responseOperationDesc);
+ service.addOperation(responseOperationDesc);
+ listener.addService(service);
+ listener.start();
+ return new EndpointReference(listener.getHost() + serviceName);
+ }
}
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=373804&r1=373803&r2=373804&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 Tue Jan 31 04:25:53 2006
@@ -26,56 +26,56 @@
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class ActivationPortTypeRawXMLAsyncMessageReceiver extends
- org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver {
+ org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver {
- public void invokeBusinessLogic(
- org.apache.axis2.context.MessageContext msgContext,
- org.apache.axis2.context.MessageContext newMsgContext)
- throws org.apache.axis2.AxisFault {
-
- try {
-
- // 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
- org.apache.axis2.soap.SOAPEnvelope envelope = null;
- //Find the operation that has been set by the Dispatch phase.
- AxisOperation op = msgContext
- .getOperationContext().getAxisOperation();
-
- String methodName;
- if (op.getName() != null
- & (methodName = op.getName().getLocalPart()) != null) {
- if (("createCoordinationContextOperation").equals(methodName)) {
- OMElement response = null;
-
- //doc style
- response = skel
- .createCoordinationContextOperation((org.apache.axis2.om.OMElement) msgContext
- .getEnvelope().getBody().getFirstElement()
- .detach());
-
- //Create a default envelop
- envelope = getSOAPFactory().getDefaultEnvelope();
- //Create a Omelement of the result if a result exist
-
- envelope.getBody().setFirstChild(response);
- }
- newMsgContext.setEnvelope(envelope);
- newMsgContext
- .setWSAAction(Constants.WS_COOR_CREATE_COORDINATIONCONTEXT_RESPONSE);
- newMsgContext.setRelatesTo(null);
- }
- } catch (Exception e) {
- throw AxisFault.makeFault(e);
- }
+ public void invokeBusinessLogic(
+ org.apache.axis2.context.MessageContext msgContext,
+ org.apache.axis2.context.MessageContext newMsgContext)
+ throws org.apache.axis2.AxisFault {
+
+ try {
+
+ // 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
+ org.apache.axis2.soap.SOAPEnvelope envelope = null;
+ //Find the operation that has been set by the Dispatch phase.
+ AxisOperation op = msgContext.getOperationContext()
+ .getAxisOperation();
+
+ String methodName;
+ if (op.getName() != null
+ & (methodName = op.getName().getLocalPart()) != null) {
+ if (("createCoordinationContextOperation").equals(methodName)) {
+ OMElement response = null;
+
+ //doc style
+ response = skel
+ .createCoordinationContextOperation((org.apache.axis2.om.OMElement) msgContext
+ .getEnvelope().getBody().getFirstElement()
+ .detach());
+
+ //Create a default envelop
+ envelope = getSOAPFactory(msgContext).getDefaultEnvelope();
+ //Create a Omelement of the result if a result exist
+
+ envelope.getBody().setFirstChild(response);
+ }
+ newMsgContext.setEnvelope(envelope);
+ newMsgContext
+ .setWSAAction(Constants.WS_COOR_CREATE_COORDINATIONCONTEXT_RESPONSE);
+ newMsgContext.setRelatesTo(null);
+ }
+ } 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=373804&r1=373803&r2=373804&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 Tue Jan 31 04:25:53 2006
@@ -25,66 +25,69 @@
import org.apache.axis2.om.OMNamespace;
import org.apache.axis2.soap.SOAPFactory;
import org.apache.kandula.Constants;
-import org.apache.kandula.storage.StorageFactory;
import org.apache.kandula.context.AbstractContext;
import org.apache.kandula.coordinator.Coordinator;
import org.apache.kandula.faults.AbstractKandulaException;
+import org.apache.kandula.storage.StorageFactory;
+
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
*/
public class ActivationPortTypeRawXMLSkeleton {
- private MessageContext msgContext;
- public void init(MessageContext context) {
- this.msgContext = context;
- }
-
- /**
- * Auto generated method signature
- *
- * @param requestElement
- * @throws AbstractKandulaException
- */
- public OMElement createCoordinationContextOperation(OMElement requestElement)
- throws AxisFault {
- AbstractContext context;
- StorageFactory.getInstance().setConfigurationContext(msgContext.getServiceContext().getConfigurationContext());
- /*
- * 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);
- 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());
- throw fault;
- }
+ private MessageContext msgContext;
+
+ public void init(MessageContext context) {
+ this.msgContext = context;
+ }
+
+ /**
+ * Auto generated method signature
+ *
+ * @param requestElement
+ * @throws AbstractKandulaException
+ */
+ public OMElement createCoordinationContextOperation(OMElement requestElement)
+ throws AxisFault {
+ AbstractContext context;
+ StorageFactory.getInstance().setConfigurationContext(
+ msgContext.getServiceContext().getConfigurationContext());
+ /*
+ * 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);
+ 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());
+ throw fault;
+ }
- }
+ }
}
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=373804&r1=373803&r2=373804&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 Tue Jan 31 04:25:53 2006
@@ -28,25 +28,25 @@
*/
public class ActivationRequesterPortTypeRawXMLSkeleton {
- private MessageContext msgContext;
+ private MessageContext msgContext;
- public void init(MessageContext context) {
- this.msgContext = context;
- }
+ public void init(MessageContext context) {
+ this.msgContext = context;
+ }
- public OMElement createCoordinationContextResponseOperation(
- OMElement responseElement) {
- OMElement response = responseElement.getFirstElement();
- if ("CoordinationContext".equals(response.getLocalName())) {
- OMElement header = msgContext.getEnvelope().getHeader();
- String requesterID = header.getFirstChildWithName(
- Constants.REQUESTER_ID_PARAMETER).getText();
- CoordinationContext coordinationContext = CoordinationContext.Factory
- .newContext(response);
- AbstractContext context = (AbstractContext) StorageFactory
- .getInstance().getInitiatorStore().get(requesterID);
- context.setCoordinationContext(coordinationContext);
- }
- return null;
- }
+ public OMElement createCoordinationContextResponseOperation(
+ OMElement responseElement) {
+ OMElement response = responseElement.getFirstElement();
+ if ("CoordinationContext".equals(response.getLocalName())) {
+ OMElement header = msgContext.getEnvelope().getHeader();
+ String requesterID = header.getFirstChildWithName(
+ Constants.REQUESTER_ID_PARAMETER).getText();
+ CoordinationContext coordinationContext = CoordinationContext.Factory
+ .newContext(response);
+ AbstractContext context = (AbstractContext) StorageFactory
+ .getInstance().getInitiatorStore().get(requesterID);
+ context.setCoordinationContext(coordinationContext);
+ }
+ return null;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org