![]() |
|
|
Bdb packages | Design docs | Source docs | Guidelines | Recent releases |
|
Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members /BdbCondRemote/BdbCondRemoteAccessor.cc
Go to the documentation of this file.00001 //----------------------------------------------------------------------------- 00002 // 00003 // File and Version Information: 00004 // $Id: BdbCondRemoteAccessor.cc,v 1.11 2002/06/21 18:49:55 ryd Exp $ 00005 // 00006 // Description: 00007 // This class implements an interface of its base class BdbCondAccessor. 00008 // 00009 // The current implementation provides remote access to the methadata 00010 // through TAO/CORBA. 00011 // 00012 // Environment: 00013 // Software developed for the BaBar Detector at the SLAC B-Factory. 00014 // 00015 // Author List: 00016 // Igor A. Gaponenko Original Author 00017 // 00018 // Copyright Information: 00019 // Copyright (C) 2000 Lawrence Berkeley Laboratory 00020 // 00021 //----------------------------------------------------------------------------- 00022 #include "BaBar/BaBar.hh" 00023 00024 // Work around a bug in ACE/TAO with DEC CXX6.3 00025 #include <string.h> 00026 00027 // ------------------------- 00028 // -- This Class's Header -- 00029 // ------------------------- 00030 00031 #include "BdbCondRemote/BdbCondRemoteAccessor.hh" 00032 00033 // ------------------------- 00034 // -- Objectivity Headers -- 00035 // ------------------------- 00036 00037 // ------------------- 00038 // -- BaBar Headers -- 00039 // ------------------- 00040 00041 // ---------------------------- 00042 // -- BaBar Database Headers -- 00043 // ---------------------------- 00044 00045 #include "BdbCond/BdbConditions.hh" 00046 #include "BdbCond/BdbDatabase.hh" 00047 00048 // --------------- 00049 // -- C Headers -- 00050 // --------------- 00051 00052 extern "C" { 00053 #include <assert.h> 00054 } 00055 00056 // --------------------------------- 00057 // -- Collaborating Class Headers -- 00058 // --------------------------------- 00059 00060 #include "TaoTools/TaoClient.hh" 00061 #include "ErrLogger/ErrLog.hh" 00062 00063 // -------------------------------------------------------------------------- 00064 // -- Local Macros, Typedefs, Structures, Unions, and Forward Declarations -- 00065 // -------------------------------------------------------------------------- 00066 00067 static const char rcsid[] = "$Id: BdbCondRemoteAccessor.cc,v 1.11 2002/06/21 18:49:55 ryd Exp $"; 00068 00069 // -------------------- 00070 // -- Static methods -- 00071 // -------------------- 00072 00073 // ------------------ 00074 // -- Constructors -- 00075 // ------------------ 00076 00077 BdbCondRemoteAccessor::BdbCondRemoteAccessor( const char* theFacility ) : 00078 BdbCondAccessor( ), 00079 _isInitialized(false), 00080 _taoClient(0), 00081 _OIDServer(BdbCondRemote::OIDServer::_nil( )), 00082 _bootFileName( CORBA::string_dup( "" )), 00083 _facilityName( "" ), 00084 _serviceName( "" ) 00085 { 00086 // Check the correctness of the facility name. 00087 00088 if( 0 == theFacility ) { 00089 ErrMsg(fatal) << "BdbCondRemoteAccessor::BdbCondRemoteAccessor() -- FATAL ERROR IN TEH CONSTRUCTOR." << endl 00090 << " The invalid value has been passed as a parameter." << endmsg; 00091 } 00092 _facilityName = string( theFacility ); 00093 00094 // The other components of the name will be initialized later in a special 00095 // initializer method. 00096 } 00097 00098 // ---------------- 00099 // -- Destructor -- 00100 // ---------------- 00101 00102 BdbCondRemoteAccessor::~BdbCondRemoteAccessor( ) 00103 { 00104 // There is nothing to delete, because: 00105 // 00106 // _taoClient - is a singleton 00107 // _OIDServer - is an instance of a smart pointer object 00108 // _bootFileName - ditto 00109 } 00110 00111 // ---------------- 00112 // -- Operations -- 00113 // ---------------- 00114 00115 BdbStatus 00116 BdbCondRemoteAccessor::findObject( BdbDatabase* theDatabasePtr, 00117 BdbHandle(BdbObject)& theObjectH, 00118 const char* theContainerName, 00119 const BdbTime& theTime ) 00120 { 00121 // NOTE: all external comunications of this method go via 00122 // its caller for the following two purposes: 00123 // 00124 // - stay in the correct context; 00125 // - provide the consistent change in the caller's context. 00126 00127 assert( 0 != theDatabasePtr ); 00128 assert( 0 != theContainerName ); 00129 00130 BdbStatus status; 00131 00132 theObjectH = 0; 00133 00134 // Make sure the connection is initialized. 00135 00136 if( ! initialize( )) return BdbcError; 00137 00138 // Find an appropriate interval. 00139 00140 BdbHandle(BdbInterval) BdbIntervalH; 00141 status = theDatabasePtr->findInterval( BdbIntervalH, 00142 theContainerName, 00143 theTime ); 00144 if (( BdbcSuccess != status ) || BdbIsNull(BdbIntervalH)) { 00145 return BdbcError; 00146 } 00147 00148 // Get an object from the interval. 00149 00150 theObjectH = BdbIntervalH->getObject( ); 00151 00152 return BdbcSuccess; 00153 } 00154 00155 BdbStatus 00156 BdbCondRemoteAccessor::findObject( BdbDatabase* theDatabasePtr, 00157 BdbHandle(BdbObject)& theObjectH, 00158 BdbIntervalBase& theIntervalBase, 00159 BdbTime& theVersionTime, 00160 const char* theContainerName, 00161 const BdbTime& theTime ) 00162 { 00163 // NOTE: Unlike its more primitive version which does not provide the validity 00164 // period for the found object, this method directly obtains all its information 00165 // from a remote server including the complete context of BdbDatabase class. 00166 // 00167 // Then the caller's context is updated from the obtained one. 00168 00169 const char* errorString = "BdbCondRemoteAccessor::findObject() -- ERROR."; 00170 00171 assert( 0 != theDatabasePtr ); 00172 assert( 0 != theContainerName ); 00173 00174 BdbStatus status; 00175 00176 theObjectH = 0; 00177 00178 theIntervalBase.setBeginTime( BdbTime::minusInfinity ); 00179 theIntervalBase.setEndTime ( BdbTime::plusInfinity ); 00180 00181 theVersionTime = BdbTime::minusInfinity; 00182 00183 // Make sure the connection is initialized. 00184 00185 if( ! initialize( )) return BdbcError; 00186 00187 // Ask remote server to do this job. 00188 00189 BdbCondRemote::TimeType theRemoteTime = theTime.getGmtSec( ); 00190 00191 CORBA::Environment theEnv; 00192 BdbCondRemote::StatusType theStatus; 00193 00194 BdbCondRemote::OIDServer::ContextType_var theContextVar; 00195 BdbCondRemote::OIDServer::ObjectContextType theObjectContext; 00196 BdbCondRemote::OIDServer_ptr theNextServer; 00197 00198 theStatus = _OIDServer->findObject( _bootFileName, 00199 theDatabasePtr->subsystemTLA( ), 00200 theContainerName, 00201 theRemoteTime, 00202 theContextVar, 00203 theObjectContext, 00204 theNextServer, 00205 theEnv ); 00206 if( theEnv.exception( ) != 0 ) { 00207 ErrMsg(error) << errorString << endl 00208 << " Can not find desired object in this container due to" << endl 00209 << " exception occured while communicating with remote server." << endl 00210 << " DETECTOR -> " << theDatabasePtr->subsystemTLA( ) << endl 00211 << " CONTAINER -> " << theContainerName << endmsg; 00212 return BdbcError; 00213 } 00214 if( BdbCondRemote::StatusSuccess != theStatus ) { 00215 ErrMsg(error) << errorString << endl 00216 << " Can not find desired object in this container due to" << endl 00217 << " error status returned by the remote server." << endl 00218 << " DETECTOR -> " << theDatabasePtr->subsystemTLA( ) << endl 00219 << " CONTAINER -> " << theContainerName << endmsg; 00220 return BdbcError; 00221 } 00222 00223 // Translate obtained results into the local data structures. Then update 00224 // the context of the caller. 00225 00226 translateResult( theDatabasePtr, 00227 theContainerName, 00228 theObjectH, 00229 theIntervalBase, 00230 theVersionTime, 00231 *(theContextVar.ptr( )), 00232 theObjectContext ); 00233 00234 // Switch to another server if a non-null pointer was returned 00235 // and return resulting status. 00236 00237 return switchServer( theNextServer ); 00238 } 00239 00240 BdbStatus 00241 BdbCondRemoteAccessor::findInterval( BdbDatabase* theDatabasePtr, 00242 BdbHandle(BdbInterval)& theIntervalH, 00243 const char* theContainerName, 00244 const BdbTime& theTime ) 00245 { 00246 // NOTE: This method obtains all its information from a remote server 00247 // including the complete context of BdbDatabase class. 00248 // 00249 // Then the caller's context is updated from the obtained one. 00250 00251 const char* errorString = "BdbCondRemoteAccessor::findInterval() -- ERROR."; 00252 00253 BdbStatus status; 00254 00255 assert( 0 != theDatabasePtr ); 00256 assert( 0 != theContainerName ); 00257 00258 theIntervalH = 0; 00259 00260 // Make sure the connection is initialized. 00261 00262 if( ! initialize( )) return BdbcError; 00263 00264 // Ask remote server to do this job. 00265 00266 BdbCondRemote::TimeType theRemoteTime = theTime.getGmtSec( ); 00267 00268 CORBA::Environment theEnv; 00269 BdbCondRemote::StatusType theStatus; 00270 00271 BdbCondRemote::OIDServer::ContextType_var theContextVar; 00272 BdbCondRemote::OIDServer_ptr theNextServer; 00273 00274 theStatus = _OIDServer->findInterval( _bootFileName, 00275 theDatabasePtr->subsystemTLA( ), 00276 theContainerName, 00277 theRemoteTime, 00278 theContextVar, 00279 theNextServer, 00280 theEnv ); 00281 if( theEnv.exception( ) != 0 ) { 00282 ErrMsg(error) << errorString << endl 00283 << " Can not find desired interval in this container due to" << endl 00284 << " exception occured while communicating with remote server." << endl 00285 << " DETECTOR -> " << theDatabasePtr->subsystemTLA( ) << endl 00286 << " CONTAINER -> " << theContainerName << endmsg; 00287 return BdbcError; 00288 } 00289 if( BdbCondRemote::StatusSuccess != theStatus ) { 00290 ErrMsg(error) << errorString << endl 00291 << " Can not find desired interval in this container due to" << endl 00292 << " error status returned by the remote server." << endl 00293 << " DETECTOR -> " << theDatabasePtr->subsystemTLA( ) << endl 00294 << " CONTAINER -> " << theContainerName << endmsg; 00295 return BdbcError; 00296 } 00297 00298 // Translate obtained results into the local data structures. Then update 00299 // the context of the caller. 00300 00301 translateResult( theDatabasePtr, 00302 theContainerName, 00303 theIntervalH, 00304 *(theContextVar.ptr( ))); 00305 00306 // Switch to another server if a non-null pointer was returned 00307 // and return resulting status. 00308 00309 return switchServer( theNextServer ); 00310 } 00311 00312 BdbStatus 00313 BdbCondRemoteAccessor::firstInterval( BdbDatabase* theDatabasePtr, 00314 BdbHandle(BdbInterval)& theIntervalH, 00315 const char* theContainerName ) 00316 { 00317 // NOTE: This method obtains all its information from a remote server 00318 // including the complete context of BdbDatabase class. 00319 // 00320 // Then the caller's context is updated from the obtained one. 00321 00322 const char* errorString = "BdbCondRemoteAccessor::firstInterval() -- ERROR."; 00323 00324 BdbStatus status; 00325 00326 assert( 0 != theDatabasePtr ); 00327 assert( 0 != theContainerName ); 00328 00329 theIntervalH = 0; 00330 00331 // Make sure the connection is initialized. 00332 00333 if( ! initialize( )) return BdbcError; 00334 00335 // Ask remote server to do this job. 00336 00337 CORBA::Environment theEnv; 00338 BdbCondRemote::StatusType theStatus; 00339 00340 BdbCondRemote::OIDServer::ContextType_var theContextVar; 00341 BdbCondRemote::OIDServer_ptr theNextServer; 00342 00343 theStatus = _OIDServer->firstInterval( _bootFileName, 00344 theDatabasePtr->subsystemTLA( ), 00345 theContainerName, 00346 theContextVar, 00347 theNextServer, 00348 theEnv ); 00349 if( theEnv.exception( ) != 0 ) { 00350 ErrMsg(error) << errorString << endl 00351 << " Can not find the FIRST interval in this container due to" << endl 00352 << " exception occured while communicating with remote server." << endl 00353 << " DETECTOR -> " << theDatabasePtr->subsystemTLA( ) << endl 00354 << " CONTAINER -> " << theContainerName << endmsg; 00355 return BdbcError; 00356 } 00357 if( BdbCondRemote::StatusSuccess != theStatus ) { 00358 ErrMsg(error) << errorString << endl 00359 << " Can not find the FIRST interval in this container due to" << endl 00360 << " error status returned by the remote server." << endl 00361 << " DETECTOR -> " << theDatabasePtr->subsystemTLA( ) << endl 00362 << " CONTAINER -> " << theContainerName << endmsg; 00363 return BdbcError; 00364 } 00365 00366 // Translate obtained results into the local data structures. Then update 00367 // the context of the caller. 00368 00369 translateResult( theDatabasePtr, 00370 theContainerName, 00371 theIntervalH, 00372 *(theContextVar.ptr( ))); 00373 00374 // Switch to another server if a non-null pointer was returned 00375 // and return resulting status. 00376 00377 return switchServer( theNextServer ); 00378 } 00379 00380 BdbStatus 00381 BdbCondRemoteAccessor::lastInterval( BdbDatabase* theDatabasePtr, 00382 BdbHandle(BdbInterval)& theIntervalH, 00383 const char* theContainerName ) 00384 { 00385 // NOTE: This method obtains all its information from a remote server 00386 // including the complete context of BdbDatabase class. 00387 // 00388 // Then the caller's context is updated from the obtained one. 00389 00390 const char* errorString = "BdbCondRemoteAccessor::lastInterval() -- ERROR."; 00391 00392 BdbStatus status; 00393 00394 assert( 0 != theDatabasePtr ); 00395 assert( 0 != theContainerName ); 00396 00397 theIntervalH = 0; 00398 00399 // Make sure the connection is initialized. 00400 00401 if( ! initialize( )) return BdbcError; 00402 00403 // Ask remote server to do this job. 00404 00405 CORBA::Environment theEnv; 00406 BdbCondRemote::StatusType theStatus; 00407 00408 BdbCondRemote::OIDServer::ContextType_var theContextVar; 00409 BdbCondRemote::OIDServer_ptr theNextServer; 00410 00411 theStatus = _OIDServer->lastInterval( _bootFileName, 00412 theDatabasePtr->subsystemTLA( ), 00413 theContainerName, 00414 theContextVar, 00415 theNextServer, 00416 theEnv ); 00417 if( theEnv.exception( ) != 0 ) { 00418 ErrMsg(error) << errorString << endl 00419 << " Can not find the LAST interval in this container due to" << endl 00420 << " exception occured while communicating with remote server." << endl 00421 << " DETECTOR -> " << theDatabasePtr->subsystemTLA( ) << endl 00422 << " CONTAINER -> " << theContainerName << endmsg; 00423 return BdbcError; 00424 } 00425 if( BdbCondRemote::StatusSuccess != theStatus ) { 00426 ErrMsg(error) << errorString << endl 00427 << " Can not find the LAST interval in this container due to" << endl 00428 << " error status returned by the remote server." << endl 00429 << " DETECTOR -> " << theDatabasePtr->subsystemTLA( ) << endl 00430 << " CONTAINER -> " << theContainerName << endmsg; 00431 return BdbcError; 00432 } 00433 00434 // Translate obtained results into the local data structures. Then update 00435 // the context of the caller. 00436 00437 translateResult( theDatabasePtr, 00438 theContainerName, 00439 theIntervalH, 00440 *(theContextVar.ptr( ))); 00441 00442 // Switch to another server if a non-null pointer was returned 00443 // and return resulting status. 00444 00445 return switchServer( theNextServer ); 00446 } 00447 00448 void 00449 BdbCondRemoteAccessor::reset( ) 00450 { 00451 // The basic idea of this method is to clear a context associated with 00452 // this brand of the accessor. 00453 // 00454 // In the current implementation this method tells a remote server 00455 // to commit the currently held transaction if any. 00456 00457 const char* errorString = "BdbCondRemoteAccessor::reset() -- ERROR."; 00458 00459 // Make sure the connection is initialized. 00460 00461 if( ! initialize( )) return; 00462 00463 // Ask remote server to do this job. 00464 00465 CORBA::Boolean theTransactionWasOpen; 00466 CORBA::Environment theEnv; 00467 BdbCondRemote::StatusType theStatus; 00468 00469 theStatus = _OIDServer->commitTransaction( theTransactionWasOpen, 00470 theEnv ); 00471 if( theEnv.exception( ) != 0 ) { 00472 ErrMsg(error) << errorString << endl 00473 << " Can not tell the remote server to commit current transaction due to" << endl 00474 << " exception occured while communicating with remote server." << endmsg; 00475 return; 00476 } 00477 if( BdbCondRemote::StatusSuccess != theStatus ) { 00478 ErrMsg(error) << errorString << endl 00479 << " Can not tell the remote server to commit current transaction due to" << endl 00480 << " error status returned by the remote server." << endmsg; 00481 return; 00482 } 00483 00484 return; 00485 } 00486 00487 // ------------- 00488 // -- Helpers -- 00489 // ------------- 00490 00491 bool 00492 BdbCondRemoteAccessor::initialize( ) 00493 { 00494 const char* errorString = "BdbCondRemoteAccessor::initialize() -- ERROR."; 00495 00496 // Proceed only if the initialization has not beed done. 00497 00498 if( _isInitialized ) return true; 00499 00500 // Build the BOOT file name for more efficient operations. 00501 00502 _bootFileName = CORBA::string_dup( BdbConditions::instance( )->bootName( )); 00503 00504 // Use BOOT file name to locate the Name Service directory 00505 // where the service corresponding to the current federation. 00506 // 00507 // NOTE: that we relace all '/' by '\' in a service name in order to not 00508 // confuse the binder at TaoTools/TaoServer class. 00509 00510 _serviceName = string( BdbConditions::instance( )->bootName( )); 00511 00512 size_t bytes = _serviceName.length( ); 00513 for( size_t i = 0; i < bytes; i++ ) { 00514 if( '/' == _serviceName[i] ) _serviceName[i] = '\\'; 00515 } 00516 00517 // Get a TAO Client object which would serve an interface between 00518 // us and CORBA. 00519 00520 _taoClient = TaoClient::getTaoClient( ); 00521 if( 0 == _taoClient ) { 00522 ErrMsg(error) << errorString << endl 00523 << " Failed to obtain a TAO Client object." << endmsg; 00524 return false; 00525 } 00526 00527 // Get initial object references for OID server via the Name Service. 00528 00529 CORBA::Object_var theObj; 00530 00531 theObj = _taoClient->getObject( _facilityName.c_str(), 00532 _serviceName.c_str() ); 00533 if( CORBA::is_nil( theObj )) { 00534 ErrMsg(error) << errorString << endl 00535 << "Failed to obtain an initial object reference through the Naming Service:" << endl 00536 << " FACILITY: " << _facilityName << endl 00537 << " SERVICE: " << _serviceName << endl 00538 << endmsg; 00539 return false; 00540 } 00541 00542 _OIDServer = BdbCondRemote::OIDServer::_narrow( theObj ); 00543 if( CORBA::is_nil( _OIDServer.in( ))) { 00544 ErrMsg(error) << errorString << endl 00545 << "Failed to narrow the object reference into BdbCondRemote::OIDServer." << endl 00546 << endmsg; 00547 } 00548 00549 // Get the final server reference. 00550 00551 CORBA::Environment theEnv; 00552 00553 _OIDServer = _OIDServer->getServer( theEnv ); 00554 if( theEnv.exception( ) != 0 ) { 00555 ErrMsg(error) << errorString << endl 00556 << " Can not obtain the final object reference through the initial one due to" << endl 00557 << " exception occured while communicating with remote server." << endmsg; 00558 return false; 00559 } 00560 if( CORBA::is_nil( _OIDServer.in( ))) { 00561 ErrMsg(error) << errorString << endl 00562 << "Failed to obtain the final object reference through the initial one:" << endl 00563 << " FACILITY: " << _facilityName << endl 00564 << " SERVICE: " << _serviceName << endl 00565 << endmsg; 00566 return false; 00567 } 00568 00569 // Ok. We have done it. 00570 00571 _isInitialized = true; 00572 00573 return true; 00574 } 00575 00576 BdbStatus 00577 BdbCondRemoteAccessor::switchServer( BdbCondRemote::OIDServer_ptr theNextServer ) 00578 { 00579 const char* errorString = "BdbCondRemoteAccessor::switchServer() -- ERROR."; 00580 00581 // NOTE: We are doing the "narrowing" since it makes a copy of this object 00582 // in the current virtual space. This will also establish a connection 00583 // with the remote server. 00584 00585 if( ! CORBA::is_nil( theNextServer )) { 00586 00587 _OIDServer = BdbCondRemote::OIDServer::_narrow( theNextServer ); 00588 if( CORBA::is_nil( _OIDServer.in( ))) { 00589 ErrMsg(error) << errorString << endl 00590 << "Failed to narrow the new server reference into BdbCondRemote::OIDServer." << endl 00591 << endmsg; 00592 return BdbcError; 00593 } 00594 } 00595 return BdbcSuccess; 00596 } 00597 00598 void 00599 BdbCondRemoteAccessor::translateResult( BdbDatabase* theDatabasePtr, 00600 const char* theContainerName, 00601 BdbHandle(BdbInterval)& theIntervalH, 00602 const BdbCondRemote::OIDServer::ContextType& theContext ) 00603 { 00604 // Translate results. 00605 00606 toHandle( theContext.intervalOID, theIntervalH ); 00607 00608 BdbHandle(BdbDBObj) theIntervalDBH; 00609 toHandle( theContext.intervalDbOID, theIntervalDBH ); 00610 00611 BdbHandle(BdbContObj) theIntervalContH; 00612 toHandle( theContext.intervalContOID, theIntervalContH ); 00613 00614 BdbHandle(BdbCondRegistry) theRegistryH; 00615 toHandle( theContext.registryOID, theRegistryH ); 00616 00617 BdbHandle(BdbCondRevision) theBaselineRevisionH; 00618 toHandle( theContext.baselineRevisionOID, theBaselineRevisionH ); 00619 00620 BdbHandle(BdbCondRevision) theReviseAfterStoreRevisionH; 00621 toHandle( theContext.reviseAfterStoreRevisionOID, theReviseAfterStoreRevisionH ); 00622 00623 BdbHandle(BdbCondHistory) theHistoryH; 00624 toHandle( theContext.historyOID, theHistoryH ); 00625 00626 bool isLink = theContext.isLink; 00627 bool isWriteLocked = theContext.isWriteLocked; 00628 00629 BdbCondContainerLink link( theContext.symbLink.originName, 00630 theContext.symbLink.detectorName, 00631 theContext.symbLink.containerName ); 00632 00633 BdbHandle(BdbDBObj) theLinkDBH; 00634 toHandle( theContext.theLinkDbOID, theLinkDBH ); 00635 00636 BdbHandle(BdbContObj) theLinkContH; 00637 toHandle( theContext.theLinkContOID, theLinkContH ); 00638 00639 // Update the caller's context using the obtained results. 00640 00641 theDatabasePtr->setCache( theContainerName, 00642 theIntervalDBH, 00643 theIntervalContH, 00644 theRegistryH, 00645 theBaselineRevisionH, 00646 theReviseAfterStoreRevisionH, 00647 theHistoryH, 00648 isLink, 00649 isWriteLocked, 00650 link, 00651 theLinkDBH, 00652 theLinkContH ); 00653 } 00654 00655 void 00656 BdbCondRemoteAccessor::translateResult( BdbDatabase* theDatabasePtr, 00657 const char* theContainerName, 00658 BdbHandle(BdbObject)& theObjectH, 00659 BdbIntervalBase& theIntervalBase, 00660 BdbTime& theVersionTime, 00661 const BdbCondRemote::OIDServer::ContextType& theContext, 00662 const BdbCondRemote::OIDServer::ObjectContextType& theObjectContext ) 00663 { 00664 // Translate results. 00665 00666 toHandle( theObjectContext.objectOID, theObjectH ); 00667 00668 theIntervalBase.setBeginTime( BdbTime( theObjectContext.beginTime )); 00669 theIntervalBase.setEndTime ( BdbTime( theObjectContext.endTime )); 00670 00671 theVersionTime=BdbTime( theObjectContext.versionTime.sec, 00672 theObjectContext.versionTime.nsec ); 00673 00674 BdbHandle(BdbInterval) theIntervalH; 00675 toHandle( theContext.intervalOID, theIntervalH ); 00676 00677 BdbHandle(BdbDBObj) theIntervalDBH; 00678 toHandle( theContext.intervalDbOID, theIntervalDBH ); 00679 00680 BdbHandle(BdbContObj) theIntervalContH; 00681 toHandle( theContext.intervalContOID, theIntervalContH ); 00682 00683 BdbHandle(BdbCondRegistry) theRegistryH; 00684 toHandle( theContext.registryOID, theRegistryH ); 00685 00686 BdbHandle(BdbCondRevision) theBaselineRevisionH; 00687 toHandle( theContext.baselineRevisionOID, theBaselineRevisionH ); 00688 00689 BdbHandle(BdbCondRevision) theReviseAfterStoreRevisionH; 00690 toHandle( theContext.reviseAfterStoreRevisionOID, theReviseAfterStoreRevisionH ); 00691 00692 BdbHandle(BdbCondHistory) theHistoryH; 00693 toHandle( theContext.historyOID, theHistoryH ); 00694 00695 bool isLink = theContext.isLink; 00696 bool isWriteLocked = theContext.isWriteLocked; 00697 00698 BdbCondContainerLink link( theContext.symbLink.originName, 00699 theContext.symbLink.detectorName, 00700 theContext.symbLink.containerName ); 00701 00702 BdbHandle(BdbDBObj) theLinkDBH; 00703 toHandle( theContext.theLinkDbOID, theLinkDBH ); 00704 00705 BdbHandle(BdbContObj) theLinkContH; 00706 toHandle( theContext.theLinkContOID, theLinkContH ); 00707 00708 // Update the caller's context using the obtained results. 00709 // 00710 // NOTE: We do this operation in two steps: (1) the cache of the base class, 00711 // (2) the cache of the subclass because the subclass's cache will be 00712 // reset by the step 1. 00713 00714 theDatabasePtr->setCache( theContainerName, 00715 theIntervalDBH, 00716 theIntervalContH, 00717 theRegistryH, 00718 theBaselineRevisionH, 00719 theReviseAfterStoreRevisionH, 00720 theHistoryH, 00721 isLink, 00722 isWriteLocked, 00723 link, 00724 theLinkDBH, 00725 theLinkContH ); 00726 00727 theDatabasePtr->setIntervalCache( theIntervalH ); 00728 } 00729 00730 void 00731 BdbCondRemoteAccessor::toHandle( const BdbCondRemote::OIDServer::OIDType& theOID, 00732 BdbHandle(BdbPersObj)& thePersObjH ) 00733 { 00734 BdbRef(BdbPersObj) thePersObjRef; 00735 00736 thePersObjRef.set_DB( theOID.database ); 00737 thePersObjRef.set_OC( theOID.container ); 00738 thePersObjRef.set_page( theOID.page ); 00739 thePersObjRef.set_slot( theOID.slot ); 00740 00741 thePersObjH = thePersObjRef; 00742 } 00743 00744 void 00745 BdbCondRemoteAccessor::toHandle( const BdbCondRemote::OIDServer::OIDType& theOID, 00746 BdbHandle(BdbObject)& theObjectH ) 00747 { 00748 BdbRef(BdbObject) theObjectRef; 00749 00750 theObjectRef.set_DB( theOID.database ); 00751 theObjectRef.set_OC( theOID.container ); 00752 theObjectRef.set_page( theOID.page ); 00753 theObjectRef.set_slot( theOID.slot ); 00754 00755 theObjectH = theObjectRef; 00756 } 00757 00758 ///////////////// 00759 // End Of File // 00760 /////////////////
BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us
Page Owner: Jacek Becla
Last Update: October 04, 2002