Dead
[official-gcc.git] / gomp-20050608-branch / libjava / classpath / org / omg / CORBA / _IDLTypeStub.java
blob6661b0c47022c81e5f02def3738f8a5f5c89ce1b
1 /* _IDLTypeStub.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 org.omg.CORBA;
41 import gnu.CORBA.Minor;
42 import gnu.CORBA.TypeCodeHelper;
44 import org.omg.CORBA.portable.ApplicationException;
45 import org.omg.CORBA.portable.Delegate;
46 import org.omg.CORBA.portable.InputStream;
47 import org.omg.CORBA.portable.ObjectImpl;
48 import org.omg.CORBA.portable.OutputStream;
49 import org.omg.CORBA.portable.RemarshalException;
51 import java.io.Serializable;
53 /**
54 * The stub for the IDL type. This stub can be used to access the
55 * remote IDL type object, if its IOR is known. To create the
56 * working instance with the known IOR, pass {@link gnu.CORBA.IorDelegate}
57 * to the constructor.
59 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
61 public class _IDLTypeStub
62 extends ObjectImpl
63 implements IDLType, Serializable
65 /**
66 * Use serialVersionUID (v1.4) for interoperability.
68 private static final long serialVersionUID = 9150293942452453626L;
70 /**
71 * Create the instance of the IDL type stub without
72 * the set delegate. The delegate must be set anyway before calling
73 * any remote method.
75 public _IDLTypeStub()
79 /**
80 * Create an instance with the given delegate.
82 * @see gnu.CORBA.IorDelegate
84 public _IDLTypeStub(Delegate delegate)
86 _set_delegate(delegate);
89 /**
90 * Get the typecode of the remote IDL type object. The method is
91 * written following OMG specification, treating the typecode
92 * as a read only attribute rather than a method. This means,
93 * the operation name is "_get_type".
95 * @return a typecode, returned by the remote IDL type object.
97 public TypeCode type()
99 InputStream in = null;
102 OutputStream out = _request("_get_type", true);
103 in = _invoke(out);
104 return TypeCodeHelper.read(in);
106 catch (ApplicationException ex)
108 in = ex.getInputStream();
109 throw new org.omg.CORBA.MARSHAL(ex.getId());
111 catch (RemarshalException rex)
113 return type();
115 catch (UserException ex)
117 MARSHAL m = new MARSHAL();
118 m.minor = Minor.UserException;
119 m.initCause(ex);
120 throw m;
122 finally
124 _releaseReply(in);
129 * Get the definition kind of the remote IDL type object. The method is
130 * written following OMG specification, treating the typecode
131 * as a read only attribute rather than a method. This means,
132 * the operation name is "_get_def_kind".
134 * @return a definition kind, returned by remote IDL type object.
136 public DefinitionKind def_kind()
138 InputStream in = null;
141 OutputStream out = _request("_get_def_kind", true);
142 in = _invoke(out);
143 return DefinitionKindHelper.read(in);
145 catch (ApplicationException ex)
147 in = ex.getInputStream();
148 throw new org.omg.CORBA.MARSHAL(ex.getId());
150 catch (RemarshalException rex)
152 return def_kind();
154 finally
156 _releaseReply(in);
161 * Destroy the remote IDL type object.
163 public void destroy()
165 InputStream in = null;
168 OutputStream out = _request("destroy", true);
169 in = _invoke(out);
171 catch (ApplicationException ex)
173 in = ex.getInputStream();
174 throw new org.omg.CORBA.MARSHAL(ex.getId());
176 catch (RemarshalException rex)
178 destroy();
180 finally
182 _releaseReply(in);
187 * Return the array of repository ids of the IDL type.
189 * @return "IDL:omg.org/CORBA/IDLType:1.0" and
190 * "IDL:omg.org/CORBA/IRObject:1.0", always.
192 public String[] _ids()
194 return new String[]
196 "IDL:omg.org/CORBA/IDLType:1.0", "IDL:omg.org/CORBA/IRObject:1.0"