OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / lib / classpath / examples / gnu / classpath / examples / CORBA / swing / x5 / _GameManager_Stub.java
1 /* _GameManager_Stub.java --
2  Copyright (C) 2005 Free Software Foundation, Inc.
3
4  This file is part of GNU Classpath.
5
6  GNU Classpath is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)
9  any later version.
10
11  GNU Classpath is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  General Public License for more details.
15
16  You should have received a copy of the GNU General Public License
17  along with GNU Classpath; see the file COPYING.  If not, write to the
18  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  02110-1301 USA.
20
21  Linking this library statically or dynamically with other modules is
22  making a combined work based on this library.  Thus, the terms and
23  conditions of the GNU General Public License cover the whole
24  combination.
25
26  As a special exception, the copyright holders of this library give you
27  permission to link this library with independent modules to produce an
28  executable, regardless of the license terms of these independent
29  modules, and to copy and distribute the resulting executable under
30  terms of your choice, provided that you also meet, for each linked
31  independent module, the terms and conditions of the license of that
32  module.  An independent module is a module which is not derived from
33  or based on this library.  If you modify this library, you may extend
34  this exception to your version of the library, but you are not
35  obligated to do so.  If you do not wish to do so, delete this
36  exception statement from your version. */
37
38
39 package gnu.classpath.examples.CORBA.swing.x5;
40
41 import java.rmi.RemoteException;
42 import java.rmi.UnexpectedException;
43
44 import javax.rmi.CORBA.Stub;
45 import javax.rmi.CORBA.Util;
46
47 import org.omg.CORBA.SystemException;
48 import org.omg.CORBA.portable.ApplicationException;
49 import org.omg.CORBA.portable.OutputStream;
50 import org.omg.CORBA.portable.RemarshalException;
51 import org.omg.CORBA.portable.ServantObject;
52
53 /**
54  * Normally generated with rmic compiler, this class represents the GameManager
55  * Stub on the client side. The Game Manager methods contain the code for
56  * remote invocation.
57  * 
58  * This class is normally generated with rmic from the {@link GameManagerImpl}:
59  * <pre>
60  * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.GameManagerImpl
61  * </pre>
62  * (the compiled package must be present in the current folder).
63  * 
64  * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) 
65  */
66 public class _GameManager_Stub extends Stub implements GameManager
67 {
68   /** 
69    * Use serialVersionUID for interoperability. 
70    */
71   private static final long serialVersionUID = 1;
72   
73   private static final String[] _type_ids =
74     { "RMI:gnu.classpath.examples.CORBA.swing.x5.GameManager:0000000000000000" };
75
76   public String[] _ids()
77   {
78     return _type_ids;
79   }
80   
81   /**
82    * Notify the manager that the player is no longer willing to play and
83    * should be removed from the queue.
84    */
85   public void unregister(Player p)
86     throws RemoteException
87   {
88     if (!Util.isLocal(this))
89       {
90         try
91           {
92             org.omg.CORBA.portable.InputStream in = null;
93             try
94               {
95                 OutputStream out = _request("unregister", true);
96                 Util.writeRemoteObject(out, p);
97                 _invoke(out);
98               }
99             catch (ApplicationException ex)
100               {
101                 in = ex.getInputStream();
102
103                 String id = in.read_string();
104                 throw new UnexpectedException(id);
105               }
106             catch (RemarshalException ex)
107               {
108                 unregister(p);
109               }
110             finally
111               {
112                 _releaseReply(in);
113               }
114           }
115         catch (SystemException ex)
116           {
117             throw Util.mapSystemException(ex);
118           }
119       }
120     else
121       {
122         ServantObject so =
123           _servant_preinvoke("requestTheGame", GameManager.class);
124         if (so == null)
125           {
126             unregister(p);
127             return;
128           }
129         try
130           {
131             ((GameManager) so.servant).unregister(p);
132           }
133         catch (Throwable ex)
134           {
135             Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
136             throw Util.wrapException(exCopy);
137           }
138         finally
139           {
140             _servant_postinvoke(so);
141           }
142       }
143   }
144   
145   /**
146    * The method that the user should invoke.
147    */
148   public void requestTheGame(Player arg0) throws RemoteException
149   {
150     if (!Util.isLocal(this))
151       {
152         try
153           {
154             org.omg.CORBA.portable.InputStream in = null;
155             try
156               {
157                 OutputStream out = _request("requestTheGame", true);
158                 Util.writeRemoteObject(out, arg0);
159                 _invoke(out);
160               }
161             catch (ApplicationException ex)
162               {
163                 in = ex.getInputStream();
164
165                 String id = in.read_string();
166                 throw new UnexpectedException(id);
167               }
168             catch (RemarshalException ex)
169               {
170                 requestTheGame(arg0);
171               }
172             finally
173               {
174                 _releaseReply(in);
175               }
176           }
177         catch (SystemException ex)
178           {
179             throw Util.mapSystemException(ex);
180           }
181       }
182     else
183       {
184         ServantObject so =
185           _servant_preinvoke("requestTheGame", GameManager.class);
186         if (so == null)
187           {
188             requestTheGame(arg0);
189             return;
190           }
191         try
192           {
193             Player arg0Copy = (Player) Util.copyObject(arg0, _orb());
194             ((GameManager) so.servant).requestTheGame(arg0Copy);
195           }
196         catch (Throwable ex)
197           {
198             Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
199             throw Util.wrapException(exCopy);
200           }
201         finally
202           {
203             _servant_postinvoke(so);
204           }
205       }
206   }
207 }