Root_POA.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Root_POA.h
00006  *
00007  *  $Id: Root_POA.h 79241 2007-08-07 12:42:30Z johnnyw $
00008  *
00009  *  Header file for CORBA's ORB type.
00010  *
00011  *  @author  Irfan Pyarali <irfan@cs.wustl.edu>
00012  */
00013 //=============================================================================
00014 
00015 #ifndef TAO_ROOT_POA_H
00016 #define TAO_ROOT_POA_H
00017 
00018 #include /**/ "ace/pre.h"
00019 
00020 #include "tao/PortableServer/portableserver_export.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 // Object Adapter
00027 #include "tao/PortableServer/Object_Adapter.h"
00028 
00029 // POA Policy Set
00030 #include "tao/PortableServer/POA_Policy_Set.h"
00031 
00032 // Cached POA Policies
00033 #include "tao/PortableServer/POA_Cached_Policies.h"
00034 #include "tao/PortableServer/Active_Policy_Strategies.h"
00035 
00036 #include "tao/PortableServer/ORT_Adapter.h"
00037 
00038 #include "tao/PortableServer/PortableServer.h"
00039 
00040 // Object_Key
00041 #include "tao/Object_KeyC.h"
00042 
00043 // Local Object
00044 #include "tao/LocalObject.h"
00045 
00046 // Portable Interceptor
00047 #include "tao/PI_ForwardC.h"
00048 
00049 // OctetSeq
00050 #include "tao/OctetSeqC.h"
00051 
00052 #include "ace/SString.h"
00053 #include "ace/Hash_Map_Manager_T.h"
00054 #include "ace/Array_Base.h"
00055 #include "ace/Synch_Traits.h"
00056 #include "ace/Thread_Mutex.h"
00057 #include "ace/Recursive_Thread_Mutex.h"
00058 #include "ace/Null_Mutex.h"
00059 
00060 // This is to remove "inherits via dominance" warnings from MSVC.
00061 // MSVC is being a little too paranoid.
00062 #if defined(_MSC_VER)
00063 #pragma warning(push)
00064 #pragma warning(disable:4250)
00065 #endif /* _MSC_VER */
00066 
00067 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00068 
00069 // Forward Declaration
00070 class TAO_Acceptor_Filter;
00071 
00072 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00073 class TAO_Acceptor_Filter_Factory;
00074 class TAO_POAManager_Factory;
00075 #endif
00076 
00077 class TAO_Network_Priority_Hook;
00078 class TAO_Acceptor_Registry;
00079 class TAO_IORInfo;
00080 class TAO_Regular_POA;
00081 
00082 namespace PortableInterceptor
00083 {
00084   class IORInfo;
00085   typedef IORInfo *IORInfo_ptr;
00086 }
00087 
00088 namespace TAO
00089 {
00090   class ORT_Adapter;
00091   class ORT_Adapter_Factory;
00092 
00093   namespace Portable_Server
00094   {
00095     class Servant_Upcall;
00096     class POA_Current_Impl;
00097     class Temporary_Creation_Time;
00098   }
00099 }
00100 
00101 namespace PortableServer
00102 {
00103   class POAManager;
00104   typedef POAManager *POAManager_ptr;
00105 }
00106 
00107 /**
00108  * @class TAO_Root_POA
00109  *
00110  * @brief Implementation of the PortableServer::POA interface.
00111  *
00112  * Implementation of the PortableServer::POA interface.
00113  */
00114 class TAO_PortableServer_Export TAO_Root_POA
00115   : public virtual PortableServer::POA,
00116     public virtual TAO_Local_RefCounted_Object
00117 {
00118 public:
00119 
00120   friend class TAO_Object_Adapter;
00121   friend class TAO::Portable_Server::Servant_Upcall;
00122   friend class TAO::Portable_Server::Non_Servant_Upcall;
00123   friend class TAO_POA_Manager;
00124   friend class TAO_RT_Collocation_Resolver;
00125   friend class TAO_IORInfo;
00126 
00127   typedef ACE_CString String;
00128 
00129 #if !defined (CORBA_E_MICRO)
00130   PortableServer::POA_ptr create_POA (
00131       const char *adapter_name,
00132       PortableServer::POAManager_ptr poa_manager,
00133       const CORBA::PolicyList &policies);
00134 
00135   PortableServer::POA_ptr find_POA (const char *adapter_name,
00136                                     CORBA::Boolean activate_it);
00137 #endif
00138 
00139   void destroy (CORBA::Boolean etherealize_objects,
00140                 CORBA::Boolean wait_for_completion);
00141 
00142 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00143   PortableServer::ThreadPolicy_ptr create_thread_policy (
00144       PortableServer::ThreadPolicyValue value);
00145 #endif /* TAO_HAS_MINIMUM_POA == 0 */
00146 
00147 #if !defined (CORBA_E_MICRO)
00148   PortableServer::LifespanPolicy_ptr create_lifespan_policy (
00149       PortableServer::LifespanPolicyValue value);
00150 #endif
00151 
00152 #if !defined (CORBA_E_MICRO)
00153   PortableServer::IdUniquenessPolicy_ptr create_id_uniqueness_policy (
00154       PortableServer::IdUniquenessPolicyValue value);
00155 #endif
00156 
00157 #if !defined (CORBA_E_MICRO)
00158   PortableServer::IdAssignmentPolicy_ptr create_id_assignment_policy (
00159       PortableServer::IdAssignmentPolicyValue value);
00160 #endif
00161 
00162 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00163   PortableServer::ImplicitActivationPolicy_ptr
00164   create_implicit_activation_policy (
00165       PortableServer::ImplicitActivationPolicyValue value);
00166 
00167   PortableServer::ServantRetentionPolicy_ptr
00168   create_servant_retention_policy (
00169       PortableServer::ServantRetentionPolicyValue value);
00170 
00171   PortableServer::RequestProcessingPolicy_ptr
00172   create_request_processing_policy (
00173       PortableServer::RequestProcessingPolicyValue value);
00174 
00175 #endif /* TAO_HAS_MINIMUM_POA == 0 && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) */
00176 
00177   char * the_name (void);
00178 
00179   PortableServer::POA_ptr the_parent (void);
00180 
00181   PortableServer::POAList *the_children (void);
00182 
00183   PortableServer::POAManager_ptr the_POAManager (void);
00184 
00185 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00186   PortableServer::POAManagerFactory_ptr the_POAManagerFactory (void);
00187 #endif
00188 
00189   /// This method returns the adapter_name as a sequence of strings of
00190   /// length one or more or just a fixed name depending on the Object
00191   /// Adapter. Added wrt to ORT Spec.
00192   PortableInterceptor::AdapterName *adapter_name (void);
00193 
00194   /// Store the given TaggedComponent for eventual insertion into all
00195   /// object reference profiles.
00196   void save_ior_component (const IOP::TaggedComponent &component);
00197 
00198   /// Store the given TaggedComponent for eventual insertion into all
00199   /// object reference profiles with the given ProfileId.
00200   void save_ior_component_and_profile_id (
00201     const IOP::TaggedComponent &component,
00202     IOP::ProfileId profile_id);
00203 
00204 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00205   PortableServer::AdapterActivator_ptr the_activator (void);
00206 
00207   void the_activator (PortableServer::AdapterActivator_ptr adapter_activator);
00208 
00209   PortableServer::ServantManager_ptr get_servant_manager (void);
00210 
00211   void set_servant_manager (PortableServer::ServantManager_ptr imgr);
00212 
00213   PortableServer::Servant get_servant (void);
00214 
00215   void set_servant (PortableServer::Servant servant);
00216 #endif /* TAO_HAS_MINIMUM_POA == 0 !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) */
00217 
00218   PortableServer::ObjectId *activate_object (PortableServer::Servant p_servant);
00219 
00220 #if !defined (CORBA_E_MICRO)
00221   void activate_object_with_id (const PortableServer::ObjectId &id,
00222                                 PortableServer::Servant p_servant);
00223 #endif
00224 
00225   void deactivate_object (const PortableServer::ObjectId &oid);
00226 
00227   CORBA::Object_ptr create_reference (const char *intf);
00228 
00229   CORBA::Object_ptr create_reference_with_id (
00230       const PortableServer::ObjectId &oid,
00231       const char *intf);
00232 
00233   PortableServer::ObjectId *servant_to_id (PortableServer::Servant p_servant);
00234 
00235   PortableServer::ObjectId *servant_to_user_id (PortableServer::Servant p_servant);
00236 
00237   CORBA::Object_ptr servant_to_reference (PortableServer::Servant p_servant);
00238 
00239   PortableServer::Servant reference_to_servant (CORBA::Object_ptr reference);
00240 
00241   PortableServer::ObjectId *reference_to_id (CORBA::Object_ptr reference);
00242 
00243   PortableServer::Servant id_to_servant (const PortableServer::ObjectId &oid);
00244 
00245   CORBA::Object_ptr id_to_reference (const PortableServer::ObjectId &oid);
00246 
00247   CORBA::OctetSeq *id (void);
00248 
00249   /// Accessor for POA policies.
00250   TAO_POA_Policy_Set &policies (void);
00251 
00252   /// Get the set policy of the given type.
00253   CORBA::Policy_ptr get_policy (CORBA::PolicyType policy);
00254 
00255   /// This method gives the policies that are exposed to the client.
00256   /// These policies are shipped within the IOR.
00257   virtual CORBA::PolicyList *client_exposed_policies (
00258       CORBA::Short object_priority);
00259 
00260   TAO_Root_POA (const String &name,
00261                 PortableServer::POAManager_ptr poa_manager,
00262                 const TAO_POA_Policy_Set &policies,
00263                 TAO_Root_POA *parent,
00264                 ACE_Lock &lock,
00265                 TAO_SYNCH_MUTEX &thread_lock,
00266                 TAO_ORB_Core &orb_core,
00267                 TAO_Object_Adapter *object_adapter);
00268 
00269   virtual ~TAO_Root_POA (void);
00270 
00271   static char name_separator (void);
00272 
00273   static CORBA::ULong name_separator_length (void);
00274 
00275   enum
00276   {
00277     TAO_OBJECTKEY_PREFIX_SIZE = 4
00278   };
00279 
00280   static CORBA::Octet const objectkey_prefix[TAO_OBJECTKEY_PREFIX_SIZE];
00281 
00282   const TAO_Object_Adapter::poa_name &folded_name (void) const;
00283 
00284   const TAO_Object_Adapter::poa_name &system_name (void) const;
00285 
00286   static void check_for_valid_wait_for_completions (
00287       const TAO_ORB_Core &orb_core,
00288       CORBA::Boolean wait_for_completion);
00289 
00290   /// ORB Core for POA.
00291   TAO_ORB_Core &orb_core (void) const;
00292 
00293   /// obtain a reference to the cached_profiles
00294   TAO::Portable_Server::Cached_Policies& cached_policies (void);
00295 
00296   /// obtain a handle to the network priority hooks
00297   TAO_Network_Priority_Hook* network_priority_hook (void);
00298 
00299   TAO::Portable_Server::Cached_Policies::PriorityModel priority_model (void) const;
00300 
00301   CORBA::Boolean cleanup_in_progress (void);
00302 
00303   /// Calls protected static method used when POACurrent is not appropriate.
00304   static int parse_ir_object_key (const TAO::ObjectKey &object_key,
00305                                   PortableServer::ObjectId &user_id);
00306 
00307   TAO_Object_Adapter &object_adapter (void);
00308 
00309   ACE_Lock &lock (void);
00310 
00311   /// Create the correct stub, properly initialized with the
00312   /// attributes and policies attached to the current POA.
00313   TAO_Stub* key_to_stub (const TAO::ObjectKey &key,
00314                          const char *type_id,
00315                          CORBA::Short priority);
00316 
00317   /// Accessor methods to POA state.
00318   /**
00319    * The POA can be in one of HOLDING, ACTIVE, DISCARDING, INACTIVE
00320    * and NON_EXISTENT states.
00321    */
00322   PortableInterceptor::AdapterState get_adapter_state (
00323     void);
00324 
00325   virtual void *thread_pool (void) const;
00326 
00327   virtual CORBA::Policy *server_protocol (void);
00328 
00329   CORBA::ULong outstanding_requests (void) const;
00330 
00331   const ACE_CString &name (void) const;
00332 
00333   CORBA::Boolean waiting_destruction (void) const;
00334 
00335   static void ort_adapter_factory_name (const char *name);
00336 
00337   static const char *ort_adapter_factory_name (void);
00338 
00339   /// Sets the value of TAO_POA_Static_Resources::imr_client_adapter_name_.
00340   static void imr_client_adapter_name (const char *name);
00341 
00342   /// Gets the value of TAO_POA_Static_Resources::imr_client_adapter_name_.
00343   static const char *imr_client_adapter_name (void);
00344 
00345   CORBA::Object_ptr invoke_key_to_object (void);
00346 
00347   CORBA::Boolean system_id (void);
00348 
00349   CORBA::ULong waiting_servant_deactivation (void) const;
00350 
00351   /// Return the POA Manager related to this POA
00352   TAO_POA_Manager &tao_poa_manager ();
00353 
00354   bool is_poa_generated (CORBA::Object_ptr reference,
00355                          PortableServer::ObjectId &system_id
00356                         );
00357 
00358   /*
00359    * Validate if the servant may be activated
00360    * @retval true This servant may be activated
00361    * @retval false This servant may not be activated
00362    */
00363   bool is_servant_activation_allowed (
00364     PortableServer::Servant servant,
00365     bool &wait_occurred_restart_call);
00366 
00367   int rebind_using_user_id_and_system_id (
00368     PortableServer::Servant servant,
00369     const PortableServer::ObjectId &user_id,
00370     const PortableServer::ObjectId &system_id,
00371     TAO::Portable_Server::Servant_Upcall &servant_upcall);
00372 
00373   CORBA::Boolean servant_has_remaining_activations (
00374     PortableServer::Servant servant);
00375 
00376   bool allow_implicit_activation (void) const;
00377 
00378   bool allow_multiple_activations (void) const;
00379 
00380   int is_servant_active (
00381     PortableServer::Servant servant,
00382     bool &wait_occurred_restart_call);
00383 
00384   void deactivate_object_i (const PortableServer::ObjectId &oid);
00385 
00386   CORBA::Boolean is_persistent (void) const;
00387 
00388   CORBA::Short server_priority (void) const;
00389 
00390   bool has_system_id (void) const;
00391 
00392   PortableServer::Servant find_servant (const PortableServer::ObjectId &system_id);
00393 
00394   TAO_SERVANT_LOCATION servant_present (
00395     const PortableServer::ObjectId &system_id,
00396     PortableServer::Servant &servant);
00397 
00398   PortableServer::Servant find_servant (
00399         const PortableServer::ObjectId &system_id,
00400         TAO::Portable_Server::Servant_Upcall &servant_upcall,
00401         TAO::Portable_Server::POA_Current_Impl &poa_current_impl);
00402 
00403   /**
00404    * Find the the servant with ObjectId <system_id>, and retrieve
00405    * its priority.Usually used in RT CORBA with SERVER_DECLARED
00406    * priority model.
00407    *
00408    * @return -1 if servant does not exist, else 0 indicating the
00409    * servant exists and priority successfully retrieved.
00410    */
00411   int find_servant_priority (
00412         const PortableServer::ObjectId &system_id,
00413         CORBA::Short &priority);
00414 
00415   int unbind_using_user_id (const PortableServer::ObjectId &user_id);
00416 
00417   void cleanup_servant (
00418     PortableServer::Servant servant,
00419     const PortableServer::ObjectId &user_id
00420    );
00421 
00422   void post_invoke_servant_cleanup(
00423     const PortableServer::ObjectId &system_id,
00424     const TAO::Portable_Server::Servant_Upcall &servant_upcall);
00425 
00426    bool validate_lifespan (
00427     CORBA::Boolean is_persistent,
00428     const TAO::Portable_Server::Temporary_Creation_Time& creation_time) const;
00429 
00430   PortableServer::ObjectId *activate_object_i (
00431       PortableServer::Servant p_servant,
00432       CORBA::Short priority,
00433       bool &wait_occurred_restart_call
00434 
00435     );
00436 
00437   CORBA::Object_ptr id_to_reference_i (const PortableServer::ObjectId &oid,
00438                                        bool indirect);
00439 
00440   PortableServer::ObjectId *servant_to_id_i (PortableServer::Servant servant);
00441 
00442   TAO_SYNCH_CONDITION &servant_deactivation_condition (void);
00443 
00444   int is_poa_generated_id (const PortableServer::ObjectId &id);
00445 
00446   /// Check the state of this POA
00447   void check_state (void);
00448 
00449   int delete_child (const String &child);
00450 
00451   PortableServer::Servant user_id_to_servant_i (const PortableServer::ObjectId &oid);
00452 
00453   virtual CORBA::ORB_ptr _get_orb (void);
00454 
00455   /// These hooks are needed by the CSD strategy to override
00456   /// and no-ops by default.
00457 
00458   /// Hook - The POA has been (or is being) activated.
00459   virtual void poa_activated_hook ();
00460 
00461   /// Hook - The POA has been deactivated.
00462   virtual void poa_deactivated_hook ();
00463 
00464   /// Hook - A servant has been activated.
00465   virtual void servant_activated_hook (PortableServer::Servant servant,
00466                                const PortableServer::ObjectId& oid);
00467 
00468   /// Hook - A servant has been deactivated.
00469   virtual void servant_deactivated_hook (PortableServer::Servant servant,
00470                                  const PortableServer::ObjectId& oid);
00471 
00472 protected:
00473 
00474 #if (TAO_HAS_MINIMUM_POA == 0)
00475   int enter (void);
00476 
00477   int exit (void);
00478 #endif /* TAO_HAS_MINIMUM_POA == 0 */
00479 
00480 #if ! defined (CORBA_E_MICRO)
00481   /// Template method for creating new POA's of this type.
00482   virtual TAO_Root_POA *new_POA (const String &name,
00483                             PortableServer::POAManager_ptr poa_manager,
00484                             const TAO_POA_Policy_Set &policies,
00485                             TAO_Root_POA *parent,
00486                             ACE_Lock &lock,
00487                             TAO_SYNCH_MUTEX &thread_lock,
00488                             TAO_ORB_Core &orb_core,
00489                             TAO_Object_Adapter *object_adapter);
00490 
00491   PortableServer::POA_ptr create_POA_i (
00492       const char *adapter_name,
00493       PortableServer::POAManager_ptr poa_manager,
00494       const CORBA::PolicyList &policies);
00495 
00496   PortableServer::POA_ptr create_POA_i (const String &adapter_name,
00497                                         PortableServer::POAManager_ptr poa_manager,
00498                                         const TAO_POA_Policy_Set &policies);
00499 
00500   TAO_Root_POA *find_POA_i (const ACE_CString &child_name,
00501                             CORBA::Boolean activate_it);
00502 #endif
00503 
00504   void destroy_i (CORBA::Boolean etherealize_objects,
00505                   CORBA::Boolean wait_for_completion);
00506 
00507   void complete_destruction_i (void);
00508 
00509   PortableServer::POAList *the_children_i (void);
00510 
00511   /// This method returns the adapter_name as a sequence of strings of
00512   /// length one or more or just a fixed name depending on the Object
00513   /// Adapter. Added wrt to ORT Spec.
00514   PortableInterceptor::AdapterName *adapter_name_i (void);
00515 
00516   /// Method to notify the IOR Interceptors when there is a state
00517   /// changed not related to POAManager.
00518   void adapter_state_changed (
00519       const TAO::ORT_Array &array_obj_ref_template,
00520       PortableInterceptor::AdapterState state);
00521 
00522   /// Add the given tagged component to all profiles.
00523   void add_ior_component (TAO_MProfile & mprofile,
00524                           const IOP::TaggedComponent & component);
00525 
00526   /// Add the given tagged component to all profiles matching the given
00527   /// ProfileId.
00528   void add_ior_component_to_profile (TAO_MProfile & mprofile,
00529                                      const IOP::TaggedComponent & component,
00530                                      IOP::ProfileId profile_id);
00531 
00532   /// Wrapper for the ORB's key_to_object that will alter the object pointer
00533   /// if the ImplRepo is used.
00534   CORBA::Object_ptr key_to_object (const TAO::ObjectKey &key,
00535                                    const char *type_id,
00536                                    TAO_ServantBase *servant,
00537                                    CORBA::Boolean collocated,
00538                                    CORBA::Short priority,
00539                                    bool indirect);
00540 
00541   /// Like key_to_stub() but assume that the ORB is not shutting down.
00542   virtual TAO_Stub* key_to_stub_i (const TAO::ObjectKey &key,
00543                                    const char *type_id,
00544                                    CORBA::Short priority);
00545 
00546   TAO_Stub *create_stub_object (const TAO::ObjectKey &object_key,
00547                                 const char *type_id,
00548                                 CORBA::PolicyList *policy_list,
00549                                 TAO_Acceptor_Filter *filter,
00550                                 TAO_Acceptor_Registry &acceptor_registry);
00551 
00552   PortableServer::Servant get_servant_i (void);
00553 
00554 protected:
00555 #if !defined (CORBA_E_MICRO)
00556   void activate_object_with_id_i (const PortableServer::ObjectId &id,
00557                                   PortableServer::Servant p_servant,
00558                                   CORBA::Short priority,
00559                                   bool &wait_occurred_restart_call);
00560 #endif
00561 
00562   virtual void remove_from_parent_i (void);
00563 
00564   void deactivate_all_objects_i (CORBA::Boolean etherealize_objects);
00565 
00566   void deactivate_all_objects_i (CORBA::Boolean etherealize_objects,
00567                                  CORBA::Boolean wait_for_completion);
00568 
00569   void wait_for_completions (CORBA::Boolean wait_for_completion);
00570 
00571   CORBA::Object_ptr create_reference_i (const char *intf,
00572                                         CORBA::Short priority);
00573 
00574   CORBA::Object_ptr create_reference_with_id_i (
00575       const PortableServer::ObjectId &oid,
00576       const char *intf,
00577       CORBA::Short priority);
00578 
00579   PortableServer::Servant reference_to_servant_i (CORBA::Object_ptr reference);
00580 
00581   CORBA::Object_ptr servant_to_reference_i (PortableServer::Servant p_servant);
00582 
00583   PortableServer::Servant id_to_servant_i (const PortableServer::ObjectId &oid);
00584 
00585   /// Call the IORInterceptor::establish_components() method on all
00586   /// registered IORInterceptors.
00587   /**
00588    * This method calls IORInterceptor::establish_components() method
00589    * on all registered IORInterceptors, and
00590    * IORInterceptor::components_established() once the former is
00591    * completed.
00592    */
00593   void establish_components (void);
00594 
00595   /// Call the IORInterceptor::components_established() method on all
00596   /// registered IORInterceptors.
00597   void components_established (PortableInterceptor::IORInfo_ptr info);
00598 
00599   void set_folded_name (TAO_Root_POA *parent);
00600 
00601   void set_id (TAO_Root_POA *parent);
00602 
00603   TAO::ObjectKey *create_object_key (const PortableServer::ObjectId &id);
00604 
00605   static int parse_key (const TAO::ObjectKey &key,
00606                         TAO_Object_Adapter::poa_name &poa_system_name,
00607                         PortableServer::ObjectId &system_id,
00608                         CORBA::Boolean &is_root,
00609                         CORBA::Boolean &is_persistent,
00610                         CORBA::Boolean &is_system_id,
00611                         TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time);
00612 
00613 protected:
00614   /// Accessor methods to ObjectReferenceTemplate
00615   PortableInterceptor::ObjectReferenceTemplate *
00616     get_adapter_template (void);
00617 
00618   /// Accessor methods to ObjectReferenceTemplate, non locked version
00619   PortableInterceptor::ObjectReferenceTemplate *get_adapter_template_i (void);
00620 
00621   /// Accessor methods to PortableInterceptor::ObjectReferenceFactory
00622   PortableInterceptor::ObjectReferenceFactory *
00623     get_obj_ref_factory (void);
00624 
00625   /// Set the object reference factory
00626   void set_obj_ref_factory (
00627     PortableInterceptor::ObjectReferenceFactory *current_factory);
00628 
00629 
00630   TAO_SERVANT_LOCATION locate_servant_i (const PortableServer::ObjectId &id,
00631                                          PortableServer::Servant &servant);
00632 
00633   PortableServer::Servant locate_servant_i (
00634       const char *operation,
00635       const PortableServer::ObjectId &id,
00636       TAO::Portable_Server::Servant_Upcall &servant_upcall,
00637       TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
00638       bool &wait_occurred_restart_call);
00639 
00640 public:
00641     // @todo Temporarily for servant retention
00642   CORBA::Object_ptr
00643   invoke_key_to_object_helper_i (const char * repository_id,
00644                                  const PortableServer::ObjectId & id);
00645 protected:
00646 
00647   /// Get the ORT adapter, in case there is no adapter yet, this method will
00648   /// try to create one and hold the POA lock
00649   TAO::ORT_Adapter *ORT_adapter (void);
00650 
00651   /// Get the ORT adapter, in case there is no adapter yet, this method will
00652   /// try to create one but assumes the POA lock is already hold
00653   TAO::ORT_Adapter *ORT_adapter_i (void);
00654 
00655   TAO::ORT_Adapter_Factory *ORT_adapter_factory (void);
00656 
00657   CORBA::Boolean persistent (void);
00658 
00659   static char persistent_key_char (void);
00660 
00661   static char transient_key_char (void);
00662 
00663   static CORBA::ULong persistent_key_type_length (void);
00664 
00665   static char system_id_key_char (void);
00666 
00667   static char user_id_key_char (void);
00668 
00669   static CORBA::ULong system_id_key_type_length (void);
00670 
00671   virtual CORBA::Boolean root (void) const;
00672 
00673   virtual char root_key_type (void);
00674 
00675   static char root_key_char (void);
00676 
00677   static char non_root_key_char (void);
00678 
00679   static CORBA::ULong root_key_type_length (void);
00680 
00681   void outstanding_requests (CORBA::ULong new_outstanding_requests);
00682 
00683   CORBA::ULong increment_outstanding_requests (void);
00684 
00685   CORBA::ULong decrement_outstanding_requests (void);
00686 
00687   String name_;
00688 
00689   /// Reference to the POAManager that this poa assicuates with.
00690   TAO_POA_Manager &poa_manager_;
00691 
00692 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00693   /// Reference to the POAManagerFactory that generate the POAManager.
00694   TAO_POAManager_Factory& poa_manager_factory_;
00695 #endif
00696 
00697   IOP::TaggedComponentSeq tagged_component_;
00698 
00699   IOP::TaggedComponentSeq tagged_component_id_;
00700 
00701   ACE_Array_Base <IOP::ProfileId> profile_id_array_;
00702 
00703   TAO_POA_Policy_Set policies_;
00704 
00705   TAO_Object_Adapter::poa_name folded_name_;
00706 
00707   TAO_Object_Adapter::poa_name_var system_name_;
00708 
00709   CORBA::OctetSeq id_;
00710 
00711   /// Pointer to the object reference template adapter.
00712   TAO::ORT_Adapter *ort_adapter_;
00713 
00714   /// Adapter can be accepting, rejecting etc.
00715   PortableInterceptor::AdapterState adapter_state_;
00716 
00717   TAO::Portable_Server::Cached_Policies cached_policies_;
00718 
00719   TAO_Network_Priority_Hook *network_priority_hook_;
00720 
00721   TAO::Portable_Server::Active_Policy_Strategies active_policy_strategies_;
00722 
00723 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00724   PortableServer::AdapterActivator_var adapter_activator_;
00725 #endif /* TAO_HAS_MINIMUM_POA == 0 !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) */
00726 
00727   typedef
00728     ACE_Hash_Map_Manager_Ex<
00729         ACE_CString, TAO_Root_POA *,
00730         ACE_Hash<ACE_CString>,
00731         ACE_Equal_To<ACE_CString>,
00732         ACE_Null_Mutex
00733       >
00734     CHILDREN;
00735 
00736   CHILDREN children_;
00737 
00738   ACE_Lock &lock_;
00739 
00740   TAO_ORB_Core &orb_core_;
00741 
00742   /// The object adapter we belong to
00743   TAO_Object_Adapter *object_adapter_;
00744 
00745   CORBA::Boolean cleanup_in_progress_;
00746 
00747   CORBA::ULong outstanding_requests_;
00748 
00749   TAO_SYNCH_CONDITION outstanding_requests_condition_;
00750 
00751   CORBA::Boolean wait_for_completion_pending_;
00752 
00753   CORBA::Boolean waiting_destruction_;
00754 
00755   TAO_SYNCH_CONDITION servant_deactivation_condition_;
00756 
00757 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00758   TAO_Acceptor_Filter_Factory * filter_factory_;
00759 #endif
00760 
00761 public:
00762     // @todo Temporarily for servant retention
00763   CORBA::ULong caller_key_to_object_;
00764 
00765   PortableServer::Servant servant_for_key_to_object_;
00766 
00767   struct Key_To_Object_Params
00768   {
00769     PortableServer::ObjectId_var *system_id_;
00770     const char *type_id_;
00771     TAO_ServantBase *servant_;
00772     CORBA::Boolean collocated_;
00773     CORBA::Short priority_;
00774     bool indirect_;
00775 
00776     void set (PortableServer::ObjectId_var &system_id_,
00777               const char *type_id_,
00778               TAO_ServantBase *servant_,
00779               CORBA::Boolean collocated_,
00780               CORBA::Short priority_,
00781               bool indirect);
00782   };
00783 
00784   Key_To_Object_Params key_to_object_params_;
00785 };
00786 
00787 /**
00788  * @class TAO_POA_Static_Resources
00789  *
00790  * @brief The static (global) resoures of all POA's.
00791  *
00792  * This class is used by the POA to store the resources global to
00793  * all POA's.  All instance variables that would have been
00794  * declared "static" in TAO_Regular_POA, should be declared in this class
00795  * to avoid the "static initialization order fiasco" as described in
00796  * http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.11.
00797  * Briefly, this is the problem that occurs if any static initializers
00798  * in any other code call into set static members of TAO_Regular_POA.
00799  * Since the order in which these initializers execute is unspecified,
00800  * uninitialized members can be accessed.
00801  */
00802 class TAO_PortableServer_Export TAO_POA_Static_Resources
00803 {
00804 public:
00805 
00806   /// Return the singleton instance.
00807   static TAO_POA_Static_Resources* instance (void);
00808 
00809 public:
00810 
00811   /**
00812    * Name of the factory object used to adapt function calls on the
00813    * PortableInterceptor interfaces ORT. The default value is
00814    * "ObjectReferenceTemplate_Adapter_Factory". If the ORT library is linked,
00815    * the corresponding accessor function
00816    * objectreferencefactory_adapter_factory_name() will be called to set
00817    * the value to "Concrete_ObjectReferenceTemplate_Adapter_Factory".
00818    */
00819   ACE_CString ort_adapter_factory_name_;
00820 
00821   /**
00822    * Name of the service object for functions that make calls on
00823    * the Implementation Repository. The default value is "ImR_Client_Adapter".
00824    * If TAO_IMR_CLient is linked, imr_client_adapter_name() will be
00825    * called to set the value to "Concrete_ImR_Client_Adapter".
00826    */
00827   ACE_CString imr_client_adapter_name_;
00828 private:
00829   /// Constructor.
00830   TAO_POA_Static_Resources (void);
00831 
00832 private:
00833   /// The singleton instance.
00834   static TAO_POA_Static_Resources* instance_;
00835 
00836   /// Mostly unused variable whose sole purpose is to enforce
00837   /// the instantiation of a TAO_POA_Static_Resources instance
00838   /// at initialization time.
00839   static TAO_POA_Static_Resources* initialization_reference_;
00840 };
00841 
00842 TAO_END_VERSIONED_NAMESPACE_DECL
00843 
00844 // ****************************************************************
00845 
00846 #if defined(_MSC_VER)
00847 #pragma warning(pop)
00848 #endif /* _MSC_VER */
00849 
00850 #if defined (__ACE_INLINE__)
00851 # include "tao/PortableServer/Root_POA.inl"
00852 #endif /* __ACE_INLINE__ */
00853 
00854 #include /**/ "ace/post.h"
00855 
00856 #endif /* TAO_ROOT_POA_H */

Generated on Sun Jan 27 13:23:44 2008 for TAO_PortableServer by doxygen 1.3.6