#include <Connector_Registry.h>
Collaboration diagram for TAO_Connector_Registry:
Public Member Functions | |
TAO_Connector_Registry (void) | |
Default constructor. | |
~TAO_Connector_Registry (void) | |
Default destructor. | |
TAO_Connector * | get_connector (CORBA::ULong tag) const |
Return the connector bridges. | |
int | open (TAO_ORB_Core *orb_core) |
Initialize all registered connectors. | |
int | close_all (void) |
Close all open connectors. | |
int | make_mprofile (const char *ior, TAO_MProfile &mprofile) |
TAO_Profile * | create_profile (TAO_InputCDR &cdr) |
Create a profile based on the contents of cdr. | |
char | object_key_delimiter (const char *ior) |
TAO_ConnectorSetIterator | begin (void) const |
TAO_ConnectorSetIterator | end (void) const |
Private Member Functions | |
TAO_Connector_Registry (const TAO_Connector_Registry &) | |
void | operator= (const TAO_Connector_Registry &) |
Private Attributes | |
TAO_Connector ** | connectors_ |
List of connectors that are currently open. | |
size_t | size_ |
Number of connectors that are currently open. |
Connector Registry and Generic Connector interface definitions. All loaded ESIOP or GIOP connector bridges must register with this object. This class is able to dynamically load a set of concrete protocol connectors which have registered with the service configurator and added their Factory name to the Resource_Factory line of the svc.conf file.
Definition at line 58 of file Connector_Registry.h.
|
Default constructor.
Definition at line 25 of file Connector_Registry.cpp.
00026 : connectors_ (0), 00027 size_ (0) 00028 { 00029 } |
|
Default destructor.
Definition at line 31 of file Connector_Registry.cpp. References close_all(), and connectors_.
00032 { 00033 this->close_all (); 00034 00035 delete [] this->connectors_; 00036 } |
|
|
|
Definition at line 8 of file Connector_Registry.i. References connectors_. Referenced by close_all(), get_connector(), make_mprofile(), object_key_delimiter(), and TAO_CORBALOC_Parser::parse_string().
00009 { 00010 return this->connectors_; 00011 } |
|
Close all open connectors.
Definition at line 99 of file Connector_Registry.cpp. References begin(), TAO_Connector::close(), end(), and TAO_ConnectorSetIterator. Referenced by TAO_Thread_Lane_Resources::finalize(), and ~TAO_Connector_Registry().
00100 { 00101 const TAO_ConnectorSetIterator end = this->end (); 00102 00103 for (TAO_ConnectorSetIterator i = this->begin (); 00104 i != end; 00105 ++i) 00106 { 00107 if (*i == 0) 00108 continue; 00109 00110 (*i)->close (); 00111 00112 delete *i; 00113 } 00114 00115 this->size_ = 0; 00116 00117 return 0; 00118 } |
|
Create a profile based on the contents of cdr.
Definition at line 173 of file Connector_Registry.cpp. References TAO_Profile::_decr_refcnt(), ACE_DEBUG, ACE_NEW_RETURN, ACE_TEXT, TAO_Connector::create_profile(), TAO_Profile::decode(), get_connector(), ACE_InputCDR::good_bit(), LM_DEBUG, LM_WARNING, TAO_InputCDR::orb_core(), ACE_InputCDR::skip_bytes(), TAO_debug_level, and TAO_ORB_Core_instance(). Referenced by operator>>(), and CORBA::Object::tao_object_initialize().
00174 { 00175 CORBA::ULong tag = 0; 00176 00177 // If there is an error we abort. 00178 if ((cdr >> tag) == 0) 00179 return 0; 00180 00181 TAO_Connector *connector = 00182 this->get_connector (tag); 00183 00184 if (connector == 0) 00185 { 00186 if (TAO_debug_level > 0) 00187 { 00188 ACE_DEBUG ((LM_DEBUG, 00189 ACE_TEXT ("TAO (%P|%t) Unknown profile tag 0x%x\n"), 00190 tag)); 00191 } 00192 00193 TAO_ORB_Core *orb_core = cdr.orb_core (); 00194 if (orb_core == 0) 00195 { 00196 orb_core = TAO_ORB_Core_instance (); 00197 if (TAO_debug_level > 0) 00198 { 00199 ACE_DEBUG ((LM_WARNING, 00200 ACE_TEXT ("TAO (%P|%t) - TAO_Connector_Registry") 00201 ACE_TEXT ("::create_profile: ") 00202 ACE_TEXT ("WARNING: extracting object from ") 00203 ACE_TEXT ("default ORB_Core\n"))); 00204 } 00205 } 00206 00207 00208 TAO_Profile *pfile = 0; 00209 ACE_NEW_RETURN (pfile, 00210 TAO_Unknown_Profile (tag, 00211 orb_core), 00212 0); 00213 if (pfile->decode (cdr) == -1) 00214 { 00215 pfile->_decr_refcnt (); 00216 pfile = 0; 00217 } 00218 00219 return pfile; 00220 } 00221 00222 // OK, we've got a known profile. It's going to be encapsulated 00223 // ProfileData. Create a new decoding stream and context for it, 00224 // and skip the data in the parent stream 00225 00226 // ProfileData is encoded as a sequence of octet. So first get the 00227 // length of the sequence. 00228 CORBA::ULong encap_len = 0; 00229 if ((cdr >> encap_len) == 0) 00230 return 0; 00231 00232 // Create the decoding stream from the encapsulation in the buffer, 00233 // and skip the encapsulation. 00234 TAO_InputCDR str (cdr, encap_len); 00235 00236 if (str.good_bit () == 0 00237 || cdr.skip_bytes (encap_len) == 0) 00238 return 0; 00239 00240 return connector->create_profile (str); 00241 } |
|
Definition at line 14 of file Connector_Registry.i. References connectors_. Referenced by close_all(), get_connector(), make_mprofile(), object_key_delimiter(), and TAO_CORBALOC_Parser::parse_string().
00015 { 00016 return this->connectors_ + this->size_; 00017 } |
|
Return the connector bridges.
Definition at line 39 of file Connector_Registry.cpp. References begin(), end(), and TAO_ConnectorSetIterator. Referenced by create_profile(), and TAO::Profile_Transport_Resolver::try_connect_i().
00040 { 00041 const TAO_ConnectorSetIterator end = this->end (); 00042 00043 for (TAO_ConnectorSetIterator connector = this->begin (); 00044 connector != end; 00045 ++connector) 00046 { 00047 if ((*connector)->tag () == tag) 00048 return *connector; 00049 } 00050 00051 return 0; 00052 } |
|
Parse a string containing a URL style IOR and return an MProfile. Definition at line 121 of file Connector_Registry.cpp. References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_THROW_RETURN, begin(), end(), TAO_CONNECTOR_REGISTRY_NO_USABLE_PROTOCOL, and TAO_ConnectorSetIterator. Referenced by CORBA::ORB::url_ior_string_to_object().
00124 { 00125 if (!ior) 00126 // Failure: Null IOR string pointer 00127 ACE_THROW_RETURN (CORBA::INV_OBJREF ( 00128 CORBA::SystemException::_tao_minor_code ( 00129 0, 00130 EINVAL), 00131 CORBA::COMPLETED_NO), 00132 -1); 00133 00134 const TAO_ConnectorSetIterator first_connector = this->begin (); 00135 const TAO_ConnectorSetIterator last_connector = this->end (); 00136 00137 for (TAO_ConnectorSetIterator connector = first_connector; 00138 connector != last_connector; 00139 ++connector) 00140 { 00141 if (*connector) 00142 { 00143 const int mp_result = 00144 (*connector)->make_mprofile (ior, 00145 mprofile 00146 ACE_ENV_ARG_PARAMETER); 00147 ACE_CHECK_RETURN (mp_result); 00148 00149 if (mp_result == 0) 00150 return 0; // Success 00151 } 00152 else 00153 // Failure: Null pointer to connector in connector registry. 00154 ACE_THROW_RETURN (CORBA::INV_OBJREF ( 00155 CORBA::SystemException::_tao_minor_code ( 00156 0, 00157 EINVAL), 00158 CORBA::COMPLETED_NO), 00159 -1); 00160 } 00161 00162 // Failure: None of the connectors were able to parse the URL style 00163 // IOR into an MProfile. 00164 ACE_THROW_RETURN (CORBA::INV_OBJREF ( 00165 CORBA::SystemException::_tao_minor_code ( 00166 TAO_CONNECTOR_REGISTRY_NO_USABLE_PROTOCOL, 00167 0), 00168 CORBA::COMPLETED_NO), 00169 -1); 00170 } |
|
Obtain the object key delimiter used by the protocol specified in the provided URL style IOR. Definition at line 244 of file Connector_Registry.cpp. References begin(), end(), and TAO_ConnectorSetIterator. Referenced by TAO_ORB_Core::resolve_rir().
00245 { 00246 if (!ior) 00247 { 00248 errno = EINVAL; 00249 return 0; // Failure: Null IOR string pointer 00250 } 00251 00252 const TAO_ConnectorSetIterator first_connector = this->begin (); 00253 const TAO_ConnectorSetIterator last_connector = this->end (); 00254 00255 for (TAO_ConnectorSetIterator connector = first_connector; 00256 connector != last_connector; 00257 ++connector) 00258 { 00259 if (*connector) 00260 { 00261 if ((*connector)->check_prefix (ior) == 0) 00262 return (*connector)->object_key_delimiter (); 00263 } 00264 } 00265 00266 // Failure: None of the connectors were able to match their protocol 00267 // against the provided string. 00268 return 0; 00269 } |
|
Initialize all registered connectors.
Definition at line 55 of file Connector_Registry.cpp. References ACE_ERROR_RETURN, ACE_NEW_RETURN, ACE_TEXT, ACE_TEXT_CHAR_TO_TCHAR, ACE_Unbounded_Set< T >::begin(), connectors_, ACE_Unbounded_Set< T >::end(), ACE_Auto_Basic_Ptr< X >::get(), LM_ERROR, TAO_ORB_Core::protocol_factories(), ACE_Auto_Basic_Ptr< X >::release(), ACE_Unbounded_Set< T >::size(), TAO_ProtocolFactorySet, and TAO_ProtocolFactorySetItor. Referenced by TAO_Thread_Lane_Resources::connector_registry().
00056 { 00057 TAO_ProtocolFactorySet * const pfs = 00058 orb_core->protocol_factories (); 00059 00060 // The array containing the TAO_Connectors will never contain more 00061 // than the number of loaded protocols in the ORB core. 00062 if (this->connectors_ == 0) 00063 ACE_NEW_RETURN (this->connectors_, 00064 TAO_Connector *[pfs->size ()], 00065 -1); 00066 00067 // Open one connector for each loaded protocol! 00068 const TAO_ProtocolFactorySetItor end = pfs->end (); 00069 00070 for (TAO_ProtocolFactorySetItor factory = pfs->begin (); 00071 factory != end; 00072 ++factory) 00073 { 00074 auto_ptr <TAO_Connector> connector ( 00075 (*factory)->factory ()->make_connector ()); 00076 00077 if (connector.get ()) 00078 { 00079 if (connector->open (orb_core) != 0) 00080 { 00081 ACE_ERROR_RETURN ((LM_ERROR, 00082 ACE_TEXT ("TAO (%P|%t) unable to open connector for ") 00083 ACE_TEXT ("<%s>.\n"), 00084 ACE_TEXT_CHAR_TO_TCHAR((*factory)->protocol_name ().c_str ())), 00085 -1); 00086 } 00087 00088 this->connectors_[this->size_++] = 00089 connector.release (); 00090 } 00091 else 00092 return -1; 00093 } 00094 00095 return 0; 00096 } |
|
|
|
List of connectors that are currently open.
Definition at line 100 of file Connector_Registry.h. Referenced by begin(), end(), open(), and ~TAO_Connector_Registry(). |
|
Number of connectors that are currently open.
Definition at line 103 of file Connector_Registry.h. |