Changeset 21028
- Timestamp:
- 02/10/08 08:08:25 (10 months ago)
- Files:
-
- juggler/trunk/modules/tweek/ChangeLog (modified) (1 diff)
- juggler/trunk/modules/tweek/VERSION (modified) (1 diff)
- juggler/trunk/modules/tweek/doc/programmer.guide/programmer.guide.xml (modified) (4 diffs)
- juggler/trunk/modules/tweek/tweek/CORBA/CorbaManager.cpp (modified) (4 diffs)
- juggler/trunk/modules/tweek/tweek/CORBA/CorbaManager.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
juggler/trunk/modules/tweek/ChangeLog
r21013 r21028 1 1 DATE AUTHOR CHANGE 2 2 ---------- ----------- -------------------------------------------------------- 3 2008-02-09 patrick Allow the GIOP end point to be configured using an 4 omniORB configuration. 5 NEW VERSION: 1.3.5 3 6 2008-02-09 patrick Added the ability to make direct connections to a 4 7 Subject Manager servant (that is, without involving the 5 CORBA Naming Service). 8 CORBA Naming Service). This is achieved by using 9 tweek::CorbaManager::initDirect() to set the GIOP end 10 point address. 6 11 NEW VERSION: 1.3.4 7 12 2007-09-04 patrick Use new environment variable TWEEK_DATA_DIR as a way to juggler/trunk/modules/tweek/VERSION
r21013 r21028 1 1.3.5-0 @02/10/2008 14:10:00 UTC@ 1 2 1.3.4-0 @02/10/2008 02:05:00 UTC@ 2 3 1.3.3-0 @09/05/2007 03:00:00 UTC@ juggler/trunk/modules/tweek/doc/programmer.guide/programmer.guide.xml
r21016 r21028 1155 1155 <para>Initialize to use direct connections to the Subject 1156 1156 Manager. This capability, while not at all new to CORBA, is 1157 new in Tweek 1.3. 4. Using this approach, there need not be a1157 new in Tweek 1.3.5. Using this approach, there need not be a 1158 1158 CORBA Naming Service at all. Instead, the client connects 1159 directly to the Subject Manager on the ORB endpoint using a1160 <literal>corbaloc</literal> URI. The simplicity of this1159 directly to the Subject Manager on the GIOP end point using 1160 a <literal>corbaloc</literal> URI. The simplicity of this 1161 1161 approach offers a key benefit over the use of the CORBA 1162 1162 Naming Service. However, if there are multiple CORBA Manager 1163 1163 instances running in a single memory space, each must have 1164 its end point port number set to a different value. Such a1164 its end point port number set to a different value. Such a 1165 1165 detail, while still critical in any event, would be hidden 1166 1166 by the use of the CORBA Naming Service.</para> … … 1397 1397 { 1398 1398 // Initialize the CORBA Manager to use a direct 1399 // connection to the Subject Manager. The ORB endpoint1400 // will be bound to port 12345 on the default network1401 / /interface.1399 // connection to the Subject Manager. The GIOP end 1400 // point will be bound to port 12345 on the default 1401 / network interface. 1402 1402 if ( mgr.initDirect("example", argc, argv, "", 12345) ) <co 1403 1403 id="TweekApp.cpp.mgr.initDirect.gen" … … 1503 1503 we call 1504 1504 <methodname>tweek::CorbaManager::initDirect()</methodname> 1505 and provide the address and port number for the ORB1506 end point. In this case, we have used an empty string1507 for the end point address to indicate that we want to1505 and provide the address and port number for the GIOP 1506 end point. In this case, we have used an empty string 1507 for the end point address to indicate that we want to 1508 1508 bind to the default network interface.</para> 1509 1509 </callout> 1510 1510 </calloutlist> 1511 1511 </example> 1512 1513 <para>The above example sets the GIOP end point address and 1514 port number explicitly through the 1515 <varname>endPointAddress</varname> and 1516 <varname>endPointPort</varname> parameters of the 1517 <methodname>tweek::CorbaManager::initDirect()</methodname> 1518 method. These parameters, however, are optional. If 1519 <varname>endPointPort</varname> is 0 (the default), then the 1520 code falls back on expecting the user to have configured the 1521 GIOP end point through an omniORB configuration file. In that 1522 case, the configuration file must be identified through the 1523 <envar>OMNIORB_CONFIG</envar> environment variable. Without 1524 doing so, omniORB would use a randomly assigned free port for 1525 the GIOP end point, and it would be difficult, though not 1526 impossible, to make the direct connection. There is a lot of 1527 flexibility offered in configuring the GIOP end point address 1528 through the omniORB configuration file, and interested readers 1529 are referred to the <ulink 1530 url="http://omniorb.sourceforge.net/docs.html">omniORB 4.x 1531 documentation</ulink> for more information. Furthermore, the 1532 example <filename>omniORB4.cfg</filename> that comes with Tweek 1533 includes a long explanation of how to configure the GIOP end 1534 point address.</para> 1535 1536 <caution> 1537 <para>It is still possible to end up with no explicit GIOP 1538 end point address set when relying on 1539 <filename>omniORB4.cfg</filename>. If tne 1540 <literal>endPoint</literal> property is not assigned a 1541 value, then omniORB will still use the randomly assigned 1542 free port number for the end piont listening address.</para> 1543 </caution> 1512 1544 </section> 1513 1545 </section> … … 1756 1788 Naming Service, there is no need to worry about this 1757 1789 because, presumably, the user of the client software knows 1758 the ORB endpoint address of interest.</para>1790 the GIOP end point address of interest.</para> 1759 1791 </sidebar> 1760 1792 juggler/trunk/modules/tweek/tweek/CORBA/CorbaManager.cpp
r21013 r21028 33 33 34 34 #include <vpr/vpr.h> 35 #include <vpr/System.h> 35 36 #include <vpr/Util/Debug.h> 36 37 #include <vpr/Util/Assert.h> … … 197 198 198 199 bool CorbaManager::initDirect(const std::string& localID, int& argc, 199 char** argv, const std::string& listenAddr,200 const vpr::Uint16 listenPort)200 char** argv, const std::string& endPointAddr, 201 const vpr::Uint16 endPointPort) 201 202 { 202 203 bool status(true); … … 211 212 { 212 213 std::ostringstream end_point_stream; 213 end_point_stream << "giop:tcp:" << listenAddr << ":" << listenPort; 214 215 const char* options[][2] = { 216 { "endPoint", NULL }, 217 { NULL, NULL } 218 }; 219 options[0][1] = strdup(end_point_stream.str().c_str()); 220 221 vprDEBUG(tweekDBG_CORBA, vprDBG_CONFIG_LVL) 222 << "CORBA endpiont: '" << options[0][1] << "'\n" << vprDEBUG_FLUSH; 214 215 const char* options[2][2] = { { NULL, NULL }, { NULL, NULL } }; 216 217 // If endPointPort is 0, then we will fall back on OMNIORB_CONFIG to 218 // provide the GIOP end point setting. 219 if ( endPointPort == 0 ) 220 { 221 #ifdef OMNIORB_VER 222 std::string temp; 223 224 // Test to determine whether the OMNIORB_CONFIG environment variable 225 // is set. 226 if ( ! vpr::System::getenv("OMNIORB_CONFIG", temp) ) 227 { 228 // If the user does not have the OMNIORB_CONFIG environment 229 // variable set, then we have no way to get the GIOP end point 230 // configured. As such, we have to return error status. 231 vprDEBUG(vprDBG_ALL, vprDBG_CRITICAL_LVL) 232 << clrOutBOLD(clrRED, "ERROR") 233 << ": OMNIORB_CONFIG not set and no end point port specified!" 234 << std::endl; 235 vprDEBUG_NEXTnl(vprDBG_ALL, vprDBG_CRITICAL_LVL) 236 << " Cannot bind CORBA Manager to a specific end point.\n" 237 << vprDEBUG_FLUSH; 238 return false; 239 } 240 #endif 241 } 242 // With the end point address and port number set through the method 243 // parameters, we construct the endPoint string and assign it to the 244 // first row in the options table. 245 else 246 { 247 end_point_stream << "giop:tcp:" << endPointAddr << ":" 248 << endPointPort; 249 250 options[0][0] = strdup("endPoint"); 251 options[0][1] = strdup(end_point_stream.str().c_str()); 252 253 vprDEBUG(tweekDBG_CORBA, vprDBG_CONFIG_LVL) 254 << "GIOP end piont: '" << options[0][1] << "'\n" 255 << vprDEBUG_FLUSH; 256 } 223 257 224 258 // Initialize the ORB. … … 228 262 mORB = CORBA::ORB_init(argc, argv, TWEEK_ORB_VER_STRING, options); 229 263 230 // Yes, this could be done with a simple C-style cast, but the C++ cast 231 // operations exist for a reason. 232 std::free(reinterpret_cast<void*>(const_cast<char*>(options[0][1]))); 233 options[0][1] = NULL; 264 if ( options[0][0] != NULL ) 265 { 266 // Yes, each of these could be done with a simple C-style cast, but 267 // the C++ cast operations exist for a reason. 268 std::free(reinterpret_cast<void*>(const_cast<char*>(options[0][0]))); 269 std::free(reinterpret_cast<void*>(const_cast<char*>(options[0][1]))); 270 options[0][0] = NULL; 271 options[0][1] = NULL; 272 } 234 273 235 274 status = createChildPOA(localID, PortableServer::UNIQUE_ID, true); juggler/trunk/modules/tweek/tweek/CORBA/CorbaManager.h
r21022 r21028 127 127 * implementation. 128 128 * 129 * If the port number passed in through \p endPointPort is 0, then we fall 130 * back on using the omniORB configuration file (as specified through the 131 * \c OMNIORB_CONFIG environment variable) to determine the GIOP end point 132 * address. In this way, users have the opportunity to customize the GIOP 133 * end point address with a great deal of flexibility. 134 * 129 135 * @pre This CorbaManager object has not been initialized previously. 130 136 * 131 * @param localID A string providing a unique identifier for the 132 * local POA. When used, "tweek_" will be prepended 133 * to this value, but user-level code should generally 134 * not need to worry aubot that detail. 135 * @param argc The size of the following argument vector. This 136 * will be modified if any elements are removed from 137 * argv. 138 * @param argv The command-line arguments passed to the 139 * application. These may include parameters defining 140 * the ORB's behavior. Those recognized as ORB 141 * arguments are removed from the array leaving 142 * application parameters. 143 * @param listenAddress The network address on the local machine to which 144 * the ORB endpoint will be bound. If an empty string 145 * is used, the default network interface will be 146 * used. Typically, a non-empty address will be passed 147 * in for this parameter only on multi-homed machines 148 * when a specific network interface must be used for 149 * the ORB endpoint. 150 * @param listenPort The port on which the ORB endpoint will listen for 151 * incoming connections. As with any port number, it 152 * must not be one that is currently in use by another 153 * listening socket. 137 * @param localID A string providing a unique identifier for the 138 * local POA. When used, "tweek_" will be prepended 139 * to this value, but user-level code should 140 * generally not need to worry aubot that detail. 141 * @param argc The size of the following argument vector. This 142 * will be modified if any elements are removed from 143 * argv. 144 * @param argv The command-line arguments passed to the 145 * application. These may include parameters 146 * defining the ORB's behavior. Those recognized as 147 * ORB arguments are removed from the array leaving 148 * application parameters. 149 * @param endPointAddress The network address on the local machine to which 150 * the GIOP end point will be bound. If an empty 151 * string is used (which is the default value for 152 * this parameter), the default network interface 153 * will be used. Typically, a non-empty address will 154 * be passed in for this parameter only on 155 * multi-homed machines when a specific network 156 * interface must be used for the GIOP end point. 157 * @param endPointPort The port on which the GIOP end point will listen 158 * for incoming connections. As with any port 159 * number, it must not be one that is currently in 160 * use by another listening socket. The default 161 * value for this parameter is 0, and if 0 is used 162 * as the value, then the GIOP end point will be set 163 * by looking to the omniORB configuration file. 154 164 * 155 165 * @return \c true is returned if initialization completes successfully. 156 * Otherwise, \c false is returned. 166 * Otherwise, \c false is returned. \c false will be returned if 167 * the value of \p endPointPort is 0 set and the \c OMNIORB_CONFIG 168 * environment variable is not set. 157 169 * 158 170 * @since 1.3.4 159 171 */ 160 172 bool initDirect(const std::string& localID, int& argc, char** argv, 161 const std::string& listenAddress,162 const vpr::Uint16 listenPort);173 const std::string& endPointAddress = "", 174 const vpr::Uint16 endPointPort = 0); 163 175 164 176 /**
