00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file ORB_Core.h 00006 * 00007 * $Id: ORB_Core.h 79366 2007-08-16 16:34:50Z mesnier_p $ 00008 * 00009 * @author DOC Center - Washington University at St. Louis 00010 * @author DOC Laboratory - University of California at Irvine 00011 */ 00012 // =================================================================== 00013 00014 #ifndef TAO_ORB_CORE_H 00015 #define TAO_ORB_CORE_H 00016 00017 #include /**/ "ace/pre.h" 00018 00019 #include "tao/Resource_Factory.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #include "tao/Collocation_Strategy.h" 00026 #include "tao/params.h" 00027 #include "tao/ORB_Constants.h" 00028 #include "tao/Parser_Registry.h" 00029 #include "tao/Service_Callbacks.h" 00030 #include "tao/Fault_Tolerance_Service.h" 00031 #include "tao/Cleanup_Func_Registry.h" 00032 #include "tao/Object_Ref_Table.h" 00033 #include "tao/ObjectKey_Table.h" 00034 #include "tao/Messaging_SyncScopeC.h" 00035 #include "tao/Object.h" 00036 #include "tao/Invocation_Utils.h" 00037 #include "tao/Adapter_Registry.h" 00038 #include "tao/ORB_Core_TSS_Resources.h" 00039 #include "ace/Array_Map.h" 00040 00041 #include "ace/Thread_Manager.h" 00042 #include "ace/Lock_Adapter_T.h" 00043 #include "ace/TSS_T.h" 00044 00045 #include "ace/Service_Object.h" 00046 00047 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00048 class ACE_Data_Block; 00049 ACE_END_VERSIONED_NAMESPACE_DECL 00050 00051 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00052 00053 #if TAO_HAS_INTERCEPTORS == 1 00054 00055 namespace TAO 00056 { 00057 class ClientRequestInterceptor_Adapter; 00058 class ServerRequestInterceptor_Adapter; 00059 } 00060 00061 #endif /* TAO_HAS_INTERCEPTORS == 1 */ 00062 00063 class TAO_Adapter; 00064 class TAO_Acceptor; 00065 class TAO_Connector; 00066 class TAO_Connector_Registry; 00067 00068 class TAO_Resource_Factory; 00069 class TAO_Client_Strategy_Factory; 00070 class TAO_Server_Strategy_Factory; 00071 00072 class TAO_TSS_Resources; 00073 class TAO_Leader_Follower; 00074 class TAO_LF_Strategy; 00075 class TAO_RT_ORB; 00076 class TAO_MProfile; 00077 class TAO_Profile; 00078 00079 class TAO_Endpoint_Selector_Factory; 00080 class TAO_Message_State_Factory; 00081 class TAO_Protocols_Hooks; 00082 class TAO_Network_Priority_Protocols_Hooks; 00083 class TAO_BiDir_Adapter; 00084 00085 class TAO_Flushing_Strategy; 00086 00087 class TAO_Thread_Lane_Resources_Manager; 00088 class TAO_Collocation_Resolver; 00089 class TAO_Thread_Lane_Resources; 00090 class TAO_Stub_Factory; 00091 class TAO_Endpoint_Selector_Factory; 00092 class TAO_Service_Context; 00093 class TAO_Request_Dispatcher; 00094 class TAO_Policy_Set; 00095 class TAO_Policy_Manager; 00096 class TAO_Policy_Current; 00097 00098 class TAO_Codeset_Manager; 00099 class TAO_IORInterceptor_Adapter; 00100 class TAO_Valuetype_Adapter; 00101 00102 class TAO_Policy_Validator; 00103 00104 namespace TAO 00105 { 00106 class GUIResource_Factory; 00107 class PolicyFactory_Registry_Adapter; 00108 class ORBInitializer_Registry_Adapter; 00109 class Transport_Queueing_Strategy; 00110 } 00111 00112 namespace CORBA 00113 { 00114 class ORB_ObjectIdList; // CORBA::ORB::ObjectIdList 00115 class ORB; 00116 typedef ORB *ORB_ptr; 00117 00118 class PolicyList; 00119 } 00120 00121 namespace IOP 00122 { 00123 class ServiceContextList; 00124 } 00125 00126 namespace PortableInterceptor 00127 { 00128 class IORInterceptor; 00129 typedef IORInterceptor *IORInterceptor_ptr; 00130 00131 #if TAO_HAS_INTERCEPTORS == 1 00132 00133 class ClientRequestInterceptor; 00134 typedef ClientRequestInterceptor *ClientRequestInterceptor_ptr; 00135 00136 class ServerRequestInterceptor; 00137 typedef ServerRequestInterceptor *ServerRequestInterceptor_ptr; 00138 00139 #endif /* TAO_HAS_INTERCEPTORS == 1 */ 00140 } 00141 00142 // **************************************************************** 00143 /** 00144 * @class TAO_ORB_Core 00145 * 00146 * @brief Encapsulates the state of an ORB. 00147 * 00148 * This is the implementation class for the CORBA::ORB interface. The 00149 * class also encapsulates the access to the ORB resources and its 00150 * state. 00151 * @par 00152 * Some resources can be TSS or global, those resources are always 00153 * accessed through a TSS interface, but are allocated using the 00154 * Resource_Factory. If the resource is really global the 00155 * Resource_Factory will simply return a pointer to the global 00156 * instance. 00157 */ 00158 class TAO_Export TAO_ORB_Core 00159 { 00160 friend class TAO_ORB_Core_Auto_Ptr; 00161 friend CORBA::ORB_ptr CORBA::ORB_init (int &, 00162 char *argv[], 00163 const char *); 00164 public: 00165 00166 /// Constructor. 00167 TAO_ORB_Core (const char* id, ACE_Service_Gestalt* g); 00168 00169 /// Accessor for the ORB parameters. 00170 TAO_ORB_Parameters *orb_params (void); 00171 00172 /** 00173 * @todo 00174 * In the future this hook should change, instead of hardcoding the 00175 * object we should add a "Resolver" to the ORB, so the "POACurrent" 00176 * object returns a per-ORB object. 00177 * @par 00178 * Similarly, each ORB should implement the TSS pattern to put the 00179 * POA_Current_Impl in a void* slot. The current approach *does* 00180 * decouple the POA from the ORB, but it cannot add new adapters or 00181 * other components transparently. 00182 */ 00183 /// Accessor to the POA current. 00184 //@{ 00185 CORBA::Object_ptr poa_current(void); 00186 //@} 00187 00188 /// Get the connector registry 00189 TAO_Connector_Registry *connector_registry (void); 00190 00191 /// Get the IOR parser registry 00192 TAO_Parser_Registry *parser_registry (void); 00193 00194 /// Return pointer to the policy factory registry associated with 00195 /// this ORB core. 00196 TAO::PolicyFactory_Registry_Adapter *policy_factory_registry (void); 00197 00198 /// Return pointer to the orb initializer registry associated with 00199 /// this ORB core. Tries to load the PI library if it is not loaded 00200 /// yet 00201 TAO::ORBInitializer_Registry_Adapter *orbinitializer_registry (void); 00202 00203 /// Get the protocol factories 00204 TAO_ProtocolFactorySet *protocol_factories (void); 00205 00206 /// Get pointer to the ORB. 00207 CORBA::ORB_ptr orb (void); 00208 00209 /// Wrappers that forward the request to the concurrency strategy. 00210 ACE_Reactor *reactor (void); 00211 00212 /// Get the ACE_Thread_Manager 00213 ACE_Thread_Manager *thr_mgr (void); 00214 00215 /// Return the RootPOA, or try to load it if not initialized already. 00216 CORBA::Object_ptr root_poa (void); 00217 00218 /// Get the adapter registry 00219 TAO_Adapter_Registry *adapter_registry (void); 00220 00221 /// @name Collocation Strategies 00222 //@{ 00223 enum 00224 { 00225 /// Indicate object should refer to ORB for either one of the 00226 /// following strategies. 00227 ORB_CONTROL, 00228 00229 /// Collocated calls will go thru POA. 00230 THRU_POA, 00231 00232 /// Collocated calls invoke operation on Servant directly. 00233 DIRECT 00234 }; 00235 00236 /** 00237 * This method returns the right collocation strategy, if any, 00238 * to be used to perform a method invocation on the given object. 00239 * 00240 * @note 00241 * No-Collocation is a special case of collocation. 00242 */ 00243 static 00244 TAO::Collocation_Strategy collocation_strategy (CORBA::Object_ptr object); 00245 //@} 00246 00247 /// Set/get the collocation flags 00248 //@{ 00249 void optimize_collocation_objects (CORBA::Boolean opt); 00250 CORBA::Boolean optimize_collocation_objects (void) const; 00251 00252 void use_global_collocation (CORBA::Boolean opt); 00253 CORBA::Boolean use_global_collocation (void) const; 00254 00255 CORBA::ULong get_collocation_strategy (void) const; 00256 //@} 00257 00258 /// Get the adapter named "RootPOA" and cache the result, this is an 00259 /// optimization for the POA. 00260 TAO_Adapter *poa_adapter (void); 00261 00262 /** 00263 * @name Access to Factories 00264 * 00265 * These factories are not thread-specific, and are presented here 00266 * in order to have one place to get useful information. Often, the 00267 * instances to which the return pointers are stored in the Service 00268 * Repository. 00269 */ 00270 //@{ 00271 /// Returns pointer to the resource factory. 00272 TAO_Resource_Factory *resource_factory (void); 00273 00274 /// Returns pointer to the factory for creating gui resources 00275 TAO::GUIResource_Factory *gui_resource_factory (void); 00276 00277 /// Returns pointer to the client factory. 00278 TAO_Client_Strategy_Factory *client_factory (void); 00279 00280 /// Returns pointer to the server factory. 00281 TAO_Server_Strategy_Factory *server_factory (void); 00282 00283 /// Returns pointer to the Protocols_Hooks. 00284 TAO_Protocols_Hooks *protocols_hooks (void); 00285 00286 /// Returns a pointer to the Thread Lane Resources Manager. 00287 TAO_Thread_Lane_Resources_Manager &thread_lane_resources_manager (void); 00288 00289 /// Returns a pointer to the Collocation Resolver. 00290 TAO_Collocation_Resolver &collocation_resolver (void); 00291 00292 /// Returns a pointer to the Stub factory. 00293 TAO_Stub_Factory *stub_factory (void); 00294 00295 /// Returns a pointer to the endpoint selector factory. 00296 TAO_Endpoint_Selector_Factory *endpoint_selector_factory (void); 00297 00298 //@} 00299 00300 /// Sets the value of TAO_ORB_Core::resource_factory_ 00301 static void set_resource_factory (const char *resource_factory_name); 00302 00303 /** Sets the value of TAO_ORB_Core::gui_resource_factory_. 00304 * 00305 * Sets the value of gui_resource_factory in TSS. ORB_Core is responsible 00306 * for releasing this factory if needed. 00307 */ 00308 static void set_gui_resource_factory (TAO::GUIResource_Factory *gui_factory); 00309 00310 /// Sets the value of TAO_ORB_Core::network_priority_protocols_hooks_ 00311 static void set_network_priority_protocols_hooks ( 00312 const char *network_priority_protocols_hooks_name); 00313 00314 /// Gets the value of TAO_ORB_Core::protocols_hooks__ 00315 TAO_Protocols_Hooks * get_protocols_hooks (void); 00316 00317 /// Gets the value of TAO_ORB_Core::network_priority_protocols_hooks__ 00318 TAO_Network_Priority_Protocols_Hooks * 00319 get_network_priority_protocols_hooks (void); 00320 00321 /// Sets the value of TAO_ORB_Core::dynamic_adapter_name_. 00322 static void dynamic_adapter_name (const char *name); 00323 00324 /// Gets the value of TAO_ORB_Core::dynamic_adapter_name_. 00325 static const char *dynamic_adapter_name (void); 00326 00327 /// Sets the value of TAO_ORB_Core::ifr_client_adapter_name_. 00328 static void ifr_client_adapter_name (const char *name); 00329 00330 /// Gets the value of TAO_ORB_Core::ifr_client_adapter_name_. 00331 static const char *ifr_client_adapter_name (void); 00332 00333 /// Sets the value of TAO_ORB_Core::typecodefactory_adapter_name_. 00334 static void typecodefactory_adapter_name (const char *name); 00335 00336 /// Gets the value of TAO_ORB_Core::typecodefactory_adapter_name_. 00337 static const char *typecodefactory_adapter_name (void); 00338 00339 /// Sets the value of TAO_ORB_Core::iorinterceptor_adapter_factory_name_. 00340 static void iorinterceptor_adapter_factory_name (const char *name); 00341 00342 /// Gets the value of TAO_ORB_Core::iorinterceptor_adapter_factory_name_. 00343 static const char *iorinterceptor_adapter_factory_name (void); 00344 00345 /// Sets the value of TAO_ORB_Core::valuetype_adapter_factory_name. 00346 static void valuetype_adapter_factory_name (const char *name); 00347 00348 /// Gets the value of TAO_ORB_Core::valuetype_adapter_factory_name. 00349 static const char *valuetype_adapter_factory_name (void); 00350 00351 /// See if we have a collocated address, if yes, return the POA 00352 /// associated with the address. 00353 int is_collocated (const TAO_MProfile& mprofile); 00354 00355 /// This allocator is always TSS and has no locks. It is intended 00356 /// for allocating the ACE_Data_Blocks used in *outgoing* CDR 00357 /// streams. 00358 ACE_Allocator *output_cdr_dblock_allocator (void); 00359 00360 /// This allocator is always TSS and has no locks. It is intended 00361 /// for allocating the buffers used in *outgoing* CDR streams. 00362 ACE_Allocator *output_cdr_buffer_allocator (void); 00363 00364 /// This allocator is always TSS and has no locks. It is intended 00365 /// for allocating the ACE_Data_Blocks used in *outgoing* CDR 00366 /// streams. 00367 ACE_Allocator *output_cdr_msgblock_allocator (void); 00368 00369 /// This allocator is global, may or may not have locks. It is 00370 /// intended for allocating the ACE_Data_Blocks used in *incoming* 00371 /// CDR streams. 00372 ACE_Allocator *input_cdr_dblock_allocator (void); 00373 00374 /// This allocator is always global and has no locks. It is intended 00375 /// for allocating the buffers used in *incoming* CDR streams. 00376 ACE_Allocator *input_cdr_buffer_allocator (void); 00377 00378 /// This allocator is always global and has no locks. It is intended 00379 /// for allocating the buffers used in *incoming* CDR streams. 00380 ACE_Allocator *input_cdr_msgblock_allocator (void); 00381 00382 /// This allocator is always global and has no locks. It is intended 00383 /// for allocating the buffers used to queue messages in 00384 /// transports. 00385 ACE_Allocator *transport_message_buffer_allocator (void); 00386 00387 /// The Message Blocks used for input CDRs must have appropiate 00388 /// locking strategies. 00389 ACE_Data_Block *create_input_cdr_data_block (size_t size); 00390 00391 /// Return the locking strategy used for the data blocks. 00392 ACE_Lock *locking_strategy (void); 00393 00394 #if (TAO_HAS_CORBA_MESSAGING == 1) 00395 00396 /// Accessor method for the default_policies_ 00397 TAO_Policy_Set *get_default_policies (void); 00398 00399 /// Get a policy. First, check the ORB-level Policy Manager, then 00400 /// check the ORB defaults. 00401 CORBA::Policy_ptr get_policy (CORBA::PolicyType type); 00402 00403 /// Get a policy. First, check the thread current, then check the 00404 /// ORB-level Policy Manager, then check the ORB defaults. 00405 CORBA::Policy_ptr get_policy_including_current (CORBA::PolicyType type); 00406 00407 /// Get a cached policy. First, check the ORB-level Policy Manager, 00408 /// then check the ORB defaults. 00409 CORBA::Policy_ptr get_cached_policy (TAO_Cached_Policy_Type type); 00410 00411 /// Get a cached policy. First, check the thread current, then 00412 /// check the ORB-level Policy Manager, then check the ORB defaults. 00413 CORBA::Policy_ptr get_cached_policy_including_current ( 00414 TAO_Cached_Policy_Type type); 00415 00416 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */ 00417 00418 /** 00419 * The thread has a default environment to simplify porting between 00420 * platforms that support native C++ exceptions and those that 00421 * don't. This is a TSS resource (always), but with a twist: if the 00422 * user creates a new environment the old one is "pushed" (actually 00423 * the new one remembers it), eventually the new environment 00424 * destructor pops itself from the stack and we recover the old 00425 * environment. 00426 * @par 00427 * This means that if the user create a new environment and somebody 00428 * calls a function using the default one the exception will still 00429 * be received in the environment created by the user. 00430 * The only drawback is that environments life time must nest 00431 * properly, this shouldn't be a problem because environments are 00432 * usually created on the stack, but, the spec allows their creation 00433 * on the heap and/or as class members; we need to investigate the 00434 * tradeoffs and take a decision. 00435 */ 00436 //@{ 00437 CORBA::Environment *default_environment (void) const; 00438 void default_environment (CORBA::Environment*); 00439 //@} 00440 00441 #if (TAO_HAS_CORBA_MESSAGING == 1) 00442 00443 /// Return the Policy_Manager for this ORB. 00444 TAO_Policy_Manager *policy_manager (void); 00445 00446 /// Accesors to the policy current, this object should be kept in 00447 /// TSS storage. The POA has to reset the policy current object on 00448 /// every upcall. 00449 TAO_Policy_Current &policy_current (void); 00450 00451 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */ 00452 00453 /// Invoke the timeout hook if present. 00454 /** 00455 * The timeout hook is used to determine if the timeout policy is 00456 * set and with what value. If the ORB is compiled without support 00457 * for Messaging this feature does not take effect 00458 * \param has_timeout returns 0 if there is no timeout policy set. 00459 * \param time_value returns the timeout value in effect for the object, 00460 * thread and current ORB. 00461 */ 00462 void call_timeout_hook (TAO_Stub *stub, 00463 bool &has_timeout, 00464 ACE_Time_Value &time_value); 00465 00466 /// Define the Timeout_Hook signature 00467 typedef void (*Timeout_Hook) (TAO_ORB_Core *, 00468 TAO_Stub *, 00469 bool&, 00470 ACE_Time_Value&); 00471 00472 void set_timeout_hook (Timeout_Hook hook); 00473 00474 /// Invoke the timeout hook if present. 00475 /** 00476 * The timeout hook is used to determine if the timeout policy is 00477 * set and with what value. If the ORB is compiled without support 00478 * for Messaging this feature does not take effect 00479 * \param has_timeout returns 0 if there is no timeout policy set. 00480 * \param time_value returns the timeout value in effect for the object, 00481 * thread and current ORB. 00482 */ 00483 void connection_timeout (TAO_Stub *stub, 00484 bool &has_timeout, 00485 ACE_Time_Value &time_value); 00486 00487 /// Define the Timeout_Hook signature 00488 /** 00489 * The connection timeout hook was originally defined to allow the 00490 * TAO Messaging code to be factored out of the core TAO library and 00491 * placed in to an optional library. Since then, a new invocation 00492 * endpoint selector, the optimised connection endpoint selector 00493 * (see Strategies/OC_Endpoint_Selector.h) reused this connection 00494 * timeout hook. However, this set up a problem when both the 00495 * Messaging library and OCES are being used in the same 00496 * application. 00497 * 00498 * The solution was to add a new connection timeout hook attribute 00499 * (see alt_connection_timeout_hook_ below). This method now checks 00500 * to see if the connection timeout hook is already set, and if so 00501 * assigns the supplied hook value to the alternate connection 00502 * timeout hook. This functionality has a side-effect of assuming 00503 * that hooks are NEVER unloaded or actively replaced. IOW, no one 00504 * will call this method with a 0 or some other pointer value to 00505 * replace an existing hook. 00506 * 00507 * If such functionality as unloading a hook pointer is required, 00508 * then this method must be extended to give some kind of identity 00509 * for the hook. Additional changes to the definition of the hook 00510 * will also be necessary to support such identity and manipulation. 00511 */ 00512 static void connection_timeout_hook (Timeout_Hook hook); 00513 00514 void call_sync_scope_hook (TAO_Stub *stub, 00515 bool &has_synchronization, 00516 Messaging::SyncScope &scope); 00517 00518 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1) 00519 00520 TAO::Transport_Queueing_Strategy *get_transport_queueing_strategy ( 00521 TAO_Stub *stub, 00522 Messaging::SyncScope &scope); 00523 00524 #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */ 00525 00526 typedef void (*Sync_Scope_Hook) (TAO_ORB_Core *, 00527 TAO_Stub *, 00528 bool &, 00529 Messaging::SyncScope &); 00530 00531 void set_sync_scope_hook (Sync_Scope_Hook hook); 00532 00533 /// Handle to the factory for protocols_hooks_.. 00534 TAO_Protocols_Hooks *protocols_hooks_; 00535 00536 /// Handle to the factory for network_priority_protocols_hooks_.. 00537 TAO_Network_Priority_Protocols_Hooks *network_priority_protocols_hooks_; 00538 00539 /// Obtain the TSS resources of this orb. 00540 TAO_ORB_Core_TSS_Resources* get_tss_resources (void); 00541 00542 /// Obtain the TSS resource in the given slot. 00543 void* get_tss_resource (size_t slot_id); 00544 00545 /// Set the TSS resource at the given slot. 00546 /// Returns 0 on success, and -1 on failure. 00547 int set_tss_resource (size_t slot_id, void *); 00548 00549 /// Register a TSS cleanup function. The slot ID for the 00550 /// corresponding ORB core TSS resource is returned by the reference 00551 /// argument. This method return 0 on success, and -1 on failure. 00552 int add_tss_cleanup_func (ACE_CLEANUP_FUNC cleanup, size_t &slot_id); 00553 00554 /// Return the underlying TSS cleanup function registry. 00555 TAO_Cleanup_Func_Registry *tss_cleanup_funcs (void); 00556 00557 /// Get access to the leader_follower class. 00558 TAO_Leader_Follower &leader_follower (void); 00559 00560 /// Get access to the leader follower strategy. 00561 TAO_LF_Strategy &lf_strategy (void); 00562 00563 /// Get access to the thread lane resources. 00564 TAO_Thread_Lane_Resources &lane_resources (void); 00565 00566 /// Run the event loop. 00567 int run (ACE_Time_Value *tv, int perform_work); 00568 00569 /// End the event loop 00570 void shutdown (CORBA::Boolean wait_for_completion); 00571 00572 /// Get the shutdown flag value 00573 bool has_shutdown (void) const; 00574 00575 /// Shutdown the ORB and free resources 00576 void destroy (void); 00577 00578 /// Check if ORB has shutdown. If it has, throw an exception. 00579 void check_shutdown (void); 00580 00581 /// Returns the <timeout> value used by the server threads to poll 00582 /// the shutdown flag. If the return value is zero then the server 00583 /// threads block forever. 00584 int thread_per_connection_timeout (ACE_Time_Value &timeout) const; 00585 00586 /// Makes sure that the ORB is open and then creates a TAO_Stub 00587 /// based on the endpoint. 00588 TAO_Stub *create_stub_object (TAO_MProfile &mprofile, 00589 const char *type_id, 00590 CORBA::PolicyList *policy_list); 00591 00592 /// Factory method that create the "right" Stub depending on 00593 /// wheather RTCORBA is loaded or not. The factory used to create 00594 /// the stub, is loaded at ORB initialization, and its type depends 00595 /// on the fact that RTCORBA is being used or not. 00596 TAO_Stub *create_stub (const char *repository_id, 00597 const TAO_MProfile &profiles); 00598 00599 /// Create a new object, use the adapter registry to create a 00600 /// collocated object, if not possible then create a regular 00601 /// object. 00602 CORBA::Object_ptr create_object (TAO_Stub *the_stub); 00603 00604 /// Initialize a new object, use the adapter registry to initialize a 00605 /// collocated object, if not possible then initialize a regular 00606 /// object. 00607 /// NOTE: Why would this method be required? The answer is if the 00608 /// user decides to use lazy initialization of CORBA object, then 00609 /// this is the route that we have to take to do the 00610 /// initialization. 00611 CORBA::Long initialize_object (TAO_Stub *the_stub, CORBA::Object_ptr obj); 00612 00613 /// Reinitialise a stub after the effective profile has changed. 00614 /// This will happen after a location forward has been received 00615 /// or if a location forward supplied new target subsequently fails. 00616 CORBA::Long reinitialize_object (TAO_Stub *stub); 00617 00618 /// Return ORBid string. 00619 const char *orbid (void) const; 00620 00621 /// Set/Get the IOR of the Implementation Repository service. 00622 //@{ 00623 CORBA::Object_ptr implrepo_service (void); 00624 void implrepo_service (const CORBA::Object_ptr ir); 00625 //@} 00626 00627 /// Do we attempt to register with the Implementation Repository 00628 CORBA::Boolean use_implrepo (void); 00629 00630 /// Do we put the ImR's endpoints into persistent object references we create 00631 CORBA::Boolean imr_endpoints_in_ior (void); 00632 00633 /// Resolve the TypeCodeFactory DLL. 00634 CORBA::Object_ptr resolve_typecodefactory (void); 00635 00636 #if TAO_HAS_INTERCEPTORS == 1 00637 /// Resolve the PICurrent. 00638 CORBA::Object_ptr resolve_picurrent (void); 00639 #endif /* TAO_HAS_INTERCEPTORS == 1 */ 00640 00641 /// Resolve POA Current. 00642 CORBA::Object_ptr resolve_poa_current (void); 00643 00644 /// Resolve the CodecFactory DLL. 00645 CORBA::Object_ptr resolve_codecfactory (void); 00646 00647 /// Resolve the Compression DLL. 00648 CORBA::Object_ptr resolve_compression_manager (void); 00649 00650 /// Resolve the Dynamic Any Factory 00651 CORBA::Object_ptr resolve_dynanyfactory (void); 00652 00653 /// Resolve the IOR Manipulation reference for this ORB. 00654 CORBA::Object_ptr resolve_ior_manipulation (void); 00655 00656 /// Resolve the IOR Table reference for this ORB. 00657 CORBA::Object_ptr resolve_ior_table (void); 00658 00659 /// Resolve an initial reference via the -ORBInitRef and 00660 // -ORBDefaultInitRef options. 00661 CORBA::Object_ptr resolve_rir (const char *name); 00662 00663 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 00664 /// Resolve the RT ORB reference for this ORB. 00665 CORBA::Object_ptr resolve_rt_orb (void); 00666 #endif 00667 00668 /// Resolve the RT Current flyweight for this ORB. 00669 /// Return server_id string. 00670 const char *server_id (void) const; 00671 00672 /// List all the service known by the ORB 00673 CORBA::ORB_ObjectIdList *list_initial_references (void); 00674 00675 /// Reference counting... 00676 unsigned long _incr_refcnt (void); 00677 unsigned long _decr_refcnt (void); 00678 00679 /// Register the handle of an open connection with the ORB Core 00680 /// handle set. This handle set will be used to explicitly remove 00681 /// corresponding event handlers from the reactor. 00682 int register_handle (ACE_HANDLE handle); 00683 00684 /// Remove <handle> from the ORB Core's handle set so that it 00685 /// isn't included in the set that is passed to the reactor upon ORB 00686 /// destruction. 00687 int remove_handle (ACE_HANDLE handle); 00688 00689 /** 00690 * @name ORB Core Service Hooks 00691 * 00692 * These methods would represent the hooks in the ORB Core. These 00693 * hooks would be used to call back on the services or other 00694 * features that are dynamically loaded. 00695 */ 00696 //@{ 00697 /** 00698 * The loaded service in the ORB_Core would determine if the profile 00699 * selection is going to be made by the services or not. If the 00700 * services do make the selection they would return the selected 00701 * profile through <profile>. 00702 */ 00703 CORBA::Boolean service_profile_selection (const TAO_MProfile &mprofile, 00704 TAO_Profile *&profile); 00705 00706 /** 00707 * The loaded service would determine if the CORBA::Object_ptr is 00708 * actually nil or not. This would be useful to accomodate new 00709 * enhanced definitions as defined by the service specification. 00710 */ 00711 CORBA::Boolean object_is_nil (CORBA::Object_ptr object); 00712 00713 /// Hook for the services to determine whether the profiles are 00714 /// equivalent or not. 00715 /** 00716 * For details on how this is used please see the FT service 00717 */ 00718 TAO_Service_Callbacks::Profile_Equivalence is_profile_equivalent ( 00719 const TAO_Profile *this_p, 00720 const TAO_Profile *that_p); 00721 00722 /// Hook for the services to determine the <hash> value of a 00723 /// profile. 00724 /** 00725 * For details on how this is used please see the FT service 00726 */ 00727 CORBA::ULong hash_service (TAO_Profile *this_p, CORBA::ULong max); 00728 00729 /// Call the service layers with the Service Context to check 00730 /// whether they would like to add something to the list. 00731 void service_context_list (TAO_Stub *stub, 00732 TAO_Service_Context &service_context, 00733 CORBA::Boolean retstart); 00734 00735 /// Return a reference to the Fault Tolerant service object. 00736 TAO_Fault_Tolerance_Service &fault_tolerance_service (void); 00737 00738 /// Raise a comm failure exception if a service is not loaded, else 00739 /// delegate to the service to see what the service has to do for 00740 /// this case. 00741 TAO::Invocation_Status service_raise_comm_failure ( 00742 IOP::ServiceContextList &clist, 00743 TAO_Profile *profile); 00744 00745 /// Raise a transient failure exception if a service is not loaded, 00746 /// else delegate to the service to see what the service has to do 00747 /// for this case. 00748 TAO::Invocation_Status service_raise_transient_failure ( 00749 IOP::ServiceContextList &clist, 00750 TAO_Profile *profile); 00751 00752 //@} 00753 00754 /** 00755 * @name Portable Interceptor Related Methods 00756 * 00757 * These are support methods for interceptor registration and 00758 * interceptor set (an array) access, in addition to PICurrent 00759 * access. 00760 */ 00761 //@{ 00762 #if TAO_HAS_INTERCEPTORS == 1 00763 00764 /// Return a pointer to the cached TAO::PICurrent object. 00765 CORBA::Object_ptr pi_current (void); 00766 00767 /// Set the pointer to the cached TAO::PICurrent object. 00768 void pi_current (CORBA::Object_ptr current); 00769 00770 /// Register a client request interceptor. 00771 void add_interceptor ( 00772 PortableInterceptor::ClientRequestInterceptor_ptr interceptor); 00773 00774 /// Register a server request interceptor. 00775 void add_interceptor ( 00776 PortableInterceptor::ServerRequestInterceptor_ptr interceptor); 00777 00778 /// Register a client request interceptor with policies. 00779 void add_interceptor ( 00780 PortableInterceptor::ClientRequestInterceptor_ptr interceptor, 00781 const CORBA::PolicyList& policies); 00782 00783 /// Register a server request interceptor with policies. 00784 void add_interceptor ( 00785 PortableInterceptor::ServerRequestInterceptor_ptr interceptor, 00786 const CORBA::PolicyList& policies); 00787 00788 /// Get the Client Request Interceptor adapter. 00789 /// Will not create a new one if not available yet. 00790 TAO::ClientRequestInterceptor_Adapter *clientrequestinterceptor_adapter (void); 00791 00792 /// Get the Server Request Interceptor adapter. 00793 /// Will not create a new one if not available yet. 00794 TAO::ServerRequestInterceptor_Adapter *serverrequestinterceptor_adapter (void); 00795 00796 #endif /* TAO_HAS_INTERCEPTORS */ 00797 00798 /// Register an IOR interceptor. 00799 void add_interceptor (PortableInterceptor::IORInterceptor_ptr interceptor); 00800 //@} 00801 00802 /// Return the valuetype adapter 00803 TAO_Valuetype_Adapter *valuetype_adapter (void); 00804 00805 /// Get the IOR Interceptor adapter. If not created, this method will try 00806 /// to create one. 00807 TAO_IORInterceptor_Adapter *ior_interceptor_adapter (void); 00808 00809 /// Set and Get methods to indicate whether a BiDir IIOP policy has 00810 /// been set in the POA. 00811 /// @note At present, the value will be true even if one of the POA's 00812 /// is set with the Bi Dir GIOP policy. 00813 CORBA::Boolean bidir_giop_policy (void); 00814 void bidir_giop_policy (CORBA::Boolean); 00815 00816 /// Return the table that maps object key/name to de-stringified 00817 /// object reference. It is needed for supporting local objects in 00818 /// the resolve_initial_references() mechanism. 00819 TAO_Object_Ref_Table &object_ref_table (void); 00820 00821 /// Acceessor to the table that stores the object_keys. 00822 TAO::ObjectKey_Table &object_key_table (void); 00823 00824 /// Return the current request dispatcher strategy. 00825 TAO_Request_Dispatcher *request_dispatcher (void); 00826 00827 /// Set a new request dispatcher. The ORB Core retains ownership 00828 /// of the request dispatcher once it gets it. Currently, this only 00829 /// gets called at initialization. 00830 void request_dispatcher (TAO_Request_Dispatcher *rd); 00831 00832 /// Call the libraries to handover the validators if they havent 00833 /// registered yet with the list of validators. 00834 void load_policy_validators (TAO_Policy_Validator &validator); 00835 00836 /// Return the flushing strategy 00837 /** 00838 * The flushing strategy is created by the resource factory, and it 00839 * is used by the ORB to control the mechanism used to flush the 00840 * outgoing data queues. 00841 * The flushing strategies are stateless, therefore, there is only 00842 * one per ORB. 00843 */ 00844 TAO_Flushing_Strategy *flushing_strategy (void); 00845 00846 /// Get Code Set Manager 00847 TAO_Codeset_Manager *codeset_manager (void); 00848 00849 typedef ACE_Array_Map<ACE_CString, ACE_CString> InitRefMap; 00850 00851 /// Return a pointer to the -ORBInitRef map. 00852 InitRefMap * init_ref_map (void); 00853 00854 /// Set the ORB related to the orb_id as the default ORB and not the 00855 /// ORB that is first binded in the ORB Table 00856 void set_default (const char * orb_id); 00857 00858 /// Choose to be not a default ORB when there is more than one ORB. 00859 void not_default (const char * orb_id); 00860 00861 /// This strategy is the default, no explicit queueing and no explicit 00862 /// flush 00863 TAO::Transport_Queueing_Strategy *default_transport_queueing_strategy (void); 00864 00865 /// Verify condition for permanent forward is given, 00866 /// both parameters must provide group attributes. 00867 CORBA::Boolean is_permanent_forward_condition 00868 (const CORBA::Object_ptr obj, 00869 const TAO_Service_Context &service_context); 00870 00871 /// Configuration accessor method 00872 ACE_Service_Gestalt* configuration () const; 00873 00874 /// Get outgoing fragmentation strategy. 00875 auto_ptr<TAO_GIOP_Fragmentation_Strategy> 00876 fragmentation_strategy (TAO_Transport * transport); 00877 00878 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1) 00879 void set_eager_transport_queueing_strategy ( 00880 TAO::Transport_Queueing_Strategy* strategy); 00881 00882 void set_delayed_transport_queueing_strategy ( 00883 TAO::Transport_Queueing_Strategy* strategy); 00884 #endif 00885 00886 protected: 00887 00888 /// Destructor is protected since the ORB Core is a reference 00889 /// counted object. 00890 ~TAO_ORB_Core (void); 00891 00892 /// Initialize the guts of the ORB Core. It is intended that this be 00893 /// called by <CORBA::ORB_init>. 00894 int init (int &argc, char *argv[]); 00895 00896 /// Final termination hook, typically called by CORBA::ORB's 00897 /// destructor. 00898 int fini (void); 00899 00900 /// Routine that creates a ACE_Data_Block given the lock and allocators. 00901 ACE_Data_Block *create_data_block_i (size_t size, 00902 ACE_Allocator *buffer_allocator, 00903 ACE_Allocator *dblock_allocator, 00904 ACE_Lock *lock); 00905 00906 /// Obtain and cache the typecode factory object reference. 00907 void resolve_typecodefactory_i (void); 00908 00909 /// Obtain and cache the poa current. 00910 void resolve_poa_current_i (void); 00911 00912 #if TAO_HAS_INTERCEPTORS == 1 00913 /// Obtain and cache the picurrent factory object reference. 00914 void resolve_picurrent_i (void); 00915 00916 /// Get the Client Request Interceptor adapter. 00917 /// If not created, this method will try to create one if needed. 00918 TAO::ClientRequestInterceptor_Adapter *clientrequestinterceptor_adapter_i (void); 00919 00920 /// Get the Server Request Interceptor adapter. 00921 /// If not created, this method will try to create one if needed. 00922 TAO::ServerRequestInterceptor_Adapter *serverrequestinterceptor_adapter_i (void); 00923 00924 #endif /* TAO_HAS_INTERCEPTORS */ 00925 00926 /// Obtain and cache the codec factory object reference. 00927 void resolve_codecfactory_i (void); 00928 00929 /// Obtain and cache the compression manager object reference. 00930 void resolve_compression_manager_i (void); 00931 00932 /// Obtain and cache the dynamic any factory object reference. 00933 void resolve_dynanyfactory_i (void); 00934 00935 /// Obtain and cache the IORManipulation factory object reference. 00936 void resolve_iormanipulation_i (void); 00937 00938 /// Search the Dynamic service list for well known services that has 00939 /// callbacks which can be dynamically loaded. 00940 void services_callbacks_init (void); 00941 00942 /// Helper method that invokes Interceptor::destroy() on all 00943 /// registered interceptors when ORB::destroy() is called. Prevents 00944 /// exceptions from propagating up the call chain. 00945 void destroy_interceptors (void); 00946 00947 /// Pointer to the list of protocol loaded into this ORB instance. 00948 /// Helper method to hold the common code part for -ORBEndpoint and 00949 /// -ORBListenEndpoint options. 00950 int set_endpoint_helper (const ACE_CString &lane, 00951 const ACE_CString &endpoints); 00952 00953 /// Return pointer to the policy factory registry associated with 00954 /// this ORB core. 00955 TAO::PolicyFactory_Registry_Adapter *policy_factory_registry_i (void); 00956 00957 /// Return pointer to the orb initializer registry associated with 00958 /// this ORB core. 00959 TAO::ORBInitializer_Registry_Adapter *orbinitializer_registry_i (void); 00960 00961 /// Common code from ::initialize_object and ::reinitialize_object 00962 CORBA::Long initialize_object_i (TAO_Stub *the_stub, 00963 const TAO_MProfile& mprofile); 00964 00965 private: 00966 00967 /// The ORB Core should not be copied. 00968 //@{ 00969 TAO_ORB_Core(const TAO_ORB_Core&); 00970 void operator=(const TAO_ORB_Core&); 00971 //@} 00972 00973 /// Obtain and cache the dynamic any factory object reference. 00974 void resolve_ior_table_i (void); 00975 00976 /// Checks to see whether collocation optimizations have to be 00977 /// applied on objects in the @a other_orb 00978 CORBA::Boolean is_collocation_enabled (TAO_ORB_Core *other_orb, 00979 const TAO_MProfile &mp); 00980 00981 bool use_local_memory_pool_; 00982 00983 protected: 00984 00985 /// Synchronize internal state... 00986 TAO_SYNCH_MUTEX lock_; 00987 00988 TAO_Thread_Lane_Resources_Manager *thread_lane_resources_manager_; 00989 00990 TAO_Collocation_Resolver *collocation_resolver_; 00991 00992 TAO_Stub_Factory *stub_factory_; 00993 00994 TAO_ProtocolFactorySet *protocol_factories_; 00995 00996 /// The cached IOR for the Implementation Repository. 00997 // @@ If this is a _var, where should it get deleted? (brunsch) 00998 CORBA::Object_ptr implrepo_service_; 00999 01000 /// Flag for whether the implrepo support is enabled or not. 01001 int use_implrepo_; 01002 01003 /// Flag for whether to put the ImR endpoints into our object refs. 01004 int imr_endpoints_in_ior_; 01005 01006 /// The cached IOR for the TypeCodeFactory DLL. 01007 CORBA::Object_ptr typecode_factory_; 01008 01009 /// The cached IOR for the CodecFactory DLL. 01010 CORBA::Object_ptr codec_factory_; 01011 01012 /// The cached IOR for the Compression DLL. 01013 CORBA::Object_ptr compression_manager_; 01014 01015 /// The cached object reference for the DynAnyFactory. 01016 CORBA::Object_ptr dynany_factory_; 01017 01018 /// The cached object reference for the IORManipulataion. 01019 CORBA::Object_ptr ior_manip_factory_; 01020 01021 /// The cached object reference for the IORTable. 01022 CORBA::Object_ptr ior_table_; 01023 01024 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 01025 /// The cached object reference for the RTCORBA::RTORB. 01026 CORBA::Object_var rt_orb_; 01027 01028 /// The cached object reference for the RTCORBA::Current interface. 01029 CORBA::Object_var rt_current_; 01030 #endif 01031 01032 /** 01033 * @note 01034 * Should we keep a single ORB pointer? This is good because 01035 * multiple calls to ORB_init() with the same ORBid can use the same 01036 * object, but maybe don't want so much coupling. 01037 * 01038 * Pointer to the ORB. 01039 */ 01040 CORBA::ORB_ptr orb_; 01041 01042 /// Object reference to the root POA. It will eventually be the 01043 /// object reference returned by calls to 01044 /// CORBA::ORB::resolve_initial_references ("RootPOA"). 01045 CORBA::Object_var root_poa_; 01046 01047 /// Parameters used by the ORB. 01048 TAO_ORB_Parameters orb_params_; 01049 01050 /// Return InitRefMap to find if a particular object id is present. 01051 InitRefMap init_ref_map_; 01052 01053 /// Table that maps object key/name to (de-stringified) object 01054 /// reference. It is needed for supporting local objects in the 01055 /// resolve_initial_references() mechanism. 01056 TAO_Object_Ref_Table object_ref_table_; 01057 01058 /// Table that stores the object key instead of caching one per-profile. 01059 TAO::ObjectKey_Table object_key_table_; 01060 01061 /// The ORBid for this ORB. 01062 char *orbid_; 01063 01064 /// Handle to the factory for resource information.. 01065 TAO_Resource_Factory *resource_factory_; 01066 01067 /// The server_id_ that was passed via -ORBServerId option 01068 ACE_CString server_id_; 01069 01070 /// Handle to the factory for Client-side strategies. 01071 TAO_Client_Strategy_Factory *client_factory_; 01072 01073 /// Handle to the factory for Server-side strategies. 01074 TAO_Server_Strategy_Factory *server_factory_; 01075 01076 /** 01077 * @name Service Level Hooks 01078 */ 01079 //@{ 01080 01081 /// Fault Tolerant service hook. 01082 TAO_Fault_Tolerance_Service ft_service_; 01083 01084 //@} 01085 01086 /// TRUE if we want to take advantage of collocation optimization in 01087 /// this ORB. 01088 CORBA::Boolean opt_for_collocation_; 01089 01090 /// TRUE if we want to consider all ORBs in this address space 01091 /// collocated. 01092 CORBA::Boolean use_global_collocation_; 01093 01094 /// Default collocation policy. This should never be ORB_CONTROL. 01095 CORBA::ULong collocation_strategy_; 01096 01097 #if (TAO_HAS_CORBA_MESSAGING == 1) 01098 01099 /// The Policy_Manager for this ORB. 01100 TAO_Policy_Manager *policy_manager_; 01101 01102 /// The default policies. 01103 TAO_Policy_Set *default_policies_; 01104 01105 /// Policy current. 01106 TAO_Policy_Current *policy_current_; 01107 01108 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */ 01109 01110 /// The request dispatching strategy. 01111 TAO_Request_Dispatcher *request_dispatcher_; 01112 01113 /** 01114 * POA current. 01115 */ 01116 CORBA::Object_var poa_current_; 01117 01118 /// The list of Adapters used in this ORB. 01119 TAO_Adapter_Registry adapter_registry_; 01120 01121 /// An optimization for the POA. 01122 TAO_Adapter *poa_adapter_; 01123 01124 /// The Thread Manager 01125 ACE_Thread_Manager tm_; 01126 01127 /// The data block reference counts are locked using this mutex 01128 ACE_Lock_Adapter<TAO_SYNCH_MUTEX> data_block_lock_; 01129 01130 /// TSS Object cleanup functions. These correspond to the TSS 01131 /// objects stored in TAO's TSS resources. 01132 TAO_Cleanup_Func_Registry tss_cleanup_funcs_; 01133 01134 /// This is where the tss resources for this ORB are stored. 01135 ACE_TSS_TYPE (TAO_ORB_Core_TSS_Resources) tss_resources_; 01136 01137 /// Flag which denotes that the ORB has been shutdown. 01138 bool has_shutdown_; 01139 01140 /// The value of the timeout if the flag above is not zero. 01141 //@{ 01142 int thread_per_connection_use_timeout_; 01143 ACE_Time_Value thread_per_connection_timeout_; 01144 //@} 01145 01146 /// Mutual exclusion for calling open. 01147 TAO_SYNCH_MUTEX open_lock_; 01148 01149 TAO_Endpoint_Selector_Factory *endpoint_selector_factory_; 01150 01151 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1) 01152 01153 /// This strategy will buffer messages. 01154 TAO::Transport_Queueing_Strategy *eager_transport_queueing_strategy_; 01155 01156 /// This strategy will buffer messages. 01157 TAO::Transport_Queueing_Strategy *delayed_transport_queueing_strategy_; 01158 01159 /// This strategy will not queue by default, but will flush the queue 01160 /// each time 01161 TAO::Transport_Queueing_Strategy *flush_transport_queueing_strategy_; 01162 01163 #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */ 01164 01165 /// This strategy will not queue by default and not flush 01166 TAO::Transport_Queueing_Strategy *default_transport_queueing_strategy_; 01167 01168 /// Number of outstanding references to this object. 01169 ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_; 01170 01171 /// Registry containing all registered policy factories. 01172 TAO::PolicyFactory_Registry_Adapter *policy_factory_registry_; 01173 01174 /// Registry containing all orb initializers 01175 TAO::ORBInitializer_Registry_Adapter *orbinitializer_registry_; 01176 01177 #if (TAO_HAS_INTERCEPTORS == 1) 01178 /// Cached pointer/reference to the PICurrent object. 01179 /** 01180 * A pointer/reference to the PICurrent object is cached in the ORB 01181 * Core since it is accessed in the critical path (i.e. the request 01182 * invocation path). Caching it prevents additional overhead to due 01183 * object resolution from occurring. 01184 */ 01185 CORBA::Object_ptr pi_current_; 01186 01187 /// The adapter for handling client request interceptors 01188 TAO::ClientRequestInterceptor_Adapter *client_request_interceptor_adapter_; 01189 01190 /// The adapter for handling server request interceptors 01191 TAO::ServerRequestInterceptor_Adapter *server_request_interceptor_adapter_; 01192 01193 #endif /* TAO_HAS_INTERCEPTORS */ 01194 01195 /// IORInterceptor adapter. 01196 TAO_IORInterceptor_Adapter *ior_interceptor_adapter_; 01197 01198 /// Pointer to the valuetype adapter. 01199 TAO_Valuetype_Adapter *valuetype_adapter_; 01200 01201 /// The IOR parser registry. 01202 TAO_Parser_Registry parser_registry_; 01203 01204 /// BiDirectional GIOP factory 01205 TAO_BiDir_Adapter *bidir_adapter_; 01206 01207 /// Bir Dir GIOP policy value 01208 CORBA::Boolean bidir_giop_policy_; 01209 01210 /// Hold the flushing strategy 01211 TAO_Flushing_Strategy *flushing_strategy_; 01212 01213 /// Code Set Manager, received from the Resource Factory 01214 TAO_Codeset_Manager *codeset_manager_; 01215 01216 /// ORB's service configuration 01217 ACE_Service_Gestalt *config_; 01218 01219 /// The hook to be set for the SyncScopePolicy 01220 Sync_Scope_Hook sync_scope_hook_; 01221 01222 /// The hook to be set for the RelativeRoundtripTimeoutPolicy. 01223 Timeout_Hook timeout_hook_; 01224 }; 01225 01226 // **************************************************************** 01227 01228 /** 01229 * @class TAO_ORB_Core_Static_Resources 01230 * 01231 * @brief The static (global) resoures of all ORB cores. 01232 * 01233 * This class is used by the ORB_Core to store the resources global to 01234 * all ORB_Cores. All instance variables that would have been 01235 * declared "static" in TAO_ORB_Core, should be declared in this class 01236 * to avoid the "static initialization order fiasco" as described in 01237 * http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.11. 01238 * Briefly, this is the problem that occurs if any static initializers 01239 * in any other code call into set static members of TAO_ORB_Core. 01240 * Since the order in which these initializers execute is unspecified, 01241 * uninitialized members can be accessed. 01242 */ 01243 class TAO_Export TAO_ORB_Core_Static_Resources : public ACE_Service_Object 01244 { 01245 public: 01246 01247 /// Return the context-specific singleton instance. 01248 static TAO_ORB_Core_Static_Resources* instance (void); 01249 01250 public: 01251 /** 01252 * Name of the network_priority_protocols_hooks that needs to be instantiated. 01253 */ 01254 ACE_CString network_priority_protocols_hooks_name_; 01255 01256 /// The hook to be set for the ConnectionTimeoutPolicy 01257 TAO_ORB_Core::Timeout_Hook connection_timeout_hook_; 01258 01259 /** 01260 * Name of the resource factory that needs to be instantiated. 01261 * The default value is "Resource_Factory". If TAO_Strategies is 01262 * linked, the set_resource_factory will be called to set the value 01263 * to be "Advanced_Resource_Factory". 01264 */ 01265 ACE_CString resource_factory_name_; 01266 01267 /** 01268 * Name of the service object for DII request creation that needs 01269 * to be instantiated. The default value is "Dynamic_Adaper". If 01270 * TAO_DynamicInterface is linked, dynamic_adapter_name() will be 01271 * called to set the value to "Concrete_Dynamic_Adapter". 01272 */ 01273 ACE_CString dynamic_adapter_name_; 01274 01275 /** 01276 * Name of the service object for functions that make calls on 01277 * the Interface Repository. The default value is "IFR_Client_Adaper". 01278 * If TAO_IFR_CLient is linked, ifr_client_adapter_name() will be 01279 * called to set the value to "Concrete_IFR_Client_Adapter". 01280 */ 01281 ACE_CString ifr_client_adapter_name_; 01282 01283 /** 01284 * Name of the service object used by the ORB create_*_tc functions. 01285 * The default value is "TypeCodeFactory_Adapter". If the 01286 * TypeCodeFactory library is linked, the corresponding accessor 01287 * function typecodefactory_adapter_name() will be called to set 01288 * the value to "Concrete_TypeCodeFactory_Adapter". 01289 */ 01290 ACE_CString typecodefactory_adapter_name_; 01291 01292 /** 01293 * Name of the factory object used to adapt function calls on 01294 * the PortableInterceptor interfaces IORInfo and IORInterceptor. 01295 * The default value is "IORInterceptor_Adapter_Factory". If the 01296 * IORInterceptor library is linked, the corresponding accessor 01297 * function iorinterceptor_adapter_factory_name() will be called to set 01298 * the value to "Concrete_IORInterceptor_Adapter_Factory". 01299 */ 01300 ACE_CString iorinterceptor_adapter_factory_name_; 01301 01302 /** 01303 * Name of the factory object used to adapt function calls on 01304 * the valuetype-related interfaces. 01305 * The default value is "Valuetype_Adapter_Factory". If the 01306 * Valuetype library is linked, the corresponding accessor 01307 * function valuetype_adapter_factory_name() will be called to set 01308 * the value to "Concrete_Valuetype_Adapter_Factory". 01309 */ 01310 ACE_CString valuetype_adapter_factory_name_; 01311 01312 /// An alternative hook to be set for the ConnectionTimeoutPolicy 01313 TAO_ORB_Core::Timeout_Hook alt_connection_timeout_hook_; 01314 01315 //private: 01316 01317 /// Constructor. 01318 TAO_ORB_Core_Static_Resources (void); 01319 TAO_ORB_Core_Static_Resources& operator= 01320 (const TAO_ORB_Core_Static_Resources&); 01321 01322 private: 01323 01324 /// Mostly unused variable whose sole purpose is to enforce 01325 /// the instantiation of a TAO_ORB_Core_Static_Resources instance 01326 /// at initialization time. 01327 static TAO_ORB_Core_Static_Resources* initialization_reference_; 01328 }; 01329 01330 // **************************************************************** 01331 01332 /// Obtain an instance of the first ORB core registered in the ORB 01333 /// table. 01334 TAO_Export TAO_ORB_Core * TAO_ORB_Core_instance (void); 01335 01336 // **************************************************************** 01337 01338 TAO_END_VERSIONED_NAMESPACE_DECL 01339 01340 ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_ORB_Core_Static_Resources) 01341 ACE_FACTORY_DECLARE (TAO, TAO_ORB_Core_Static_Resources) 01342 01343 #if defined (__ACE_INLINE__) 01344 # include "tao/ORB_Core.inl" 01345 #endif /* __ACE_INLINE__ */ 01346 01347 #include /**/ "ace/post.h" 01348 #endif /* TAO_ORB_CORE_H */