00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "BaBar/BaBar.hh"
00010
00011 #include "CdbBdbWrapper/CdbBdbWFolder.hh"
00012
00013 #include "CdbBase/Cdb.hh"
00014 #include "CdbBase/CdbPathName.hh"
00015 #include "CdbBase/CdbDatabase.hh"
00016
00017 #include "CdbBdbWrapper/CdbBdbWListOfDetectors.hh"
00018 #include "CdbBdbWrapper/CdbBdbWFolderItr.hh"
00019 #include "CdbBdbWrapper/CdbBdbWCondition.hh"
00020 #include "CdbBdbWrapper/CdbBdbWConditionItr.hh"
00021
00022 #include "BdbCond/BdbCondDatabaseMgr.hh"
00023
00024 #include "ErrLogger/ErrLog.hh"
00025
00026 CdbFolder*
00027 CdbBdbWFolder::clone( ) const
00028 {
00029 CdbBdbWFolder* mySelf = const_cast<CdbBdbWFolder*>( this );
00030 return new CdbBdbWFolder( mySelf->parentView( ),
00031 mySelf->parentFolder( ),
00032 mySelf->name( ));
00033 }
00034
00035 CdbBdbWFolder::CdbBdbWFolder( const CdbViewPtr& theViewPtr,
00036 const CdbFolderPtr& theFolderPtr,
00037 const char* theName ) :
00038 CdbFolder( theViewPtr,
00039 theFolderPtr,
00040 theName )
00041 { }
00042
00043 CdbBdbWFolder::~CdbBdbWFolder( )
00044 { }
00045
00046 bool
00047 CdbBdbWFolder::isValid( )
00048 {
00049 return true;
00050 }
00051
00052 bool
00053 CdbBdbWFolder::isOpen( )
00054 {
00055 return true;
00056 }
00057
00058 CdbStatus
00059 CdbBdbWFolder::open( )
00060 {
00061 return CdbStatus::Success;
00062 }
00063
00064 CdbStatus
00065 CdbBdbWFolder::close( )
00066 {
00067 return CdbStatus::Success;
00068 }
00069
00070 BdbTime
00071 CdbBdbWFolder::created( ) const
00072 {
00073 return BdbTime::minusInfinity;
00074 }
00075
00076 std::string
00077 CdbBdbWFolder::description( ) const
00078 {
00079 return std::string( "<not available in current implementation>" );
00080 }
00081
00082 CdbStatus
00083 CdbBdbWFolder::findFolder( CdbFolderPtr& thePtr,
00084 const char* theName
00085 )
00086 {
00087 CdbStatus result = CdbStatus::Error;
00088
00089 thePtr = 0;
00090
00091 do {
00092
00093 if( !parentFolder( ).isNull( )) {
00094 ErrMsg(error) << "this implementation does not support folders of specified depth." << endmsg;
00095 break;
00096 }
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 CdbFolderPtr myPtr( this->clone( ));
00117
00118 thePtr = new CdbBdbWFolder( parentView( ),
00119 myPtr,
00120 theName );
00121
00122 result = CdbStatus::Success;
00123
00124
00125
00126
00127
00128 if( CdbStatus::Success != result ) {
00129 ErrMsg(error) << "specified folder was not found in the database." << endmsg;
00130 break;
00131 }
00132
00133 } while( false );
00134
00135 return result;
00136 }
00137
00138 CdbStatus
00139 CdbBdbWFolder::folderIterator( CdbFolderItr& theItr )
00140 {
00141 CdbFolderPtr myPtr( this->clone( ));
00142
00143
00144
00145
00146 theItr = CdbFolderItr( new CdbBdbWFolderItr( myPtr ));
00147
00148 return CdbStatus::Success;
00149 }
00150
00151 CdbStatus
00152 CdbBdbWFolder::findCondition( CdbConditionPtr& thePtr,
00153 const char* theName
00154 )
00155 {
00156 CdbStatus result = CdbStatus::Error;
00157
00158 thePtr = 0;
00159
00160 do {
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171 if( ! ( !parentFolder( ).isNull( ) &&
00172 !parentFolder( )->parentView( ).isNull( ))) {
00173
00174 ErrMsg(error) << "this implementation only allows conditions at in detector/subsystem folders." << endmsg;
00175 break;
00176 }
00177
00178 CdbPathName detectorName( name( ));
00179 CdbPathName conditionName( theName );
00180
00181 if( ! ( detectorName.isValid( ) &&
00182 conditionName.isValid( ) &&
00183 ! conditionName.isAbsolute( ) &&
00184 ! conditionName.isComposite( ))) {
00185
00186 ErrMsg(error) << "invalid condition name passed. Simple non-composite name was expected." << endmsg;
00187 break;
00188 }
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228 CdbFolderPtr myPtr( this->clone( ));
00229
00230 CdbDatabasePtr databasePtr = 0;
00231
00232 thePtr = new CdbBdbWCondition( myPtr,
00233 databasePtr,
00234 conditionName.toString( ).c_str( ));
00235
00236 result = CdbStatus::Success;
00237
00238 } while( false );
00239
00240 return result;
00241 }
00242
00243 CdbStatus
00244 CdbBdbWFolder::conditionIterator( CdbConditionItr& theItr )
00245 {
00246 CdbFolderPtr myPtr( this->clone( ));
00247
00248
00249
00250
00251 theItr = CdbConditionItr( new CdbBdbWConditionItr( myPtr ));
00252
00253 return CdbStatus::Success;
00254 }
00255
00256
00257
00258