1 /* _Player_Stub.java --
2 Copyright (C) 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
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)
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.
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
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
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. */
39 package gnu.classpath.examples.CORBA.swing.x5;
41 import java.awt.Point;
42 import java.io.Serializable;
43 import java.rmi.RemoteException;
44 import java.rmi.UnexpectedException;
46 import javax.rmi.CORBA.Stub;
47 import javax.rmi.CORBA.Util;
49 import org.omg.CORBA.SystemException;
50 import org.omg.CORBA.portable.ApplicationException;
51 import org.omg.CORBA.portable.OutputStream;
52 import org.omg.CORBA.portable.RemarshalException;
53 import org.omg.CORBA.portable.ServantObject;
56 * Generate with rmic, command line
57 * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.PlayerImpl
58 * (the compiled package must be present in the current folder).
60 * This class is normally generated with rmic from the {@link GameManagerImpl}:
62 * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.GameManagerImpl
64 * (the compiled package must be present in the current folder).
66 * In this example the class was manually edited and commented for better
67 * understanding of functionality.
69 * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
71 public class _Player_Stub extends Stub implements Player
74 * Use serialVersionUID for interoperability.
76 private static final long serialVersionUID = 1;
78 private static final String[] _type_ids =
79 { "RMI:gnu.classpath.examples.CORBA.swing.x5.Player:0000000000000000" };
81 public String[] _ids()
86 public boolean start_game(Player arg0, boolean arg1)
87 throws RemoteException
89 if (!Util.isLocal(this))
93 org.omg.CORBA.portable.InputStream in = null;
96 OutputStream out = _request("start_game", true);
97 Util.writeRemoteObject(out, arg0);
98 out.write_boolean(arg1);
100 return in.read_boolean();
102 catch (ApplicationException ex)
104 in = ex.getInputStream();
106 String id = in.read_string();
107 throw new UnexpectedException(id);
109 catch (RemarshalException ex)
111 return start_game(arg0, arg1);
118 catch (SystemException ex)
120 throw Util.mapSystemException(ex);
125 ServantObject so = _servant_preinvoke("start_game", Player.class);
128 return start_game(arg0, arg1);
132 Player arg0Copy = (Player) Util.copyObject(arg0, _orb());
133 return ((Player) so.servant).start_game(arg0Copy, arg1);
137 Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
138 throw Util.wrapException(exCopy);
142 _servant_postinvoke(so);
147 public int get_current_state() throws RemoteException
149 if (!Util.isLocal(this))
153 org.omg.CORBA.portable.InputStream in = null;
156 OutputStream out = _request("_get_J_current_state", true);
158 return in.read_long();
160 catch (ApplicationException ex)
162 in = ex.getInputStream();
164 String id = in.read_string();
165 throw new UnexpectedException(id);
167 catch (RemarshalException ex)
169 return get_current_state();
176 catch (SystemException ex)
178 throw Util.mapSystemException(ex);
184 _servant_preinvoke("_get_J_current_state", Player.class);
187 return get_current_state();
191 return ((Player) so.servant).get_current_state();
195 Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
196 throw Util.wrapException(exCopy);
200 _servant_postinvoke(so);
205 public void receive_chat(byte arg0, String arg1) throws RemoteException
207 if (!Util.isLocal(this))
211 org.omg.CORBA_2_3.portable.InputStream in = null;
214 org.omg.CORBA_2_3.portable.OutputStream out =
215 (org.omg.CORBA_2_3.portable.OutputStream) _request("receive_chat",
218 out.write_octet(arg0);
219 out.write_value(arg1, String.class);
222 catch (ApplicationException ex)
225 (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
227 String id = in.read_string();
228 throw new UnexpectedException(id);
230 catch (RemarshalException ex)
232 receive_chat(arg0, arg1);
239 catch (SystemException ex)
241 throw Util.mapSystemException(ex);
246 ServantObject so = _servant_preinvoke("receive_chat", Player.class);
249 receive_chat(arg0, arg1);
254 ((Player) so.servant).receive_chat(arg0, arg1);
258 Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
259 throw Util.wrapException(exCopy);
263 _servant_postinvoke(so);
268 public void disconnect() throws RemoteException
270 if (!Util.isLocal(this))
274 org.omg.CORBA.portable.InputStream in = null;
277 OutputStream out = _request("disconnect", true);
280 catch (ApplicationException ex)
282 in = ex.getInputStream();
284 String id = in.read_string();
285 throw new UnexpectedException(id);
287 catch (RemarshalException ex)
296 catch (SystemException ex)
298 throw Util.mapSystemException(ex);
303 ServantObject so = _servant_preinvoke("disconnect", Player.class);
311 ((Player) so.servant).disconnect();
315 Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
316 throw Util.wrapException(exCopy);
320 _servant_postinvoke(so);
325 public void receive_move(int arg0, int arg1, Point[] arg2)
326 throws RemoteException
328 if (!Util.isLocal(this))
332 org.omg.CORBA_2_3.portable.InputStream in = null;
335 org.omg.CORBA_2_3.portable.OutputStream out =
336 (org.omg.CORBA_2_3.portable.OutputStream) _request("receive_move",
339 out.write_long(arg0);
340 out.write_long(arg1);
341 out.write_value(cast_array(arg2), Point[].class);
344 catch (ApplicationException ex)
347 (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
349 String id = in.read_string();
350 throw new UnexpectedException(id);
352 catch (RemarshalException ex)
354 receive_move(arg0, arg1, arg2);
361 catch (SystemException ex)
363 throw Util.mapSystemException(ex);
368 ServantObject so = _servant_preinvoke("receive_move", Player.class);
371 receive_move(arg0, arg1, arg2);
376 Point[] arg2Copy = (Point[]) Util.copyObject(arg2, _orb());
377 ((Player) so.servant).receive_move(arg0, arg1, arg2Copy);
381 Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
382 throw Util.wrapException(exCopy);
386 _servant_postinvoke(so);
391 // This method is required as a work-around for
392 // a bug in the JDK 1.1.6 verifier.
393 private Serializable cast_array(Object obj)
395 return (Serializable) obj;