1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.kandula.wsat.completion;
18
19 import org.apache.axiom.om.OMElement;
20 import org.apache.axis2.AxisFault;
21 import org.apache.axis2.context.OperationContext;
22 import org.apache.axis2.wsdl.WSDLConstants;
23 import org.apache.kandula.Constants;
24 import org.apache.kandula.Status;
25 import org.apache.kandula.context.AbstractContext;
26 import org.apache.kandula.storage.StorageFactory;
27
28 /***
29 * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
30 */
31
32 public class CompletionInitiatorPortTypeRawXMLSkeleton {
33 private OperationContext opContext;
34
35 public void setOperationContext(OperationContext opContext) {
36 this.opContext = opContext;
37 }
38
39 public OMElement committedOperation(OMElement requestElement)
40 throws AxisFault {
41 StorageFactory.getInstance().setConfigurationContext(
42 opContext.getServiceContext().getConfigurationContext());
43 OMElement header = opContext.getMessageContext(
44 WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope().getHeader();
45 String requesterID = header.getFirstChildWithName(
46 Constants.REQUESTER_ID_PARAMETER).getText();
47 AbstractContext context = (AbstractContext) StorageFactory
48 .getInstance().getInitiatorStore().get(requesterID);
49 context.setStatus(Status.ParticipantStatus.STATUS_COMMITED);
50 return null;
51 }
52
53 public OMElement abortedOperation(OMElement requestElement)
54 throws AxisFault {
55 StorageFactory.getInstance().setConfigurationContext(
56 opContext.getServiceContext().getConfigurationContext());
57 OMElement header = opContext.getMessageContext(
58 WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope().getHeader();
59 String requesterID = header.getFirstChildWithName(
60 Constants.REQUESTER_ID_PARAMETER).getText();
61 AbstractContext context = (AbstractContext) StorageFactory
62 .getInstance().getInitiatorStore().get(requesterID);
63 context.setStatus(Status.ParticipantStatus.STATUS_ABORTED);
64 return null;
65 }
66 }