OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [examples/] [gnu/] [classpath/] [examples/] [CORBA/] [swing/] [x5/] [_Player_Stub.java] - Blame information for rev 781

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 781 jeremybenn
/* _Player_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.awt.Point;
42
import java.io.Serializable;
43
import java.rmi.RemoteException;
44
import java.rmi.UnexpectedException;
45
 
46
import javax.rmi.CORBA.Stub;
47
import javax.rmi.CORBA.Util;
48
 
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;
54
 
55
/**
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).
59
 *
60
 * This class is normally generated with rmic from the {@link GameManagerImpl}:
61
 * <pre>
62
 * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.GameManagerImpl
63
 * </pre>
64
 * (the compiled package must be present in the current folder).
65
 *
66
 * In this example the class was manually edited and commented for better
67
 * understanding of functionality.
68
 *
69
 * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
70
 */
71
public class _Player_Stub extends Stub implements Player
72
{
73
  /**
74
   * Use serialVersionUID for interoperability.
75
   */
76
  private static final long serialVersionUID = 1;
77
 
78
  private static final String[] _type_ids =
79
    { "RMI:gnu.classpath.examples.CORBA.swing.x5.Player:0000000000000000" };
80
 
81
  public String[] _ids()
82
  {
83
    return _type_ids;
84
  }
85
 
86
  public boolean start_game(Player arg0, boolean arg1)
87
    throws RemoteException
88
  {
89
    if (!Util.isLocal(this))
90
      {
91
        try
92
          {
93
            org.omg.CORBA.portable.InputStream in = null;
94
            try
95
              {
96
                OutputStream out = _request("start_game", true);
97
                Util.writeRemoteObject(out, arg0);
98
                out.write_boolean(arg1);
99
                in = _invoke(out);
100
                return in.read_boolean();
101
              }
102
            catch (ApplicationException ex)
103
              {
104
                in = ex.getInputStream();
105
 
106
                String id = in.read_string();
107
                throw new UnexpectedException(id);
108
              }
109
            catch (RemarshalException ex)
110
              {
111
                return start_game(arg0, arg1);
112
              }
113
            finally
114
              {
115
                _releaseReply(in);
116
              }
117
          }
118
        catch (SystemException ex)
119
          {
120
            throw Util.mapSystemException(ex);
121
          }
122
      }
123
    else
124
      {
125
        ServantObject so = _servant_preinvoke("start_game", Player.class);
126
        if (so == null)
127
          {
128
            return start_game(arg0, arg1);
129
          }
130
        try
131
          {
132
            Player arg0Copy = (Player) Util.copyObject(arg0, _orb());
133
            return ((Player) so.servant).start_game(arg0Copy, arg1);
134
          }
135
        catch (Throwable ex)
136
          {
137
            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
138
            throw Util.wrapException(exCopy);
139
          }
140
        finally
141
          {
142
            _servant_postinvoke(so);
143
          }
144
      }
145
  }
146
 
147
  public int get_current_state() throws RemoteException
148
  {
149
    if (!Util.isLocal(this))
150
      {
151
        try
152
          {
153
            org.omg.CORBA.portable.InputStream in = null;
154
            try
155
              {
156
                OutputStream out = _request("_get_J_current_state", true);
157
                in = _invoke(out);
158
                return in.read_long();
159
              }
160
            catch (ApplicationException ex)
161
              {
162
                in = ex.getInputStream();
163
 
164
                String id = in.read_string();
165
                throw new UnexpectedException(id);
166
              }
167
            catch (RemarshalException ex)
168
              {
169
                return get_current_state();
170
              }
171
            finally
172
              {
173
                _releaseReply(in);
174
              }
175
          }
176
        catch (SystemException ex)
177
          {
178
            throw Util.mapSystemException(ex);
179
          }
180
      }
181
    else
182
      {
183
        ServantObject so =
184
          _servant_preinvoke("_get_J_current_state", Player.class);
185
        if (so == null)
186
          {
187
            return get_current_state();
188
          }
189
        try
190
          {
191
            return ((Player) so.servant).get_current_state();
192
          }
193
        catch (Throwable ex)
194
          {
195
            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
196
            throw Util.wrapException(exCopy);
197
          }
198
        finally
199
          {
200
            _servant_postinvoke(so);
201
          }
202
      }
203
  }
204
 
205
  public void receive_chat(byte arg0, String arg1) throws RemoteException
206
  {
207
    if (!Util.isLocal(this))
208
      {
209
        try
210
          {
211
            org.omg.CORBA_2_3.portable.InputStream in = null;
212
            try
213
              {
214
                org.omg.CORBA_2_3.portable.OutputStream out =
215
                  (org.omg.CORBA_2_3.portable.OutputStream) _request("receive_chat",
216
                    true
217
                  );
218
                out.write_octet(arg0);
219
                out.write_value(arg1, String.class);
220
                _invoke(out);
221
              }
222
            catch (ApplicationException ex)
223
              {
224
                in =
225
                  (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
226
 
227
                String id = in.read_string();
228
                throw new UnexpectedException(id);
229
              }
230
            catch (RemarshalException ex)
231
              {
232
                receive_chat(arg0, arg1);
233
              }
234
            finally
235
              {
236
                _releaseReply(in);
237
              }
238
          }
239
        catch (SystemException ex)
240
          {
241
            throw Util.mapSystemException(ex);
242
          }
243
      }
244
    else
245
      {
246
        ServantObject so = _servant_preinvoke("receive_chat", Player.class);
247
        if (so == null)
248
          {
249
            receive_chat(arg0, arg1);
250
            return;
251
          }
252
        try
253
          {
254
            ((Player) so.servant).receive_chat(arg0, arg1);
255
          }
256
        catch (Throwable ex)
257
          {
258
            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
259
            throw Util.wrapException(exCopy);
260
          }
261
        finally
262
          {
263
            _servant_postinvoke(so);
264
          }
265
      }
266
  }
267
 
268
  public void disconnect() throws RemoteException
269
  {
270
    if (!Util.isLocal(this))
271
      {
272
        try
273
          {
274
            org.omg.CORBA.portable.InputStream in = null;
275
            try
276
              {
277
                OutputStream out = _request("disconnect", true);
278
                _invoke(out);
279
              }
280
            catch (ApplicationException ex)
281
              {
282
                in = ex.getInputStream();
283
 
284
                String id = in.read_string();
285
                throw new UnexpectedException(id);
286
              }
287
            catch (RemarshalException ex)
288
              {
289
                disconnect();
290
              }
291
            finally
292
              {
293
                _releaseReply(in);
294
              }
295
          }
296
        catch (SystemException ex)
297
          {
298
            throw Util.mapSystemException(ex);
299
          }
300
      }
301
    else
302
      {
303
        ServantObject so = _servant_preinvoke("disconnect", Player.class);
304
        if (so == null)
305
          {
306
            disconnect();
307
            return;
308
          }
309
        try
310
          {
311
            ((Player) so.servant).disconnect();
312
          }
313
        catch (Throwable ex)
314
          {
315
            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
316
            throw Util.wrapException(exCopy);
317
          }
318
        finally
319
          {
320
            _servant_postinvoke(so);
321
          }
322
      }
323
  }
324
 
325
  public void receive_move(int arg0, int arg1, Point[] arg2)
326
    throws RemoteException
327
  {
328
    if (!Util.isLocal(this))
329
      {
330
        try
331
          {
332
            org.omg.CORBA_2_3.portable.InputStream in = null;
333
            try
334
              {
335
                org.omg.CORBA_2_3.portable.OutputStream out =
336
                  (org.omg.CORBA_2_3.portable.OutputStream) _request("receive_move",
337
                    true
338
                  );
339
                out.write_long(arg0);
340
                out.write_long(arg1);
341
                out.write_value(cast_array(arg2), Point[].class);
342
                _invoke(out);
343
              }
344
            catch (ApplicationException ex)
345
              {
346
                in =
347
                  (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
348
 
349
                String id = in.read_string();
350
                throw new UnexpectedException(id);
351
              }
352
            catch (RemarshalException ex)
353
              {
354
                receive_move(arg0, arg1, arg2);
355
              }
356
            finally
357
              {
358
                _releaseReply(in);
359
              }
360
          }
361
        catch (SystemException ex)
362
          {
363
            throw Util.mapSystemException(ex);
364
          }
365
      }
366
    else
367
      {
368
        ServantObject so = _servant_preinvoke("receive_move", Player.class);
369
        if (so == null)
370
          {
371
            receive_move(arg0, arg1, arg2);
372
            return;
373
          }
374
        try
375
          {
376
            Point[] arg2Copy = (Point[]) Util.copyObject(arg2, _orb());
377
            ((Player) so.servant).receive_move(arg0, arg1, arg2Copy);
378
          }
379
        catch (Throwable ex)
380
          {
381
            Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
382
            throw Util.wrapException(exCopy);
383
          }
384
        finally
385
          {
386
            _servant_postinvoke(so);
387
          }
388
      }
389
  }
390
 
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)
394
  {
395
    return (Serializable) obj;
396
  }
397
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.