00001 /* 00002 * dbmutableserverbase.h -- Extends the MutableServerBase class to add 00003 * database access. 00004 * 00005 * CONFIGURATION (.d) FILE: 00006 * 00007 * DBConnection User Password Service 00008 */ 00009 00010 #if ! defined(_MSM_DBServer_H) 00011 #define _MSM_DBServer_H 00012 00013 00014 #include "mutableserverbase.h" 00015 #include <string> // std::string 00016 00017 extern "C" { 00018 00019 #include <ewdb_ora_api.h> 00020 #include <ewdb_cli_base.h> 00021 00022 } 00023 00024 class DBMutableServer : public MutableServerBase 00025 { 00026 protected: 00027 00028 // ======================================================================= 00029 // from TConfigurable 00030 // ======================================================================= 00031 00032 /* CheckConfig() -- allows derivative classes to report the status of their 00033 ** the configuration state. 00034 ** 00035 ** Set ConfigStatus = WORM_STAT_BADSTATE if there 00036 ** is a configuration problem, otherwise take no action. 00037 */ 00038 void CheckConfig(); 00039 00040 00041 // ======================================================================= 00042 // from WormServerBase 00043 // ======================================================================= 00044 00045 // PrepareToRun() -- actions to take prior to entering main loop 00046 // 00047 // ALWAYS call base class's PrepareToRun() at the top 00048 // 00049 // RETURN: true if ready 00050 // false if some condition prevents proper execution 00051 // 00052 bool PrepareToRun(); 00053 00054 00055 // ======================================================================= 00056 // for DBMutableServer 00057 // ======================================================================= 00058 00059 00060 // Database connection parameters 00061 // 00062 std::string DB_User 00063 , DB_Password 00064 , DB_Service 00065 ; 00066 00067 // InitializeDB() -- Initializes the database connection, using 00068 // DB_User, DB_Password, DB_Service 00069 // Called within this class's PrepareToRun() method. 00070 // 00071 // RETURNS: 00072 // true = success 00073 // false = error 00074 // 00075 bool InitializeDB(); 00076 00077 // GetDefaultsFromDB() -- Gets default parameter lines from the database, 00078 // passes each line, along with a pointer (to the 00079 // default parameters struct) to HandleParameterLine() 00080 // 00081 // RETURNS: 00082 // true = success 00083 // false = error 00084 // 00085 bool GetDefaultsFromDB( void * p_parmstruct ); 00086 00087 00088 // HandleParameterLine() -- handle configuration lines which may be either 00089 // lines from a .d file, or passport lines from 00090 // the database. 00091 // 00092 // PARAMETERS: 00093 // p_parser = pointer to a ComFile or OracleConfigSource object 00094 // p_params = pointer to either a struct holding default parameters, 00095 // or to a struct that is being used to hold parameters 00096 // for an arriving processing request. 00097 // 00098 // RETURNS: 00099 // HANDLE_INVALID -- line invalid 00100 // HANDLE_UNUSED -- line not used 00101 // HANDLE_USED -- line used okay 00102 // 00103 virtual HANDLE_STATUS HandleParameterLine( ConfigSource * p_parser 00104 , void * p_params 00105 ) = 0; 00106 00107 00108 00109 public: 00110 00111 00112 // ======================================================================= 00113 // from TConfigurable 00114 // ======================================================================= 00115 00116 /* 00117 ** HandleConfigLine() 00118 ** 00119 ** PARMS: 00120 ** p_parser -- the parser being used, command string already 00121 ** in the current token for comparison with Its() 00122 ** 00123 ** RETURN: 00124 ** HANDLE_INVALID -- line invalid 00125 ** HANDLE_UNUSED -- line not used 00126 ** HANDLE_USED -- line used okay 00127 ** 00128 ** Override for child classes to handle command lines 00129 ** Call <super_class::HandleConfigLine() within derivative classes 00130 ** to allow them a whack at the parameter as well. 00131 */ 00132 HANDLE_STATUS HandleConfigLine( ConfigSource * p_parser ); 00133 00134 00135 }; 00136 00137 #endif // _MSM_DBServer_H