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 81429 2008-04-24 18:49:54Z 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 ::CORBA::LocalObject
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 #if !defined (CORBA_E_MICRO)
00230   CORBA::Object_ptr create_reference_with_id (
00231       const PortableServer::ObjectId &oid,
00232       const char *intf);
00233 #endif
00234 
00235   PortableServer::ObjectId *servant_to_id (PortableServer::Servant p_servant);
00236 
00237   PortableServer::ObjectId *servant_to_user_id (PortableServer::Servant p_servant);
00238 
00239   CORBA::Object_ptr servant_to_reference (PortableServer::Servant p_servant);
00240 
00241   PortableServer::Servant reference_to_servant (CORBA::Object_ptr reference);
00242 
00243   PortableServer::ObjectId *reference_to_id (CORBA::Object_ptr reference);
00244 
00245   PortableServer::Servant id_to_servant (const PortableServer::ObjectId &oid);
00246 
00247   CORBA::Object_ptr id_to_reference (const PortableServer::ObjectId &oid);
00248 
00249   CORBA::OctetSeq *id (void);
00250 
00251   /// Accessor for POA policies.
00252   TAO_POA_Policy_Set &policies (void);
00253 
00254   /// Get the set policy of the given type.
00255   CORBA::Policy_ptr get_policy (CORBA::PolicyType policy);
00256 
00257   /// This method gives the policies that are exposed to the client.
00258   /// These policies are shipped within the IOR.
00259   virtual CORBA::PolicyList *client_exposed_policies (
00260       CORBA::Short object_priority);
00261 
00262   TAO_Root_POA (const String &name,
00263                 PortableServer::POAManager_ptr poa_manager,
00264                 const TAO_POA_Policy_Set &policies,
00265                 TAO_Root_POA *parent,
00266                 ACE_Lock &lock,
00267                 TAO_SYNCH_MUTEX &thread_lock,
00268                 TAO_ORB_Core &orb_core,
00269                 TAO_Object_Adapter *object_adapter);
00270 
00271   virtual ~TAO_Root_POA (void);
00272 
00273   static char name_separator (void);
00274 
00275   static CORBA::ULong name_separator_length (void);
00276 
00277   enum
00278   {
00279     TAO_OBJECTKEY_PREFIX_SIZE = 4
00280   };
00281 
00282   static CORBA::Octet const objectkey_prefix[TAO_OBJECTKEY_PREFIX_SIZE];
00283 
00284   const TAO_Object_Adapter::poa_name &folded_name (void) const;
00285 
00286   const TAO_Object_Adapter::poa_name &system_name (void) const;
00287 
00288   static void check_for_valid_wait_for_completions (
00289       const TAO_ORB_Core &orb_core,
00290       CORBA::Boolean wait_for_completion);
00291 
00292   /// ORB Core for POA.
00293   TAO_ORB_Core &orb_core (void) const;
00294 
00295   /// obtain a reference to the cached_profiles
00296   TAO::Portable_Server::Cached_Policies& cached_policies (void);
00297 
00298   /// obtain a handle to the network priority hooks
00299   TAO_Network_Priority_Hook* network_priority_hook (void);
00300 
00301   TAO::Portable_Server::Cached_Policies::PriorityModel priority_model (void) const;
00302 
00303   CORBA::Boolean cleanup_in_progress (void);
00304 
00305   /// Calls protected static method used when POACurrent is not appropriate.
00306   static int parse_ir_object_key (const TAO::ObjectKey &object_key,
00307                                   PortableServer::ObjectId &user_id);
00308 
00309   TAO_Object_Adapter &object_adapter (void);
00310 
00311   ACE_Lock &lock (void);
00312 
00313   /// Create the correct stub, properly initialized with the
00314   /// attributes and policies attached to the current POA.
00315   TAO_Stub* key_to_stub (const TAO::ObjectKey &key,
00316                          const char *type_id,
00317                          CORBA::Short priority);
00318 
00319   /// Accessor methods to POA state.
00320   /**
00321    * The POA can be in one of HOLDING, ACTIVE, DISCARDING, INACTIVE
00322    * and NON_EXISTENT states.
00323    */
00324   PortableInterceptor::AdapterState get_adapter_state (
00325     void);
00326 
00327   virtual void *thread_pool (void) const;
00328 
00329   virtual CORBA::Policy *server_protocol (void);
00330 
00331   CORBA::ULong outstanding_requests (void) const;
00332 
00333   const ACE_CString &name (void) const;
00334 
00335   CORBA::Boolean waiting_destruction (void) const;
00336 
00337   static void ort_adapter_factory_name (const char *name);
00338 
00339   static const char *ort_adapter_factory_name (void);
00340 
00341   /// Sets the value of TAO_POA_Static_Resources::imr_client_adapter_name_.
00342   static void imr_client_adapter_name (const char *name);
00343 
00344   /// Gets the value of TAO_POA_Static_Resources::imr_client_adapter_name_.
00345   static const char *imr_client_adapter_name (void);
00346 
00347   CORBA::Object_ptr invoke_key_to_object (void);
00348 
00349   CORBA::Boolean system_id (void);
00350 
00351   CORBA::ULong waiting_servant_deactivation (void) const;
00352 
00353   /// Return the POA Manager related to this POA
00354   TAO_POA_Manager &tao_poa_manager ();
00355 
00356   bool is_poa_generated (CORBA::Object_ptr reference,
00357                          PortableServer::ObjectId &system_id
00358                         );
00359 
00360   /*
00361    * Validate if the servant may be activated
00362    * @retval true This servant may be activated
00363    * @retval false This servant may not be activated
00364    */
00365   bool is_servant_activation_allowed (
00366     PortableServer::Servant servant,
00367     bool &wait_occurred_restart_call);
00368 
00369   int rebind_using_user_id_and_system_id (
00370     PortableServer::Servant servant,
00371     const PortableServer::ObjectId &user_id,
00372     const PortableServer::ObjectId &system_id,
00373     TAO::Portable_Server::Servant_Upcall &servant_upcall);
00374 
00375   CORBA::Boolean servant_has_remaining_activations (
00376     PortableServer::Servant servant);
00377 
00378   bool allow_implicit_activation (void) const;
00379 
00380   bool allow_multiple_activations (void) const;
00381 
00382   int is_servant_active (
00383     PortableServer::Servant servant,
00384     bool &wait_occurred_restart_call);
00385 
00386   void deactivate_object_i (const PortableServer::ObjectId &oid);
00387 
00388   CORBA::Boolean is_persistent (void) const;
00389 
00390   CORBA::Short server_priority (void) const;
00391 
00392   bool has_system_id (void) const;
00393 
00394   PortableServer::Servant find_servant (const PortableServer::ObjectId &system_id);
00395 
00396   TAO_SERVANT_LOCATION servant_present (
00397     const PortableServer::ObjectId &system_id,
00398     PortableServer::Servant &servant);
00399 
00400   PortableServer::Servant find_servant (
00401         const PortableServer::ObjectId &system_id,
00402         TAO::Portable_Server::Servant_Upcall &servant_upcall,
00403         TAO::Portable_Server::POA_Current_Impl &poa_current_impl);
00404 
00405   /**
00406    * Find the the servant with ObjectId <system_id>, and retrieve
00407    * its priority.Usually used in RT CORBA with SERVER_DECLARED
00408    * priority model.
00409    *
00410    * @return -1 if servant does not exist, else 0 indicating the
00411    * servant exists and priority successfully retrieved.
00412    */
00413   int find_servant_priority (
00414         const PortableServer::ObjectId &system_id,
00415         CORBA::Short &priority);
00416 
00417   int unbind_using_user_id (const PortableServer::ObjectId &user_id);
00418 
00419   void cleanup_servant (
00420     PortableServer::Servant servant,
00421     const PortableServer::ObjectId &user_id
00422    );
00423 
00424   void post_invoke_servant_cleanup(
00425     const PortableServer::ObjectId &system_id,
00426     const TAO::Portable_Server::Servant_Upcall &servant_upcall);
00427 
00428    bool validate_lifespan (
00429     CORBA::Boolean is_persistent,
00430     const TAO::Portable_Server::Temporary_Creation_Time& creation_time) const;
00431 
00432   PortableServer::ObjectId *activate_object_i (
00433       PortableServer::Servant p_servant,
00434       CORBA::Short priority,
00435       bool &wait_occurred_restart_call
00436 
00437     );
00438 
00439   CORBA::Object_ptr id_to_reference_i (const PortableServer::ObjectId &oid,
00440                                        bool indirect);
00441 
00442   PortableServer::ObjectId *servant_to_id_i (PortableServer::Servant servant);
00443 
00444   TAO_SYNCH_CONDITION &servant_deactivation_condition (void);
00445 
00446   int is_poa_generated_id (const PortableServer::ObjectId &id);
00447 
00448   /// Check the state of this POA
00449   void check_state (void);
00450 
00451   int delete_child (const String &child);
00452 
00453   PortableServer::Servant user_id_to_servant_i (const PortableServer::ObjectId &oid);
00454 
00455   virtual CORBA::ORB_ptr _get_orb (void);
00456 
00457   /// These hooks are needed by the CSD strategy to override
00458   /// and no-ops by default.
00459 
00460   /// Hook - The POA has been (or is being) activated.
00461   virtual void poa_activated_hook ();
00462 
00463   /// Hook - The POA has been deactivated.
00464   virtual void poa_deactivated_hook ();
00465 
00466   /// Hook - A servant has been activated.
00467   virtual void servant_activated_hook (PortableServer::Servant servant,
00468                                const PortableServer::ObjectId& oid);
00469 
00470   /// Hook - A servant has been deactivated.
00471   virtual void servant_deactivated_hook (PortableServer::Servant servant,
00472                                  const PortableServer::ObjectId& oid);
00473 
00474 protected:
00475 
00476 #if (TAO_HAS_MINIMUM_POA == 0)
00477   int enter (void);
00478 
00479   int exit (void);
00480 #endif /* TAO_HAS_MINIMUM_POA == 0 */
00481 
00482 #if ! defined (CORBA_E_MICRO)
00483   /// Template method for creating new POA's of this type.
00484   virtual TAO_Root_POA *new_POA (const String &name,
00485                             PortableServer::POAManager_ptr poa_manager,
00486                             const TAO_POA_Policy_Set &policies,
00487                             TAO_Root_POA *parent,
00488                             ACE_Lock &lock,
00489                             TAO_SYNCH_MUTEX &thread_lock,
00490                             TAO_ORB_Core &orb_core,
00491                             TAO_Object_Adapter *object_adapter);
00492 
00493   PortableServer::POA_ptr create_POA_i (
00494       const char *adapter_name,
00495       PortableServer::POAManager_ptr poa_manager,
00496       const CORBA::PolicyList &policies);
00497 
00498   PortableServer::POA_ptr create_POA_i (const String &adapter_name,
00499                                         PortableServer::POAManager_ptr poa_manager,
00500                                         const TAO_POA_Policy_Set &policies);
00501 
00502   TAO_Root_POA *find_POA_i (const ACE_CString &child_name,
00503                             CORBA::Boolean activate_it);
00504 #endif
00505 
00506   void destroy_i (CORBA::Boolean etherealize_objects,
00507                   CORBA::Boolean wait_for_completion);
00508 
00509   void complete_destruction_i (void);
00510 
00511   PortableServer::POAList *the_children_i (void);
00512 
00513   /// This method returns the adapter_name as a sequence of strings of
00514   /// length one or more or just a fixed name depending on the Object
00515   /// Adapter. Added wrt to ORT Spec.
00516   PortableInterceptor::AdapterName *adapter_name_i (void);
00517 
00518   /// Method to notify the IOR Interceptors when there is a state
00519   /// changed not related to POAManager.
00520   void adapter_state_changed (
00521       const TAO::ORT_Array &array_obj_ref_template,
00522       PortableInterceptor::AdapterState state);
00523 
00524   /// Add the given tagged component to all profiles.
00525   void add_ior_component (TAO_MProfile & mprofile,
00526                           const IOP::TaggedComponent & component);
00527 
00528   /// Add the given tagged component to all profiles matching the given
00529   /// ProfileId.
00530   void add_ior_component_to_profile (TAO_MProfile & mprofile,
00531                                      const IOP::TaggedComponent & component,
00532                                      IOP::ProfileId profile_id);
00533 
00534   /// Wrapper for the ORB's key_to_object that will alter the object pointer
00535   /// if the ImplRepo is used.
00536   CORBA::Object_ptr key_to_object (const TAO::ObjectKey &key,
00537                                    const char *type_id,
00538                                    TAO_ServantBase *servant,
00539                                    CORBA::Boolean collocated,
00540                                    CORBA::Short priority,
00541                                    bool indirect);
00542 
00543   /// Like key_to_stub() but assume that the ORB is not shutting down.
00544   virtual TAO_Stub* key_to_stub_i (const TAO::ObjectKey &key,
00545                                    const char *type_id,
00546                                    CORBA::Short priority);
00547 
00548   TAO_Stub *create_stub_object (const TAO::ObjectKey &object_key,
00549                                 const char *type_id,
00550                                 CORBA::PolicyList *policy_list,
00551                                 TAO_Acceptor_Filter *filter,
00552                                 TAO_Acceptor_Registry &acceptor_registry);
00553 
00554   PortableServer::Servant get_servant_i (void);
00555 
00556 protected:
00557 #if !defined (CORBA_E_MICRO)
00558   void activate_object_with_id_i (const PortableServer::ObjectId &id,
00559                                   PortableServer::Servant p_servant,
00560                                   CORBA::Short priority,
00561                                   bool &wait_occurred_restart_call);
00562 #endif
00563 
00564   virtual void remove_from_parent_i (void);
00565 
00566   void deactivate_all_objects_i (CORBA::Boolean etherealize_objects);
00567 
00568   void deactivate_all_objects_i (CORBA::Boolean etherealize_objects,
00569                                  CORBA::Boolean wait_for_completion);
00570 
00571   void wait_for_completions (CORBA::Boolean wait_for_completion);
00572 
00573   CORBA::Object_ptr create_reference_i (const char *intf,
00574                                         CORBA::Short priority);
00575 
00576   CORBA::Object_ptr create_reference_with_id_i (
00577       const PortableServer::ObjectId &oid,
00578       const char *intf,
00579       CORBA::Short priority);
00580 
00581   PortableServer::Servant reference_to_servant_i (CORBA::Object_ptr reference);
00582 
00583   CORBA::Object_ptr servant_to_reference_i (PortableServer::Servant p_servant);
00584 
00585   PortableServer::Servant id_to_servant_i (const PortableServer::ObjectId &oid);
00586 
00587   /// Call the IORInterceptor::establish_components() method on all
00588   /// registered IORInterceptors.
00589   /**
00590    * This method calls IORInterceptor::establish_components() method
00591    * on all registered IORInterceptors, and
00592    * IORInterceptor::components_established() once the former is
00593    * completed.
00594    */
00595   void establish_components (void);
00596 
00597   /// Call the IORInterceptor::components_established() method on all
00598   /// registered IORInterceptors.
00599   void components_established (PortableInterceptor::IORInfo_ptr info);
00600 
00601   void set_folded_name (TAO_Root_POA *parent);
00602 
00603   void set_id (TAO_Root_POA *parent);
00604 
00605   TAO::ObjectKey *create_object_key (const PortableServer::ObjectId &id);
00606 
00607   static int parse_key (const TAO::ObjectKey &key,
00608                         TAO_Object_Adapter::poa_name &poa_system_name,
00609                         PortableServer::ObjectId &system_id,
00610                         CORBA::Boolean &is_root,
00611                         CORBA::Boolean &is_persistent,
00612                         CORBA::Boolean &is_system_id,
00613                         TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time);
00614 
00615 protected:
00616   /// Accessor methods to ObjectReferenceTemplate
00617   PortableInterceptor::ObjectReferenceTemplate *
00618     get_adapter_template (void);
00619 
00620   /// Accessor methods to ObjectReferenceTemplate, non locked version
00621   PortableInterceptor::ObjectReferenceTemplate *get_adapter_template_i (void);
00622 
00623   /// Accessor methods to PortableInterceptor::ObjectReferenceFactory
00624   PortableInterceptor::ObjectReferenceFactory *
00625     get_obj_ref_factory (void);
00626 
00627   /// Set the object reference factory
00628   void set_obj_ref_factory (
00629     PortableInterceptor::ObjectReferenceFactory *current_factory);
00630 
00631 
00632   TAO_SERVANT_LOCATION locate_servant_i (const PortableServer::ObjectId &id,
00633                                          PortableServer::Servant &servant);
00634 
00635   PortableServer::Servant locate_servant_i (
00636       const char *operation,
00637       const PortableServer::ObjectId &id,
00638       TAO::Portable_Server::Servant_Upcall &servant_upcall,
00639       TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
00640       bool &wait_occurred_restart_call);
00641 
00642 public:
00643     // @todo Temporarily for servant retention
00644   CORBA::Object_ptr
00645   invoke_key_to_object_helper_i (const char * repository_id,
00646                                  const PortableServer::ObjectId & id);
00647 protected:
00648 
00649   /// Get the ORT adapter, in case there is no adapter yet, this method will
00650   /// try to create one and hold the POA lock
00651   TAO::ORT_Adapter *ORT_adapter (void);
00652 
00653   /// Get the ORT adapter, in case there is no adapter yet, this method will
00654   /// try to create one but assumes the POA lock is already hold
00655   TAO::ORT_Adapter *ORT_adapter_i (void);
00656 
00657   TAO::ORT_Adapter_Factory *ORT_adapter_factory (void);
00658 
00659   CORBA::Boolean persistent (void);
00660 
00661   static char persistent_key_char (void);
00662 
00663   static char transient_key_char (void);
00664 
00665   static CORBA::ULong persistent_key_type_length (void);
00666 
00667   static char system_id_key_char (void);
00668 
00669   static char user_id_key_char (void);
00670 
00671   static CORBA::ULong system_id_key_type_length (void);
00672 
00673   virtual CORBA::Boolean root (void) const;
00674 
00675   virtual char root_key_type (void);
00676 
00677   static char root_key_char (void);
00678 
00679   static char non_root_key_char (void);
00680 
00681   static CORBA::ULong root_key_type_length (void);
00682 
00683   void outstanding_requests (CORBA::ULong new_outstanding_requests);
00684 
00685   CORBA::ULong increment_outstanding_requests (void);
00686 
00687   CORBA::ULong decrement_outstanding_requests (void);
00688 
00689   String name_;
00690 
00691   /// Reference to the POAManager that this poa assicuates with.
00692   TAO_POA_Manager &poa_manager_;
00693 
00694 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00695   /// Reference to the POAManagerFactory that generate the POAManager.
00696   TAO_POAManager_Factory& poa_manager_factory_;
00697 #endif
00698 
00699   IOP::TaggedComponentSeq tagged_component_;
00700 
00701   IOP::TaggedComponentSeq tagged_component_id_;
00702 
00703   ACE_Array_Base <IOP::ProfileId> profile_id_array_;
00704 
00705   TAO_POA_Policy_Set policies_;
00706 
00707   TAO_Object_Adapter::poa_name folded_name_;
00708 
00709   TAO_Object_Adapter::poa_name_var system_name_;
00710 
00711   CORBA::OctetSeq id_;
00712 
00713   /// Pointer to the object reference template adapter.
00714   TAO::ORT_Adapter *ort_adapter_;
00715 
00716   /// Adapter can be accepting, rejecting etc.
00717   PortableInterceptor::AdapterState adapter_state_;
00718 
00719   TAO::Portable_Server::Cached_Policies cached_policies_;
00720 
00721   TAO_Network_Priority_Hook *network_priority_hook_;
00722 
00723   TAO::Portable_Server::Active_Policy_Strategies active_policy_strategies_;
00724 
00725 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00726   PortableServer::AdapterActivator_var adapter_activator_;
00727 #endif /* TAO_HAS_MINIMUM_POA == 0 !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) */
00728 
00729   typedef
00730     ACE_Hash_Map_Manager_Ex<
00731         ACE_CString, TAO_Root_POA *,
00732         ACE_Hash<ACE_CString>,
00733         ACE_Equal_To<ACE_CString>,
00734         ACE_Null_Mutex
00735       >
00736     CHILDREN;
00737 
00738   CHILDREN children_;
00739 
00740   ACE_Lock &lock_;
00741 
00742   TAO_ORB_Core &orb_core_;
00743 
00744   /// The object adapter we belong to
00745   TAO_Object_Adapter *object_adapter_;
00746 
00747   CORBA::Boolean cleanup_in_progress_;
00748 
00749   CORBA::ULong outstanding_requests_;
00750 
00751   TAO_SYNCH_CONDITION outstanding_requests_condition_;
00752 
00753   CORBA::Boolean wait_for_completion_pending_;
00754 
00755   CORBA::Boolean waiting_destruction_;
00756 
00757   TAO_SYNCH_CONDITION servant_deactivation_condition_;
00758 
00759 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00760   TAO_Acceptor_Filter_Factory * filter_factory_;
00761 #endif
00762 
00763 public:
00764     // @todo Temporarily for servant retention
00765   CORBA::ULong caller_key_to_object_;
00766 
00767   PortableServer::Servant servant_for_key_to_object_;
00768 
00769   struct Key_To_Object_Params
00770   {
00771     PortableServer::ObjectId_var *system_id_;
00772     const char *type_id_;
00773     TAO_ServantBase *servant_;
00774     CORBA::Boolean collocated_;
00775     CORBA::Short priority_;
00776     bool indirect_;
00777 
00778     void set (PortableServer::ObjectId_var &system_id_,
00779               const char *type_id_,
00780               TAO_ServantBase *servant_,
00781               CORBA::Boolean collocated_,
00782               CORBA::Short priority_,
00783               bool indirect);
00784   };
00785 
00786   Key_To_Object_Params key_to_object_params_;
00787 };
00788 
00789 /**
00790  * @class TAO_POA_Static_Resources
00791  *
00792  * @brief The static (global) resoures of all POA's.
00793  *
00794  * This class is used by the POA to store the resources global to
00795  * all POA's.  All instance variables that would have been
00796  * declared "static" in TAO_Regular_POA, should be declared in this class
00797  * to avoid the "static initialization order fiasco" as described in
00798  * http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.11.
00799  * Briefly, this is the problem that occurs if any static initializers
00800  * in any other code call into set static members of TAO_Regular_POA.
00801  * Since the order in which these initializers execute is unspecified,
00802  * uninitialized members can be accessed.
00803  */
00804 class TAO_PortableServer_Export TAO_POA_Static_Resources
00805 {
00806 public:
00807 
00808   /// Return the singleton instance.
00809   static TAO_POA_Static_Resources* instance (void);
00810 
00811 public:
00812 
00813   /**
00814    * Name of the factory object used to adapt function calls on the
00815    * PortableInterceptor interfaces ORT. The default value is
00816    * "ObjectReferenceTemplate_Adapter_Factory". If the ORT library is linked,
00817    * the corresponding accessor function
00818    * objectreferencefactory_adapter_factory_name() will be called to set
00819    * the value to "Concrete_ObjectReferenceTemplate_Adapter_Factory".
00820    */
00821   ACE_CString ort_adapter_factory_name_;
00822 
00823   /**
00824    * Name of the service object for functions that make calls on
00825    * the Implementation Repository. The default value is "ImR_Client_Adapter".
00826    * If TAO_IMR_CLient is linked, imr_client_adapter_name() will be
00827    * called to set the value to "Concrete_ImR_Client_Adapter".
00828    */
00829   ACE_CString imr_client_adapter_name_;
00830 private:
00831   /// Constructor.
00832   TAO_POA_Static_Resources (void);
00833 
00834 private:
00835   /// The singleton instance.
00836   static TAO_POA_Static_Resources* instance_;
00837 
00838   /// Mostly unused variable whose sole purpose is to enforce
00839   /// the instantiation of a TAO_POA_Static_Resources instance
00840   /// at initialization time.
00841   static TAO_POA_Static_Resources* initialization_reference_;
00842 };
00843 
00844 TAO_END_VERSIONED_NAMESPACE_DECL
00845 
00846 // ****************************************************************
00847 
00848 #if defined(_MSC_VER)
00849 #pragma warning(pop)
00850 #endif /* _MSC_VER */
00851 
00852 #if defined (__ACE_INLINE__)
00853 # include "tao/PortableServer/Root_POA.inl"
00854 #endif /* __ACE_INLINE__ */
00855 
00856 #include /**/ "ace/post.h"
00857 
00858 #endif /* TAO_ROOT_POA_H */

Generated on Tue Feb 2 17:40:54 2010 for TAO_PortableServer by  doxygen 1.4.7