Merge from mainline.
[official-gcc.git] / libjava / classpath / tools / gnu / classpath / tools / rmi / registry / RegistryImpl_Skel.java
blob36b7d94a595a151ddd273fdeaa7ba6c0f590771e
1 /* RegistryImpl_Skel.java
2 Copyright (C) 2002, 2006 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.tools.rmi.registry;
41 import java.io.IOException;
42 import java.io.ObjectInput;
43 import java.io.ObjectOutput;
44 import java.rmi.MarshalException;
45 import java.rmi.Remote;
46 import java.rmi.UnmarshalException;
47 import java.rmi.server.Operation;
48 import java.rmi.server.RemoteCall;
49 import java.rmi.server.SkeletonMismatchException;
51 /**
52 * This skeleton supports unlikely cases when the naming service is
53 * contacted from other interoperable java implementation that still uses
54 * the old style skeleton-dependent invocations.
56 public final class RegistryImpl_Skel
57 implements java.rmi.server.Skeleton
59 private static final long interfaceHash = 4905912898345647071L;
61 /**
62 * Repeated multiple times.
64 static final String EUM = "error unmarshalling arguments for Registry";
66 /**
67 * Repeated multiple times.
69 static final String EMR = "error marshalling return from Registry";
71 private static final Operation[] operations =
73 new Operation("void bind(java.lang.String, Remote"),
74 new Operation("java.lang.String[] list("),
75 new Operation("Remote lookup(java.lang.String"),
76 new Operation("void rebind(java.lang.String, Remote"),
77 new Operation("void unbind(java.lang.String")
80 public Operation[] getOperations()
82 return ((Operation[]) operations.clone());
85 public void dispatch(Remote obj, RemoteCall call,
86 int opnum, long hash) throws java.lang.Exception
88 if (opnum < 0)
90 if (hash == 7583982177005850366L)
91 opnum = 0;
92 else if (hash == 2571371476350237748L)
93 opnum = 1;
94 else if (hash == -7538657168040752697L)
95 opnum = 2;
96 else if (hash == -8381844669958460146L)
97 opnum = 3;
98 else if (hash == 7305022919901907578L)
99 opnum = 4;
100 else
101 throw new SkeletonMismatchException("interface hash mismatch");
103 else if (hash != interfaceHash)
104 throw new SkeletonMismatchException("interface hash mismatch");
106 RegistryImpl server = (RegistryImpl) obj;
107 switch (opnum)
109 case 0:
111 java.lang.String $param_0;
112 Remote $param_1;
115 ObjectInput in = call.getInputStream();
116 $param_0 = (java.lang.String) in.readObject();
117 $param_1 = (Remote) in.readObject();
120 catch (IOException e)
122 throw new UnmarshalException(EUM, e);
124 catch (java.lang.ClassCastException e)
126 throw new UnmarshalException(EUM, e);
128 finally
130 call.releaseInputStream();
132 server.bind($param_0, $param_1);
135 ObjectOutput out = call.getResultStream(true);
137 catch (IOException e)
139 throw new MarshalException(EMR, e);
141 break;
144 case 1:
148 ObjectInput in = call.getInputStream();
151 catch (IOException e)
153 throw new UnmarshalException(EUM, e);
155 finally
157 call.releaseInputStream();
159 java.lang.String[] $result = server.list();
162 ObjectOutput out = call.getResultStream(true);
163 out.writeObject($result);
165 catch (IOException e)
167 throw new MarshalException(EMR, e);
169 break;
172 case 2:
174 java.lang.String $param_0;
177 ObjectInput in = call.getInputStream();
178 $param_0 = (java.lang.String) in.readObject();
181 catch (IOException e)
183 throw new UnmarshalException(EUM, e);
185 catch (java.lang.ClassCastException e)
187 throw new UnmarshalException(EUM, e);
189 finally
191 call.releaseInputStream();
193 Remote $result = server.lookup($param_0);
196 ObjectOutput out = call.getResultStream(true);
197 out.writeObject($result);
199 catch (IOException e)
201 throw new MarshalException(EMR, e);
203 break;
206 case 3:
208 java.lang.String $param_0;
209 Remote $param_1;
212 ObjectInput in = call.getInputStream();
213 $param_0 = (java.lang.String) in.readObject();
214 $param_1 = (Remote) in.readObject();
217 catch (IOException e)
219 throw new UnmarshalException(EUM, e);
221 catch (java.lang.ClassCastException e)
223 throw new UnmarshalException(EUM, e);
225 finally
227 call.releaseInputStream();
229 server.rebind($param_0, $param_1);
232 ObjectOutput out = call.getResultStream(true);
234 catch (IOException e)
236 throw new MarshalException(EMR, e);
238 break;
241 case 4:
243 java.lang.String $param_0;
246 ObjectInput in = call.getInputStream();
247 $param_0 = (java.lang.String) in.readObject();
250 catch (IOException e)
252 throw new UnmarshalException(EUM, e);
254 catch (java.lang.ClassCastException e)
256 throw new UnmarshalException(EUM, e);
258 finally
260 call.releaseInputStream();
262 server.unbind($param_0);
265 ObjectOutput out = call.getResultStream(true);
267 catch (IOException e)
269 throw new MarshalException(EMR, e);
271 break;
274 default:
275 throw new UnmarshalException("invalid method number");