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 ParticipantPortTypeRawXMLStub extends AbstractATNotifierStub {
32  	public static final String AXIS2_HOME = ".";
33  
34  	/***
35  	 * Constructor
36  	 * 
37  	 * @throws AbstractKandulaException
38  	 */
39  	public ParticipantPortTypeRawXMLStub() throws AbstractKandulaException {
40  		super(KandulaConfiguration.getInstance().getCoordinatorRepo(),
41  				KandulaConfiguration.getInstance().getCoordinatorAxis2Conf(),
42  				new AxisService("ParticipantPortType"));
43  
44  		// creating the operations
45  		AxisOperation operation;
46  		operations = new AxisOperation[3];
47  
48  		operation = new OutOnlyAxisOperation();
49  		operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
50  				"prepareOperation"));
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  				"commitOperation"));
57  		operations[1] = operation;
58  		service.addOperation(operation);
59  
60  		operation = new OutOnlyAxisOperation();
61  		operation.setName(new javax.xml.namespace.QName(Constants.WS_AT,
62  				"rollbackOperation"));
63  		operations[2] = operation;
64  		service.addOperation(operation);
65  	}
66  
67  	public void prepareOperation(EndpointReference targetEndpoint)
68  			throws AbstractKandulaException {
69  		// TODO must send reply TO epr
70  		this.toEPR = targetEndpoint;
71  		this.notify("Prepare", Constants.WS_AT_PREPARE, 0, null);
72  
73  	}
74  
75  	public void commitOperation(EndpointReference targetEndpoint)
76  			throws AbstractKandulaException {
77  		// TODO must send reply to epr
78  		this.toEPR = targetEndpoint;
79  		this.notify("Commit", Constants.WS_AT_COMMIT, 1, null);
80  
81  	}
82  
83  	public void rollbackOperation(EndpointReference targetEndpoint)
84  			throws AbstractKandulaException {
85  		// TODO must send reply to epr
86  		this.toEPR = targetEndpoint;
87  		this.notify("Rollback", Constants.WS_AT_ROLLBACK, 2, null);
88  	}
89  
90  }