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.twopc;
18  
19  import org.apache.axis2.addressing.EndpointReference;
20  import org.apache.axis2.description.AxisOperation;
21  import org.apache.axis2.description.AxisService;
22  import org.apache.axis2.description.OutOnlyAxisOperation;
23  import org.apache.kandula.Constants;
24  import org.apache.kandula.faults.AbstractKandulaException;
25  import org.apache.kandula.utility.KandulaConfiguration;
26  import org.apache.kandula.wsat.AbstractATNotifierStub;
27  
28  /***
29   * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
30   */
31  public class CoordinatorPortTypeRawXMLStub extends AbstractATNotifierStub {
32  	public static final String AXIS2_HOME = ".";
33  
34  	/***
35  	 * Constructor
36  	 */
37  	public CoordinatorPortTypeRawXMLStub(EndpointReference targetEndpoint)
38  			throws AbstractKandulaException {
39  		super(KandulaConfiguration.getInstance().getParticipantRepository(),
40  				KandulaConfiguration.getInstance().getParticipantAxis2Conf(),
41  				new AxisService("CoordinatorPortType"));
42  		this.toEPR = targetEndpoint;
43  
44  		// creating the operations
45  		AxisOperation operation;
46  		operations = new AxisOperation[5];
47  
48  		operation = new OutOnlyAxisOperation();
49  		operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
50  				"PreparedOperation"));
51  		operations[0] = operation;
52  		service.addOperation(operation);
53  
54  		operation = new OutOnlyAxisOperation();
55  		operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
56  				"AbortedOperation"));
57  		operations[1] = operation;
58  		service.addOperation(operation);
59  		operation = new OutOnlyAxisOperation();
60  		operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
61  				"ReadOnlyOperation"));
62  		operations[2] = operation;
63  		service.addOperation(operation);
64  
65  		operation = new OutOnlyAxisOperation();
66  		operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
67  				"CommittedOperation"));
68  		operations[3] = operation;
69  		service.addOperation(operation);
70  		operation = new OutOnlyAxisOperation();
71  		operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
72  				"ReplayOperation"));
73  		operations[4] = operation;
74  		service.addOperation(operation);
75  
76  	}
77  
78  	public void preparedOperation() throws AbstractKandulaException {
79  		// must send reply to epr
80  		this.notify("Prepared", Constants.WS_AT_PREPARED, 0, null);
81  	}
82  
83  	public void abortedOperation() throws AbstractKandulaException {
84  		this.notify("Aborted", Constants.WS_AT_ABORTED, 1, null);
85  	}
86  
87  	public void readOnlyOperation() throws AbstractKandulaException {
88  		this.notify("ReadOnly", Constants.WS_AT_READONLY, 2, null);
89  
90  	}
91  
92  	public void committedOperation() throws AbstractKandulaException {
93  		this.notify("Committed", Constants.WS_AT_COMMITTED, 3, null);
94  
95  	}
96  
97  	public void replayOperation() throws AbstractKandulaException {
98  		// must send reply to epr
99  		this.notify("Replay", Constants.WS_AT_REPLAY, 4, null);
100 	}
101 
102 }