00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Adapter_Registry.h 00006 * 00007 * $Id: Adapter_Registry.h 76995 2007-02-11 12:51:42Z johnnyw $ 00008 * 00009 * @author Carlos O'Ryan (coryan@uci.edu) 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_ADAPTER_REGISTRY_H 00014 #define TAO_ADAPTER_REGISTRY_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00019 # pragma once 00020 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00021 00022 #include "tao/CORBA_methods.h" 00023 00024 #if defined(_MSC_VER) 00025 #pragma warning(push) 00026 #pragma warning(disable:4250) 00027 #endif /* _MSC_VER */ 00028 00029 #include "tao/Pseudo_VarOut_T.h" 00030 00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00032 00033 namespace CORBA 00034 { 00035 typedef TAO_Pseudo_Var_T<Object> Object_var; 00036 typedef TAO_Pseudo_Out_T<Object> Object_out; 00037 } 00038 00039 namespace TAO 00040 { 00041 class ObjectKey; 00042 } 00043 00044 class TAO_ORB_Core; 00045 class TAO_Stub; 00046 class TAO_MProfile; 00047 class TAO_ServerRequest; 00048 class TAO_Adapter; 00049 00050 class TAO_Export TAO_Adapter_Registry 00051 { 00052 public: 00053 TAO_Adapter_Registry (TAO_ORB_Core *orb_core); 00054 00055 /// Close the 00056 ~TAO_Adapter_Registry (void); 00057 00058 /** 00059 * Close each of of the Adapters and then cleanup the Registry. 00060 * It is possible that an Adapter will reject a close() call if it 00061 * is invoked in an innapropriate context (think shutting down the 00062 * POA while performing an upcall). 00063 */ 00064 void close (int wait_for_completion 00065 ); 00066 00067 /** 00068 * Verify if the close() call can be invoked in the current 00069 * context for *all* adapters. 00070 * Raise the right exception if not. 00071 */ 00072 void check_close (int wait_for_completion 00073 ); 00074 00075 /// Insert a new adapter into the registry. 00076 void insert (TAO_Adapter *adapter 00077 ); 00078 00079 /** 00080 * Dispatch the request to all the adapters. 00081 * It tries the adapters ordered by priority, stopping when the 00082 * adapter returns a status different from DS_MISMATCHED_KEY 00083 */ 00084 void dispatch (TAO::ObjectKey &key, 00085 TAO_ServerRequest &request, 00086 CORBA::Object_out forward_to 00087 ); 00088 00089 /// Create a collocated object using the given profile and stub. 00090 CORBA::Object_ptr create_collocated_object (TAO_Stub *, 00091 const TAO_MProfile &); 00092 00093 /// Initialize a collocated object using the given stub and object 00094 /// pointer for lazily evaluated object references. 00095 CORBA::Long initialize_collocated_object (TAO_Stub *); 00096 00097 /// Fetch the adapter named @a name 00098 TAO_Adapter *find_adapter (const char *name) const; 00099 00100 private: 00101 /// The ORB Core 00102 TAO_ORB_Core *orb_core_; 00103 00104 /** 00105 * @name A simple array of adapters. 00106 */ 00107 //@{ 00108 size_t adapters_capacity_; 00109 size_t adapters_count_; 00110 TAO_Adapter **adapters_; 00111 //@} 00112 }; 00113 00114 TAO_END_VERSIONED_NAMESPACE_DECL 00115 00116 #if defined(_MSC_VER) 00117 #pragma warning(pop) 00118 #endif /* _MSC_VER */ 00119 00120 #include /**/ "ace/post.h" 00121 00122 #endif /* TAO_ADAPTER_REGISTRY_H */