KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jts > jtsxa > _OTSResourceStub


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.jtsxa;
29
30
31 /**
32 * com/sun/jts/jtsxa/_OTSResourceStub.java .
33 * Generated by the IDL-to-Java compiler (portable), version "3.1"
34 * from com/sun/jts/jtsxa.idl
35 * Tuesday, February 5, 2002 12:57:25 PM PST
36 */

37
38
39 //#-----------------------------------------------------------------------------
40
public class _OTSResourceStub extends org.omg.CORBA.portable.ObjectImpl JavaDoc implements com.sun.jts.jtsxa.OTSResource
41 {
42
43   public org.omg.CosTransactions.otid_t getGlobalTID ()
44   {
45     org.omg.CORBA.portable.InputStream JavaDoc $in = null;
46     try {
47        org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("getGlobalTID", true);
48        $in = _invoke ($out);
49        org.omg.CosTransactions.otid_t $result = org.omg.CosTransactions.otid_tHelper.read ($in);
50        return $result;
51     } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
52        $in = $ex.getInputStream ();
53        String JavaDoc _id = $ex.getId ();
54        throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
55     } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
56        return getGlobalTID ();
57     } finally {
58         _releaseReply ($in);
59     }
60   } // getGlobalTID
61

62   public org.omg.CosTransactions.Vote prepare () throws org.omg.CosTransactions.HeuristicMixed, org.omg.CosTransactions.HeuristicHazard
63   {
64     org.omg.CORBA.portable.InputStream JavaDoc $in = null;
65     try {
66        org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("prepare", true);
67        $in = _invoke ($out);
68        org.omg.CosTransactions.Vote $result = org.omg.CosTransactions.VoteHelper.read ($in);
69        return $result;
70     } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
71        $in = $ex.getInputStream ();
72        String JavaDoc _id = $ex.getId ();
73        if (_id.equals ("IDL:omg.org/CosTransactions/HeuristicMixed:1.0"))
74           throw org.omg.CosTransactions.HeuristicMixedHelper.read ($in);
75        else if (_id.equals ("IDL:omg.org/CosTransactions/HeuristicHazard:1.0"))
76           throw org.omg.CosTransactions.HeuristicHazardHelper.read ($in);
77        else
78             throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
79     } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
80        return prepare ();
81     } finally {
82         _releaseReply ($in);
83     }
84   } // prepare
85

86   public void rollback () throws org.omg.CosTransactions.HeuristicCommit, org.omg.CosTransactions.HeuristicMixed, org.omg.CosTransactions.HeuristicHazard
87   {
88     org.omg.CORBA.portable.InputStream JavaDoc $in = null;
89     try {
90        org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("rollback", true);
91        $in = _invoke ($out);
92     } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
93        $in = $ex.getInputStream ();
94        String JavaDoc _id = $ex.getId ();
95        if (_id.equals ("IDL:omg.org/CosTransactions/HeuristicCommit:1.0"))
96           throw org.omg.CosTransactions.HeuristicCommitHelper.read ($in);
97        else if (_id.equals ("IDL:omg.org/CosTransactions/HeuristicMixed:1.0"))
98           throw org.omg.CosTransactions.HeuristicMixedHelper.read ($in);
99        else if (_id.equals ("IDL:omg.org/CosTransactions/HeuristicHazard:1.0"))
100           throw org.omg.CosTransactions.HeuristicHazardHelper.read ($in);
101        else
102             throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
103     } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
104        rollback ();
105     } finally {
106         _releaseReply ($in);
107     }
108   } // rollback
109

110   public void commit () throws org.omg.CosTransactions.NotPrepared, org.omg.CosTransactions.HeuristicRollback, org.omg.CosTransactions.HeuristicMixed, org.omg.CosTransactions.HeuristicHazard
111   {
112     org.omg.CORBA.portable.InputStream JavaDoc $in = null;
113     try {
114        org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("commit", true);
115        $in = _invoke ($out);
116     } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
117        $in = $ex.getInputStream ();
118        String JavaDoc _id = $ex.getId ();
119        if (_id.equals ("IDL:omg.org/CosTransactions/NotPrepared:1.0"))
120           throw org.omg.CosTransactions.NotPreparedHelper.read ($in);
121        else if (_id.equals ("IDL:omg.org/CosTransactions/HeuristicRollback:1.0"))
122           throw org.omg.CosTransactions.HeuristicRollbackHelper.read ($in);
123        else if (_id.equals ("IDL:omg.org/CosTransactions/HeuristicMixed:1.0"))
124           throw org.omg.CosTransactions.HeuristicMixedHelper.read ($in);
125        else if (_id.equals ("IDL:omg.org/CosTransactions/HeuristicHazard:1.0"))
126           throw org.omg.CosTransactions.HeuristicHazardHelper.read ($in);
127        else
128             throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
129     } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
130        commit ();
131     } finally {
132         _releaseReply ($in);
133     }
134   } // commit
135

136   public void commit_one_phase () throws org.omg.CosTransactions.HeuristicHazard
137   {
138     org.omg.CORBA.portable.InputStream JavaDoc $in = null;
139     try {
140        org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("commit_one_phase", true);
141        $in = _invoke ($out);
142     } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
143        $in = $ex.getInputStream ();
144        String JavaDoc _id = $ex.getId ();
145        if (_id.equals ("IDL:omg.org/CosTransactions/HeuristicHazard:1.0"))
146           throw org.omg.CosTransactions.HeuristicHazardHelper.read ($in);
147        else
148             throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
149     } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
150        commit_one_phase ();
151     } finally {
152         _releaseReply ($in);
153     }
154   } // commit_one_phase
155

156   public void forget ()
157   {
158     org.omg.CORBA.portable.InputStream JavaDoc $in = null;
159     try {
160        org.omg.CORBA.portable.OutputStream JavaDoc $out = _request ("forget", true);
161        $in = _invoke ($out);
162     } catch (org.omg.CORBA.portable.ApplicationException JavaDoc $ex) {
163        $in = $ex.getInputStream ();
164        String JavaDoc _id = $ex.getId ();
165        throw new org.omg.CORBA.MARSHAL JavaDoc (_id);
166     } catch (org.omg.CORBA.portable.RemarshalException JavaDoc $rm) {
167        forget ();
168     } finally {
169         _releaseReply ($in);
170     }
171   } // forget
172

173   // Type-specific CORBA::Object operations
174
private static String JavaDoc[] __ids = {
175     "IDL:jtsxa/OTSResource:1.0",
176     "IDL:omg.org/CosTransactions/Resource:1.0"};
177
178   public String JavaDoc[] _ids ()
179   {
180     return (String JavaDoc[])__ids.clone ();
181   }
182
183   private void readObject (java.io.ObjectInputStream JavaDoc s) throws java.io.IOException JavaDoc
184   {
185      String JavaDoc str = s.readUTF ();
186      String JavaDoc[] args = null;
187      java.util.Properties JavaDoc props = null;
188      org.omg.CORBA.Object JavaDoc obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);
189      org.omg.CORBA.portable.Delegate JavaDoc delegate = ((org.omg.CORBA.portable.ObjectImpl JavaDoc) obj)._get_delegate ();
190      _set_delegate (delegate);
191   }
192
193   private void writeObject (java.io.ObjectOutputStream JavaDoc s) throws java.io.IOException JavaDoc
194   {
195      String JavaDoc[] args = null;
196      java.util.Properties JavaDoc props = null;
197      String JavaDoc str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);
198      s.writeUTF (str);
199   }
200 } // class _OTSResourceStub
201
Popular Tags