Root_POA.h

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

Generated on Thu Nov 9 12:40:43 2006 for TAO_PortableServer by doxygen 1.3.6