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