~ubuntu-branches/ubuntu/breezy/ace/breezy

« back to all changes in this revision

Viewing changes to TAO/tao/ORB.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad, Benjamin Montgomery, Adam Conrad
  • Date: 2005-09-18 22:51:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge) (0.1.2 woody)
  • Revision ID: james.westby@ubuntu.com-20050918225138-seav22q6fyylb536
Tags: 5.4.7-3ubuntu1
[ Benjamin Montgomery ]
* Added a patch for amd64 and powerpc that disables the compiler
  option -fvisibility-inlines-hidden

[ Adam Conrad ]
* Added DPATCH_OPTION_CPP=1 to debian/patches/00options to make
  Benjamin's above changes work correctly with dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// "ORB.cpp,v 1.461 2003/11/20 01:53:32 parsons Exp"
2
 
 
3
 
#include "ORB.h"
4
 
 
5
 
ACE_RCSID (tao,
6
 
           ORB,
7
 
           "ORB.cpp,v 1.461 2003/11/20 01:53:32 parsons Exp")
8
 
 
9
 
#include "ORB_Table.h"
10
 
#include "Connector_Registry.h"
11
 
#include "IOR_Parser.h"
12
 
#include "Typecode_Constants.h"
13
 
#include "Stub.h"
14
 
#include "ORB_Core.h"
15
 
#include "TAO_Internal.h"
16
 
#include "NVList.h"
17
 
#include "Dynamic_Adapter.h"
18
 
#include "Profile.h"
19
 
#include "default_ports.h"
20
 
#include "ORBInitInfo.h"
21
 
#include "ORBInitializer_Registry.h"
22
 
#include "TAO_Singleton_Manager.h"
23
 
#include "Policy_Manager.h"
24
 
#include "Valuetype_Adapter.h"
25
 
#include "IFR_Client_Adapter.h"
26
 
#include "CodecFactory_ORBInitializer.h"
27
 
#include "TypeCodeFactory_Adapter.h"
28
 
#include "debug.h"
29
 
 
30
 
#if TAO_HAS_INTERCEPTORS == 1
31
 
# include "PICurrent_ORBInitializer.h"  /* @@ This should go away! */
32
 
#endif  /* TAO_HAS_INTERCEPTORS == 1 */
33
 
 
34
 
#include "ace/Dynamic_Service.h"
35
 
#include "ace/Arg_Shifter.h"
36
 
#include "ace/Reactor.h"
37
 
#include "ace/Argv_Type_Converter.h"
38
 
#include "ace/OS_NS_strings.h"
39
 
 
40
 
#if !defined (__ACE_INLINE__)
41
 
# include "ORB.i"
42
 
#endif /* ! __ACE_INLINE__ */
43
 
 
44
 
static const char ior_prefix[] = "IOR:";
45
 
 
46
 
// = Static initialization.
47
 
 
48
 
// Count of the number of ORBs.
49
 
int CORBA::ORB::orb_init_count_ = 0;
50
 
 
51
 
// ****************************************************************
52
 
 
53
 
CORBA::ORB::InvalidName::InvalidName (void)
54
 
  : CORBA::UserException ("IDL:omg.org/CORBA/ORB/InvalidName:1.0",
55
 
                          "InvalidName")
56
 
{
57
 
}
58
 
 
59
 
// Destructor - all members are of self managing types.
60
 
CORBA::ORB::InvalidName::~InvalidName (void)
61
 
{
62
 
}
63
 
 
64
 
// Copy constructor.
65
 
CORBA::ORB::InvalidName::InvalidName (const CORBA::ORB::InvalidName &exc)
66
 
  : CORBA::UserException (exc._rep_id (),
67
 
                          exc._name ())
68
 
{
69
 
}
70
 
 
71
 
// Assignment operator.
72
 
CORBA::ORB::InvalidName&
73
 
CORBA::ORB::InvalidName::operator= (const ::CORBA::ORB::InvalidName &_tao_excp)
74
 
{
75
 
  this->UserException::operator= (_tao_excp);
76
 
  return *this;
77
 
}
78
 
 
79
 
CORBA::ORB::InvalidName *
80
 
CORBA::ORB::InvalidName::_downcast (CORBA::Exception *exc)
81
 
{
82
 
  if (!ACE_OS::strcmp ("IDL:omg.org/CORBA/ORB/InvalidName:1.0",
83
 
                       exc->_rep_id ()))
84
 
    {
85
 
      return ACE_dynamic_cast (InvalidName *, exc);
86
 
    }
87
 
  else
88
 
    {
89
 
      return 0;
90
 
    }
91
 
}
92
 
 
93
 
CORBA::Exception *CORBA::ORB::InvalidName::_alloc (void)
94
 
{
95
 
  CORBA::Exception *retval = 0;
96
 
  ACE_NEW_RETURN (retval, ::CORBA::ORB::InvalidName, 0);
97
 
  return retval;
98
 
}
99
 
 
100
 
CORBA::Exception *
101
 
CORBA::ORB::InvalidName::_tao_duplicate (void) const
102
 
{
103
 
  CORBA::Exception *result;
104
 
  ACE_NEW_RETURN (
105
 
      result,
106
 
      ::CORBA::ORB::InvalidName (*this),
107
 
      0
108
 
    );
109
 
  return result;
110
 
}
111
 
 
112
 
void CORBA::ORB::InvalidName::_raise (void) const
113
 
{
114
 
  TAO_RAISE (*this);
115
 
}
116
 
 
117
 
void CORBA::ORB::InvalidName::_tao_encode (
118
 
    TAO_OutputCDR &
119
 
    ACE_ENV_ARG_DECL
120
 
  ) const
121
 
{
122
 
  ACE_THROW (CORBA::MARSHAL ());
123
 
}
124
 
 
125
 
void CORBA::ORB::InvalidName::_tao_decode (
126
 
    TAO_InputCDR &
127
 
    ACE_ENV_ARG_DECL
128
 
  )
129
 
{
130
 
  ACE_THROW (CORBA::MARSHAL ());
131
 
}
132
 
 
133
 
// ****************************************************************
134
 
 
135
 
CORBA::ORB::ORB (TAO_ORB_Core *orb_core)
136
 
  : lock_ ()
137
 
  , refcount_ (1)
138
 
  , orb_core_ (orb_core)
139
 
  , use_omg_ior_format_ (1)
140
 
  , timeout_ (0)
141
 
{
142
 
}
143
 
 
144
 
CORBA::ORB::~ORB (void)
145
 
{
146
 
  // This destructor is only invoked when the last ORB reference (not
147
 
  // instance) is being destroyed.
148
 
}
149
 
 
150
 
void
151
 
CORBA::ORB::shutdown (CORBA::Boolean wait_for_completion
152
 
                     ACE_ENV_ARG_DECL)
153
 
{
154
 
  // We cannot lock the exceptions here. We need to propogate
155
 
  // BAD_INV_ORDER  exceptions if needed to the caller. Locking
156
 
  // exceptions down would render us non-compliant with the spec.
157
 
  this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
158
 
  ACE_CHECK;
159
 
 
160
 
  this->orb_core ()->shutdown (wait_for_completion
161
 
                               ACE_ENV_ARG_PARAMETER);
162
 
}
163
 
 
164
 
void
165
 
CORBA::ORB::destroy (ACE_ENV_SINGLE_ARG_DECL)
166
 
{
167
 
  if (this->orb_core () == 0)
168
 
    {
169
 
      // If the ORB_Core pointer is zero, assume that the ORB_Core has
170
 
      // been destroyed.
171
 
 
172
 
      // As defined by the CORBA 2.3 specification, throw a
173
 
      // CORBA::OBJECT_NOT_EXIST exception if the ORB has been
174
 
      // destroyed by the time an ORB function is called.
175
 
 
176
 
      ACE_THROW (CORBA::OBJECT_NOT_EXIST (TAO_DEFAULT_MINOR_CODE,
177
 
                                          CORBA::COMPLETED_NO));
178
 
    }
179
 
 
180
 
  if (TAO_debug_level >= 3)
181
 
    {
182
 
      ACE_DEBUG ((LM_DEBUG,
183
 
                  ACE_LIB_TEXT ("CORBA::ORB::destroy() has been called on ORB <%s>.\n"),
184
 
                  ACE_TEXT_CHAR_TO_TCHAR (this->orb_core ()->orbid ())));
185
 
    }
186
 
 
187
 
  this->orb_core ()->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
188
 
  ACE_CHECK;
189
 
 
190
 
  // Now invalidate the pointer to the ORB_Core that created this
191
 
  // ORB.
192
 
  this->orb_core_ = 0;
193
 
}
194
 
 
195
 
void
196
 
CORBA::ORB::run (ACE_ENV_SINGLE_ARG_DECL)
197
 
{
198
 
  this->run (0 ACE_ENV_ARG_PARAMETER);
199
 
}
200
 
 
201
 
void
202
 
CORBA::ORB::run (ACE_Time_Value &tv ACE_ENV_ARG_DECL)
203
 
{
204
 
  this->run (&tv ACE_ENV_ARG_PARAMETER);
205
 
}
206
 
 
207
 
void
208
 
CORBA::ORB::run (ACE_Time_Value *tv
209
 
                 ACE_ENV_ARG_DECL)
210
 
{
211
 
  this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
212
 
  ACE_CHECK;
213
 
 
214
 
  this->orb_core ()->run (tv, 0 ACE_ENV_ARG_PARAMETER);
215
 
}
216
 
 
217
 
void
218
 
CORBA::ORB::perform_work (ACE_ENV_SINGLE_ARG_DECL)
219
 
{
220
 
  this->perform_work (0 ACE_ENV_ARG_PARAMETER);
221
 
}
222
 
 
223
 
void
224
 
CORBA::ORB::perform_work (ACE_Time_Value &tv ACE_ENV_ARG_DECL)
225
 
{
226
 
  this->perform_work (&tv ACE_ENV_ARG_PARAMETER);
227
 
}
228
 
 
229
 
void
230
 
CORBA::ORB::perform_work (ACE_Time_Value *tv
231
 
                         ACE_ENV_ARG_DECL)
232
 
{
233
 
  // This method should not be called if the ORB has been shutdown.
234
 
  this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
235
 
  ACE_CHECK;
236
 
 
237
 
  this->orb_core ()->run (tv, 1 ACE_ENV_ARG_PARAMETER);
238
 
}
239
 
 
240
 
CORBA::Boolean
241
 
CORBA::ORB::work_pending (ACE_Time_Value &tv ACE_ENV_ARG_DECL)
242
 
{
243
 
  // This method should not be called if the ORB has been shutdown.
244
 
  this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
245
 
  ACE_CHECK_RETURN (0);
246
 
 
247
 
  int result = this->orb_core_->reactor ()->work_pending (tv);
248
 
  if (result == 0 || (result == -1 && errno == ETIME))
249
 
    return 0;
250
 
 
251
 
  if (result == -1)
252
 
    ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
253
 
 
254
 
  return 1;
255
 
}
256
 
 
257
 
CORBA::Boolean
258
 
CORBA::ORB::work_pending (ACE_ENV_SINGLE_ARG_DECL)
259
 
{
260
 
  // This method should not be called if the ORB has been shutdown.
261
 
  this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
262
 
  ACE_CHECK_RETURN (0);
263
 
 
264
 
  int result = this->orb_core_->reactor ()->work_pending ();
265
 
  if (result == 0)
266
 
    return 0;
267
 
 
268
 
  if (result == -1)
269
 
    ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
270
 
 
271
 
  return 1;
272
 
}
273
 
 
274
 
#if (TAO_HAS_MINIMUM_CORBA == 0)
275
 
 
276
 
void
277
 
CORBA::ORB::create_list (CORBA::Long count,
278
 
                        CORBA::NVList_ptr &new_list
279
 
                        ACE_ENV_ARG_DECL)
280
 
{
281
 
  ACE_ASSERT (CORBA::ULong (count) <= UINT_MAX);
282
 
 
283
 
  // Create an empty list
284
 
  ACE_NEW_THROW_EX (new_list,
285
 
                    CORBA::NVList,
286
 
                    CORBA::NO_MEMORY (
287
 
                      CORBA::SystemException::_tao_minor_code (
288
 
                        TAO_DEFAULT_MINOR_CODE,
289
 
                        ENOMEM),
290
 
                      CORBA::COMPLETED_NO));
291
 
  ACE_CHECK;
292
 
 
293
 
  // If count is greater than 0, create a list of NamedValues.
294
 
  if (count != 0)
295
 
    {
296
 
      new_list->max_ = (CORBA::ULong) count;
297
 
 
298
 
      for (CORBA::Long i = 0; i < count; i++)
299
 
        {
300
 
          CORBA::NamedValue_ptr nv = 0;
301
 
          ACE_NEW_THROW_EX (nv,
302
 
                            CORBA::NamedValue,
303
 
                            CORBA::NO_MEMORY (
304
 
                              CORBA::SystemException::_tao_minor_code (
305
 
                                TAO_DEFAULT_MINOR_CODE,
306
 
                                ENOMEM),
307
 
                              CORBA::COMPLETED_NO));
308
 
          ACE_CHECK;
309
 
 
310
 
          new_list->values_.enqueue_tail (nv);
311
 
        }
312
 
    }
313
 
}
314
 
 
315
 
void
316
 
CORBA::ORB::create_exception_list (CORBA::ExceptionList_ptr &list
317
 
                                  ACE_ENV_ARG_DECL)
318
 
{
319
 
  TAO_Dynamic_Adapter *dynamic_adapter =
320
 
    ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance (
321
 
        TAO_ORB_Core::dynamic_adapter_name ()
322
 
      );
323
 
 
324
 
  dynamic_adapter->create_exception_list (list
325
 
                                          ACE_ENV_ARG_PARAMETER);
326
 
}
327
 
 
328
 
void
329
 
CORBA::ORB::create_operation_list (CORBA::OperationDef_ptr opDef,
330
 
                                   CORBA::NVList_ptr &result
331
 
                                   ACE_ENV_ARG_DECL)
332
 
{
333
 
  TAO_IFR_Client_Adapter *adapter =
334
 
    ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
335
 
        TAO_ORB_Core::ifr_client_adapter_name ()
336
 
      );
337
 
 
338
 
  if (adapter == 0)
339
 
    {
340
 
      ACE_THROW (CORBA::INTF_REPOS ());
341
 
    }
342
 
 
343
 
  adapter->create_operation_list (this, 
344
 
                                  opDef, 
345
 
                                  result 
346
 
                                  ACE_ENV_ARG_PARAMETER);
347
 
}
348
 
 
349
 
 
350
 
void
351
 
CORBA::ORB::create_environment (CORBA::Environment_ptr &environment
352
 
                                ACE_ENV_ARG_DECL)
353
 
{
354
 
  ACE_NEW_THROW_EX (environment,
355
 
                    CORBA::Environment (),
356
 
                    CORBA::NO_MEMORY (
357
 
                      CORBA::SystemException::_tao_minor_code (
358
 
                        TAO_DEFAULT_MINOR_CODE,
359
 
                        ENOMEM),
360
 
                      CORBA::COMPLETED_NO));
361
 
}
362
 
 
363
 
void
364
 
CORBA::ORB::create_named_value (CORBA::NamedValue_ptr &nv
365
 
                               ACE_ENV_ARG_DECL)
366
 
{
367
 
  ACE_NEW_THROW_EX (nv,
368
 
                    CORBA::NamedValue,
369
 
                    CORBA::NO_MEMORY (
370
 
                      CORBA::SystemException::_tao_minor_code (
371
 
                        TAO_DEFAULT_MINOR_CODE,
372
 
                        ENOMEM),
373
 
                      CORBA::COMPLETED_NO));
374
 
}
375
 
 
376
 
// The following functions are not implemented - they just throw
377
 
// CORBA::NO_IMPLEMENT.
378
 
 
379
 
CORBA::Boolean
380
 
CORBA::ORB::get_service_information (
381
 
  CORBA::ServiceType /* service_type */,
382
 
  CORBA::ServiceInformation_out /* service_information */
383
 
  ACE_ENV_ARG_DECL)
384
 
{
385
 
  ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (
386
 
                      CORBA::SystemException::_tao_minor_code (
387
 
                        TAO_DEFAULT_MINOR_CODE,
388
 
                        ENOTSUP),
389
 
                      CORBA::COMPLETED_NO),
390
 
                    0);
391
 
}
392
 
 
393
 
void
394
 
CORBA::ORB::create_context_list (CORBA::ContextList_ptr &
395
 
                                ACE_ENV_ARG_DECL)
396
 
{
397
 
  ACE_THROW (CORBA::NO_IMPLEMENT (
398
 
               CORBA::SystemException::_tao_minor_code (
399
 
                 TAO_DEFAULT_MINOR_CODE,
400
 
                 ENOTSUP),
401
 
               CORBA::COMPLETED_NO));
402
 
}
403
 
 
404
 
void
405
 
CORBA::ORB::get_default_context (CORBA::Context_ptr &
406
 
                                ACE_ENV_ARG_DECL)
407
 
{
408
 
  ACE_THROW (CORBA::NO_IMPLEMENT (
409
 
               CORBA::SystemException::_tao_minor_code (
410
 
                 TAO_DEFAULT_MINOR_CODE,
411
 
                 ENOTSUP),
412
 
               CORBA::COMPLETED_NO));
413
 
}
414
 
 
415
 
void
416
 
CORBA::ORB::send_multiple_requests_oneway (const CORBA::ORB::RequestSeq &
417
 
                                          ACE_ENV_ARG_DECL)
418
 
{
419
 
  ACE_THROW (CORBA::NO_IMPLEMENT (
420
 
               CORBA::SystemException::_tao_minor_code (
421
 
                 TAO_DEFAULT_MINOR_CODE,
422
 
                 ENOTSUP),
423
 
               CORBA::COMPLETED_NO));
424
 
}
425
 
 
426
 
void
427
 
CORBA::ORB::send_multiple_requests_deferred (const CORBA::ORB::RequestSeq &
428
 
                                            ACE_ENV_ARG_DECL)
429
 
{
430
 
  ACE_THROW (CORBA::NO_IMPLEMENT (
431
 
               CORBA::SystemException::_tao_minor_code (
432
 
                 TAO_DEFAULT_MINOR_CODE,
433
 
                 ENOTSUP),
434
 
               CORBA::COMPLETED_NO));
435
 
}
436
 
 
437
 
void
438
 
CORBA::ORB::get_next_response (CORBA::Request_ptr &
439
 
                              ACE_ENV_ARG_DECL)
440
 
{
441
 
  ACE_THROW (CORBA::NO_IMPLEMENT (
442
 
               CORBA::SystemException::_tao_minor_code (
443
 
                 TAO_DEFAULT_MINOR_CODE,
444
 
                 ENOTSUP),
445
 
               CORBA::COMPLETED_NO));
446
 
}
447
 
 
448
 
CORBA::Boolean
449
 
CORBA::ORB::poll_next_response (ACE_ENV_SINGLE_ARG_DECL)
450
 
{
451
 
  ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (
452
 
                      CORBA::SystemException::_tao_minor_code (
453
 
                        TAO_DEFAULT_MINOR_CODE,
454
 
                        ENOTSUP),
455
 
                      CORBA::COMPLETED_NO),
456
 
                    0);
457
 
}
458
 
 
459
 
// ****************************************************************
460
 
 
461
 
CORBA::TypeCode_ptr
462
 
CORBA::ORB::create_struct_tc (
463
 
    const char *id,
464
 
    const char *name,
465
 
    const CORBA::StructMemberSeq & members
466
 
    ACE_ENV_ARG_DECL
467
 
  )
468
 
  ACE_THROW_SPEC ((CORBA::SystemException))
469
 
{
470
 
  TAO_TypeCodeFactory_Adapter *adapter =
471
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
472
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
473
 
      );
474
 
 
475
 
  if (adapter == 0)
476
 
    {
477
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
478
 
                        0);
479
 
    }
480
 
 
481
 
  return adapter->create_struct_tc (id,
482
 
                                    name,
483
 
                                    members
484
 
                                    ACE_ENV_ARG_PARAMETER);
485
 
}
486
 
 
487
 
CORBA::TypeCode_ptr
488
 
CORBA::ORB::create_union_tc (
489
 
    const char *id,
490
 
    const char *name,
491
 
    CORBA::TypeCode_ptr discriminator_type,
492
 
    const CORBA::UnionMemberSeq & members
493
 
    ACE_ENV_ARG_DECL
494
 
  )
495
 
  ACE_THROW_SPEC ((CORBA::SystemException))
496
 
{
497
 
  TAO_TypeCodeFactory_Adapter *adapter =
498
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
499
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
500
 
      );
501
 
 
502
 
  if (adapter == 0)
503
 
    {
504
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
505
 
                        0);
506
 
    }
507
 
 
508
 
  return adapter->create_union_tc (id,
509
 
                                   name,
510
 
                                   discriminator_type,
511
 
                                   members
512
 
                                   ACE_ENV_ARG_PARAMETER);
513
 
}
514
 
 
515
 
CORBA::TypeCode_ptr
516
 
CORBA::ORB::create_enum_tc (
517
 
    const char *id,
518
 
    const char *name,
519
 
    const CORBA::EnumMemberSeq & members
520
 
    ACE_ENV_ARG_DECL
521
 
  )
522
 
  ACE_THROW_SPEC ((CORBA::SystemException))
523
 
{
524
 
  TAO_TypeCodeFactory_Adapter *adapter =
525
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
526
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
527
 
      );
528
 
 
529
 
  if (adapter == 0)
530
 
    {
531
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
532
 
                        0);
533
 
    }
534
 
 
535
 
  return adapter->create_enum_tc (id,
536
 
                                  name,
537
 
                                  members
538
 
                                  ACE_ENV_ARG_PARAMETER);
539
 
}
540
 
 
541
 
CORBA::TypeCode_ptr
542
 
CORBA::ORB::create_alias_tc (
543
 
    const char *id,
544
 
    const char *name,
545
 
    CORBA::TypeCode_ptr original_type
546
 
    ACE_ENV_ARG_DECL
547
 
  )
548
 
  ACE_THROW_SPEC ((CORBA::SystemException))
549
 
{
550
 
  TAO_TypeCodeFactory_Adapter *adapter =
551
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
552
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
553
 
      );
554
 
 
555
 
  if (adapter == 0)
556
 
    {
557
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
558
 
                        0);
559
 
    }
560
 
 
561
 
  return adapter->create_alias_tc (id,
562
 
                                   name,
563
 
                                   original_type
564
 
                                   ACE_ENV_ARG_PARAMETER);
565
 
}
566
 
 
567
 
CORBA::TypeCode_ptr
568
 
CORBA::ORB::create_exception_tc (
569
 
    const char *id,
570
 
    const char *name,
571
 
    const CORBA::StructMemberSeq & members
572
 
    ACE_ENV_ARG_DECL
573
 
  )
574
 
  ACE_THROW_SPEC ((CORBA::SystemException))
575
 
{
576
 
  TAO_TypeCodeFactory_Adapter *adapter =
577
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
578
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
579
 
      );
580
 
 
581
 
  if (adapter == 0)
582
 
    {
583
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
584
 
                        0);
585
 
    }
586
 
 
587
 
  return adapter->create_exception_tc (id,
588
 
                                       name,
589
 
                                       members
590
 
                                       ACE_ENV_ARG_PARAMETER);
591
 
}
592
 
 
593
 
CORBA::TypeCode_ptr
594
 
CORBA::ORB::create_interface_tc (
595
 
    const char *id,
596
 
    const char *name
597
 
    ACE_ENV_ARG_DECL
598
 
  )
599
 
  ACE_THROW_SPEC ((CORBA::SystemException))
600
 
{
601
 
  TAO_TypeCodeFactory_Adapter *adapter =
602
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
603
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
604
 
      );
605
 
 
606
 
  if (adapter == 0)
607
 
    {
608
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
609
 
                        0);
610
 
    }
611
 
 
612
 
  return adapter->create_interface_tc (id,
613
 
                                       name
614
 
                                       ACE_ENV_ARG_PARAMETER);
615
 
}
616
 
 
617
 
CORBA::TypeCode_ptr
618
 
CORBA::ORB::create_string_tc (
619
 
    CORBA::ULong bound
620
 
    ACE_ENV_ARG_DECL
621
 
  )
622
 
  ACE_THROW_SPEC ((CORBA::SystemException))
623
 
{
624
 
  TAO_TypeCodeFactory_Adapter *adapter =
625
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
626
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
627
 
      );
628
 
 
629
 
  if (adapter == 0)
630
 
    {
631
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
632
 
                        0);
633
 
    }
634
 
 
635
 
  return adapter->create_string_tc (bound
636
 
                                    ACE_ENV_ARG_PARAMETER);
637
 
}
638
 
 
639
 
CORBA::TypeCode_ptr
640
 
CORBA::ORB::create_wstring_tc (
641
 
    CORBA::ULong bound
642
 
    ACE_ENV_ARG_DECL
643
 
  )
644
 
  ACE_THROW_SPEC ((CORBA::SystemException))
645
 
{
646
 
  TAO_TypeCodeFactory_Adapter *adapter =
647
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
648
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
649
 
      );
650
 
 
651
 
  if (adapter == 0)
652
 
    {
653
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
654
 
                        0);
655
 
    }
656
 
 
657
 
  return adapter->create_wstring_tc (bound
658
 
                                     ACE_ENV_ARG_PARAMETER);
659
 
}
660
 
 
661
 
CORBA::TypeCode_ptr
662
 
CORBA::ORB::create_fixed_tc (
663
 
    CORBA::UShort digits,
664
 
    CORBA::UShort scale
665
 
    ACE_ENV_ARG_DECL
666
 
  )
667
 
  ACE_THROW_SPEC ((CORBA::SystemException))
668
 
{
669
 
  TAO_TypeCodeFactory_Adapter *adapter =
670
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
671
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
672
 
      );
673
 
 
674
 
  if (adapter == 0)
675
 
    {
676
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
677
 
                        0);
678
 
    }
679
 
 
680
 
  return adapter->create_fixed_tc (digits,
681
 
                                   scale
682
 
                                   ACE_ENV_ARG_PARAMETER);
683
 
}
684
 
 
685
 
CORBA::TypeCode_ptr
686
 
CORBA::ORB::create_sequence_tc (
687
 
    CORBA::ULong bound,
688
 
    CORBA::TypeCode_ptr element_type
689
 
    ACE_ENV_ARG_DECL
690
 
  )
691
 
  ACE_THROW_SPEC ((CORBA::SystemException))
692
 
{
693
 
  TAO_TypeCodeFactory_Adapter *adapter =
694
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
695
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
696
 
      );
697
 
 
698
 
  if (adapter == 0)
699
 
    {
700
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
701
 
                        0);
702
 
    }
703
 
 
704
 
  return adapter->create_sequence_tc (bound,
705
 
                                      element_type
706
 
                                      ACE_ENV_ARG_PARAMETER);
707
 
}
708
 
 
709
 
CORBA::TypeCode_ptr
710
 
CORBA::ORB::create_array_tc (
711
 
    CORBA::ULong length,
712
 
    CORBA::TypeCode_ptr element_type
713
 
    ACE_ENV_ARG_DECL
714
 
  )
715
 
  ACE_THROW_SPEC ((CORBA::SystemException))
716
 
{
717
 
  TAO_TypeCodeFactory_Adapter *adapter =
718
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
719
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
720
 
      );
721
 
 
722
 
  if (adapter == 0)
723
 
    {
724
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
725
 
                        0);
726
 
    }
727
 
 
728
 
  return adapter->create_array_tc (length,
729
 
                                   element_type
730
 
                                   ACE_ENV_ARG_PARAMETER);
731
 
}
732
 
 
733
 
CORBA::TypeCode_ptr
734
 
CORBA::ORB::create_value_tc (
735
 
    const char *id,
736
 
    const char *name,
737
 
    CORBA::ValueModifier type_modifier,
738
 
    CORBA::TypeCode_ptr concrete_base,
739
 
    const CORBA::ValueMemberSeq & members
740
 
    ACE_ENV_ARG_DECL
741
 
  )
742
 
  ACE_THROW_SPEC ((CORBA::SystemException))
743
 
{
744
 
  TAO_TypeCodeFactory_Adapter *adapter =
745
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
746
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
747
 
      );
748
 
 
749
 
  if (adapter == 0)
750
 
    {
751
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
752
 
                        0);
753
 
    }
754
 
 
755
 
  return adapter->create_value_tc (id,
756
 
                                   name,
757
 
                                   type_modifier,
758
 
                                   concrete_base,
759
 
                                   members
760
 
                                   ACE_ENV_ARG_PARAMETER);
761
 
}
762
 
 
763
 
CORBA::TypeCode_ptr
764
 
CORBA::ORB::create_value_box_tc (
765
 
    const char *id,
766
 
    const char *name,
767
 
    CORBA::TypeCode_ptr boxed_type
768
 
    ACE_ENV_ARG_DECL
769
 
  )
770
 
  ACE_THROW_SPEC ((CORBA::SystemException))
771
 
{
772
 
  TAO_TypeCodeFactory_Adapter *adapter =
773
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
774
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
775
 
      );
776
 
 
777
 
  if (adapter == 0)
778
 
    {
779
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
780
 
                        0);
781
 
    }
782
 
 
783
 
  return adapter->create_value_box_tc (id,
784
 
                                       name,
785
 
                                       boxed_type
786
 
                                       ACE_ENV_ARG_PARAMETER);
787
 
}
788
 
 
789
 
CORBA::TypeCode_ptr
790
 
CORBA::ORB::create_native_tc (
791
 
    const char *id,
792
 
    const char *name
793
 
    ACE_ENV_ARG_DECL
794
 
  )
795
 
  ACE_THROW_SPEC ((CORBA::SystemException))
796
 
{
797
 
  TAO_TypeCodeFactory_Adapter *adapter =
798
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
799
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
800
 
      );
801
 
 
802
 
  if (adapter == 0)
803
 
    {
804
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
805
 
                        0);
806
 
    }
807
 
 
808
 
  return adapter->create_native_tc (id,
809
 
                                    name
810
 
                                    ACE_ENV_ARG_PARAMETER);
811
 
}
812
 
 
813
 
CORBA::TypeCode_ptr
814
 
CORBA::ORB::create_recursive_tc (
815
 
    const char *id
816
 
    ACE_ENV_ARG_DECL
817
 
  )
818
 
  ACE_THROW_SPEC ((CORBA::SystemException))
819
 
{
820
 
  TAO_TypeCodeFactory_Adapter *adapter =
821
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
822
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
823
 
      );
824
 
 
825
 
  if (adapter == 0)
826
 
    {
827
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
828
 
                        0);
829
 
    }
830
 
 
831
 
  return adapter->create_recursive_tc (id
832
 
                                       ACE_ENV_ARG_PARAMETER);
833
 
}
834
 
 
835
 
CORBA::TypeCode_ptr
836
 
CORBA::ORB::create_abstract_interface_tc (
837
 
    const char *id,
838
 
    const char *name
839
 
    ACE_ENV_ARG_DECL
840
 
  )
841
 
  ACE_THROW_SPEC ((CORBA::SystemException))
842
 
{
843
 
  TAO_TypeCodeFactory_Adapter *adapter =
844
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
845
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
846
 
      );
847
 
 
848
 
  if (adapter == 0)
849
 
    {
850
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
851
 
                        0);
852
 
    }
853
 
 
854
 
  return adapter->create_abstract_interface_tc (id,
855
 
                                                name
856
 
                                                ACE_ENV_ARG_PARAMETER);
857
 
}
858
 
 
859
 
CORBA::TypeCode_ptr
860
 
CORBA::ORB::create_local_interface_tc (
861
 
    const char *id,
862
 
    const char *name
863
 
    ACE_ENV_ARG_DECL
864
 
  )
865
 
  ACE_THROW_SPEC ((CORBA::SystemException))
866
 
{
867
 
  TAO_TypeCodeFactory_Adapter *adapter =
868
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
869
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
870
 
      );
871
 
 
872
 
  if (adapter == 0)
873
 
    {
874
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
875
 
                        0);
876
 
    }
877
 
 
878
 
  return adapter->create_local_interface_tc (id,
879
 
                                             name
880
 
                                             ACE_ENV_ARG_PARAMETER);
881
 
}
882
 
 
883
 
CORBA::TypeCode_ptr
884
 
CORBA::ORB::create_component_tc (
885
 
    const char *id,
886
 
    const char *name
887
 
    ACE_ENV_ARG_DECL
888
 
  )
889
 
  ACE_THROW_SPEC ((CORBA::SystemException))
890
 
{
891
 
  TAO_TypeCodeFactory_Adapter *adapter =
892
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
893
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
894
 
      );
895
 
 
896
 
  if (adapter == 0)
897
 
    {
898
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
899
 
                        0);
900
 
    }
901
 
 
902
 
  return adapter->create_component_tc (id,
903
 
                                       name
904
 
                                       ACE_ENV_ARG_PARAMETER);
905
 
}
906
 
 
907
 
CORBA::TypeCode_ptr
908
 
CORBA::ORB::create_home_tc (
909
 
    const char *id,
910
 
    const char *name
911
 
    ACE_ENV_ARG_DECL
912
 
  )
913
 
  ACE_THROW_SPEC ((CORBA::SystemException))
914
 
{
915
 
  TAO_TypeCodeFactory_Adapter *adapter =
916
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
917
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
918
 
      );
919
 
 
920
 
  if (adapter == 0)
921
 
    {
922
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
923
 
                        0);
924
 
    }
925
 
 
926
 
  return adapter->create_home_tc (id,
927
 
                                  name
928
 
                                  ACE_ENV_ARG_PARAMETER);
929
 
}
930
 
 
931
 
CORBA::TypeCode_ptr
932
 
CORBA::ORB::create_event_tc (
933
 
    const char *id,
934
 
    const char *name,
935
 
    CORBA::ValueModifier type_modifier,
936
 
    CORBA::TypeCode_ptr concrete_base,
937
 
    const CORBA::ValueMemberSeq &members
938
 
    ACE_ENV_ARG_DECL
939
 
  )
940
 
  ACE_THROW_SPEC ((CORBA::SystemException))
941
 
{
942
 
  TAO_TypeCodeFactory_Adapter *adapter =
943
 
    ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance (
944
 
        TAO_ORB_Core::typecodefactory_adapter_name ()
945
 
      );
946
 
 
947
 
  if (adapter == 0)
948
 
    {
949
 
      ACE_THROW_RETURN (CORBA::INTERNAL (),
950
 
                        0);
951
 
    }
952
 
 
953
 
  return adapter->create_event_tc (id,
954
 
                                   name,
955
 
                                   type_modifier,
956
 
                                   concrete_base,
957
 
                                   members
958
 
                                   ACE_ENV_ARG_PARAMETER);
959
 
}
960
 
 
961
 
// ****************************************************************
962
 
 
963
 
#endif /* TAO_HAS_MINIMUM_CORBA */
964
 
 
965
 
CORBA::Object_ptr
966
 
CORBA::ORB::resolve_root_poa (ACE_ENV_SINGLE_ARG_DECL)
967
 
{
968
 
  return this->orb_core_->root_poa (ACE_ENV_SINGLE_ARG_PARAMETER);
969
 
}
970
 
 
971
 
CORBA::Object_ptr
972
 
CORBA::ORB::resolve_poa_current (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
973
 
{
974
 
  return this->orb_core_->poa_current ();
975
 
}
976
 
 
977
 
CORBA::Object_ptr
978
 
CORBA::ORB::resolve_policy_manager (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
979
 
{
980
 
#if (TAO_HAS_CORBA_MESSAGING == 1)
981
 
 
982
 
  TAO_Policy_Manager *policy_manager =
983
 
    this->orb_core_->policy_manager ();
984
 
 
985
 
  if (policy_manager == 0)
986
 
    {
987
 
      return CORBA::Object::_nil ();
988
 
    }
989
 
 
990
 
  return CORBA::Object::_duplicate (policy_manager);
991
 
 
992
 
#else
993
 
 
994
 
  return CORBA::Object::_nil ();
995
 
 
996
 
#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
997
 
}
998
 
 
999
 
CORBA::Object_ptr
1000
 
CORBA::ORB::resolve_policy_current (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
1001
 
{
1002
 
 
1003
 
#if (TAO_HAS_CORBA_MESSAGING == 1)
1004
 
 
1005
 
  TAO_Policy_Current &policy_current = this->orb_core_->policy_current ();
1006
 
  return CORBA::Object::_duplicate (&policy_current);
1007
 
 
1008
 
#else
1009
 
 
1010
 
  return CORBA::Object::_nil ();
1011
 
 
1012
 
#endif /* TAO_HAS_CORBA_MESSAGING == 1 */
1013
 
}
1014
 
 
1015
 
CORBA::Object_ptr
1016
 
CORBA::ORB::resolve_service (TAO_MCAST_SERVICEID mcast_service_id
1017
 
                             ACE_ENV_ARG_DECL_NOT_USED)
1018
 
{
1019
 
  const char * env_service_port [] =
1020
 
  {
1021
 
    "NameServicePort",
1022
 
    "TradingServicePort",
1023
 
    "ImplRepoServicePort",
1024
 
    "InterfaceRepoServicePort"
1025
 
  };
1026
 
 
1027
 
  u_short default_service_port [] =
1028
 
  {
1029
 
    TAO_DEFAULT_NAME_SERVER_REQUEST_PORT,
1030
 
    TAO_DEFAULT_TRADING_SERVER_REQUEST_PORT,
1031
 
    TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT,
1032
 
    TAO_DEFAULT_INTERFACEREPO_SERVER_REQUEST_PORT
1033
 
  };
1034
 
 
1035
 
  CORBA::Object_var return_value = CORBA::Object::_nil ();
1036
 
 
1037
 
  // By now, the table filled in with -ORBInitRef arguments has been
1038
 
  // checked.  We only get here if the table didn't contain an initial
1039
 
  // reference for the requested Service.
1040
 
 
1041
 
  // First, determine if the port was supplied on the command line
1042
 
  u_short port =
1043
 
  this->orb_core_->orb_params ()->service_port (mcast_service_id);
1044
 
 
1045
 
  if (port == 0)
1046
 
  {
1047
 
    // Look for the port among our environment variables.
1048
 
    const char *port_number =
1049
 
      ACE_OS::getenv (env_service_port[mcast_service_id]);
1050
 
 
1051
 
    if (port_number != 0)
1052
 
      port = (u_short) ACE_OS::atoi (port_number);
1053
 
    else
1054
 
      port = default_service_port[mcast_service_id];
1055
 
  }
1056
 
 
1057
 
  // Set the port value in ORB_Params: modify the default mcast
1058
 
  // value.
1059
 
  const char prefix[] = "mcast://:";
1060
 
 
1061
 
  char port_char[256];
1062
 
 
1063
 
  ACE_OS::itoa (port,
1064
 
                port_char,
1065
 
                10);
1066
 
 
1067
 
  CORBA::String_var port_ptr =
1068
 
  CORBA::string_alloc (ACE_static_cast (CORBA::ULong,
1069
 
                         ACE_OS::strlen ((const char *) port_char)));
1070
 
 
1071
 
  port_ptr = (const char *) port_char;
1072
 
 
1073
 
  CORBA::String_var def_init_ref =
1074
 
  CORBA::string_alloc (sizeof (prefix) +
1075
 
                       ACE_static_cast (CORBA::ULong,
1076
 
                         ACE_OS::strlen (port_ptr.in ())) +
1077
 
                       2);
1078
 
 
1079
 
  ACE_OS::strcpy (def_init_ref.inout (), prefix);
1080
 
  ACE_OS::strcat (def_init_ref.inout (), port_ptr.in ());
1081
 
  ACE_OS::strcat (def_init_ref.inout (), "::");
1082
 
 
1083
 
  CORBA::String_var default_init_ref =
1084
 
        this->orb_core_->orb_params ()->default_init_ref ();
1085
 
 
1086
 
  static const char mcast_prefix[] = "mcast://:::";
1087
 
 
1088
 
  if ((ACE_OS::strncmp (default_init_ref.in (),
1089
 
                       mcast_prefix,
1090
 
                       sizeof mcast_prefix - 1) == 0))
1091
 
  {
1092
 
    this->orb_core_->orb_params ()->default_init_ref (def_init_ref.in ());
1093
 
  }
1094
 
 
1095
 
  return CORBA::Object::_nil ();
1096
 
}
1097
 
 
1098
 
CORBA::Object_ptr
1099
 
CORBA::ORB::resolve_initial_references (const char *name
1100
 
                                        ACE_ENV_ARG_DECL)
1101
 
{
1102
 
  return this->resolve_initial_references (name,
1103
 
                                           0
1104
 
                                           ACE_ENV_ARG_PARAMETER);
1105
 
}
1106
 
 
1107
 
CORBA::Object_ptr
1108
 
CORBA::ORB::resolve_initial_references (const char *name,
1109
 
                                        ACE_Time_Value *timeout
1110
 
                                        ACE_ENV_ARG_DECL)
1111
 
{
1112
 
  // This method should not be called if the ORB has been shutdown.
1113
 
  this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
1114
 
  ACE_CHECK_RETURN (CORBA::Object::_nil ());
1115
 
 
1116
 
  if (ACE_OS::strcmp (name, TAO_OBJID_ROOTPOA) == 0)
1117
 
    return this->resolve_root_poa (ACE_ENV_SINGLE_ARG_PARAMETER);
1118
 
 
1119
 
  else if (ACE_OS::strcmp (name, TAO_OBJID_POACURRENT) == 0)
1120
 
    return this->resolve_poa_current (ACE_ENV_SINGLE_ARG_PARAMETER);
1121
 
 
1122
 
  else if (ACE_OS::strcmp (name, TAO_OBJID_POLICYMANAGER) == 0)
1123
 
    return this->resolve_policy_manager (ACE_ENV_SINGLE_ARG_PARAMETER);
1124
 
 
1125
 
  else if (ACE_OS::strcmp (name, TAO_OBJID_POLICYCURRENT) == 0)
1126
 
    return this->resolve_policy_current (ACE_ENV_SINGLE_ARG_PARAMETER);
1127
 
 
1128
 
  else if (ACE_OS::strcmp (name, TAO_OBJID_IORMANIPULATION) == 0)
1129
 
    return this->orb_core ()->resolve_ior_manipulation (ACE_ENV_SINGLE_ARG_PARAMETER);
1130
 
 
1131
 
  else if (ACE_OS::strcmp (name, TAO_OBJID_IORTABLE) == 0)
1132
 
    return this->orb_core ()->resolve_ior_table (ACE_ENV_SINGLE_ARG_PARAMETER);
1133
 
 
1134
 
  else if (ACE_OS::strcmp (name, TAO_OBJID_DYNANYFACTORY) == 0)
1135
 
    return this->orb_core ()->resolve_dynanyfactory (ACE_ENV_SINGLE_ARG_PARAMETER);
1136
 
 
1137
 
  else if (ACE_OS::strcmp (name, TAO_OBJID_TYPECODEFACTORY) == 0)
1138
 
    return this->orb_core ()->resolve_typecodefactory (ACE_ENV_SINGLE_ARG_PARAMETER);
1139
 
 
1140
 
 
1141
 
  // -----------------------------------------------------------------
1142
 
 
1143
 
  // Search the object reference table.  This search must occur before
1144
 
  // the InitRef table search, since it may contain local objects.
1145
 
  CORBA::Object_var result =
1146
 
    this->orb_core ()->object_ref_table ().resolve_initial_references (
1147
 
      name
1148
 
      ACE_ENV_ARG_PARAMETER);
1149
 
  ACE_CHECK_RETURN (CORBA::Object::_nil ());
1150
 
 
1151
 
  if (!CORBA::is_nil (result.in ()))
1152
 
    return result._retn ();
1153
 
 
1154
 
  // -----------------------------------------------------------------
1155
 
 
1156
 
  // Check ORBInitRef options.
1157
 
  ACE_CString ior;
1158
 
  ACE_CString object_id ((const char *) name);
1159
 
 
1160
 
  // Is the service name in the IOR Table.
1161
 
  if (this->orb_core_->init_ref_map ()->find (object_id, ior) == 0)
1162
 
    return this->string_to_object (ior.c_str ()
1163
 
                                   ACE_ENV_ARG_PARAMETER);
1164
 
 
1165
 
  // Look for an environment variable called "<name>IOR".
1166
 
  //
1167
 
  CORBA::String_var ior_env_var_name =
1168
 
    CORBA::string_alloc (ACE_OS::strlen (name) + 3);
1169
 
 
1170
 
  ACE_OS::strcpy (ior_env_var_name.inout (),
1171
 
                  name);
1172
 
 
1173
 
  ACE_OS::strcat (ior_env_var_name.inout (),
1174
 
                  "IOR");
1175
 
 
1176
 
  ACE_CString service_ior = ACE_OS::getenv (ior_env_var_name.in ());
1177
 
 
1178
 
  if (ACE_OS::strcmp (service_ior.c_str (), "") != 0 )
1179
 
    {
1180
 
      result =
1181
 
        this->string_to_object (service_ior.c_str()
1182
 
                                ACE_ENV_ARG_PARAMETER);
1183
 
      ACE_CHECK_RETURN (CORBA::Object::_nil ());
1184
 
 
1185
 
      return result._retn ();
1186
 
    }
1187
 
 
1188
 
  // May be trying the explicitly specified services and the well
1189
 
  // known services should be tried first before falling on to default
1190
 
  // services.
1191
 
 
1192
 
  // Set the timeout value.
1193
 
  this->set_timeout (timeout);
1194
 
 
1195
 
  if (ACE_OS::strcmp (name, TAO_OBJID_NAMESERVICE) == 0)
1196
 
    {
1197
 
      result = this->resolve_service (NAMESERVICE
1198
 
                                      ACE_ENV_ARG_PARAMETER);
1199
 
      ACE_CHECK_RETURN (CORBA::Object::_nil ());
1200
 
 
1201
 
      if (!CORBA::is_nil (result.in ()))
1202
 
        return result._retn ();
1203
 
    }
1204
 
  else if (ACE_OS::strcmp (name, TAO_OBJID_TRADINGSERVICE) == 0)
1205
 
    {
1206
 
      result = this->resolve_service (TRADINGSERVICE
1207
 
                                      ACE_ENV_ARG_PARAMETER);
1208
 
      ACE_CHECK_RETURN (CORBA::Object::_nil ());
1209
 
 
1210
 
      if (!CORBA::is_nil (result.in ()))
1211
 
        return result._retn ();
1212
 
    }
1213
 
  else if (ACE_OS::strcmp (name, TAO_OBJID_IMPLREPOSERVICE) == 0)
1214
 
    {
1215
 
      result = this->resolve_service (IMPLREPOSERVICE
1216
 
                                      ACE_ENV_ARG_PARAMETER);
1217
 
      ACE_CHECK_RETURN (CORBA::Object::_nil ());
1218
 
 
1219
 
      if (!CORBA::is_nil (result.in ()))
1220
 
        return result._retn ();
1221
 
    }
1222
 
  else if (ACE_OS::strcmp (name, TAO_OBJID_INTERFACEREP) == 0)
1223
 
    {
1224
 
      result = this->resolve_service (INTERFACEREPOSERVICE
1225
 
                                      ACE_ENV_ARG_PARAMETER);
1226
 
      ACE_CHECK_RETURN (CORBA::Object::_nil ());
1227
 
 
1228
 
      if (!CORBA::is_nil (result.in ()))
1229
 
        return result._retn ();
1230
 
    }
1231
 
 
1232
 
  // Is not one of the well known services, try to find it in the
1233
 
  // InitRef table....check the defaultinitref values also.
1234
 
 
1235
 
  result = this->orb_core ()->resolve_rir (name ACE_ENV_ARG_PARAMETER);
1236
 
  ACE_CHECK_RETURN (CORBA::Object::_nil ());
1237
 
 
1238
 
  if (!CORBA::is_nil (result.in ()))
1239
 
    return result._retn ();
1240
 
  // -----------------------------------------------------------------
1241
 
 
1242
 
  ACE_THROW_RETURN (CORBA::ORB::InvalidName (), CORBA::Object::_nil ());
1243
 
}
1244
 
 
1245
 
void
1246
 
CORBA::ORB::register_initial_reference (const char * id,
1247
 
                                        CORBA::Object_ptr obj
1248
 
                                        ACE_ENV_ARG_DECL)
1249
 
{
1250
 
  TAO_Object_Ref_Table &table = this->orb_core_->object_ref_table ();
1251
 
 
1252
 
  table.register_initial_reference (id,
1253
 
                                    obj
1254
 
                                    ACE_ENV_ARG_PARAMETER);
1255
 
  ACE_CHECK;
1256
 
}
1257
 
 
1258
 
 
1259
 
CORBA::ORB::ObjectIdList_ptr
1260
 
CORBA::ORB::list_initial_services (ACE_ENV_SINGLE_ARG_DECL)
1261
 
{
1262
 
  this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
1263
 
  ACE_CHECK_RETURN (0);
1264
 
 
1265
 
  return
1266
 
    this->orb_core ()->list_initial_references (ACE_ENV_SINGLE_ARG_PARAMETER);
1267
 
}
1268
 
 
1269
 
void
1270
 
CORBA::ORB::check_shutdown (ACE_ENV_SINGLE_ARG_DECL)
1271
 
{
1272
 
  if (this->orb_core () != 0)
1273
 
    {
1274
 
      this->orb_core ()->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
1275
 
      ACE_CHECK;
1276
 
    }
1277
 
  else
1278
 
    {
1279
 
      // If the ORB_Core pointer is zero, assume that the ORB_Core has
1280
 
      // been destroyed.
1281
 
 
1282
 
      // As defined by the CORBA 2.3 specification, throw a
1283
 
      // CORBA::OBJECT_NOT_EXIST exception if the ORB has been
1284
 
      // destroyed by the time an ORB function is called.
1285
 
 
1286
 
      ACE_THROW (CORBA::OBJECT_NOT_EXIST (TAO_DEFAULT_MINOR_CODE,
1287
 
                                          CORBA::COMPLETED_NO));
1288
 
    }
1289
 
}
1290
 
 
1291
 
// ****************************************************************
1292
 
 
1293
 
void
1294
 
CORBA::ORB::init_orb_globals (ACE_ENV_SINGLE_ARG_DECL)
1295
 
{
1296
 
  // This method should be invoked atomically.  It is the caller's
1297
 
  // responsibility to ensure that this condition is satisfied.
1298
 
 
1299
 
  // Prevent multiple initializations.
1300
 
  if (CORBA::ORB::orb_init_count_ != 0)
1301
 
    {
1302
 
      return;
1303
 
    }
1304
 
  else
1305
 
    {
1306
 
      CORBA::ORB::orb_init_count_++;
1307
 
    }
1308
 
 
1309
 
  // initialize the system TypeCodes
1310
 
  TAO::TypeCode_Constants::init ();
1311
 
 
1312
 
  // initialize the system exceptions
1313
 
  TAO_Exceptions::init (ACE_ENV_SINGLE_ARG_PARAMETER);
1314
 
  ACE_CHECK;
1315
 
 
1316
 
#if defined (ACE_HAS_EXCEPTIONS)
1317
 
  // This must be done after the system TypeCodes and Exceptions have
1318
 
  // been initialized.  An unexpected exception will cause TAO's
1319
 
  // unexpected exception handler to be called.  That handler
1320
 
  // transforms all unexpected exceptions to CORBA::UNKNOWN, which of
1321
 
  // course requires the TypeCode constants and system exceptions to
1322
 
  // have been initialized.
1323
 
  TAO_Singleton_Manager::instance ()->_set_unexpected (
1324
 
    CORBA::ORB::_tao_unexpected_exception);
1325
 
#endif /* ACE_HAS_EXCEPTIONS */
1326
 
 
1327
 
  // Verify some of the basic implementation requirements.  This test
1328
 
  // gets optimized away by a decent compiler (or else the rest of the
1329
 
  // routine does).
1330
 
  //
1331
 
  // NOTE:  we still "just" assume that native floating point is IEEE.
1332
 
  if (sizeof (CORBA::Short) != 2
1333
 
      || sizeof (CORBA::Long) != 4
1334
 
      || sizeof (CORBA::LongLong) != 8
1335
 
      || sizeof (CORBA::Float) != 4
1336
 
      || sizeof (CORBA::Double) != 8
1337
 
      || sizeof (CORBA::LongDouble) != 16
1338
 
      || sizeof (CORBA::WChar) < 2
1339
 
      || sizeof (void *) != ACE_SIZEOF_VOID_P)
1340
 
    {
1341
 
      ACE_DEBUG ((LM_DEBUG,
1342
 
                  "%s; ERROR: unexpected basic type size; "
1343
 
                  "s:%d l:%d ll:%d f:%d d:%d ld:%d wc:%d v:%d\n"
1344
 
                  "please reconfigure TAO\n",
1345
 
                  __FILE__,
1346
 
                  sizeof (CORBA::Short),
1347
 
                  sizeof (CORBA::Long),
1348
 
                  sizeof (CORBA::LongLong),
1349
 
                  sizeof (CORBA::Float),
1350
 
                  sizeof (CORBA::Double),
1351
 
                  sizeof (CORBA::LongDouble),
1352
 
                  sizeof (CORBA::WChar),
1353
 
                  sizeof (void *)));
1354
 
 
1355
 
      ACE_THROW (CORBA::INITIALIZE ());
1356
 
    }
1357
 
 
1358
 
  // Register the CodecFactory ORBInitializer.
1359
 
  PortableInterceptor::ORBInitializer_ptr tmp_cf_initializer;
1360
 
  ACE_NEW_THROW_EX (tmp_cf_initializer,
1361
 
                    TAO_CodecFactory_ORBInitializer,
1362
 
                    CORBA::NO_MEMORY (
1363
 
                      CORBA::SystemException::_tao_minor_code (
1364
 
                        TAO_DEFAULT_MINOR_CODE,
1365
 
                        ENOMEM),
1366
 
                      CORBA::COMPLETED_NO));
1367
 
  ACE_CHECK;
1368
 
 
1369
 
  PortableInterceptor::ORBInitializer_var cf_initializer =
1370
 
    tmp_cf_initializer;
1371
 
 
1372
 
  PortableInterceptor::register_orb_initializer (cf_initializer.in ()
1373
 
                                                 ACE_ENV_ARG_PARAMETER);
1374
 
  ACE_CHECK;
1375
 
 
1376
 
  // -------------------------------------------------------------
1377
 
  // @@ These ORB initializer instantiations should go away.  They
1378
 
  //    should be registered via the service configurator, for
1379
 
  //    example.
1380
 
 
1381
 
#if TAO_HAS_INTERCEPTORS == 1
1382
 
  PortableInterceptor::ORBInitializer_ptr temp_pi_initializer =
1383
 
    PortableInterceptor::ORBInitializer::_nil ();
1384
 
  PortableInterceptor::ORBInitializer_var pi_initializer;
1385
 
 
1386
 
  // Register the PICurrent ORBInitializer.
1387
 
  ACE_NEW_THROW_EX (temp_pi_initializer,
1388
 
                    TAO_PICurrent_ORBInitializer,
1389
 
                    CORBA::NO_MEMORY (
1390
 
                      CORBA::SystemException::_tao_minor_code (
1391
 
                        TAO_DEFAULT_MINOR_CODE,
1392
 
                        ENOMEM),
1393
 
                      CORBA::COMPLETED_NO));
1394
 
  ACE_CHECK;
1395
 
 
1396
 
  pi_initializer = temp_pi_initializer;
1397
 
 
1398
 
  PortableInterceptor::register_orb_initializer (pi_initializer.in ()
1399
 
                                                 ACE_ENV_ARG_PARAMETER);
1400
 
  ACE_CHECK;
1401
 
#endif  /* TAO_HAS_INTERCEPTORS == 1 */
1402
 
}
1403
 
 
1404
 
void CORBA::ORB::_tao_unexpected_exception (void)
1405
 
{
1406
 
#if defined(ACE_HAS_EXCEPTIONS)
1407
 
  throw CORBA::UNKNOWN ();
1408
 
#else
1409
 
  // Nothing to do, this will be handled by the ORB core when sending
1410
 
  // the exception back to the client...
1411
 
#endif /* ACE_HAS_EXCEPTIONS */
1412
 
}
1413
 
 
1414
 
const ACE_CString &
1415
 
CORBA::ORB::_tao_ft_client_id (void)
1416
 
{
1417
 
  return this->orb_core ()->fault_tolerance_service ().client_id ();
1418
 
}
1419
 
 
1420
 
void
1421
 
CORBA::ORB::_tao_ft_client_id (const char *id)
1422
 
{
1423
 
  this->orb_core ()->fault_tolerance_service ().client_id (id);
1424
 
}
1425
 
 
1426
 
CORBA::ORB_ptr
1427
 
CORBA::ORB::_tao_make_ORB (TAO_ORB_Core * orb_core)
1428
 
{
1429
 
  CORBA::ORB_ptr orb = CORBA::ORB::_nil ();
1430
 
 
1431
 
  ACE_NEW_RETURN (orb,
1432
 
                  CORBA::ORB (orb_core),
1433
 
                  CORBA::ORB::_nil ());
1434
 
 
1435
 
  return orb;
1436
 
}
1437
 
 
1438
 
// ****************************************************************
1439
 
 
1440
 
// ORB initialization, per OMG document 98-12-01.
1441
 
 
1442
 
CORBA::ORB_ptr
1443
 
CORBA::ORB_init (int &argc,
1444
 
                 char *argv[],
1445
 
                 const char *orb_name)
1446
 
{
1447
 
  // Make sure TAO's singleton manager is initialized.
1448
 
  //
1449
 
  // We need to initialize before TAO_default_environment() is called
1450
 
  // since that call instantiates a TAO_TSS_Singleton.
1451
 
  if (TAO_Singleton_Manager::instance ()->init () == -1)
1452
 
    {
1453
 
      return CORBA::ORB::_nil ();
1454
 
    }
1455
 
 
1456
 
  return CORBA::ORB_init (argc,
1457
 
                          argv,
1458
 
                          orb_name,
1459
 
                          TAO_default_environment ());
1460
 
}
1461
 
 
1462
 
CORBA::ORB_ptr
1463
 
CORBA::ORB_init (int &argc,
1464
 
                 char *argv[],
1465
 
                 const char *orbid,
1466
 
                 CORBA::Environment &ACE_TRY_ENV)
1467
 
{
1468
 
  // This ugly macro will go away once we've merged the two ORB_init's.
1469
 
  ACE_UNUSED_ARG(ACE_TRY_ENV); // FUZZ: ignore check_for_ace_check
1470
 
 
1471
 
  // Use this string variable to hold the orbid
1472
 
  ACE_CString orbid_string = orbid;
1473
 
 
1474
 
  // Copy command line parameter not to use original.
1475
 
  ACE_Argv_Type_Converter command_line(argc, argv);
1476
 
 
1477
 
  // Using ACE_Static_Object_Lock::instance() precludes <ORB_init>
1478
 
  // from being called within a static object CTOR.
1479
 
  ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX, guard,
1480
 
                            *ACE_Static_Object_Lock::instance (),
1481
 
                            CORBA::ORB::_nil ()));
1482
 
 
1483
 
  // Make sure TAO's singleton manager is initialized.
1484
 
  if (TAO_Singleton_Manager::instance ()->init () == -1)
1485
 
    {
1486
 
      return CORBA::ORB::_nil ();
1487
 
    }
1488
 
 
1489
 
  CORBA::ORB::init_orb_globals (ACE_ENV_SINGLE_ARG_PARAMETER);
1490
 
  ACE_CHECK_RETURN (CORBA::ORB::_nil ());
1491
 
 
1492
 
  // Make sure the following is done after the global ORB
1493
 
  // initialization since we need to have exceptions initialized.
1494
 
 
1495
 
  // It doesn't make sense for argc to be zero and argv to be
1496
 
  // non-empty/zero, or for argc to be greater than zero and argv be
1497
 
  // zero.
1498
 
  size_t argv0_len =
1499
 
    (command_line.get_TCHAR_argv ()
1500
 
     ? (*command_line.get_TCHAR_argv ()
1501
 
        ? ACE_OS::strlen (*command_line.get_TCHAR_argv ())
1502
 
        : 0)
1503
 
     : 0);
1504
 
 
1505
 
  if ((command_line.get_argc () == 0 && argv0_len != 0)
1506
 
      || (command_line.get_argc () != 0
1507
 
          && (command_line.get_TCHAR_argv () == 0
1508
 
              || command_line.get_TCHAR_argv ()[0] == 0)))
1509
 
    {
1510
 
      ACE_THROW_RETURN (CORBA::BAD_PARAM (
1511
 
                          CORBA::SystemException::_tao_minor_code (
1512
 
                            TAO_DEFAULT_MINOR_CODE,
1513
 
                            EINVAL),
1514
 
                          CORBA::COMPLETED_NO),
1515
 
                        CORBA::ORB::_nil ());
1516
 
    }
1517
 
 
1518
 
  if (orbid_string.length () == 0)
1519
 
    {
1520
 
      ACE_Arg_Shifter arg_shifter (command_line.get_argc (),
1521
 
                                   command_line.get_TCHAR_argv ());
1522
 
 
1523
 
      while (arg_shifter.is_anything_left ())
1524
 
        {
1525
 
          const ACE_TCHAR *current_arg = arg_shifter.get_current ();
1526
 
 
1527
 
          const ACE_TCHAR orbid_opt[] = ACE_TEXT ("-ORBid");
1528
 
          size_t orbid_len = ACE_OS::strlen (orbid_opt);
1529
 
          if (ACE_OS::strcasecmp (current_arg,
1530
 
                                  orbid_opt) == 0)
1531
 
            {
1532
 
              arg_shifter.consume_arg ();
1533
 
              if (arg_shifter.is_parameter_next ())
1534
 
                {
1535
 
                  orbid_string =
1536
 
                    ACE_TEXT_ALWAYS_CHAR (arg_shifter.get_current ());
1537
 
                  arg_shifter.consume_arg ();
1538
 
                }
1539
 
            }
1540
 
          else if (ACE_OS::strncasecmp (current_arg, orbid_opt,
1541
 
                                        orbid_len) == 0)
1542
 
            {
1543
 
              arg_shifter.consume_arg ();
1544
 
              // The rest of the argument is the ORB id...
1545
 
              // but we should skip an optional space...
1546
 
              if (current_arg[orbid_len] == ' ')
1547
 
                orbid_string =
1548
 
                  ACE_TEXT_ALWAYS_CHAR (current_arg + orbid_len + 1);
1549
 
              else
1550
 
                orbid_string = ACE_TEXT_ALWAYS_CHAR (current_arg + orbid_len);
1551
 
            }
1552
 
          else
1553
 
            arg_shifter.ignore_arg ();
1554
 
        }
1555
 
    }
1556
 
 
1557
 
  // Get ORB Core
1558
 
  TAO_ORB_Core *oc =
1559
 
    TAO_ORB_Table::instance ()->find (orbid_string.c_str ());
1560
 
 
1561
 
  // The ORB was initialized already, just return that one!
1562
 
  if (oc != 0)
1563
 
    {
1564
 
      if (oc->has_shutdown ())
1565
 
        {
1566
 
          // As defined by the CORBA 2.3 specification, throw a
1567
 
          // CORBA::BAD_INV_ORDER exception with minor code 4 if the ORB
1568
 
          // has shutdown by the time an ORB function is called.
1569
 
 
1570
 
          // @@ Does the BAD_INV_ORDER exception apply here?
1571
 
          //       -Ossama
1572
 
 
1573
 
          ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 4,
1574
 
                                                  CORBA::COMPLETED_NO),
1575
 
                            CORBA::ORB::_nil ());
1576
 
        }
1577
 
 
1578
 
      return CORBA::ORB::_duplicate (oc->orb ());
1579
 
    }
1580
 
 
1581
 
  // An ORB corresponding to the desired ORBid doesn't exist so create
1582
 
  // a new one.
1583
 
  ACE_NEW_THROW_EX (oc,
1584
 
                    TAO_ORB_Core (orbid_string.c_str ()),
1585
 
                    CORBA::NO_MEMORY (
1586
 
                      CORBA::SystemException::_tao_minor_code (
1587
 
                        TAO_DEFAULT_MINOR_CODE,
1588
 
                        ENOMEM),
1589
 
                      CORBA::COMPLETED_NO));
1590
 
  ACE_CHECK_RETURN (CORBA::ORB::_nil ());
1591
 
 
1592
 
  // The ORB table increases the reference count on the ORB Core so do
1593
 
  // not release it here.  Allow the TAO_ORB_Core_Auto_Ptr do decrease
1594
 
  // the reference on the ORB Core when it goes out of scope.
1595
 
  TAO_ORB_Core_Auto_Ptr safe_oc (oc);
1596
 
 
1597
 
  // Initialize the Service Configurator.  This must occur before the
1598
 
  // ORBInitializer::pre_init() method is invoked on each registered
1599
 
  // ORB initializer.
1600
 
  int result = TAO_Internal::open_services (command_line.get_argc (),
1601
 
                                            command_line.get_TCHAR_argv ());
1602
 
 
1603
 
  // Check for errors returned from <TAO_Internal::open_services>.
1604
 
  if (result != 0 && errno != ENOENT)
1605
 
    {
1606
 
      ACE_ERROR ((LM_ERROR,
1607
 
                  ACE_TEXT ("(%P|%t) %p\n"),
1608
 
                  ACE_TEXT ("Unable to initialize the ")
1609
 
                  ACE_TEXT ("Service Configurator")));
1610
 
      ACE_THROW_RETURN (CORBA::INITIALIZE (
1611
 
                          CORBA::SystemException::_tao_minor_code (
1612
 
                            TAO_ORB_CORE_INIT_LOCATION_CODE,
1613
 
                            0),
1614
 
                          CORBA::COMPLETED_NO),
1615
 
                        CORBA::ORB::_nil ());
1616
 
    }
1617
 
 
1618
 
  // Run the registered ORB initializers, and initialize the ORB_Core.
1619
 
  TAO_ORBInitInfo *orb_init_info_temp;
1620
 
  ACE_NEW_THROW_EX (orb_init_info_temp,
1621
 
                    TAO_ORBInitInfo (safe_oc.get (),
1622
 
                                     command_line.get_argc(),
1623
 
                                     command_line.get_ASCII_argv()),
1624
 
                    CORBA::NO_MEMORY (
1625
 
                      CORBA::SystemException::_tao_minor_code (
1626
 
                        TAO_DEFAULT_MINOR_CODE,
1627
 
                        ENOMEM),
1628
 
                      CORBA::COMPLETED_NO));
1629
 
  ACE_CHECK_RETURN (CORBA::ORB::_nil ());
1630
 
 
1631
 
  // This ORBInitInfo instance is only valid for the duration of this
1632
 
  // ORB's initialization.
1633
 
  PortableInterceptor::ORBInitInfo_var orb_init_info =
1634
 
    orb_init_info_temp;
1635
 
 
1636
 
  // Call the ORBInitializer::pre_init() on each registered ORB
1637
 
  // initializer.
1638
 
  TAO_ORBInitializer_Registry::instance ()->pre_init (orb_init_info.in ()
1639
 
                                                      ACE_ENV_ARG_PARAMETER);
1640
 
  ACE_CHECK_RETURN (CORBA::ORB::_nil ());
1641
 
 
1642
 
  // Initialize the ORB Core instance.
1643
 
  result = safe_oc->init (command_line.get_argc(),
1644
 
                          command_line.get_ASCII_argv()
1645
 
                          ACE_ENV_ARG_PARAMETER);
1646
 
  ACE_CHECK_RETURN (CORBA::ORB::_nil ());
1647
 
 
1648
 
  // Check for errors and return nil pseudo-reference on error.
1649
 
  if (result == -1)
1650
 
      ACE_THROW_RETURN (CORBA::BAD_PARAM (
1651
 
                          CORBA::SystemException::_tao_minor_code (
1652
 
                            TAO_DEFAULT_MINOR_CODE,
1653
 
                            EINVAL),
1654
 
                          CORBA::COMPLETED_NO),
1655
 
                        CORBA::ORB::_nil ());
1656
 
 
1657
 
  // Call the ORBInitializer::post_init() on each registered ORB
1658
 
  // initializer.
1659
 
  TAO_ORBInitializer_Registry::instance ()->post_init (orb_init_info.in ()
1660
 
                                                       ACE_ENV_ARG_PARAMETER);
1661
 
  ACE_CHECK_RETURN (CORBA::ORB::_nil ());
1662
 
 
1663
 
#if TAO_HAS_INTERCEPTORS == 1
1664
 
  oc->pi_current ()->initialize (oc,
1665
 
                                 orb_init_info_temp->slot_count ());
1666
 
#endif  /* TAO_HAS_INTERCEPTORS == 1 */
1667
 
 
1668
 
  // Invalidate the ORBInitInfo instance to prevent future
1669
 
  // modifications to the ORB.  This behavior complies with the
1670
 
  // PortableInterceptor specification.
1671
 
  orb_init_info_temp->invalidate ();
1672
 
 
1673
 
  if (TAO_debug_level >= 3)
1674
 
    ACE_DEBUG ((LM_DEBUG,
1675
 
                ACE_LIB_TEXT("TAO (%P|%t) created new ORB <%s>\n"),
1676
 
                ACE_TEXT_CHAR_TO_TCHAR (orbid_string.c_str ())));
1677
 
 
1678
 
  // Before returning remember to store the ORB into the table...
1679
 
  if (TAO_ORB_Table::instance ()->bind (orbid_string.c_str (),
1680
 
                                        safe_oc.get ()) != 0)
1681
 
    ACE_THROW_RETURN (CORBA::INTERNAL (TAO_DEFAULT_MINOR_CODE,
1682
 
                                       CORBA::COMPLETED_NO),
1683
 
                      CORBA::ORB::_nil ());
1684
 
 
1685
 
  // Return a duplicate since the ORB_Core should release the last
1686
 
  // reference to the ORB.
1687
 
  return CORBA::ORB::_duplicate (oc->orb ());
1688
 
}
1689
 
 
1690
 
// ****************************************************************
1691
 
 
1692
 
// Object reference stringification.
1693
 
char *
1694
 
CORBA::ORB::object_to_string (CORBA::Object_ptr obj
1695
 
                              ACE_ENV_ARG_DECL)
1696
 
{
1697
 
  // This method should not be called if the ORB has been shutdown.
1698
 
  this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
1699
 
  ACE_CHECK_RETURN (0);
1700
 
 
1701
 
  if (!CORBA::is_nil (obj) && obj->_is_local ())
1702
 
    // @@ The CCM spec says one minor code, and the CORBA spec says
1703
 
    //    another.  Which is the correct one?
1704
 
    ACE_THROW_RETURN (CORBA::MARSHAL (CORBA::OMGVMCID | 4,
1705
 
                                      CORBA::COMPLETED_NO),
1706
 
                      0);
1707
 
 
1708
 
 
1709
 
  // Application writer controls what kind of objref strings they get,
1710
 
  // maybe along with other things, by how they initialize the ORB.
1711
 
 
1712
 
  if (use_omg_ior_format_)
1713
 
    {
1714
 
      // By default, orbs use IOR strings; these are ugly (and error
1715
 
      // prone) but specified by CORBA.
1716
 
      //
1717
 
      // XXX there should be a simple way to reuse this code in other
1718
 
      // ORB implementations ...
1719
 
 
1720
 
#if defined (ACE_HAS_PURIFY)
1721
 
      char buf [ACE_CDR::DEFAULT_BUFSIZE] = { 0 };
1722
 
#else
1723
 
      // Avoid the initialization overhead if not compiling with
1724
 
      // support for Purify.  There is no need to actually perform
1725
 
      // initialization otherwise.
1726
 
      char buf [ACE_CDR::DEFAULT_BUFSIZE];
1727
 
#endif /* ACE_HAS_PURIFY */
1728
 
 
1729
 
      TAO_OutputCDR cdr (buf,  sizeof buf,
1730
 
                         TAO_ENCAP_BYTE_ORDER,
1731
 
                         this->orb_core_->output_cdr_buffer_allocator (),
1732
 
                         this->orb_core_->output_cdr_dblock_allocator (),
1733
 
                         this->orb_core_->output_cdr_msgblock_allocator (),
1734
 
                         this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (),
1735
 
                         TAO_DEF_GIOP_MAJOR,
1736
 
                         TAO_DEF_GIOP_MINOR);
1737
 
 
1738
 
      // There is no translator currently available for stringifying an object
1739
 
      // reference, since there is no transport with which to choose an NCS/TCS
1740
 
      // pair.
1741
 
 
1742
 
      // support limited oref ACE_OS::strcmp.
1743
 
      (void) ACE_OS::memset (buf, 0, sizeof (buf));
1744
 
 
1745
 
      // Marshal the objref into an encapsulation bytestream.
1746
 
      (void) cdr.write_octet (TAO_ENCAP_BYTE_ORDER);
1747
 
      if ((cdr << obj) == 0)
1748
 
        ACE_THROW_RETURN (CORBA::MARSHAL (), 0);
1749
 
 
1750
 
      // Now hexify the encapsulated CDR data into a string, and
1751
 
      // return that string.
1752
 
 
1753
 
      size_t total_len = cdr.total_length ();
1754
 
 
1755
 
      char *cp;
1756
 
      ACE_ALLOCATOR_RETURN (cp,
1757
 
                            CORBA::string_alloc (sizeof ior_prefix
1758
 
                                                 + 2 *
1759
 
                                                 ACE_static_cast (CORBA::ULong,
1760
 
                                                                  total_len)),
1761
 
                            0);
1762
 
 
1763
 
      CORBA::String_var string = cp;
1764
 
 
1765
 
      ACE_OS::strcpy (cp, ior_prefix);
1766
 
      cp += sizeof (ior_prefix) - 1;
1767
 
 
1768
 
      for (const ACE_Message_Block *i = cdr.begin ();
1769
 
           i != 0;
1770
 
           i = i->cont ())
1771
 
        {
1772
 
          const char *bytes = i->rd_ptr ();
1773
 
          size_t len = i->length ();
1774
 
 
1775
 
          while (len--)
1776
 
            {
1777
 
              *cp++ = ACE::nibble2hex ((*bytes) >> 4);
1778
 
              *cp++ = ACE::nibble2hex (*bytes);
1779
 
              bytes++;
1780
 
            }
1781
 
        }
1782
 
      // Null terminate the string..
1783
 
      *cp = 0;
1784
 
 
1785
 
      return string._retn ();
1786
 
    }
1787
 
  else
1788
 
    {
1789
 
      // It is perfectly valid to marshal a nil object reference.
1790
 
      // However, it is not possible to convert a nil object reference
1791
 
      // to a URL IOR, so throw an exception.
1792
 
      if (CORBA::is_nil (obj) || obj->_stubobj () == 0)
1793
 
        {
1794
 
          if (TAO_debug_level > 0)
1795
 
            ACE_ERROR ((LM_ERROR,
1796
 
                        ACE_TEXT ("Nil object reference or TAO_Stub ")
1797
 
                        ACE_TEXT ("pointer is zero when converting\n")
1798
 
                        ACE_TEXT ("object reference to URL IOR.\n")));
1799
 
 
1800
 
          ACE_THROW_RETURN (CORBA::MARSHAL (
1801
 
                              CORBA::SystemException::_tao_minor_code (
1802
 
                                TAO_DEFAULT_MINOR_CODE,
1803
 
                                EINVAL),
1804
 
                              CORBA::COMPLETED_NO),
1805
 
                            0);
1806
 
        }
1807
 
 
1808
 
      TAO_MProfile &mp = obj->_stubobj ()->base_profiles ();
1809
 
 
1810
 
      if (mp.profile_count () == 0)
1811
 
        {
1812
 
          if (TAO_debug_level > 0)
1813
 
            ACE_ERROR ((LM_ERROR,
1814
 
                        ACE_TEXT ("(%P|%t) Cannot stringify given ")
1815
 
                        ACE_TEXT ("object.  No profiles.\n")));
1816
 
 
1817
 
 
1818
 
          ACE_THROW_RETURN (CORBA::MARSHAL (
1819
 
                              CORBA::SystemException::_tao_minor_code (
1820
 
                                TAO_DEFAULT_MINOR_CODE,
1821
 
                                EINVAL),
1822
 
                              CORBA::COMPLETED_NO),
1823
 
                            0);
1824
 
        }
1825
 
 
1826
 
      // For now we just use the first profile.
1827
 
      TAO_Profile *profile = mp.get_profile (0);
1828
 
 
1829
 
      return profile->to_string (ACE_ENV_SINGLE_ARG_PARAMETER);
1830
 
    }
1831
 
}
1832
 
 
1833
 
// Destringify arbitrary objrefs.  This method is called from
1834
 
// <resolve_name_service> with an IOR <multicast_to_service>.
1835
 
 
1836
 
CORBA::Object_ptr
1837
 
CORBA::ORB::string_to_object (const char *str
1838
 
                              ACE_ENV_ARG_DECL)
1839
 
{
1840
 
  // This method should not be called if the ORB has been shutdown.
1841
 
  this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
1842
 
  ACE_CHECK_RETURN (CORBA::Object::_nil ());
1843
 
 
1844
 
  // Check for NULL pointer
1845
 
  if (str == 0)
1846
 
    ACE_THROW_RETURN (CORBA::INV_OBJREF (
1847
 
                        CORBA::SystemException::_tao_minor_code (
1848
 
                          TAO_DEFAULT_MINOR_CODE,
1849
 
                          EINVAL),
1850
 
                        CORBA::COMPLETED_NO),
1851
 
                      CORBA::Object::_nil ());
1852
 
 
1853
 
  TAO_IOR_Parser *ior_parser =
1854
 
    this->orb_core_->parser_registry ()->match_parser (str);
1855
 
 
1856
 
  if (ior_parser != 0)
1857
 
    {
1858
 
      return ior_parser->parse_string (str,
1859
 
                                       this
1860
 
                                       ACE_ENV_ARG_PARAMETER);
1861
 
    }
1862
 
 
1863
 
 
1864
 
  if (ACE_OS::strncmp (str,
1865
 
                       ior_prefix,
1866
 
                       sizeof ior_prefix - 1) == 0)
1867
 
    return this->ior_string_to_object (str + sizeof ior_prefix - 1
1868
 
                                       ACE_ENV_ARG_PARAMETER);
1869
 
  else
1870
 
    return this->url_ior_string_to_object (str
1871
 
                                           ACE_ENV_ARG_PARAMETER);
1872
 
}
1873
 
 
1874
 
// ****************************************************************
1875
 
 
1876
 
char *
1877
 
CORBA::ORB::id (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
1878
 
{
1879
 
  return CORBA::string_dup (this->orb_core_->orbid ());
1880
 
}
1881
 
 
1882
 
// ****************************************************************
1883
 
 
1884
 
CORBA::Policy_ptr
1885
 
CORBA::ORB::create_policy (CORBA::PolicyType type,
1886
 
                           const CORBA::Any& val
1887
 
                           ACE_ENV_ARG_DECL)
1888
 
  ACE_THROW_SPEC ((CORBA::SystemException,
1889
 
                   CORBA::PolicyError))
1890
 
{
1891
 
  this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
1892
 
  ACE_CHECK_RETURN (CORBA::Policy::_nil ());
1893
 
 
1894
 
  // Attempt to obtain the policy from the policy factory registry.
1895
 
  return
1896
 
    this->orb_core_->policy_factory_registry ()->create_policy (
1897
 
      type,
1898
 
      val
1899
 
      ACE_ENV_ARG_PARAMETER);
1900
 
}
1901
 
 
1902
 
CORBA::Policy_ptr
1903
 
CORBA::ORB::_create_policy (CORBA::PolicyType type
1904
 
                            ACE_ENV_ARG_DECL)
1905
 
  ACE_THROW_SPEC ((CORBA::SystemException,
1906
 
                   CORBA::PolicyError))
1907
 
{
1908
 
  this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
1909
 
  ACE_CHECK_RETURN (CORBA::Policy::_nil ());
1910
 
 
1911
 
  // Attempt to obtain the policy from the policy factory registry.
1912
 
  return
1913
 
    this->orb_core_->policy_factory_registry ()->_create_policy (
1914
 
      type
1915
 
      ACE_ENV_ARG_PARAMETER);
1916
 
}
1917
 
 
1918
 
// Destringify OMG-specified "IOR" string.
1919
 
//
1920
 
// XXX there should be a simple way to reuse this code in other ORB
1921
 
// implementations ...
1922
 
 
1923
 
CORBA::Object_ptr
1924
 
CORBA::ORB::ior_string_to_object (const char *str
1925
 
                                  ACE_ENV_ARG_DECL)
1926
 
{
1927
 
  // Unhex the bytes, and make a CDR deencapsulation stream from the
1928
 
  // resulting data.
1929
 
  ACE_Message_Block mb (ACE_OS::strlen ((char *) str) / 2 + 1
1930
 
                        + ACE_CDR::MAX_ALIGNMENT + 1);
1931
 
 
1932
 
  ACE_CDR::mb_align (&mb);
1933
 
 
1934
 
  char *buffer = mb.rd_ptr ();
1935
 
  const char *tmp = str;
1936
 
  size_t len = 0;
1937
 
 
1938
 
  while (tmp [0] && tmp [1])
1939
 
    {
1940
 
      // Some platforms define 'byte' as a macro, solve the problem
1941
 
      // here.
1942
 
#undef byte
1943
 
      u_char byte;
1944
 
 
1945
 
      if (!(isxdigit (tmp [0]) && isxdigit (tmp [1])))
1946
 
        break;
1947
 
 
1948
 
      byte = (u_char) (ACE::hex2byte (tmp [0]) << 4);
1949
 
      byte |= ACE::hex2byte (tmp [1]);
1950
 
 
1951
 
      buffer [len++] = byte;
1952
 
      tmp += 2;
1953
 
    }
1954
 
 
1955
 
  if (tmp [0] && !isspace (tmp [0]))
1956
 
    {
1957
 
      ACE_THROW_RETURN (CORBA::BAD_PARAM (),
1958
 
                        CORBA::Object::_nil ());
1959
 
    }
1960
 
 
1961
 
  // Create deencapsulation stream ... then unmarshal objref from that
1962
 
  // stream.
1963
 
 
1964
 
  int byte_order = *(mb.rd_ptr ());
1965
 
  mb.rd_ptr (1);
1966
 
  mb.wr_ptr (len);
1967
 
  TAO_InputCDR stream (&mb,
1968
 
                       byte_order,
1969
 
                       TAO_DEF_GIOP_MAJOR,
1970
 
                       TAO_DEF_GIOP_MINOR,
1971
 
                       this->orb_core_);
1972
 
 
1973
 
  CORBA::Object_ptr objref = CORBA::Object::_nil ();
1974
 
  stream >> objref;
1975
 
  return objref;
1976
 
}
1977
 
 
1978
 
// ****************************************************************
1979
 
 
1980
 
// Convert an URL style IOR in an object
1981
 
 
1982
 
CORBA::Object_ptr
1983
 
CORBA::ORB::url_ior_string_to_object (const char* str
1984
 
                                      ACE_ENV_ARG_DECL)
1985
 
{
1986
 
  TAO_MProfile mprofile;
1987
 
  // It is safe to declare this on the stack since the contents of
1988
 
  // mprofile get copied.  No memory is allocated for profile storage
1989
 
  // here.  The Connector Registry will determine the exact number
1990
 
  // of profiles and tell the MProfile object to allocate enough memory
1991
 
  // to hold them all.
1992
 
 
1993
 
  TAO_Connector_Registry *conn_reg =
1994
 
    this->orb_core_->connector_registry (ACE_ENV_SINGLE_ARG_PARAMETER);
1995
 
  ACE_CHECK_RETURN (0);
1996
 
 
1997
 
  int retv =
1998
 
    conn_reg->make_mprofile (str,
1999
 
                             mprofile
2000
 
                             ACE_ENV_ARG_PARAMETER);
2001
 
  ACE_CHECK_RETURN (CORBA::Object::_nil ());   // Return nil.
2002
 
 
2003
 
  if (retv != 0)
2004
 
    {
2005
 
      ACE_THROW_RETURN (CORBA::INV_OBJREF (
2006
 
                          CORBA::SystemException::_tao_minor_code (
2007
 
                            TAO_DEFAULT_MINOR_CODE,
2008
 
                            EINVAL),
2009
 
                          CORBA::COMPLETED_NO),
2010
 
                        CORBA::Object::_nil ());
2011
 
    }
2012
 
 
2013
 
  // Now make the TAO_Stub.
2014
 
  TAO_Stub *data = this->orb_core_->create_stub ((char *) 0,
2015
 
                                                 mprofile
2016
 
                                                 ACE_ENV_ARG_PARAMETER);
2017
 
  ACE_CHECK_RETURN (CORBA::Object::_nil ());
2018
 
 
2019
 
  TAO_Stub_Auto_Ptr safe_objdata (data);
2020
 
 
2021
 
  // Figure out if the servant is collocated.
2022
 
  CORBA::Object_ptr obj =
2023
 
    this->orb_core_->create_object (safe_objdata.get ());
2024
 
  if (CORBA::is_nil (obj))
2025
 
    return CORBA::Object::_nil ();
2026
 
 
2027
 
  // Transfer ownership to the CORBA::Object
2028
 
  (void) safe_objdata.release ();
2029
 
 
2030
 
  return obj;
2031
 
}
2032
 
 
2033
 
// ****************************************************************
2034
 
 
2035
 
void
2036
 
CORBA::ORB::_optimize_collocation_objects (CORBA::Boolean opt)
2037
 
{
2038
 
  if (this->orb_core_ != 0)
2039
 
    this->orb_core_->optimize_collocation_objects (opt);
2040
 
}
2041
 
 
2042
 
CORBA::Boolean
2043
 
CORBA::ORB::_optimize_collocation_objects (void) const
2044
 
{
2045
 
  if (this->orb_core_ != 0)
2046
 
    return this->orb_core_->optimize_collocation_objects ();
2047
 
  else
2048
 
    return 0; // Need to return something
2049
 
}
2050
 
 
2051
 
ACE_Time_Value *
2052
 
CORBA::ORB::get_timeout (void)
2053
 
{
2054
 
  return this->timeout_;
2055
 
}
2056
 
 
2057
 
void
2058
 
CORBA::ORB::set_timeout (ACE_Time_Value *timeout)
2059
 
{
2060
 
  this->timeout_ = timeout;
2061
 
}
2062
 
 
2063
 
// *************************************************************
2064
 
// Valuetype factory operations
2065
 
// *************************************************************
2066
 
 
2067
 
CORBA::ValueFactory
2068
 
CORBA::ORB::register_value_factory (const char *repository_id,
2069
 
                                    CORBA::ValueFactory factory
2070
 
                                    ACE_ENV_ARG_DECL)
2071
 
{
2072
 
  // %! guard, and ACE_Null_Mutex in the map
2073
 
  // do _add_ref here not in map->rebind
2074
 
 
2075
 
  if (this->orb_core ()->valuetype_adapter () == 0)
2076
 
    {
2077
 
 
2078
 
     this->orb_core ()->valuetype_adapter () =
2079
 
       ACE_Dynamic_Service<TAO_Valuetype_Adapter>::instance (
2080
 
            TAO_ORB_Core::valuetype_adapter_name ()
2081
 
         );
2082
 
 
2083
 
      if (this->orb_core ()->valuetype_adapter () == 0)
2084
 
        {
2085
 
          ACE_THROW_RETURN (CORBA::INTERNAL (),
2086
 
                            0);
2087
 
        }
2088
 
    }
2089
 
 
2090
 
  int result =
2091
 
    this->orb_core ()->valuetype_adapter ()->vf_map_rebind (repository_id,
2092
 
                                                            factory);
2093
 
 
2094
 
  if (result == 0)              // No previous factory found
2095
 
    {
2096
 
      return 0;
2097
 
    }
2098
 
 
2099
 
  if (result == -1)
2100
 
    {
2101
 
      // Error on bind.
2102
 
      ACE_THROW_RETURN (CORBA::MARSHAL (),
2103
 
                        0);
2104
 
    }
2105
 
 
2106
 
  return factory;    // previous factory was found
2107
 
}
2108
 
 
2109
 
void
2110
 
CORBA::ORB::unregister_value_factory (const char *repository_id
2111
 
                                      ACE_ENV_ARG_DECL_NOT_USED)
2112
 
{
2113
 
  if (this->orb_core ()->valuetype_adapter ())
2114
 
    {
2115
 
      // Dont care whther it was successful or not!
2116
 
      (void) this->orb_core ()->valuetype_adapter ()->vf_map_unbind (repository_id);
2117
 
    }
2118
 
}
2119
 
 
2120
 
CORBA::ValueFactory
2121
 
CORBA::ORB::lookup_value_factory (const char *repository_id
2122
 
                                  ACE_ENV_ARG_DECL)
2123
 
{
2124
 
  if (this->orb_core ()->valuetype_adapter () == 0)
2125
 
    {
2126
 
      this->orb_core ()->valuetype_adapter () =
2127
 
        ACE_Dynamic_Service<TAO_Valuetype_Adapter>::instance (
2128
 
            TAO_ORB_Core::valuetype_adapter_name ()
2129
 
          );
2130
 
 
2131
 
      if (this->orb_core ()->valuetype_adapter () == 0)
2132
 
        {
2133
 
          ACE_THROW_RETURN (CORBA::INTERNAL (),
2134
 
                            0);
2135
 
        }
2136
 
    }
2137
 
 
2138
 
  return this->orb_core ()->valuetype_adapter ()->vf_map_find (repository_id);
2139
 
}
2140
 
 
2141
 
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
2142
 
 
2143
 
template class TAO_Pseudo_Var_T<CORBA::ORB>;
2144
 
template class TAO_Pseudo_Out_T<CORBA::ORB, CORBA::ORB_var>;
2145
 
 
2146
 
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
2147
 
 
2148
 
#pragma instantiate TAO_Pseudo_Var_T<CORBA::ORB>
2149
 
#pragma instantiate TAO_Pseudo_Out_T<CORBA::ORB, CORBA::ORB_var>
2150
 
 
2151
 
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */