KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jts > otsidl > CoordinatorResourcePOA


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
26  * Use is subject to license terms.
27  */

28 package com.sun.jts.otsidl;
29
30
31 /**
32 * com/sun/jts/otsidl/CoordinatorResourcePOA.java .
33 * Generated by the IDL-to-Java compiler (portable), version "3.1"
34 * from com/sun/jts/ots.idl
35 * Tuesday, February 5, 2002 12:57:23 PM PST
36 */

37
38
39 //#-----------------------------------------------------------------------------
40
public abstract class CoordinatorResourcePOA extends org.omg.PortableServer.Servant JavaDoc
41  implements com.sun.jts.otsidl.CoordinatorResourceOperations, org.omg.CORBA.portable.InvokeHandler JavaDoc
42 {
43
44   // Constructors
45

46   private static java.util.Hashtable JavaDoc _methods = new java.util.Hashtable JavaDoc ();
47   static
48   {
49     _methods.put ("commit_subtransaction", new java.lang.Integer JavaDoc (0));
50     _methods.put ("rollback_subtransaction", new java.lang.Integer JavaDoc (1));
51     _methods.put ("prepare", new java.lang.Integer JavaDoc (2));
52     _methods.put ("rollback", new java.lang.Integer JavaDoc (3));
53     _methods.put ("commit", new java.lang.Integer JavaDoc (4));
54     _methods.put ("commit_one_phase", new java.lang.Integer JavaDoc (5));
55     _methods.put ("forget", new java.lang.Integer JavaDoc (6));
56   }
57
58   public org.omg.CORBA.portable.OutputStream JavaDoc _invoke (String JavaDoc $method,
59                                 org.omg.CORBA.portable.InputStream JavaDoc in,
60                                 org.omg.CORBA.portable.ResponseHandler JavaDoc $rh)
61   {
62     org.omg.CORBA.portable.OutputStream JavaDoc out = null;
63     java.lang.Integer JavaDoc __method = (java.lang.Integer JavaDoc)_methods.get ($method);
64     if (__method == null)
65       throw new org.omg.CORBA.BAD_OPERATION JavaDoc (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
66
67     switch (__method.intValue ())
68     {
69        case 0: // CosTransactions/SubtransactionAwareResource/commit_subtransaction
70
{
71          org.omg.CosTransactions.Coordinator parent = org.omg.CosTransactions.CoordinatorHelper.read (in);
72          this.commit_subtransaction (parent);
73          out = $rh.createReply();
74          break;
75        }
76
77        case 1: // CosTransactions/SubtransactionAwareResource/rollback_subtransaction
78
{
79          this.rollback_subtransaction ();
80          out = $rh.createReply();
81          break;
82        }
83
84        case 2: // CosTransactions/Resource/prepare
85
{
86          try {
87            org.omg.CosTransactions.Vote $result = null;
88            $result = this.prepare ();
89            out = $rh.createReply();
90            org.omg.CosTransactions.VoteHelper.write (out, $result);
91          } catch (org.omg.CosTransactions.HeuristicMixed $ex) {
92            out = $rh.createExceptionReply ();
93            org.omg.CosTransactions.HeuristicMixedHelper.write (out, $ex);
94          } catch (org.omg.CosTransactions.HeuristicHazard $ex) {
95            out = $rh.createExceptionReply ();
96            org.omg.CosTransactions.HeuristicHazardHelper.write (out, $ex);
97          }
98          break;
99        }
100
101        case 3: // CosTransactions/Resource/rollback
102
{
103          try {
104            this.rollback ();
105            out = $rh.createReply();
106          } catch (org.omg.CosTransactions.HeuristicCommit $ex) {
107            out = $rh.createExceptionReply ();
108            org.omg.CosTransactions.HeuristicCommitHelper.write (out, $ex);
109          } catch (org.omg.CosTransactions.HeuristicMixed $ex) {
110            out = $rh.createExceptionReply ();
111            org.omg.CosTransactions.HeuristicMixedHelper.write (out, $ex);
112          } catch (org.omg.CosTransactions.HeuristicHazard $ex) {
113            out = $rh.createExceptionReply ();
114            org.omg.CosTransactions.HeuristicHazardHelper.write (out, $ex);
115          }
116          break;
117        }
118
119        case 4: // CosTransactions/Resource/commit
120
{
121          try {
122            this.commit ();
123            out = $rh.createReply();
124          } catch (org.omg.CosTransactions.NotPrepared $ex) {
125            out = $rh.createExceptionReply ();
126            org.omg.CosTransactions.NotPreparedHelper.write (out, $ex);
127          } catch (org.omg.CosTransactions.HeuristicRollback $ex) {
128            out = $rh.createExceptionReply ();
129            org.omg.CosTransactions.HeuristicRollbackHelper.write (out, $ex);
130          } catch (org.omg.CosTransactions.HeuristicMixed $ex) {
131            out = $rh.createExceptionReply ();
132            org.omg.CosTransactions.HeuristicMixedHelper.write (out, $ex);
133          } catch (org.omg.CosTransactions.HeuristicHazard $ex) {
134            out = $rh.createExceptionReply ();
135            org.omg.CosTransactions.HeuristicHazardHelper.write (out, $ex);
136          }
137          break;
138        }
139
140        case 5: // CosTransactions/Resource/commit_one_phase
141
{
142          try {
143            this.commit_one_phase ();
144            out = $rh.createReply();
145          } catch (org.omg.CosTransactions.HeuristicHazard $ex) {
146            out = $rh.createExceptionReply ();
147            org.omg.CosTransactions.HeuristicHazardHelper.write (out, $ex);
148          }
149          break;
150        }
151
152        case 6: // CosTransactions/Resource/forget
153
{
154          this.forget ();
155          out = $rh.createReply();
156          break;
157        }
158
159        default:
160          throw new org.omg.CORBA.BAD_OPERATION JavaDoc (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
161     }
162
163     return out;
164   } // _invoke
165

166   // Type-specific CORBA::Object operations
167
private static String JavaDoc[] __ids = {
168     "IDL:otsidl/CoordinatorResource:1.0",
169     "IDL:omg.org/CosTransactions/SubtransactionAwareResource:1.0",
170     "IDL:omg.org/CosTransactions/Resource:1.0"};
171
172   public String JavaDoc[] _all_interfaces (org.omg.PortableServer.POA JavaDoc poa, byte[] objectId)
173   {
174     return (String JavaDoc[])__ids.clone ();
175   }
176
177   public CoordinatorResource _this()
178   {
179     return CoordinatorResourceHelper.narrow(
180     super._this_object());
181   }
182
183   public CoordinatorResource _this(org.omg.CORBA.ORB JavaDoc orb)
184   {
185     return CoordinatorResourceHelper.narrow(
186     super._this_object(orb));
187   }
188
189
190 } // class CoordinatorResourcePOA
191
Popular Tags