Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libjava / classpath / gnu / CORBA / Interceptor / gnuClientRequestInfo.java
blobbeb81c81f6c59fd015a7f38449452119d6ec76ca
1 /* gnuClientRequestInfo.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.CORBA.Interceptor;
41 import gnu.CORBA.Unexpected;
42 import gnu.CORBA.gnuRequest;
44 import org.omg.CORBA.ARG_IN;
45 import org.omg.CORBA.ARG_INOUT;
46 import org.omg.CORBA.ARG_OUT;
47 import org.omg.CORBA.Any;
48 import org.omg.CORBA.BAD_PARAM;
49 import org.omg.CORBA.Bounds;
50 import org.omg.CORBA.ExceptionList;
51 import org.omg.CORBA.INV_POLICY;
52 import org.omg.CORBA.LocalObject;
53 import org.omg.CORBA.NVList;
54 import org.omg.CORBA.ORB;
55 import org.omg.CORBA.ParameterMode;
56 import org.omg.CORBA.Policy;
57 import org.omg.CORBA.TCKind;
58 import org.omg.CORBA.TypeCode;
59 import org.omg.CORBA.TypeCodePackage.BadKind;
60 import org.omg.Dynamic.Parameter;
61 import org.omg.IOP.ServiceContext;
62 import org.omg.IOP.TaggedComponent;
63 import org.omg.IOP.TaggedProfile;
64 import org.omg.PortableInterceptor.ClientRequestInfo;
65 import org.omg.PortableInterceptor.InvalidSlot;
67 /**
68 * Client request info. All requests on the client side in Classpath
69 * implementations are handled via gnuRequest class. This class holds the
70 * instance of the gnuRequest, accessing the request info this way.
72 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
74 public class gnuClientRequestInfo extends LocalObject
75 implements ClientRequestInfo
77 /**
78 * Use serialVersionUID for interoperability.
80 private static final long serialVersionUID = 1;
82 /**
83 * The request structure, from that some methods take the needed information
84 * directly. The same request structure cannot be reused in parallel threads,
85 * the submission methods are synchronized.
87 private final gnuRequest request;
89 /**
90 * Provides possibility to set the wrapped thrown exception explicitly, where
91 * applicable.
93 public Any m_wrapped_exception;
95 /**
96 * Create the info on the given request.
98 public gnuClientRequestInfo(gnuRequest a_request)
100 request = a_request;
103 /** @inheritDoc */
104 public void add_request_service_context(ServiceContext service_context,
105 boolean replace
108 request.add_request_service_context(service_context, replace);
111 /** @inheritDoc */
112 public TaggedProfile effective_profile()
114 return request.effective_profile();
117 /** @inheritDoc */
118 public org.omg.CORBA.Object effective_target()
120 return request.effective_target();
123 /** @inheritDoc */
124 public TaggedComponent get_effective_component(int id)
125 throws BAD_PARAM
127 return request.get_effective_component(id);
130 /** @inheritDoc */
131 public TaggedComponent[] get_effective_components(int id)
132 throws BAD_PARAM
134 return request.get_effective_components(id);
137 /** @inheritDoc */
138 public Policy get_request_policy(int type) throws INV_POLICY
140 return request.get_request_policy(type);
143 /** @inheritDoc */
144 public String received_exception_id()
148 if (m_wrapped_exception != null)
150 return m_wrapped_exception.type().id();
152 else
154 return request.received_exception_id();
157 catch (BadKind e)
159 throw new Unexpected(e);
163 /** @inheritDoc */
164 public Any received_exception()
166 if (m_wrapped_exception != null)
168 return m_wrapped_exception;
170 else
172 return request.received_exception();
176 /** @inheritDoc */
177 public org.omg.CORBA.Object target()
179 return request.target();
182 /** @inheritDoc */
183 public Parameter[] arguments()
185 request.checkDii();
187 NVList args = request.arguments();
188 Parameter[] p = new Parameter[ args.count() ];
191 for (int i = 0; i < p.length; i++)
193 ParameterMode mode;
195 switch (args.item(i).flags())
197 case ARG_IN.value :
198 mode = ParameterMode.PARAM_IN;
199 break;
201 case ARG_OUT.value :
202 mode = ParameterMode.PARAM_OUT;
203 break;
205 case ARG_INOUT.value :
206 mode = ParameterMode.PARAM_INOUT;
207 break;
209 default :
210 throw new Unexpected();
213 p [ i ] = new Parameter(args.item(i).value(), mode);
216 catch (Bounds e)
218 throw new Unexpected(e);
220 return p;
223 /** @inheritDoc */
224 public Any result()
226 request.checkDii();
228 Any rt = request.return_value();
230 if (rt == null)
232 ORB orb = request.orb();
233 rt = orb.create_any();
234 rt.type(orb.get_primitive_tc(TCKind.tk_void));
235 return rt;
238 return request.return_value();
241 /** @inheritDoc */
242 public String[] contexts()
244 return request.ice_contexts();
247 /** @inheritDoc */
248 public TypeCode[] exceptions()
250 request.checkDii();
252 ExceptionList ex = request.exceptions();
253 TypeCode[] et = new TypeCode[ ex.count() ];
256 for (int i = 0; i < et.length; i++)
258 et [ i ] = ex.item(i);
261 catch (Bounds e)
263 throw new Unexpected(e);
265 return et;
268 /** @inheritDoc */
269 public org.omg.CORBA.Object forward_reference()
271 return request.forward_reference();
274 /** @inheritDoc */
275 public String[] operation_context()
277 return request.operation_context();
280 /** @inheritDoc */
281 public Any get_slot(int id) throws InvalidSlot
283 return request.get_slot(id);
286 /** @inheritDoc */
287 public String operation()
289 return request.operation();
292 /** @inheritDoc */
293 public short reply_status()
295 return request.reply_status();
298 /** @inheritDoc */
299 public int request_id()
301 return request.request_id();
304 /** @inheritDoc */
305 public boolean response_expected()
307 return request.response_expected();
311 * Determines how far the request shall progress before control is returned to
312 * the client. However up till JDK 1.5 inclusive this method always returns
313 * SYNC_WITH_TRANSPORT.
315 * @return {@link org.omg.Messaging.SYNC_WITH_TRANSPORT.value (1), always.
317 * @specnote as defined in the Suns 1.5 JDK API.
319 public short sync_scope()
321 return request.sync_scope();
324 /** @inheritDoc */
325 public ServiceContext get_reply_service_context(int ctx_name)
326 throws BAD_PARAM
328 return request.get_reply_service_context(ctx_name);
331 /** @inheritDoc */
332 public ServiceContext get_request_service_context(int ctx_name)
333 throws BAD_PARAM
335 return request.get_request_service_context(ctx_name);