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)
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
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
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
;
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
78 * Use serialVersionUID for interoperability.
80 private static final long serialVersionUID
= 1;
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
;
90 * Provides possibility to set the wrapped thrown exception explicitly, where
93 public Any m_wrapped_exception
;
96 * Create the info on the given request.
98 public gnuClientRequestInfo(gnuRequest a_request
)
104 public void add_request_service_context(ServiceContext service_context
,
108 request
.add_request_service_context(service_context
, replace
);
112 public TaggedProfile
effective_profile()
114 return request
.effective_profile();
118 public org
.omg
.CORBA
.Object
effective_target()
120 return request
.effective_target();
124 public TaggedComponent
get_effective_component(int id
)
127 return request
.get_effective_component(id
);
131 public TaggedComponent
[] get_effective_components(int id
)
134 return request
.get_effective_components(id
);
138 public Policy
get_request_policy(int type
) throws INV_POLICY
140 return request
.get_request_policy(type
);
144 public String
received_exception_id()
148 if (m_wrapped_exception
!= null)
150 return m_wrapped_exception
.type().id();
154 return request
.received_exception_id();
159 throw new Unexpected(e
);
164 public Any
received_exception()
166 if (m_wrapped_exception
!= null)
168 return m_wrapped_exception
;
172 return request
.received_exception();
177 public org
.omg
.CORBA
.Object
target()
179 return request
.target();
183 public Parameter
[] arguments()
187 NVList args
= request
.arguments();
188 Parameter
[] p
= new Parameter
[ args
.count() ];
191 for (int i
= 0; i
< p
.length
; i
++)
195 switch (args
.item(i
).flags())
198 mode
= ParameterMode
.PARAM_IN
;
202 mode
= ParameterMode
.PARAM_OUT
;
205 case ARG_INOUT
.value
:
206 mode
= ParameterMode
.PARAM_INOUT
;
210 throw new Unexpected();
213 p
[ i
] = new Parameter(args
.item(i
).value(), mode
);
218 throw new Unexpected(e
);
228 Any rt
= request
.return_value();
232 ORB orb
= request
.orb();
233 rt
= orb
.create_any();
234 rt
.type(orb
.get_primitive_tc(TCKind
.tk_void
));
238 return request
.return_value();
242 public String
[] contexts()
244 return request
.ice_contexts();
248 public TypeCode
[] exceptions()
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
);
263 throw new Unexpected(e
);
269 public org
.omg
.CORBA
.Object
forward_reference()
271 return request
.forward_reference();
275 public String
[] operation_context()
277 return request
.operation_context();
281 public Any
get_slot(int id
) throws InvalidSlot
283 return request
.get_slot(id
);
287 public String
operation()
289 return request
.operation();
293 public short reply_status()
295 return request
.reply_status();
299 public int request_id()
301 return request
.request_id();
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();
325 public ServiceContext
get_reply_service_context(int ctx_name
)
328 return request
.get_reply_service_context(ctx_name
);
332 public ServiceContext
get_request_service_context(int ctx_name
)
335 return request
.get_request_service_context(ctx_name
);