00001 #ifndef CDBBDBINIT_HH 00002 #define CDBBDBINIT_HH 00003 00004 //-------------------------------------------------------------------------- 00005 // File and Version Information: 00006 // $Id: CdbBdbInit.hh,v 1.6 2005/10/25 19:36:51 gapon Exp $ 00007 // 00008 // Description: 00009 // Class CdbBdbInit. Initialize Cdb. 00010 // 00011 // Environment: 00012 // Software developed for the BaBar Detector at the SLAC B-Factory. 00013 // 00014 // Author List: 00015 // David Brown, Igor Gaponenko 4/26/02 00016 // 00017 // Copyright Information: 00018 // Copyright (C) 2002 Lawrence Berkeley Laboratory 00019 // 00020 //------------------------------------------------------------------------ 00021 00022 //---------------------- 00023 // Base Class Headers -- 00024 //---------------------- 00025 #include "Framework/AppModule.hh" 00026 #include "Framework/AbsParmString.hh" 00027 #include "Framework/AbsParmDouble.hh" 00028 #include "Framework/AbsParmGeneral.hh" 00029 #include "AbsParm/AbsParmNamedValue.hh" 00030 00031 //----------------- 00032 // Other headers -- 00033 //----------------- 00034 #include "BdbTime/BdbTime.hh" 00035 00036 class CdbBdbInit : public AppModule { 00037 00038 private: 00039 00040 // the selection of CDB implementations 00041 enum Implementation { AUTODETECTION = 0, 00042 WRAPPER, 00043 SHARED }; 00044 00045 /// Main transaction policy 00046 /** 00047 * RESTARTED_LONG_MAIN_TRANSACTION : same as LONG_MAIN_TRANSACTION but restarted every 'N' seconds, where 00048 * is defined by the value of the "MainTransactionRestartInterval". 00049 * The default value of thsi parameter is implementation specific. See 00050 * the body of the class for details. 00051 * LONG_MAIN_TRANSACTION : begin transaction at ::beginJob(), commit it at ::endJob() 00052 * SHORT_MAIN_TRANSACTION : begin transaction at ::beginJob(), commit it at the second invocation of ::event() 00053 * NO_MAIN_TRANSACTION : do no start main transaction at all. 00054 */ 00055 enum MainTransactionPolicy { RESTARTED_LONG_MAIN_TRANSACTION = 0, 00056 LONG_MAIN_TRANSACTION, 00057 SHORT_MAIN_TRANSACTION, 00058 NO_MAIN_TRANSACTION }; 00059 00060 public: 00061 00062 // Constructors 00063 CdbBdbInit( const char* const theName = "CdbBdbInit", 00064 const char* const theDescription = "Initialize Conditions database access" ); 00065 00066 // Destructor 00067 virtual ~CdbBdbInit( ); 00068 00069 // Operations 00070 virtual AppResult beginJob( AbsEvent* anEvent ); 00071 virtual AppResult event( AbsEvent* anEvent ); 00072 virtual AppResult endJob( AbsEvent* anEvent ); 00073 00074 private: 00075 00076 void startTransaction( ); 00077 void commitTransaction( ); 00078 00079 private: 00080 00081 // Parameters of the module 00082 00083 AbsParmNamedValue<Implementation> _implementation; 00084 AbsParmString _view; 00085 AbsParmString _truncateTime; 00086 AbsParmNamedValue<MainTransactionPolicy> _mainTransactionPolicy; 00087 AbsParmDouble _mainTransactionRestartInterval; 00088 AbsParmGeneral<unsigned> _cacheMaxPages; 00089 00090 // The context of the module 00091 00092 unsigned int _numEvents; // number of times the ::event() method got called 00093 00094 BdbTime _previousTimestamp; // the last time the ::event() method was invoked. 00095 00096 // Parameter: 00097 // 00098 // "AllowedOrigins" 00099 // 00100 // Description: 00101 // 00102 // This parameter can be used to prevent an application from running against 00103 // any type of CDB installations (so called "origins") not mentioned in this 00104 // parameter. 00105 // 00106 // Syntax: 00107 // 00108 // A comma separated list of allowed origins is expected here. A variable number 00109 // of origins is allowed. Duplications of origins is also allowed, this however 00110 // will be treated as one entry of that origin. Any kinds of 00111 // spaces/tabs/newlines are not allowed in the string. 00112 // 00113 // The general syntax is: 00114 // 00115 // * | <name1>[,<name2>[...]] 00116 // 00117 // Where: 00118 // 00119 // <name1>, <name2> are the names of the origins. Use the corresponding CDB 00120 // management tools to get a list of known ones. 00121 // 00122 // Note, that the '*' character used above is the legal value of the parameter 00123 // recognized by the module. 00124 // 00125 // Examples: 00126 // 00127 // * 00128 // NAME 00129 // NAME1,NAME2 00130 // 00131 // Default value: 00132 // 00133 // The default value for the parameter is "*" meaning that there is no restrictions 00134 // on where to run this module. 00135 // 00136 00137 AbsParmString _allowedOrigins; 00138 }; 00139 00140 #endif
1.3-rc3