OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [gnu/] [CORBA/] [Interceptor/] [gnuClientRequestInfo.java] - Blame information for rev 769

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 769 jeremybenn
/* gnuClientRequestInfo.java --
2
   Copyright (C) 2005 Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
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.
10
 
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.
15
 
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.
20
 
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.
25
 
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. */
37
 
38
 
39
package gnu.CORBA.Interceptor;
40
 
41
import gnu.CORBA.Unexpected;
42
import gnu.CORBA.gnuRequest;
43
 
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;
66
 
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.
71
 *
72
 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
73
 */
74
public class gnuClientRequestInfo extends LocalObject
75
  implements ClientRequestInfo
76
{
77
  /**
78
   * Use serialVersionUID for interoperability.
79
   */
80
  private static final long serialVersionUID = 1;
81
 
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.
86
   */
87
  private final gnuRequest request;
88
 
89
  /**
90
   * Provides possibility to set the wrapped thrown exception explicitly, where
91
   * applicable.
92
   */
93
  public Any m_wrapped_exception;
94
 
95
  /**
96
   * Create the info on the given request.
97
   */
98
  public gnuClientRequestInfo(gnuRequest a_request)
99
  {
100
    request = a_request;
101
  }
102
 
103
  /** @inheritDoc */
104
  public void add_request_service_context(ServiceContext service_context,
105
    boolean replace
106
  )
107
  {
108
    request.add_request_service_context(service_context, replace);
109
  }
110
 
111
  /** @inheritDoc */
112
  public TaggedProfile effective_profile()
113
  {
114
    return request.effective_profile();
115
  }
116
 
117
  /** @inheritDoc */
118
  public org.omg.CORBA.Object effective_target()
119
  {
120
    return request.effective_target();
121
  }
122
 
123
  /** @inheritDoc */
124
  public TaggedComponent get_effective_component(int id)
125
    throws BAD_PARAM
126
  {
127
    return request.get_effective_component(id);
128
  }
129
 
130
  /** @inheritDoc */
131
  public TaggedComponent[] get_effective_components(int id)
132
    throws BAD_PARAM
133
  {
134
    return request.get_effective_components(id);
135
  }
136
 
137
  /** @inheritDoc */
138
  public Policy get_request_policy(int type) throws INV_POLICY
139
  {
140
    return request.get_request_policy(type);
141
  }
142
 
143
  /** @inheritDoc */
144
  public String received_exception_id()
145
  {
146
    try
147
      {
148
        if (m_wrapped_exception != null)
149
          {
150
            return m_wrapped_exception.type().id();
151
          }
152
        else
153
          {
154
            return request.received_exception_id();
155
          }
156
      }
157
    catch (BadKind e)
158
      {
159
        throw new Unexpected(e);
160
      }
161
  }
162
 
163
  /** @inheritDoc */
164
  public Any received_exception()
165
  {
166
    if (m_wrapped_exception != null)
167
      {
168
        return m_wrapped_exception;
169
      }
170
    else
171
      {
172
        return request.received_exception();
173
      }
174
  }
175
 
176
  /** @inheritDoc */
177
  public org.omg.CORBA.Object target()
178
  {
179
    return request.target();
180
  }
181
 
182
  /** @inheritDoc */
183
  public Parameter[] arguments()
184
  {
185
    request.checkDii();
186
 
187
    NVList args = request.arguments();
188
    Parameter[] p = new Parameter[ args.count() ];
189
    try
190
      {
191
        for (int i = 0; i < p.length; i++)
192
          {
193
            ParameterMode mode;
194
 
195
            switch (args.item(i).flags())
196
              {
197
                case ARG_IN.value :
198
                  mode = ParameterMode.PARAM_IN;
199
                  break;
200
 
201
                case ARG_OUT.value :
202
                  mode = ParameterMode.PARAM_OUT;
203
                  break;
204
 
205
                case ARG_INOUT.value :
206
                  mode = ParameterMode.PARAM_INOUT;
207
                  break;
208
 
209
                default :
210
                  throw new Unexpected();
211
              }
212
 
213
            p [ i ] = new Parameter(args.item(i).value(), mode);
214
          }
215
      }
216
    catch (Bounds e)
217
      {
218
        throw new Unexpected(e);
219
      }
220
    return p;
221
  }
222
 
223
  /** @inheritDoc */
224
  public Any result()
225
  {
226
    request.checkDii();
227
 
228
    Any rt = request.return_value();
229
 
230
    if (rt == null)
231
      {
232
        ORB orb = request.orb();
233
        rt = orb.create_any();
234
        rt.type(orb.get_primitive_tc(TCKind.tk_void));
235
        return rt;
236
      }
237
 
238
    return request.return_value();
239
  }
240
 
241
  /** @inheritDoc */
242
  public String[] contexts()
243
  {
244
    return request.ice_contexts();
245
  }
246
 
247
  /** @inheritDoc */
248
  public TypeCode[] exceptions()
249
  {
250
    request.checkDii();
251
 
252
    ExceptionList ex = request.exceptions();
253
    TypeCode[] et = new TypeCode[ ex.count() ];
254
    try
255
      {
256
        for (int i = 0; i < et.length; i++)
257
          {
258
            et [ i ] = ex.item(i);
259
          }
260
      }
261
    catch (Bounds e)
262
      {
263
        throw new Unexpected(e);
264
      }
265
    return et;
266
  }
267
 
268
  /** @inheritDoc */
269
  public org.omg.CORBA.Object forward_reference()
270
  {
271
    return request.forward_reference();
272
  }
273
 
274
  /** @inheritDoc */
275
  public String[] operation_context()
276
  {
277
    return request.operation_context();
278
  }
279
 
280
  /** @inheritDoc */
281
  public Any get_slot(int id) throws InvalidSlot
282
  {
283
    return request.get_slot(id);
284
  }
285
 
286
  /** @inheritDoc */
287
  public String operation()
288
  {
289
    return request.operation();
290
  }
291
 
292
  /** @inheritDoc */
293
  public short reply_status()
294
  {
295
    return request.reply_status();
296
  }
297
 
298
  /** @inheritDoc */
299
  public int request_id()
300
  {
301
    return request.request_id();
302
  }
303
 
304
  /** @inheritDoc */
305
  public boolean response_expected()
306
  {
307
    return request.response_expected();
308
  }
309
 
310
  /**
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.
314
   *
315
   * @return {@link org.omg.Messaging.SYNC_WITH_TRANSPORT.value (1), always.
316
   *
317
   * @specnote as defined in the Suns 1.5 JDK API.
318
   */
319
  public short sync_scope()
320
  {
321
    return request.sync_scope();
322
  }
323
 
324
  /** @inheritDoc */
325
  public ServiceContext get_reply_service_context(int ctx_name)
326
    throws BAD_PARAM
327
  {
328
    return request.get_reply_service_context(ctx_name);
329
  }
330
 
331
  /** @inheritDoc */
332
  public ServiceContext get_request_service_context(int ctx_name)
333
    throws BAD_PARAM
334
  {
335
    return request.get_request_service_context(ctx_name);
336
  }
337
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.