View Javadoc

1   /*
2    * Copyright  2004 The Apache Software Foundation.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *
16   */
17  package org.apache.kandula.wsat.completion;
18  
19  import org.apache.axis2.AxisFault;
20  import org.apache.axis2.addressing.EndpointReference;
21  import org.apache.axis2.description.AxisOperation;
22  import org.apache.axis2.description.AxisService;
23  import org.apache.axis2.description.OutOnlyAxisOperation;
24  import org.apache.kandula.Constants;
25  import org.apache.kandula.faults.AbstractKandulaException;
26  import org.apache.kandula.wsat.AbstractATNotifierStub;
27  
28  /***
29   * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
30   */
31  public class CompletionCoordinatorPortTypeRawXMLStub extends
32  		AbstractATNotifierStub {
33  	public static final String AXIS2_HOME = ".";
34  
35  	/***
36  	 * Constructor
37  	 * 
38  	 * @throws AxisFault
39  	 */
40  	public CompletionCoordinatorPortTypeRawXMLStub(String axis2Home,
41  			String axis2Xml, EndpointReference targetEndpoint)
42  			throws AbstractKandulaException {
43  		super(axis2Home, axis2Xml, new AxisService(
44  				"CompletionCoordinatorPortType"));
45  		this.toEPR = targetEndpoint;
46  
47  		// creating the operations
48  		AxisOperation operation;
49  		operations = new AxisOperation[2];
50  
51  		operation = new OutOnlyAxisOperation();
52  		operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
53  				"commitOperation"));
54  		operations[0] = operation;
55  		service.addOperation(operation);
56  
57  		operation = new OutOnlyAxisOperation();
58  		operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
59  				"rollbackOperation"));
60  		operations[1] = operation;
61  		service.addOperation(operation);
62  	}
63  
64  	public void commitOperation() throws AbstractKandulaException {
65  		// TODO must send reply to epr
66  		this.notify("Commit", Constants.WS_AT_COMMIT, 0, null);
67  
68  	}
69  
70  	public void rollbackOperation() throws AbstractKandulaException {
71  		// TODO must send reply to EPR
72  		this.notify("Rollback", Constants.WS_AT_ROLLBACK, 1, null);
73  
74  	}
75  
76  }