Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libjava / classpath / examples / gnu / classpath / examples / CORBA / swing / x5 / _PlayerImpl_Tie.java
blob730c6f469a0a9ef5eb0c31d8f720dcbcf6f611cd
1 /* _PlayerImpl_Tie.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)
9 any later version.
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
19 02110-1301 USA.
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.
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.rmi.Remote;
44 import javax.rmi.PortableRemoteObject;
45 import javax.rmi.CORBA.Tie;
47 import org.omg.CORBA.BAD_OPERATION;
48 import org.omg.CORBA.ORB;
49 import org.omg.CORBA.SystemException;
50 import org.omg.CORBA.portable.InputStream;
51 import org.omg.CORBA.portable.OutputStream;
52 import org.omg.CORBA.portable.ResponseHandler;
53 import org.omg.CORBA.portable.UnknownException;
54 import org.omg.PortableServer.Servant;
56 /**
57 * Generate with rmic, command line
58 * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.PlayerImpl
59 * (the compiled package must be present in the current folder).
61 * This class is normally generated with rmic from the {@link PlayerImpl}:
62 * <pre>
63 * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.PlayerImpl
64 * </pre>
65 * (the compiled package must be present in the current folder).
67 * In this example the class was manually edited and commented for better
68 * understanding of functionality.
70 * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
72 public class _PlayerImpl_Tie extends Servant implements Tie
74 private PlayerImpl target = null;
75 private static final String[] _type_ids =
76 { "RMI:gnu.classpath.examples.CORBA.swing.x5.Player:0000000000000000" };
78 public void setTarget(Remote a_target)
80 this.target = (PlayerImpl) a_target;
83 public Remote getTarget()
85 return target;
88 public org.omg.CORBA.Object thisObject()
90 return _this_object();
93 public void deactivate()
95 try
97 _poa().deactivate_object(_poa().servant_to_id(this));
99 catch (org.omg.PortableServer.POAPackage.WrongPolicy exception)
102 catch (org.omg.PortableServer.POAPackage.ObjectNotActive exception)
105 catch (org.omg.PortableServer.POAPackage.ServantNotActive exception)
110 public ORB orb()
112 return _orb();
115 public void orb(ORB orb)
119 ((org.omg.CORBA_2_3.ORB) orb).set_delegate(this);
121 catch (ClassCastException e)
123 throw new org.omg.CORBA.BAD_PARAM(
124 "POA Servant requires an instance of org.omg.CORBA_2_3.ORB"
129 public String[] _all_interfaces(org.omg.PortableServer.POA poa,
130 byte[] objectId
133 return _type_ids;
136 public OutputStream _invoke(String method, InputStream _in,
137 ResponseHandler reply
138 ) throws SystemException
142 org.omg.CORBA_2_3.portable.InputStream in =
143 (org.omg.CORBA_2_3.portable.InputStream) _in;
144 switch (method.charAt(9))
146 case 101 :
147 if (method.equals("start_game"))
149 Player arg0 =
150 (Player) PortableRemoteObject.narrow(in.read_Object(),
151 Player.class
153 boolean arg1 = in.read_boolean();
154 boolean result = target.start_game(arg0, arg1);
155 OutputStream out = reply.createReply();
156 out.write_boolean(result);
157 return out;
160 case 104 :
161 if (method.equals("receive_chat"))
163 byte arg0 = in.read_octet();
164 String arg1 = (String) in.read_value(String.class);
165 target.receive_chat(arg0, arg1);
167 OutputStream out = reply.createReply();
168 return out;
171 case 111 :
172 if (method.equals("receive_move"))
174 int arg0 = in.read_long();
175 int arg1 = in.read_long();
176 Point[] arg2 = (Point[]) in.read_value(Point[].class);
177 target.receive_move(arg0, arg1, arg2);
179 OutputStream out = reply.createReply();
180 return out;
183 case 114 :
184 if (method.equals("_get_J_current_state"))
186 int result = target.get_current_state();
187 OutputStream out = reply.createReply();
188 out.write_long(result);
189 return out;
192 case 116 :
193 if (method.equals("disconnect"))
195 target.disconnect();
197 OutputStream out = reply.createReply();
198 return out;
201 throw new BAD_OPERATION("No such method: '"+method+"'");
203 catch (SystemException ex)
205 throw ex;
207 catch (Throwable ex)
209 throw new UnknownException(ex);