00001
00002
00003 #include "tao/PortableServer/Root_POA.h"
00004 #include "tao/PortableServer/Regular_POA.h"
00005
00006 #include "tao/PortableServer/ThreadPolicy.h"
00007 #include "tao/PortableServer/LifespanPolicy.h"
00008 #include "tao/PortableServer/IdAssignmentPolicy.h"
00009 #include "tao/PortableServer/IdUniquenessPolicy.h"
00010 #include "tao/PortableServer/ImplicitActivationPolicy.h"
00011 #include "tao/PortableServer/RequestProcessingPolicy.h"
00012 #include "tao/PortableServer/ServantRetentionPolicy.h"
00013 #include "tao/PortableServer/Active_Object_Map.h"
00014 #include "tao/PortableServer/Default_Acceptor_Filter.h"
00015 #include "tao/PortableServer/ORT_Adapter.h"
00016 #include "tao/PortableServer/ORT_Adapter_Factory.h"
00017 #include "tao/PortableServer/POA_Current_Impl.h"
00018 #include "tao/PortableServer/Servant_Upcall.h"
00019 #include "tao/PortableServer/AdapterActivatorC.h"
00020 #include "tao/PortableServer/Non_Servant_Upcall.h"
00021 #include "tao/PortableServer/POAManager.h"
00022 #include "tao/PortableServer/POAManagerFactory.h"
00023 #include "tao/PortableServer/ServantManagerC.h"
00024 #include "tao/PortableServer/poa_macros.h"
00025 #include "tao/PortableServer/POA_Guard.h"
00026 #include "tao/PortableServer/Creation_Time.h"
00027 #include "tao/PortableServer/RequestProcessingStrategy.h"
00028 #include "tao/PortableServer/LifespanStrategy.h"
00029 #include "tao/PortableServer/IdUniquenessStrategy.h"
00030 #include "tao/PortableServer/IdAssignmentStrategy.h"
00031 #include "tao/PortableServer/ServantRetentionStrategy.h"
00032 #include "tao/PortableServer/ImplicitActivationStrategy.h"
00033 #include "tao/PortableServer/ThreadStrategy.h"
00034 #include "tao/PortableServer/Acceptor_Filter_Factory.h"
00035 #include "tao/PortableServer/Network_Priority_Hook.h"
00036
00037 #include "tao/StringSeqC.h"
00038 #include "tao/PortableInterceptorC.h"
00039 #include "tao/PolicyC.h"
00040 #include "tao/ORB_Core.h"
00041 #include "tao/ORB.h"
00042 #include "tao/Server_Strategy_Factory.h"
00043 #include "tao/Acceptor_Registry.h"
00044 #include "tao/Thread_Lane_Resources.h"
00045 #include "tao/Exception.h"
00046 #include "tao/Stub.h"
00047 #include "tao/Profile.h"
00048 #include "tao/TSS_Resources.h"
00049 #include "tao/IORInterceptor_Adapter.h"
00050 #include "tao/debug.h"
00051
00052
00053 #include "ace/Auto_Ptr.h"
00054 #include "ace/Dynamic_Service.h"
00055 #include "ace/OS_NS_netdb.h"
00056 #include "ace/OS_NS_string.h"
00057 #include "ace/OS_NS_unistd.h"
00058 #include "ace/Log_Msg.h"
00059
00060 #if !defined (__ACE_INLINE__)
00061 # include "tao/PortableServer/Root_POA.inl"
00062 #endif
00063
00064 ACE_RCSID (PortableServer,
00065 Root_POA,
00066 "$Id: Root_POA.cpp 88564 2010-01-15 09:56:57Z johnnyw $")
00067
00068 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00069
00070
00071
00072 CORBA::Octet const
00073 TAO_Root_POA::objectkey_prefix [TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE] = {
00074 024,
00075 001,
00076 017,
00077 000
00078 };
00079
00080 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00081
00082 PortableServer::ThreadPolicy_ptr
00083 TAO_Root_POA::create_thread_policy (PortableServer::ThreadPolicyValue value)
00084 {
00085 TAO::Portable_Server::ThreadPolicy *policy = 0;
00086 ACE_NEW_THROW_EX (policy,
00087 TAO::Portable_Server::ThreadPolicy (value),
00088 CORBA::NO_MEMORY ());
00089
00090 return policy;
00091 }
00092
00093 #endif
00094
00095 #if !defined (CORBA_E_MICRO)
00096
00097 PortableServer::LifespanPolicy_ptr
00098 TAO_Root_POA::create_lifespan_policy (PortableServer::LifespanPolicyValue value)
00099 {
00100 TAO::Portable_Server::LifespanPolicy *policy = 0;
00101 ACE_NEW_THROW_EX (policy,
00102 TAO::Portable_Server::LifespanPolicy (value),
00103 CORBA::NO_MEMORY ());
00104
00105 return policy;
00106 }
00107
00108 #endif
00109
00110 #if !defined (CORBA_E_MICRO)
00111 PortableServer::IdUniquenessPolicy_ptr
00112 TAO_Root_POA::create_id_uniqueness_policy (PortableServer::IdUniquenessPolicyValue value)
00113 {
00114 TAO::Portable_Server::IdUniquenessPolicy *policy = 0;
00115 ACE_NEW_THROW_EX (policy,
00116 TAO::Portable_Server::IdUniquenessPolicy (value),
00117 CORBA::NO_MEMORY ());
00118
00119 return policy;
00120 }
00121 #endif
00122
00123 #if !defined (CORBA_E_MICRO)
00124 PortableServer::IdAssignmentPolicy_ptr
00125 TAO_Root_POA::create_id_assignment_policy (PortableServer::IdAssignmentPolicyValue value)
00126 {
00127 TAO::Portable_Server::IdAssignmentPolicy *policy = 0;
00128 ACE_NEW_THROW_EX (policy,
00129 TAO::Portable_Server::IdAssignmentPolicy (value),
00130 CORBA::NO_MEMORY ());
00131
00132 return policy;
00133 }
00134 #endif
00135
00136 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00137
00138 PortableServer::ImplicitActivationPolicy_ptr
00139 TAO_Root_POA::create_implicit_activation_policy (PortableServer::ImplicitActivationPolicyValue value)
00140 {
00141 TAO::Portable_Server::ImplicitActivationPolicy *policy = 0;
00142 ACE_NEW_THROW_EX (policy,
00143 TAO::Portable_Server::ImplicitActivationPolicy (value),
00144 CORBA::NO_MEMORY ());
00145
00146 return policy;
00147 }
00148
00149 PortableServer::ServantRetentionPolicy_ptr
00150 TAO_Root_POA::create_servant_retention_policy (PortableServer::ServantRetentionPolicyValue value)
00151 {
00152 TAO::Portable_Server::ServantRetentionPolicy *policy = 0;
00153 ACE_NEW_THROW_EX (policy,
00154 TAO::Portable_Server::ServantRetentionPolicy (value),
00155 CORBA::NO_MEMORY ());
00156
00157 return policy;
00158 }
00159
00160 PortableServer::RequestProcessingPolicy_ptr
00161 TAO_Root_POA::create_request_processing_policy (PortableServer::RequestProcessingPolicyValue value)
00162 {
00163 TAO::Portable_Server::RequestProcessingPolicy *policy = 0;
00164 ACE_NEW_THROW_EX (policy,
00165 TAO::Portable_Server::RequestProcessingPolicy (value),
00166 CORBA::NO_MEMORY ());
00167
00168 return policy;
00169 }
00170
00171 #endif
00172
00173 void
00174 TAO_Root_POA::set_obj_ref_factory (
00175 PortableInterceptor::ObjectReferenceFactory *current_factory)
00176 {
00177 TAO::ORT_Adapter *adapter = this->ORT_adapter ();
00178
00179 if (adapter)
00180 {
00181
00182 this->ort_adapter_->set_obj_ref_factory (current_factory);
00183 }
00184 }
00185
00186 TAO_Root_POA::TAO_Root_POA (const TAO_Root_POA::String &name,
00187 PortableServer::POAManager_ptr poa_manager,
00188 const TAO_POA_Policy_Set &policies,
00189 TAO_Root_POA *parent,
00190 ACE_Lock &lock,
00191 TAO_SYNCH_MUTEX &thread_lock,
00192 TAO_ORB_Core &orb_core,
00193 TAO_Object_Adapter *object_adapter)
00194 : name_ (name),
00195 poa_manager_ (* (dynamic_cast <TAO_POA_Manager*> (poa_manager))),
00196
00197 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00198 poa_manager_factory_ (* (object_adapter->poa_manager_factory_)),
00199 #endif
00200
00201 tagged_component_ (),
00202 tagged_component_id_ (),
00203 profile_id_array_ (0),
00204 policies_ (policies),
00205 ort_adapter_ (0),
00206 adapter_state_ (PortableInterceptor::HOLDING),
00207 network_priority_hook_ (0),
00208 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00209 adapter_activator_ (),
00210 #endif
00211 children_ (),
00212 lock_ (lock),
00213 orb_core_ (orb_core),
00214 object_adapter_ (object_adapter),
00215 cleanup_in_progress_ (false),
00216 outstanding_requests_ (0),
00217 outstanding_requests_condition_ (thread_lock),
00218 wait_for_completion_pending_ (0),
00219 waiting_destruction_ (false),
00220 servant_deactivation_condition_ (thread_lock),
00221 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00222 filter_factory_ (0),
00223 #endif
00224 caller_key_to_object_ (0),
00225 servant_for_key_to_object_ (0)
00226 {
00227
00228
00229 PortableServer::POAManager_var pm_guard (
00230 PortableServer::POAManager::_duplicate(&this->poa_manager_));
00231
00232
00233
00234 this->cached_policies_.update (this->policies_);
00235
00236 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00237 this->filter_factory_
00238 = ACE_Dynamic_Service<TAO_Acceptor_Filter_Factory>::instance (
00239 "TAO_Acceptor_Filter_Factory");
00240 #endif
00241
00242 this->network_priority_hook_
00243 = ACE_Dynamic_Service<TAO_Network_Priority_Hook>::instance (
00244 "TAO_Network_Priority_Hook");
00245
00246 if (this->network_priority_hook_ != 0)
00247 {
00248 this->network_priority_hook_->update_network_priority (
00249 *this, this->policies_);
00250 }
00251
00252 #if (TAO_HAS_MINIMUM_POA == 1)
00253
00254
00255
00256
00257
00258
00259
00260
00261 if (ACE_OS::strcmp (this->name_.c_str (),
00262 TAO_DEFAULT_ROOTPOA_NAME) == 0)
00263 {
00264 this->cached_policies_.implicit_activation
00265 (PortableServer::IMPLICIT_ACTIVATION);
00266 }
00267 #endif
00268
00269
00270 this->active_policy_strategies_.update (this->cached_policies_,
00271 this);
00272 TAO::Portable_Server::Active_Policy_Strategies_Cleanup_Guard aps_cleanup_guard (
00273 &this->active_policy_strategies_);
00274
00275
00276 this->set_folded_name (parent);
00277
00278
00279 int result = this->poa_manager_.register_poa (this);
00280 if (result != 0)
00281 {
00282 throw ::CORBA::OBJ_ADAPTER ();
00283 }
00284
00285
00286 result =
00287 this->object_adapter ().bind_poa (this->folded_name_,
00288 this,
00289 this->system_name_.out ());
00290 if (result != 0)
00291 {
00292
00293
00294 this->poa_manager_.remove_poa (this);
00295
00296 throw ::CORBA::OBJ_ADAPTER ();
00297 }
00298
00299
00300 this->set_id (parent);
00301
00302
00303 try
00304 {
00305 this->active_policy_strategies_.lifespan_strategy()->notify_startup ();
00306 }
00307 catch (const ::CORBA::Exception&)
00308 {
00309 this->poa_manager_.remove_poa (this);
00310 this->object_adapter ().unbind_poa (this,
00311 this->folded_name_,
00312 this->system_name_.in ());
00313 throw;
00314 }
00315
00316
00317 pm_guard._retn ();
00318 aps_cleanup_guard._retn ();
00319 }
00320
00321 TAO_Root_POA::~TAO_Root_POA (void)
00322 {
00323 this->poa_manager_._remove_ref();
00324 }
00325
00326 void
00327 TAO_Root_POA::complete_destruction_i (void)
00328 {
00329 bool doing_complete_destruction =
00330 this->waiting_destruction_ != false;
00331
00332
00333 this->waiting_destruction_ = false;
00334
00335 PortableServer::POA_var poa;
00336 TAO::ORT_Array my_array_obj_ref_template;
00337 TAO::ORT_Adapter *ort_adapter = 0;
00338 if (doing_complete_destruction)
00339 {
00340 ort_adapter =
00341 this->ORT_adapter_i ();
00342
00343
00344 if (ort_adapter != 0)
00345 {
00346
00347 PortableInterceptor::ObjectReferenceTemplate * const ort =
00348 ort_adapter->get_adapter_template ();
00349
00350
00351
00352
00353 my_array_obj_ref_template.size (1);
00354 my_array_obj_ref_template[0] = ort;
00355 }
00356
00357 poa = PortableServer::POA::_duplicate (this);
00358 }
00359
00360
00361 if (this->poa_manager_.remove_poa (this) != 0)
00362 throw ::CORBA::OBJ_ADAPTER ();
00363
00364
00365 int result = this->object_adapter ().unbind_poa (this,
00366 this->folded_name_,
00367 this->system_name_.in ());
00368 if (result != 0)
00369 throw ::CORBA::OBJ_ADAPTER ();
00370
00371
00372 this->active_policy_strategies_.cleanup ();
00373
00374
00375
00376
00377 {
00378
00379
00380
00381
00382
00383
00384 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00385
00386
00387 TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*this);
00388 ACE_UNUSED_ARG (non_servant_upcall);
00389
00390 this->adapter_activator_ = PortableServer::AdapterActivator::_nil ();
00391
00392 #endif
00393
00394 }
00395
00396 ::CORBA::release (this);
00397
00398 if (doing_complete_destruction)
00399 {
00400 this->adapter_state_ = PortableInterceptor::NON_EXISTENT;
00401
00402 this->adapter_state_changed (my_array_obj_ref_template,
00403 this->adapter_state_);
00404
00405 if (ort_adapter != 0)
00406 {
00407 ort_adapter->release (my_array_obj_ref_template[0]);
00408
00409 TAO::ORT_Adapter_Factory *ort_factory =
00410 this->ORT_adapter_factory ();
00411
00412 ort_factory->destroy (ort_adapter);
00413
00414 this->ort_adapter_ = 0;
00415 }
00416 }
00417 }
00418
00419 #if ! defined (CORBA_E_MICRO)
00420 PortableServer::POA_ptr
00421 TAO_Root_POA::create_POA_i (const char *adapter_name,
00422 PortableServer::POAManager_ptr poa_manager,
00423 const CORBA::PolicyList &policies)
00424 {
00425
00426
00427 TAO_POA_Policy_Set tao_policies (this->object_adapter ().default_poa_policies ());
00428
00429
00430 this->object_adapter ().validator ().merge_policies (tao_policies.policies ());
00431
00432
00433 tao_policies.merge_policies (policies);
00434
00435
00436
00437
00438
00439
00440
00441 tao_policies.validate_policies (this->object_adapter ().validator (),
00442 this->orb_core_);
00443
00444
00445
00446
00447
00448
00449 PortableServer::POAManager_var the_poa_manager;
00450
00451 if (CORBA::is_nil (poa_manager))
00452 {
00453 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT)
00454
00455 PortableServer::POA_var poa = PortableServer::POA::_duplicate (this);
00456 PortableServer::POA_var root_poa;
00457
00458
00459
00460 while (!CORBA::is_nil (poa.in ()))
00461 {
00462 root_poa = poa;
00463 poa = poa->the_parent ();
00464 }
00465
00466
00467 PortableServer::POAManagerFactory_var tao_poa_manager_factory
00468 = root_poa->the_POAManagerFactory ();
00469
00470 CORBA::PolicyList empty_policies;
00471
00472
00473
00474 the_poa_manager
00475 = tao_poa_manager_factory->create_POAManager (0, empty_policies);
00476 #else
00477
00478 PortableServer::POAManager_ptr the_poa_manager_ptr;
00479 ACE_NEW_THROW_EX (the_poa_manager_ptr,
00480 TAO_POA_Manager (this->object_adapter (), 0),
00481 CORBA::NO_MEMORY ());
00482 the_poa_manager = the_poa_manager_ptr;
00483 #endif
00484
00485 }
00486 else
00487 {
00488 the_poa_manager = PortableServer::POAManager::_duplicate (poa_manager);
00489 }
00490
00491 PortableServer::POA_var poa = this->create_POA_i (adapter_name,
00492 the_poa_manager.in (),
00493 tao_policies);
00494
00495 return poa._retn ();
00496 }
00497 #endif
00498
00499 #if ! defined (CORBA_E_MICRO)
00500 TAO_Root_POA *
00501 TAO_Root_POA::new_POA (const String &name,
00502 PortableServer::POAManager_ptr poa_manager,
00503 const TAO_POA_Policy_Set &policies,
00504 TAO_Root_POA *parent,
00505 ACE_Lock &lock,
00506 TAO_SYNCH_MUTEX &thread_lock,
00507 TAO_ORB_Core &orb_core,
00508 TAO_Object_Adapter *object_adapter)
00509 {
00510 TAO_Regular_POA *poa = 0;
00511
00512 ACE_NEW_THROW_EX (poa,
00513 TAO_Regular_POA (name,
00514 poa_manager,
00515 policies,
00516 parent,
00517 lock,
00518 thread_lock,
00519 orb_core,
00520 object_adapter),
00521 CORBA::NO_MEMORY ());
00522
00523 return poa;
00524 }
00525
00526 PortableServer::POA_ptr
00527 TAO_Root_POA::create_POA_i (const TAO_Root_POA::String &adapter_name,
00528 PortableServer::POAManager_ptr poa_manager,
00529 const TAO_POA_Policy_Set &policies)
00530 {
00531
00532
00533
00534
00535
00536
00537 if (this->children_.find (adapter_name) != -1)
00538 {
00539 throw PortableServer::POA::AdapterAlreadyExists ();
00540 }
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551 TAO_Root_POA * poa = this->new_POA (adapter_name,
00552 poa_manager,
00553 policies,
00554 this,
00555 this->object_adapter ().lock (),
00556 this->object_adapter ().thread_lock (),
00557 this->orb_core_,
00558 this->object_adapter_);
00559
00560
00561
00562
00563 PortableServer::POA_var new_poa = poa;
00564
00565
00566
00567
00568 if (this->children_.bind (adapter_name, poa) != 0)
00569 {
00570 throw ::CORBA::OBJ_ADAPTER ();
00571 }
00572
00573
00574
00575
00576
00577 poa->_add_ref ();
00578
00579
00580
00581
00582 poa->establish_components ();
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597 return new_poa._retn ();
00598 }
00599 #endif
00600
00601 #if ! defined (CORBA_E_MICRO)
00602 PortableServer::POA_ptr
00603 TAO_Root_POA::find_POA (const char *adapter_name,
00604 CORBA::Boolean activate_it)
00605 {
00606
00607 TAO_POA_GUARD_RETURN (0);
00608
00609 TAO_Root_POA *poa = this->find_POA_i (adapter_name, activate_it);
00610
00611 return PortableServer::POA::_duplicate (poa);
00612 }
00613 #endif
00614
00615 #if ! defined (CORBA_E_MICRO)
00616 TAO_Root_POA *
00617 TAO_Root_POA::find_POA_i (const ACE_CString &child_name,
00618 CORBA::Boolean activate_it)
00619 {
00620 TAO_Root_POA *child = 0;
00621 int result = this->children_.find (child_name, child);
00622
00623 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT)
00624
00625 if (result != 0)
00626 {
00627 if (activate_it)
00628 {
00629 if (!CORBA::is_nil (this->adapter_activator_.in ()))
00630 {
00631
00632 this->check_state ();
00633
00634 CORBA::Boolean success = false;
00635
00636 {
00637
00638 TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (
00639 *this);
00640 ACE_UNUSED_ARG (non_servant_upcall);
00641
00642
00643
00644
00645 success =
00646 this->adapter_activator_->unknown_adapter (
00647 this,
00648 child_name.c_str ());
00649 }
00650
00651 if (success)
00652 {
00653 result = this->children_.find (child_name,
00654 child);
00655 }
00656 else
00657 {
00658 result = -1;
00659 }
00660 }
00661 else
00662 {
00663 result = -1;
00664 }
00665 }
00666 else
00667 {
00668 result = -1;
00669 }
00670 }
00671 #else
00672 ACE_UNUSED_ARG (activate_it);
00673 #endif
00674
00675 if (result == 0)
00676 {
00677 return child;
00678 }
00679 else
00680 {
00681
00682 throw PortableServer::POA::AdapterNonExistent ();
00683 }
00684 }
00685 #endif
00686
00687 TAO_POA_Manager &
00688 TAO_Root_POA::tao_poa_manager ()
00689 {
00690 return poa_manager_;
00691 }
00692
00693 #if ! defined (CORBA_E_MICRO)
00694 PortableServer::POA_ptr
00695 TAO_Root_POA::create_POA (const char *adapter_name,
00696 PortableServer::POAManager_ptr poa_manager,
00697 const CORBA::PolicyList &policies)
00698 {
00699
00700 TAO_POA_GUARD_RETURN (0);
00701
00702 return this->create_POA_i (adapter_name, poa_manager, policies);
00703 }
00704 #endif
00705
00706 PortableServer::ObjectId *
00707 TAO_Root_POA::servant_to_id (PortableServer::Servant servant)
00708 {
00709
00710
00711
00712 TAO_POA_GUARD_RETURN (0);
00713
00714 return this->servant_to_id_i (servant);
00715 }
00716
00717 PortableServer::ObjectId *
00718 TAO_Root_POA::servant_to_user_id (PortableServer::Servant servant)
00719 {
00720 return this->active_policy_strategies_.servant_retention_strategy()->
00721 servant_to_user_id (servant);
00722 }
00723
00724 PortableServer::Servant
00725 TAO_Root_POA::reference_to_servant (CORBA::Object_ptr reference)
00726 {
00727
00728 TAO_POA_GUARD_RETURN (0);
00729
00730 return this->reference_to_servant_i (reference);
00731 }
00732
00733 CORBA::Object_ptr
00734 TAO_Root_POA::servant_to_reference (PortableServer::Servant servant)
00735 {
00736 TAO_POA_GUARD_RETURN (CORBA::Object::_nil ());
00737
00738 return this->servant_to_reference_i (servant);
00739 }
00740
00741 PortableServer::POAList *
00742 TAO_Root_POA::the_children (void)
00743 {
00744
00745 TAO_POA_GUARD_RETURN (0);
00746
00747 return this->the_children_i ();
00748 }
00749
00750
00751 PortableServer::Servant
00752 TAO_Root_POA::id_to_servant (const PortableServer::ObjectId &oid)
00753 {
00754
00755 TAO_POA_GUARD_RETURN (0);
00756
00757 return this->id_to_servant_i (oid);
00758 }
00759
00760 CORBA::Object_ptr
00761 TAO_Root_POA::id_to_reference (const PortableServer::ObjectId &oid)
00762 {
00763
00764 TAO_POA_GUARD_RETURN (0);
00765
00766 return this->id_to_reference_i (oid, true);
00767 }
00768
00769
00770 #if ! defined (CORBA_E_MICRO)
00771 CORBA::Object_ptr
00772 TAO_Root_POA::create_reference_with_id (const PortableServer::ObjectId &id,
00773 const char *intf)
00774 {
00775
00776 TAO_POA_GUARD_RETURN (CORBA::Object::_nil ());
00777
00778 return this->create_reference_with_id_i (id,
00779 intf,
00780 this->server_priority ());
00781 }
00782 #endif
00783
00784 void
00785 TAO_Root_POA::destroy (CORBA::Boolean etherealize_objects,
00786 CORBA::Boolean wait_for_completion)
00787 {
00788
00789 TAO::Portable_Server::POA_Guard poa_guard (*this , 0);
00790 ACE_UNUSED_ARG (poa_guard);
00791
00792 this->destroy_i (etherealize_objects, wait_for_completion);
00793 }
00794
00795 void
00796 TAO_Root_POA::remove_from_parent_i (void)
00797 {
00798
00799 }
00800
00801 void
00802 TAO_Root_POA::destroy_i (CORBA::Boolean etherealize_objects,
00803 CORBA::Boolean wait_for_completion)
00804 {
00805 if (this->cleanup_in_progress_)
00806 return;
00807
00808
00809 TAO_Root_POA::check_for_valid_wait_for_completions (this->orb_core (),
00810 wait_for_completion);
00811
00812 this->cleanup_in_progress_ = true;
00813
00814
00815
00816 this->poa_deactivated_hook ();
00817
00818
00819
00820
00821
00822
00823
00824
00825 this->remove_from_parent_i ();
00826
00827 TAO::ORT_Array array_obj_ref_template (1);
00828
00829 CORBA::ULong i = 0;
00830
00831
00832
00833 for (CHILDREN::iterator iterator = this->children_.begin ();
00834 iterator != this->children_.end ();
00835 ++iterator)
00836 {
00837 TAO_Root_POA * const child_poa = (*iterator).int_id_;
00838
00839 TAO::ORT_Adapter * const adapter = child_poa->ORT_adapter_i ();
00840
00841
00842 if (adapter != 0)
00843 {
00844
00845 PortableInterceptor::ObjectReferenceTemplate * const ort =
00846 adapter->get_adapter_template ();
00847
00848
00849
00850 array_obj_ref_template.size (1);
00851
00852 array_obj_ref_template[0] = ort;
00853 }
00854
00855 child_poa->adapter_state_ =
00856 PortableInterceptor::INACTIVE;
00857
00858
00859 this->adapter_state_changed (array_obj_ref_template,
00860 PortableInterceptor::INACTIVE);
00861
00862 if (adapter != 0)
00863 adapter->release (array_obj_ref_template[0]);
00864
00865 ++i;
00866 }
00867
00868
00869 for (CHILDREN::iterator destroy_iterator = this->children_.begin ();
00870 destroy_iterator != this->children_.end ();
00871 ++destroy_iterator)
00872 {
00873 TAO_Root_POA *destroy_child_poa = (*destroy_iterator).int_id_;
00874
00875 destroy_child_poa->destroy_i (etherealize_objects,
00876 wait_for_completion);
00877 }
00878
00879
00880 this->active_policy_strategies_.lifespan_strategy()->notify_shutdown ();
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896 this->deactivate_all_objects_i (etherealize_objects,
00897 wait_for_completion);
00898
00899
00900
00901
00902 TAO::Portable_Server::Non_Servant_Upcall *non_servant_upcall_in_progress =
00903 this->object_adapter ().non_servant_upcall_in_progress ();
00904 if (this->outstanding_requests_ == 0 &&
00905 (non_servant_upcall_in_progress == 0 ||
00906 &non_servant_upcall_in_progress->poa () != this))
00907 {
00908 TAO::ORT_Array my_array_obj_ref_template;
00909
00910 TAO::ORT_Adapter * const ort_adapter =
00911 this->ORT_adapter_i ();
00912
00913
00914 if (ort_adapter != 0)
00915 {
00916
00917 PortableInterceptor::ObjectReferenceTemplate * const ort =
00918 ort_adapter->get_adapter_template ();
00919
00920
00921
00922
00923 my_array_obj_ref_template.size (1);
00924 my_array_obj_ref_template[0] = ort;
00925 }
00926
00927
00928
00929
00930
00931
00932
00933 PortableServer::POA_var poa = PortableServer::POA::_duplicate (this);
00934
00935 this->complete_destruction_i ();
00936
00937 this->adapter_state_ = PortableInterceptor::NON_EXISTENT;
00938
00939 this->adapter_state_changed (my_array_obj_ref_template,
00940 this->adapter_state_);
00941
00942 if (ort_adapter != 0)
00943 {
00944 ort_adapter->release (my_array_obj_ref_template[0]);
00945
00946 TAO::ORT_Adapter_Factory *ort_factory =
00947 this->ORT_adapter_factory ();
00948
00949 ort_factory->destroy (ort_adapter);
00950
00951 this->ort_adapter_ = 0;
00952 }
00953 }
00954 else
00955 {
00956
00957 this->waiting_destruction_ = true;
00958 }
00959 }
00960
00961 int
00962 TAO_Root_POA::delete_child (const TAO_Root_POA::String &child)
00963 {
00964 int result = 0;
00965
00966
00967
00968 if (!this->cleanup_in_progress_)
00969 result = this->children_.unbind (child);
00970
00971
00972
00973
00974
00975 return result;
00976 }
00977
00978 PortableServer::POAList *
00979 TAO_Root_POA::the_children_i (void)
00980 {
00981 PortableServer::POAList_var children;
00982 CORBA::ULong child_current = static_cast <CORBA::ULong>
00983 (this->children_.current_size ());
00984 ACE_NEW_THROW_EX (children,
00985 PortableServer::POAList (child_current),
00986 CORBA::NO_MEMORY ());
00987
00988 children->length (child_current);
00989
00990 CORBA::ULong index = 0;
00991 for (CHILDREN::iterator iterator = this->children_.begin ();
00992 iterator != this->children_.end ();
00993 ++iterator, ++index)
00994 {
00995 TAO_Root_POA *child_poa = (*iterator).int_id_;
00996 children[index] = PortableServer::POA::_duplicate (child_poa);
00997 }
00998
00999 return children._retn ();
01000 }
01001
01002 PortableInterceptor::AdapterName *
01003 TAO_Root_POA::adapter_name_i (void)
01004 {
01005
01006
01007
01008
01009 PortableServer::POA_var poa = PortableServer::POA::_duplicate (this);
01010
01011 CORBA::ULong len = 0;
01012
01013
01014
01015
01016 while (!CORBA::is_nil (poa.in ()))
01017 {
01018 poa = poa->the_parent ();
01019 ++len;
01020 }
01021
01022
01023 PortableInterceptor::AdapterName *names = 0;
01024 ACE_NEW_THROW_EX (names,
01025 PortableInterceptor::AdapterName (len),
01026 CORBA::NO_MEMORY (
01027 CORBA::SystemException::_tao_minor_code (
01028 TAO::VMCID,
01029 ENOMEM),
01030 CORBA::COMPLETED_NO));
01031
01032 PortableInterceptor::AdapterName_var safe_names (names);
01033
01034 names->length (len);
01035
01036 poa = PortableServer::POA::_duplicate (this);
01037
01038 (*names)[0] = CORBA::string_dup ("RootPOA");
01039
01040
01041
01042 CORBA::ULong ilen = len;
01043 for (CORBA::ULong i = 1; i < len; ++i)
01044 {
01045 (*names)[--ilen] = poa->the_name ();
01046
01047 poa = poa->the_parent ();
01048
01049
01050
01051 ACE_ASSERT ((ilen > 0 ? !CORBA::is_nil (poa.in ()) : 1));
01052 }
01053
01054 return safe_names._retn ();
01055 }
01056
01057 void
01058 TAO_Root_POA::add_ior_component (TAO_MProfile & mprofile,
01059 const IOP::TaggedComponent &component)
01060 {
01061
01062 const CORBA::ULong profile_count = mprofile.profile_count ();
01063
01064 for (CORBA::ULong i = 0; i < profile_count; ++i)
01065 {
01066 TAO_Profile *profile = mprofile.get_profile (i);
01067
01068 profile->add_tagged_component (component);
01069 }
01070 }
01071
01072 void
01073 TAO_Root_POA::add_ior_component_to_profile (
01074 TAO_MProfile & mprofile,
01075 const IOP::TaggedComponent &component,
01076 IOP::ProfileId profile_id)
01077 {
01078
01079
01080 bool found_profile = false;
01081
01082 CORBA::ULong const profile_count = mprofile.profile_count ();
01083
01084 for (CORBA::ULong i = 0; i < profile_count; ++i)
01085 {
01086 TAO_Profile *profile = mprofile.get_profile (i);
01087
01088 if (profile->tag () == profile_id)
01089 {
01090 profile->add_tagged_component (component);
01091
01092 found_profile = true;
01093 }
01094 }
01095
01096
01097
01098
01099 if (found_profile == false)
01100 throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 29, CORBA::COMPLETED_NO);
01101 }
01102
01103 void
01104 TAO_Root_POA::adapter_state_changed (
01105 const TAO::ORT_Array &array_obj_ref_template,
01106 PortableInterceptor::AdapterState state)
01107 {
01108 TAO_IORInterceptor_Adapter *ior_adapter =
01109 this->orb_core_.ior_interceptor_adapter ();
01110
01111 if (ior_adapter)
01112 {
01113 ior_adapter->adapter_state_changed (array_obj_ref_template, state);
01114 }
01115 }
01116
01117 PortableServer::ObjectId *
01118 TAO_Root_POA::activate_object_i (PortableServer::Servant servant,
01119 CORBA::Short priority,
01120 bool &wait_occurred_restart_call)
01121 {
01122 return this->active_policy_strategies_.servant_retention_strategy()->
01123 activate_object (servant,
01124 priority,
01125 wait_occurred_restart_call);
01126 }
01127
01128 PortableServer::ObjectId *
01129 TAO_Root_POA::activate_object (PortableServer::Servant servant)
01130 {
01131 while (1)
01132 {
01133 bool wait_occurred_restart_call = false;
01134
01135
01136 TAO_POA_GUARD_RETURN (0);
01137
01138 PortableServer::ObjectId *result =
01139 this->activate_object_i (servant,
01140 this->server_priority (),
01141 wait_occurred_restart_call);
01142
01143
01144
01145
01146 if (wait_occurred_restart_call)
01147 continue;
01148 else
01149 return result;
01150 }
01151 }
01152
01153 void
01154 TAO_Root_POA::activate_object_with_id (const PortableServer::ObjectId &id,
01155 PortableServer::Servant servant)
01156 {
01157 while (1)
01158 {
01159 bool wait_occurred_restart_call = false;
01160
01161
01162 TAO_POA_GUARD;
01163
01164 this->activate_object_with_id_i (id,
01165 servant,
01166 this->server_priority (),
01167 wait_occurred_restart_call);
01168
01169
01170
01171
01172 if (wait_occurred_restart_call)
01173 continue;
01174 else
01175 return;
01176 }
01177 }
01178
01179 void
01180 TAO_Root_POA::activate_object_with_id_i (const PortableServer::ObjectId &id,
01181 PortableServer::Servant servant,
01182 CORBA::Short priority,
01183 bool &wait_occurred_restart_call)
01184 {
01185 this->active_policy_strategies_.servant_retention_strategy()->
01186 activate_object_with_id (id,
01187 servant,
01188 priority,
01189 wait_occurred_restart_call);
01190 }
01191
01192 void
01193 TAO_Root_POA::deactivate_all_objects_i (CORBA::Boolean etherealize_objects,
01194 CORBA::Boolean wait_for_completion)
01195 {
01196 this->deactivate_all_objects_i (etherealize_objects);
01197
01198 this->wait_for_completions (wait_for_completion);
01199 }
01200
01201 void
01202 TAO_Root_POA::wait_for_completions (CORBA::Boolean wait_for_completion)
01203 {
01204 while (this->object_adapter ().enable_locking_ &&
01205 wait_for_completion &&
01206 this->outstanding_requests_ > 0)
01207 {
01208 this->wait_for_completion_pending_ = 1;
01209
01210 int result = this->outstanding_requests_condition_.wait ();
01211 if (result == -1)
01212 {
01213 throw ::CORBA::OBJ_ADAPTER ();
01214 }
01215 }
01216 }
01217
01218
01219 void
01220 TAO_Root_POA::check_for_valid_wait_for_completions (const TAO_ORB_Core &orb_core,
01221 CORBA::Boolean wait_for_completion)
01222 {
01223 if (wait_for_completion)
01224 {
01225 TAO::Portable_Server::POA_Current_Impl *poa_current_impl =
01226 static_cast <TAO::Portable_Server::POA_Current_Impl *>
01227 (TAO_TSS_Resources::instance ()->poa_current_impl_);
01228
01229 while (1)
01230 {
01231
01232
01233
01234
01235
01236 if ((poa_current_impl != 0) && (poa_current_impl->poa () != 0))
01237 {
01238 if (&orb_core == &poa_current_impl->orb_core ())
01239 {
01240
01241
01242 throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 3,
01243 CORBA::COMPLETED_NO);
01244 }
01245 }
01246 else
01247 break;
01248
01249 poa_current_impl =
01250 poa_current_impl->previous_current_impl_;
01251 }
01252 }
01253 }
01254
01255 void
01256 TAO_Root_POA::deactivate_all_objects_i (CORBA::Boolean etherealize_objects)
01257 {
01258 this->active_policy_strategies_.request_processing_strategy ()->
01259 etherealize_objects (etherealize_objects);
01260
01261 this->active_policy_strategies_.servant_retention_strategy ()->
01262 deactivate_all_objects ();
01263 }
01264
01265 void
01266 TAO_Root_POA::deactivate_object (const PortableServer::ObjectId &oid)
01267 {
01268
01269 TAO_POA_GUARD;
01270
01271 this->deactivate_object_i (oid);
01272 }
01273
01274 void
01275 TAO_Root_POA::deactivate_object_i (const PortableServer::ObjectId &id)
01276 {
01277 this->active_policy_strategies_.servant_retention_strategy()->
01278 deactivate_object (id);
01279 }
01280
01281 CORBA::Boolean
01282 TAO_Root_POA::is_persistent (void) const
01283 {
01284 return active_policy_strategies_.lifespan_strategy()->is_persistent ();
01285 }
01286
01287 CORBA::Object_ptr
01288 TAO_Root_POA::create_reference (const char *intf)
01289 {
01290
01291 TAO_POA_GUARD_RETURN (CORBA::Object::_nil ());
01292
01293 return this->create_reference_i (intf,
01294 this->server_priority ());
01295 }
01296
01297 CORBA::Object_ptr
01298 TAO_Root_POA::create_reference_i (const char *intf,
01299 CORBA::Short priority)
01300 {
01301 if (!this->has_system_id ())
01302 {
01303 throw PortableServer::POA::WrongPolicy ();
01304 }
01305
01306 return this->active_policy_strategies_.servant_retention_strategy()->
01307 create_reference (intf, priority);
01308 }
01309
01310 CORBA::Object_ptr
01311 TAO_Root_POA::invoke_key_to_object_helper_i (const char * repository_id,
01312 const PortableServer::ObjectId & id)
01313 {
01314 const PortableInterceptor::ObjectId &user_oid =
01315 reinterpret_cast <const PortableInterceptor::ObjectId &>(id);
01316
01317
01318 if (this->ORT_adapter_i ())
01319 {
01320
01321 return this->ort_adapter_->make_object (repository_id,
01322 user_oid);
01323 }
01324 else
01325 {
01326 return this->invoke_key_to_object ();
01327 }
01328 }
01329
01330 #if ! defined (CORBA_E_MICRO)
01331 CORBA::Object_ptr
01332 TAO_Root_POA::create_reference_with_id_i (const PortableServer::ObjectId &user_id,
01333 const char *intf,
01334 CORBA::Short priority)
01335 {
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345 if (this->has_system_id () &&
01346 !this->is_poa_generated_id (user_id))
01347 {
01348 throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
01349 }
01350
01351 return this->active_policy_strategies_.servant_retention_strategy()->
01352 create_reference_with_id (user_id, intf, priority);
01353 }
01354 #endif
01355
01356 PortableServer::ObjectId *
01357 TAO_Root_POA::servant_to_id_i (PortableServer::Servant servant)
01358 {
01359 return this->active_policy_strategies_.request_processing_strategy()->
01360 servant_to_id (servant);
01361 }
01362
01363 CORBA::Object_ptr
01364 TAO_Root_POA::servant_to_reference_i (PortableServer::Servant servant)
01365 {
01366 return this->active_policy_strategies_.servant_retention_strategy()->
01367 servant_to_reference (servant);
01368 }
01369
01370 PortableServer::Servant
01371 TAO_Root_POA::reference_to_servant_i (CORBA::Object_ptr reference)
01372 {
01373
01374 if (CORBA::is_nil (reference))
01375 {
01376 throw ::CORBA::BAD_PARAM ();
01377 }
01378
01379 PortableServer::ObjectId system_id;
01380 bool const is_generated =
01381 this->is_poa_generated (reference, system_id);
01382
01383 if (!is_generated)
01384 {
01385
01386
01387 throw PortableServer::POA::WrongAdapter ();
01388 }
01389
01390 PortableServer::Servant servant =
01391 this->active_policy_strategies_.request_processing_strategy()->
01392 system_id_to_servant (system_id);
01393
01394 if (servant != 0)
01395 {
01396
01397 TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*this);
01398 ACE_UNUSED_ARG (non_servant_upcall);
01399
01400
01401
01402
01403
01404
01405
01406
01407 servant->_add_ref ();
01408 }
01409
01410 return servant;
01411 }
01412
01413 bool
01414 TAO_Root_POA::is_poa_generated (CORBA::Object_ptr reference,
01415 PortableServer::ObjectId &system_id)
01416 {
01417 TAO::ObjectKey_var key = reference->_key ();
01418
01419 TAO_Object_Adapter::poa_name poa_system_name;
01420 CORBA::Boolean is_root = false;
01421 CORBA::Boolean is_persistent = false;
01422 CORBA::Boolean is_system_id = false;
01423 TAO::Portable_Server::Temporary_Creation_Time poa_creation_time;
01424
01425 int const result = this->parse_key (key.in (),
01426 poa_system_name,
01427 system_id,
01428 is_root,
01429 is_persistent,
01430 is_system_id,
01431 poa_creation_time);
01432 if (result != 0
01433 || (this->root () == 0 && poa_system_name != this->system_name ())
01434 || is_root != this->root ()
01435 || is_system_id != this->system_id ()
01436 || !this->validate_lifespan (is_persistent, poa_creation_time))
01437 {
01438
01439 return false;
01440 }
01441 else
01442 {
01443
01444 return true;
01445 }
01446 }
01447
01448 PortableServer::ObjectId *
01449 TAO_Root_POA::reference_to_id (CORBA::Object_ptr reference)
01450 {
01451
01452 if (CORBA::is_nil (reference))
01453 {
01454 throw ::CORBA::BAD_PARAM ();
01455 }
01456
01457
01458
01459
01460
01461
01462
01463 PortableServer::ObjectId system_id;
01464 bool const is_generated = this->is_poa_generated (reference, system_id);
01465
01466 if (!is_generated)
01467 {
01468 throw PortableServer::POA::WrongAdapter ();
01469 }
01470
01471
01472 TAO_POA_GUARD_RETURN (0);
01473
01474 return this->active_policy_strategies_.servant_retention_strategy()->
01475 system_id_to_object_id (system_id);
01476 }
01477
01478 PortableServer::Servant
01479 TAO_Root_POA::find_servant (const PortableServer::ObjectId &system_id)
01480 {
01481 return this->active_policy_strategies_.servant_retention_strategy()->
01482 find_servant (system_id);
01483 }
01484
01485 int
01486 TAO_Root_POA::unbind_using_user_id (const PortableServer::ObjectId &user_id)
01487 {
01488 return this->active_policy_strategies_.servant_retention_strategy()->
01489 unbind_using_user_id (user_id);
01490 }
01491
01492 void
01493 TAO_Root_POA::cleanup_servant (
01494 PortableServer::Servant servant,
01495 const PortableServer::ObjectId &user_id)
01496 {
01497 this->active_policy_strategies_.request_processing_strategy()->
01498 cleanup_servant (servant, user_id);
01499 }
01500
01501 PortableServer::Servant
01502 TAO_Root_POA::id_to_servant_i (const PortableServer::ObjectId &id)
01503 {
01504
01505 PortableServer::Servant servant =
01506 this->active_policy_strategies_.request_processing_strategy()->
01507 id_to_servant (id);
01508
01509 if (servant != 0)
01510 {
01511
01512 TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*this);
01513 ACE_UNUSED_ARG (non_servant_upcall);
01514
01515
01516
01517
01518
01519
01520
01521
01522 servant->_add_ref ();
01523 }
01524
01525 return servant;
01526 }
01527
01528 PortableServer::Servant
01529 TAO_Root_POA::user_id_to_servant_i (const PortableServer::ObjectId &id)
01530 {
01531 return this->active_policy_strategies_.servant_retention_strategy()->
01532 user_id_to_servant (id);
01533 }
01534
01535 CORBA::Object_ptr
01536 TAO_Root_POA::id_to_reference_i (const PortableServer::ObjectId &id,
01537 bool indirect)
01538 {
01539 return this->active_policy_strategies_.servant_retention_strategy()->
01540 id_to_reference (id, indirect);
01541 }
01542
01543 CORBA::OctetSeq *
01544 TAO_Root_POA::id (void)
01545 {
01546 CORBA::OctetSeq *id = 0;
01547 ACE_NEW_THROW_EX (id,
01548 CORBA::OctetSeq (this->id_),
01549 CORBA::NO_MEMORY ());
01550
01551 return id;
01552 }
01553
01554 PortableServer::Servant
01555 TAO_Root_POA::locate_servant_i (const char *operation,
01556 const PortableServer::ObjectId &system_id,
01557 TAO::Portable_Server::Servant_Upcall &servant_upcall,
01558 TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
01559 bool &wait_occurred_restart_call)
01560 {
01561 return this->active_policy_strategies_.request_processing_strategy()->
01562 locate_servant (operation,
01563 system_id,
01564 servant_upcall,
01565 poa_current_impl,
01566 wait_occurred_restart_call);
01567 }
01568
01569
01570 int
01571 TAO_Root_POA::parse_key (const TAO::ObjectKey &key,
01572 TAO_Object_Adapter::poa_name &poa_system_name,
01573 PortableServer::ObjectId &system_id,
01574 CORBA::Boolean &is_root,
01575 CORBA::Boolean &is_persistent,
01576 CORBA::Boolean &is_system_id,
01577 TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time)
01578 {
01579
01580 const CORBA::Octet *key_data = key.get_buffer ();
01581
01582
01583 CORBA::ULong starting_at = TAO_OBJECTKEY_PREFIX_SIZE;
01584
01585
01586 char root_key_type = key_data[starting_at];
01587 if (root_key_type == TAO_Root_POA::root_key_char ())
01588 {
01589 is_root = true;
01590 }
01591 else if (root_key_type == TAO_Root_POA::non_root_key_char ())
01592 {
01593 is_root = false;
01594 }
01595 else
01596 {
01597
01598 return -1;
01599 }
01600
01601
01602 starting_at += TAO_Root_POA::root_key_type_length ();
01603
01604
01605 char system_id_key_type = key_data[starting_at];
01606 if (system_id_key_type == TAO_Root_POA::system_id_key_char ())
01607 {
01608 is_system_id = true;
01609 }
01610 else if (system_id_key_type == TAO_Root_POA::user_id_key_char ())
01611 {
01612 is_system_id = false;
01613 }
01614 else
01615 {
01616
01617 return -1;
01618 }
01619
01620
01621 starting_at += TAO_Root_POA::system_id_key_type_length ();
01622
01623
01624 char persistent_key_type = key_data[starting_at];
01625 if (persistent_key_type == TAO_Root_POA::persistent_key_char ())
01626 {
01627 is_persistent = true;
01628 }
01629 else if (persistent_key_type == TAO_Root_POA::transient_key_char ())
01630 {
01631 is_persistent = false;
01632 }
01633 else
01634 {
01635
01636 return -1;
01637 }
01638
01639
01640 starting_at += TAO_Root_POA::persistent_key_type_length ();
01641
01642 #if (POA_NO_TIMESTAMP == 0)
01643
01644 if (!is_persistent)
01645 {
01646
01647 poa_creation_time.creation_time (key_data + starting_at);
01648
01649
01650 starting_at += TAO::Portable_Server::Creation_Time::creation_time_length ();
01651 }
01652 #else
01653 ACE_UNUSED_ARG (poa_creation_time);
01654 #endif
01655
01656
01657 CORBA::ULong poa_name_size = 0;
01658 if (!is_persistent)
01659 {
01660
01661 poa_name_size = TAO_Object_Adapter::transient_poa_name_size ();
01662 }
01663 else if (is_system_id)
01664 {
01665
01666 poa_name_size = static_cast <CORBA::ULong>
01667 (key.length () - starting_at -
01668 TAO_Active_Object_Map::system_id_size ());
01669 }
01670 else
01671 {
01672
01673 ACE_OS::memcpy (&poa_name_size,
01674 key_data + starting_at,
01675 sizeof (poa_name_size));
01676 poa_name_size = ACE_NTOHL (poa_name_size);
01677
01678 starting_at += sizeof (poa_name_size);
01679 }
01680
01681
01682 if (!is_root)
01683 {
01684 poa_system_name.replace (poa_name_size,
01685 poa_name_size,
01686 (CORBA::Octet *) key_data + starting_at,
01687 0);
01688
01689 starting_at += poa_name_size;
01690 }
01691
01692
01693 CORBA::ULong system_id_size = key.length () - starting_at;
01694
01695
01696 system_id.length (system_id_size);
01697 CORBA::Octet * buf = system_id.get_buffer ();
01698 ACE_OS::memcpy (buf, key_data + starting_at, system_id_size);
01699
01700
01701 return 0;
01702 }
01703
01704 TAO::ObjectKey *
01705 TAO_Root_POA::create_object_key (const PortableServer::ObjectId &id)
01706 {
01707
01708 CORBA::ULong buffer_size =
01709 this->id_.length () +
01710 id.length ();
01711
01712
01713 CORBA::Octet *buffer = TAO::ObjectKey::allocbuf (buffer_size);
01714
01715
01716 ACE_OS::memcpy (&buffer[0],
01717 this->id_.get_buffer (),
01718 this->id_.length ());
01719
01720
01721 ACE_OS::memcpy (&buffer[this->id_.length ()],
01722 id.get_buffer (),
01723 id.length ());
01724
01725
01726
01727 TAO::ObjectKey *key = 0;
01728 ACE_NEW_RETURN (key,
01729 TAO::ObjectKey (buffer_size,
01730 buffer_size,
01731 buffer,
01732 1),
01733 0);
01734
01735 return key;
01736 }
01737
01738 void
01739 TAO_Root_POA::set_id (TAO_Root_POA *parent)
01740 {
01741
01742 CORBA::ULong prefix_size = 0;
01743 prefix_size += TAO_OBJECTKEY_PREFIX_SIZE;
01744
01745
01746
01747
01748
01749 bool const add_poa_name_length =
01750 this->is_persistent () &&
01751 !this->system_id ();
01752
01753
01754 CORBA::ULong poa_name = 0;
01755
01756
01757 CORBA::ULong poa_name_length = this->system_name_->length ();
01758 if (parent != 0)
01759 {
01760 poa_name += poa_name_length;
01761 }
01762
01763
01764 if (add_poa_name_length)
01765 {
01766 poa_name += sizeof (poa_name_length);
01767 }
01768
01769
01770
01771 CORBA::ULong const lifespan_key_length =
01772 this->active_policy_strategies_.lifespan_strategy()->key_length ();
01773
01774 CORBA::ULong const id_assignment_key_length =
01775 this->active_policy_strategies_.id_assignment_strategy()->key_type_length ();
01776
01777
01778 CORBA::ULong const buffer_size =
01779 prefix_size +
01780 this->root_key_type_length () +
01781 id_assignment_key_length +
01782 lifespan_key_length +
01783 poa_name;
01784
01785
01786 this->id_.length (buffer_size);
01787 CORBA::Octet *buffer = &this->id_[0];
01788
01789
01790 CORBA::ULong starting_at = 0;
01791
01792
01793 ACE_OS::memcpy (&buffer[starting_at],
01794 &objectkey_prefix[0],
01795 TAO_OBJECTKEY_PREFIX_SIZE);
01796
01797 starting_at += TAO_OBJECTKEY_PREFIX_SIZE;
01798
01799
01800 if (parent != 0)
01801 {
01802 buffer[starting_at] = (CORBA::Octet) TAO_Root_POA::non_root_key_char ();
01803 }
01804 else
01805 {
01806 buffer[starting_at] = (CORBA::Octet) TAO_Root_POA::root_key_char ();
01807 }
01808 starting_at += this->root_key_type_length ();
01809
01810
01811 this->active_policy_strategies_.id_assignment_strategy()->create_key (buffer, starting_at);
01812
01813
01814 this->active_policy_strategies_.lifespan_strategy()->create_key (buffer, starting_at);
01815
01816
01817 if (add_poa_name_length)
01818 {
01819 poa_name_length = ACE_HTONL (poa_name_length);
01820 ACE_OS::memcpy (&buffer[starting_at],
01821 &poa_name_length,
01822 sizeof (poa_name_length));
01823 starting_at += sizeof (poa_name_length);
01824 }
01825
01826
01827 if (parent != 0)
01828 {
01829 ACE_OS::memcpy (&buffer[starting_at],
01830 this->system_name_->get_buffer (),
01831 this->system_name_->length ());
01832 starting_at += this->system_name_->length ();
01833 }
01834 }
01835
01836 int
01837 TAO_Root_POA::is_poa_generated_id (const PortableServer::ObjectId &id)
01838 {
01839 #if defined (POA_NAME_IN_POA_GENERATED_ID)
01840
01841
01842 const char *id_buffer = (const char *) id.get_buffer ();
01843
01844
01845 return
01846 this->name_.length () < id.length () &&
01847 ACE_OS::strncmp (id_buffer,
01848 this->name_.c_str (),
01849 this->name_.length ()) == 0;
01850 #else
01851
01852 ACE_UNUSED_ARG (id);
01853 return 1;
01854
01855 #endif
01856 }
01857
01858 void
01859 TAO_Root_POA::set_folded_name (TAO_Root_POA *parent)
01860 {
01861 size_t length = 0;
01862 size_t parent_length = 0;
01863
01864 if (parent != 0)
01865 {
01866 parent_length = parent->folded_name ().length ();
01867 length += parent_length;
01868 }
01869
01870 length += this->name_.length ();
01871 length += TAO_Root_POA::name_separator_length ();
01872
01873 this->folded_name_.length (static_cast <CORBA::ULong> (length));
01874 CORBA::Octet *folded_name_buffer = this->folded_name_.get_buffer ();
01875
01876 if (parent != 0)
01877 {
01878 ACE_OS::memcpy (folded_name_buffer,
01879 parent->folded_name ().get_buffer (),
01880 parent_length);
01881 }
01882
01883 ACE_OS::memcpy (&folded_name_buffer[parent_length],
01884 this->name_.c_str (),
01885 this->name_.length ());
01886
01887 folded_name_buffer[length - TAO_Root_POA::name_separator_length ()] = TAO_Root_POA::name_separator ();
01888 }
01889
01890 int
01891 TAO_Root_POA::parse_ir_object_key (const TAO::ObjectKey &object_key,
01892 PortableServer::ObjectId &user_id)
01893 {
01894 TAO_Object_Adapter::poa_name poa_system_name;
01895 CORBA::Boolean is_root = false;
01896 CORBA::Boolean is_persistent = false;
01897 CORBA::Boolean is_system_id = false;
01898 TAO::Portable_Server::Temporary_Creation_Time poa_creation_time;
01899
01900 return TAO_Root_POA::parse_key (object_key,
01901 poa_system_name,
01902 user_id,
01903 is_root,
01904 is_persistent,
01905 is_system_id,
01906 poa_creation_time);
01907 }
01908
01909 TAO_Object_Adapter &
01910 TAO_Root_POA::object_adapter (void)
01911 {
01912 return *this->object_adapter_;
01913 }
01914
01915 CORBA::Object_ptr
01916 TAO_Root_POA::invoke_key_to_object (void)
01917 {
01918 PortableServer::ObjectId_var &system_id =
01919 *this->key_to_object_params_.system_id_;
01920
01921
01922 TAO::ObjectKey_var key =
01923 this->create_object_key (system_id.in ());
01924
01925 return this->key_to_object (key.in (),
01926 this->key_to_object_params_.type_id_,
01927 this->key_to_object_params_.servant_,
01928 this->key_to_object_params_.collocated_,
01929 this->key_to_object_params_.priority_,
01930 this->key_to_object_params_.indirect_);
01931 }
01932
01933 CORBA::Object_ptr
01934 TAO_Root_POA::key_to_object (const TAO::ObjectKey &key,
01935 const char *type_id,
01936 TAO_ServantBase *servant,
01937 CORBA::Boolean collocated,
01938 CORBA::Short priority,
01939 bool indirect)
01940 {
01941
01942
01943
01944 this->orb_core_.check_shutdown ();
01945
01946
01947
01948
01949 #if (TAO_HAS_MINIMUM_CORBA == 0)
01950
01951 CORBA::Object_ptr obj = CORBA::Object::_nil ();
01952
01953 if (indirect && this->active_policy_strategies_.lifespan_strategy()->use_imr ()
01954 && this->orb_core ().imr_endpoints_in_ior ())
01955 {
01956
01957 CORBA::Object_var imr = this->orb_core ().implrepo_service ();
01958
01959 if (CORBA::is_nil (imr.in ())
01960 || !imr->_stubobj ()
01961 || !imr->_stubobj ()->profile_in_use ())
01962 {
01963 if (TAO_debug_level > 1)
01964 {
01965 ACE_DEBUG ((LM_DEBUG,
01966 "Missing ImR IOR, will not use the ImR\n"));
01967 }
01968 goto orbkey;
01969 }
01970
01971 CORBA::String_var imr_str =
01972 imr->_stubobj ()->profile_in_use ()->to_string ();
01973
01974 if (TAO_debug_level > 0)
01975 ACE_DEBUG ((LM_DEBUG,
01976 "IMR IOR =\n%C\n",
01977 imr_str.in ()));
01978
01979
01980
01981 const char corbaloc[] = "corbaloc:";
01982 char *pos = ACE_OS::strstr (imr_str.inout (), corbaloc);
01983 pos = ACE_OS::strchr (pos + sizeof (corbaloc), ':');
01984
01985 pos = ACE_OS::strchr (pos + 1,
01986 imr->_stubobj ()->profile_in_use ()->object_key_delimiter ());
01987
01988 if (pos)
01989 pos[1] = 0;
01990 else
01991 {
01992 if (TAO_debug_level > 0)
01993 ACE_ERROR ((LM_ERROR,
01994 "Could not parse ImR IOR, skipping ImRification\n"));
01995 goto orbkey;
01996 }
01997
01998 ACE_CString ior (imr_str.in ());
01999
02000
02001
02002 CORBA::String_var key_str;
02003 TAO::ObjectKey::encode_sequence_to_string (key_str.inout (), key);
02004
02005 ior += key_str.in ();
02006
02007 if (TAO_debug_level > 0)
02008 ACE_DEBUG ((LM_DEBUG,
02009 "ImR-ified IOR =\n%C\n",
02010 ior.c_str ()));
02011
02012 obj = this->orb_core_.orb ()->string_to_object (ior.c_str ());
02013
02014 return obj;
02015 }
02016
02017 orbkey:
02018
02019 #else
02020 ACE_UNUSED_ARG (indirect);
02021 #endif
02022
02023 TAO_Stub *data = this->key_to_stub_i (key, type_id, priority);
02024
02025 TAO_Stub_Auto_Ptr safe_data (data);
02026
02027 CORBA::Object_ptr tmp;
02028
02029 if (this->orb_core_.optimize_collocation_objects ())
02030 {
02031 ACE_NEW_THROW_EX (tmp, CORBA::Object (data,
02032 collocated,
02033 servant),
02034 CORBA::INTERNAL ());
02035
02036 }
02037 else
02038 {
02039 ACE_NEW_THROW_EX (tmp,
02040 CORBA::Object (data,
02041 collocated),
02042 CORBA::INTERNAL ());
02043 }
02044
02045 data->servant_orb (this->orb_core_.orb ());
02046
02047
02048 (void) safe_data.release ();
02049
02050 return tmp;
02051 }
02052
02053 TAO_Stub *
02054 TAO_Root_POA::key_to_stub (const TAO::ObjectKey &key,
02055 const char *type_id,
02056 CORBA::Short priority)
02057 {
02058
02059
02060
02061 this->orb_core_.check_shutdown ();
02062
02063 return this->key_to_stub_i (key, type_id, priority);
02064 }
02065
02066 TAO_Stub *
02067 TAO_Root_POA::key_to_stub_i (const TAO::ObjectKey &key,
02068 const char *type_id,
02069 CORBA::Short priority)
02070 {
02071 CORBA::PolicyList_var client_exposed_policies =
02072 this->client_exposed_policies (priority);
02073
02074 TAO_Acceptor_Filter* filter = 0;
02075
02076 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
02077 if (this->filter_factory_)
02078 {
02079 filter = this->filter_factory_->create_object (this->poa_manager_);
02080 }
02081 else
02082 #endif
02083 {
02084 ACE_NEW_RETURN (filter,
02085 TAO_Default_Acceptor_Filter (),
02086 0);
02087 }
02088
02089
02090 auto_ptr<TAO_Acceptor_Filter> new_filter (filter);
02091
02092 TAO_Stub *data =
02093 this->create_stub_object (
02094 key,
02095 type_id,
02096 client_exposed_policies._retn (),
02097 filter,
02098 this->orb_core_.lane_resources ().acceptor_registry ());
02099
02100 return data;
02101 }
02102
02103 void
02104 TAO_Root_POA::establish_components (void)
02105 {
02106 TAO_IORInterceptor_Adapter *ior_adapter =
02107 this->orb_core_.ior_interceptor_adapter ();
02108
02109 if (ior_adapter)
02110 {
02111 ior_adapter->establish_components (this);
02112 }
02113 }
02114
02115 void
02116 TAO_Root_POA::components_established (PortableInterceptor::IORInfo_ptr info)
02117 {
02118 TAO_IORInterceptor_Adapter *ior_adapter =
02119 this->orb_core_.ior_interceptor_adapter ();
02120
02121 if (ior_adapter)
02122 {
02123 ior_adapter->components_established (info);
02124 }
02125 }
02126
02127 void
02128 TAO_Root_POA::save_ior_component (const IOP::TaggedComponent &component)
02129 {
02130 CORBA::ULong const old_len = this->tagged_component_.length ();
02131
02132 this->tagged_component_.length (old_len + 1);
02133 this->tagged_component_[old_len] = component;
02134 }
02135
02136 void
02137 TAO_Root_POA::
02138 save_ior_component_and_profile_id (const IOP::TaggedComponent &component,
02139 IOP::ProfileId profile_id)
02140 {
02141
02142
02143
02144
02145
02146
02147 CORBA::ULong const old_len = this->tagged_component_id_.length ();
02148
02149 CORBA::ULong const new_len = old_len + 1;
02150
02151 this->tagged_component_id_.length (new_len);
02152 this->tagged_component_id_[old_len] = component;
02153
02154 this->profile_id_array_.size (new_len);
02155 this->profile_id_array_[old_len] = profile_id;
02156 }
02157
02158 TAO_Stub *
02159 TAO_Root_POA::create_stub_object (const TAO::ObjectKey &object_key,
02160 const char *type_id,
02161 CORBA::PolicyList *policy_list,
02162 TAO_Acceptor_Filter *filter,
02163 TAO_Acceptor_Registry &acceptor_registry)
02164 {
02165 bool error = false;
02166
02167
02168 size_t const profile_count = acceptor_registry.endpoint_count ();
02169
02170
02171
02172 TAO_MProfile mprofile (0);
02173
02174
02175
02176
02177 int result = mprofile.set (static_cast <CORBA::ULong> (profile_count));
02178 if (result == -1)
02179 error = true;
02180
02181 if (!error)
02182 {
02183 result =
02184 filter->fill_profile (object_key,
02185 mprofile,
02186 acceptor_registry.begin (),
02187 acceptor_registry.end ());
02188 if (result == -1)
02189 error = true;
02190 }
02191
02192 if (!error)
02193 result = filter->encode_endpoints (mprofile);
02194
02195 if (result == -1)
02196 error = true;
02197
02198 if (error)
02199 throw ::CORBA::INTERNAL (
02200 CORBA::SystemException::_tao_minor_code (
02201 TAO_MPROFILE_CREATION_ERROR,
02202 0),
02203 CORBA::COMPLETED_NO);
02204
02205
02206
02207
02208 if (mprofile.profile_count () == 0)
02209 throw ::CORBA::BAD_PARAM (
02210 CORBA::SystemException::_tao_minor_code (
02211 TAO_MPROFILE_CREATION_ERROR,
02212 0),
02213 CORBA::COMPLETED_NO);
02214
02215 TAO_Stub *stub =
02216 this->orb_core_.create_stub_object (mprofile, type_id, policy_list);
02217
02218
02219 CORBA::ULong len = this->tagged_component_.length ();
02220 for (CORBA::ULong i = 0; i != len; ++i)
02221 {
02222 this->add_ior_component (mprofile, this->tagged_component_[i]);
02223 }
02224
02225 len = this->tagged_component_id_.length ();
02226
02227 for (CORBA::ULong k = 0; k != len; ++k)
02228 {
02229 this->add_ior_component_to_profile (mprofile,
02230 this->tagged_component_id_[k],
02231 this->profile_id_array_[k]);
02232 }
02233
02234 return stub;
02235 }
02236
02237 CORBA::PolicyList *
02238 TAO_Root_POA::client_exposed_policies (CORBA::Short )
02239 {
02240 CORBA::PolicyList *client_exposed_policies = 0;
02241 ACE_NEW_THROW_EX (client_exposed_policies,
02242 CORBA::PolicyList (),
02243 CORBA::NO_MEMORY (TAO::VMCID,
02244 CORBA::COMPLETED_NO));
02245
02246 CORBA::PolicyList_var policies = client_exposed_policies;
02247
02248
02249 this->policies_.add_client_exposed_fixed_policies (client_exposed_policies);
02250
02251 return policies._retn ();
02252 }
02253
02254 TAO_SERVANT_LOCATION
02255 TAO_Root_POA::locate_servant_i (const PortableServer::ObjectId &system_id,
02256 PortableServer::Servant &servant)
02257 {
02258 return this->active_policy_strategies_.request_processing_strategy()->
02259 locate_servant (system_id, servant);
02260 }
02261
02262 TAO_SERVANT_LOCATION
02263 TAO_Root_POA::servant_present (const PortableServer::ObjectId &system_id,
02264 PortableServer::Servant &servant)
02265 {
02266 return this->active_policy_strategies_.servant_retention_strategy()->
02267 servant_present (system_id, servant);
02268 }
02269
02270 PortableServer::Servant
02271 TAO_Root_POA::find_servant (
02272 const PortableServer::ObjectId &system_id,
02273 TAO::Portable_Server::Servant_Upcall &servant_upcall,
02274 TAO::Portable_Server::POA_Current_Impl &poa_current_impl)
02275 {
02276 return this->active_policy_strategies_.servant_retention_strategy()->
02277 find_servant (system_id,
02278 servant_upcall,
02279 poa_current_impl);
02280 }
02281
02282 int
02283 TAO_Root_POA::find_servant_priority (
02284 const PortableServer::ObjectId &system_id,
02285 CORBA::Short &priority)
02286 {
02287 return this->active_policy_strategies_.servant_retention_strategy()->
02288 find_servant_priority (system_id, priority);
02289 }
02290
02291 TAO::ORT_Adapter_Factory *
02292 TAO_Root_POA::ORT_adapter_factory (void)
02293 {
02294 return ACE_Dynamic_Service<TAO::ORT_Adapter_Factory>::instance
02295 (orb_core_.configuration (),
02296 TAO_Root_POA::ort_adapter_factory_name ());
02297 }
02298
02299 TAO::ORT_Adapter *
02300 TAO_Root_POA::ORT_adapter_i (void)
02301 {
02302 if (this->ort_adapter_ != 0)
02303 return this->ort_adapter_;
02304
02305 try
02306 {
02307 TAO::ORT_Adapter_Factory * ort_ap_factory = this->ORT_adapter_factory ();
02308
02309 if (!ort_ap_factory)
02310 return 0;
02311
02312
02313
02314
02315 PortableInterceptor::AdapterName *adapter_name = this->adapter_name_i ();
02316
02317 this->ort_adapter_ = ort_ap_factory->create ();
02318
02319 if (!this->ort_adapter_)
02320 return 0;
02321
02322
02323
02324
02325
02326 this->ort_adapter_->activate (this->orb_core_.server_id (),
02327 this->orb_core_.orbid (),
02328 adapter_name,
02329 this);
02330 }
02331 catch (const ::CORBA::Exception& ex)
02332 {
02333 ex._tao_print_exception (
02334 "(%P|%t) Cannot initialize the "
02335 "object_reference_template_adapter\n");
02336 }
02337
02338 return this->ort_adapter_;
02339 }
02340
02341 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
02342
02343 PortableServer::AdapterActivator_ptr
02344 TAO_Root_POA::the_activator (void)
02345 {
02346
02347 TAO_POA_GUARD_RETURN (PortableServer::AdapterActivator::_nil ());
02348
02349 return PortableServer::AdapterActivator::_duplicate (this->adapter_activator_.in ());
02350 }
02351
02352 void
02353 TAO_Root_POA::the_activator (PortableServer::AdapterActivator_ptr adapter_activator)
02354 {
02355
02356 TAO_POA_GUARD;
02357
02358 this->adapter_activator_ = PortableServer::AdapterActivator::_duplicate (adapter_activator);
02359 }
02360
02361 #endif
02362
02363 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
02364
02365 PortableServer::ServantManager_ptr
02366 TAO_Root_POA::get_servant_manager (void)
02367 {
02368
02369 TAO_POA_GUARD_RETURN (PortableServer::ServantManager::_nil ());
02370
02371 return this->active_policy_strategies_.request_processing_strategy()->
02372 get_servant_manager ();
02373 }
02374
02375 void
02376 TAO_Root_POA::set_servant_manager (PortableServer::ServantManager_ptr imgr)
02377 {
02378
02379 TAO_POA_GUARD;
02380
02381 this->active_policy_strategies_.request_processing_strategy()->
02382 set_servant_manager (imgr);
02383 }
02384
02385 PortableServer::Servant
02386 TAO_Root_POA::get_servant_i (void)
02387 {
02388 return this->active_policy_strategies_.request_processing_strategy()->
02389 get_servant ();
02390 }
02391
02392 PortableServer::Servant
02393 TAO_Root_POA::get_servant (void)
02394 {
02395
02396 TAO_POA_GUARD_RETURN (0);
02397
02398 PortableServer::Servant servant = this->get_servant_i ();
02399
02400 if (servant != 0)
02401 {
02402
02403 TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*this);
02404 ACE_UNUSED_ARG (non_servant_upcall);
02405
02406
02407
02408
02409
02410
02411
02412
02413 servant->_add_ref ();
02414
02415 return servant;
02416 }
02417 else
02418 {
02419
02420
02421 throw PortableServer::POA::NoServant ();
02422 }
02423 }
02424
02425 void
02426 TAO_Root_POA::set_servant (PortableServer::Servant servant)
02427 {
02428
02429 TAO_POA_GUARD;
02430
02431 this->active_policy_strategies_.request_processing_strategy()->
02432 set_servant (servant);
02433 }
02434
02435 #endif
02436
02437 bool
02438 TAO_Root_POA::is_servant_activation_allowed (PortableServer::Servant servant,
02439 bool &wait_occurred_restart_call)
02440 {
02441 return this->active_policy_strategies_.id_uniqueness_strategy ()->
02442 is_servant_activation_allowed (servant, wait_occurred_restart_call);
02443 }
02444
02445 bool
02446 TAO_Root_POA::has_system_id (void) const
02447 {
02448 return this->active_policy_strategies_.id_assignment_strategy ()->
02449 has_system_id ();
02450 }
02451
02452 int
02453 TAO_Root_POA::rebind_using_user_id_and_system_id (
02454 PortableServer::Servant servant,
02455 const PortableServer::ObjectId &user_id,
02456 const PortableServer::ObjectId &system_id,
02457 TAO::Portable_Server::Servant_Upcall &servant_upcall)
02458 {
02459 return this->active_policy_strategies_.servant_retention_strategy ()->
02460 rebind_using_user_id_and_system_id (servant,
02461 user_id,
02462 system_id,
02463 servant_upcall);
02464 }
02465
02466 CORBA::Boolean
02467 TAO_Root_POA::servant_has_remaining_activations (PortableServer::Servant servant)
02468 {
02469 return this->active_policy_strategies_.servant_retention_strategy ()->
02470 servant_has_remaining_activations (servant);
02471 }
02472
02473 bool
02474 TAO_Root_POA::allow_implicit_activation (void) const
02475 {
02476 return this->active_policy_strategies_.implicit_activation_strategy ()->
02477 allow_implicit_activation ();
02478 }
02479
02480 bool
02481 TAO_Root_POA::allow_multiple_activations (void) const
02482 {
02483 return this->active_policy_strategies_.id_uniqueness_strategy ()->
02484 allow_multiple_activations ();
02485 }
02486
02487 void
02488 TAO_Root_POA::post_invoke_servant_cleanup(
02489 const PortableServer::ObjectId &system_id,
02490 const TAO::Portable_Server::Servant_Upcall &servant_upcall)
02491 {
02492 this->active_policy_strategies_.request_processing_strategy ()->
02493 post_invoke_servant_cleanup (system_id, servant_upcall);
02494 }
02495
02496 CORBA::Short
02497 TAO_Root_POA::server_priority (void) const
02498 {
02499 return this->cached_policies_.server_priority ();
02500 }
02501
02502 int
02503 TAO_Root_POA::is_servant_active (
02504 PortableServer::Servant servant,
02505 bool &wait_occurred_restart_call)
02506 {
02507 return this->active_policy_strategies_.servant_retention_strategy ()->
02508 is_servant_in_map (servant, wait_occurred_restart_call);
02509 }
02510
02511 TAO::Portable_Server::Cached_Policies&
02512 TAO_Root_POA::cached_policies (void)
02513 {
02514 return this->cached_policies_;
02515 }
02516
02517 TAO_Network_Priority_Hook*
02518 TAO_Root_POA::network_priority_hook (void)
02519 {
02520 return this->network_priority_hook_;
02521 }
02522
02523 TAO::Portable_Server::Cached_Policies::PriorityModel
02524 TAO_Root_POA::priority_model (void) const
02525 {
02526 return cached_policies_.priority_model ();
02527 }
02528
02529 #if (TAO_HAS_MINIMUM_POA == 0)
02530 int
02531 TAO_Root_POA::enter ()
02532 {
02533 return this->active_policy_strategies_.thread_strategy ()->enter();
02534 }
02535 #endif
02536
02537 #if (TAO_HAS_MINIMUM_POA == 0)
02538 int
02539 TAO_Root_POA::exit ()
02540 {
02541 return this->active_policy_strategies_.thread_strategy ()->exit();
02542 }
02543 #endif
02544
02545 bool
02546 TAO_Root_POA::validate_lifespan (
02547 CORBA::Boolean is_persistent,
02548 const TAO::Portable_Server::Temporary_Creation_Time& creation_time) const
02549 {
02550 return this->active_policy_strategies_.lifespan_strategy()->
02551 validate (is_persistent, creation_time);
02552 }
02553
02554 CORBA::Boolean
02555 TAO_Root_POA::root (void) const
02556 {
02557 return true;
02558 }
02559
02560 TAO::ORT_Adapter *
02561 TAO_Root_POA::ORT_adapter (void)
02562 {
02563 if (this->ort_adapter_ != 0)
02564 return this->ort_adapter_;
02565
02566
02567 TAO_POA_GUARD_RETURN (0);
02568
02569
02570 if (this->ort_adapter_ != 0)
02571 {
02572 return this->ort_adapter_;
02573 }
02574
02575 return this->ORT_adapter_i ();
02576 }
02577
02578 CORBA::Policy *
02579 TAO_Root_POA::server_protocol (void)
02580 {
02581 return 0;
02582 }
02583
02584 void
02585 TAO_Root_POA::Key_To_Object_Params::set (PortableServer::ObjectId_var &system_id,
02586 const char *type_id,
02587 TAO_ServantBase *servant,
02588 CORBA::Boolean collocated,
02589 CORBA::Short priority,
02590 bool indirect)
02591 {
02592 this->system_id_ = &system_id;
02593 this->type_id_ = type_id;
02594 this->servant_ = servant;
02595 this->collocated_ = collocated;
02596 this->priority_ = priority;
02597 this->indirect_ = indirect;
02598 }
02599
02600 CORBA::ULong
02601 TAO_Root_POA::waiting_servant_deactivation (void) const
02602 {
02603 return this->active_policy_strategies_.servant_retention_strategy ()->
02604 waiting_servant_deactivation ();
02605 }
02606
02607 void
02608 TAO_Root_POA::ort_adapter_factory_name (const char *name)
02609 {
02610 TAO_POA_Static_Resources::instance ()->ort_adapter_factory_name_ =
02611 name;
02612 }
02613
02614 CORBA::Policy_ptr
02615 TAO_Root_POA::get_policy (CORBA::PolicyType policy)
02616 {
02617 return this->policies_.get_policy (policy);
02618 }
02619
02620 void
02621 TAO_Root_POA::check_state (void)
02622 {
02623 this->active_policy_strategies_.lifespan_strategy ()->check_state ();
02624 }
02625
02626 const char *
02627 TAO_Root_POA::ort_adapter_factory_name (void)
02628 {
02629 return TAO_POA_Static_Resources::instance ()->ort_adapter_factory_name_.c_str();
02630 }
02631
02632 void
02633 TAO_Root_POA::imr_client_adapter_name (const char *name)
02634 {
02635 TAO_POA_Static_Resources::instance ()->imr_client_adapter_name_ = name;
02636 }
02637
02638 const char *
02639 TAO_Root_POA::imr_client_adapter_name (void)
02640 {
02641 return TAO_POA_Static_Resources::instance ()->imr_client_adapter_name_.c_str();
02642 }
02643
02644 PortableServer::POAManager_ptr
02645 TAO_Root_POA::the_POAManager (void)
02646 {
02647 return PortableServer::POAManager::_duplicate (&this->poa_manager_);
02648 }
02649
02650 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
02651 PortableServer::POAManagerFactory_ptr
02652 TAO_Root_POA::the_POAManagerFactory (void)
02653 {
02654 return PortableServer::POAManagerFactory::_duplicate (&this->poa_manager_factory_);
02655 }
02656 #endif
02657
02658 CORBA::ORB_ptr
02659 TAO_Root_POA::_get_orb (void)
02660 {
02661 return CORBA::ORB::_duplicate (this->orb_core_.orb ());
02662 }
02663
02664
02665
02666
02667 TAO_POA_Static_Resources* TAO_POA_Static_Resources::instance_ = 0;
02668
02669
02670
02671
02672 TAO_POA_Static_Resources* TAO_POA_Static_Resources::initialization_reference_ =
02673 TAO_POA_Static_Resources::instance ();
02674
02675 void
02676 TAO_POA_Static_Resources::fini (void)
02677 {
02678 delete TAO_POA_Static_Resources::instance_;
02679 TAO_POA_Static_Resources::instance_ = 0;
02680 }
02681
02682 TAO_POA_Static_Resources*
02683 TAO_POA_Static_Resources::instance (void)
02684 {
02685 if (TAO_POA_Static_Resources::instance_ == 0)
02686 {
02687
02688
02689
02690
02691
02692 ACE_NEW_RETURN (TAO_POA_Static_Resources::instance_,
02693 TAO_POA_Static_Resources (),
02694 0);
02695 }
02696
02697 return TAO_POA_Static_Resources::instance_;
02698 }
02699
02700 TAO_POA_Static_Resources::TAO_POA_Static_Resources (void)
02701 : ort_adapter_factory_name_ ("ORT_Adapter_Factory"),
02702 imr_client_adapter_name_ ("ImR_Client_Adapter")
02703 {
02704 }
02705
02706 void
02707 TAO_Root_POA::poa_activated_hook ()
02708 {
02709 }
02710
02711 void
02712 TAO_Root_POA::poa_deactivated_hook ()
02713 {
02714 }
02715
02716 void
02717 TAO_Root_POA::servant_activated_hook (PortableServer::Servant,
02718 const PortableServer::ObjectId&)
02719 {
02720 }
02721
02722 void
02723 TAO_Root_POA::servant_deactivated_hook (PortableServer::Servant,
02724 const PortableServer::ObjectId&)
02725 {
02726 }
02727
02728 TAO_END_VERSIONED_NAMESPACE_DECL