Matrix Science header

ms_datfile.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_datfile.hpp                                                       #
00004 # 'msparser' toolkit                                                         #
00005 # Encapsulates "mascot.dat"-file that describes most important parameters    #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2003 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 #    $Archive:: /Mowse/ms_mascotresfile/include/ms_datfile.hpp             $ #
00012 #     $Author: francoisr@matrixscience.com $ #
00013 #       $Date: 2021-04-01 13:53:38 +0100 $ #
00014 #   $Revision: 3751734795f3869ea922a585f719718bbde3b800 | MSPARSER_REL_2_8_1-0-gea32989045 $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 #ifndef MS_DATFILE_HPP
00020 #define MS_DATFILE_HPP
00021 
00022 
00023 #include <string>
00024 #include <vector>
00025 
00026 
00027 namespace matrix_science {
00028 
00029     class ms_filesource;
00030 
00036 
00037 
00046     class MS_MASCOTRESFILE_API ms_datfile : public ms_errors
00047     {
00048     public:
00049 
00051 
00054         enum WST
00055         {
00056             WST_APACHE=0, 
00057             WST_IIS=1     
00058         };
00059 
00061 
00066         enum SEQDB_INSTALL
00067         {
00068             // Anything in the lower 16 bits (1..16) should result in asking the user to confirm that they want to update
00069             SEQDB_INSTALL_SHOULD_QUERY_USER = 0x0000FFFF, 
00070             SEQDB_INSTALL_CUSTOMISED        = 0x00000001, 
00071             SEQDB_INSTALL_INACTIVE          = 0x00000002, 
00072             SEQDB_INSTALL_INVALID_CONFIG    = 0x00000004, 
00073             SEQDB_INSTALL_EXISTING_LARGER   = 0x00000010, 
00074 
00075             // Bit 32 for something really bad.
00076             SEQDB_INSTALL_INVALID_DBNAME    = 0x00000000, 
00077 
00078             // Further information that may be useful in bits 16 to 31 
00079             SEQDB_INSTALL_MUST_UPDATE_CFG   = 0x000F000F, 
00080             SEQDB_INSTALL_MISSING_CONFIG    = 0x00010000, 
00081             SEQDB_INSTALL_OLD_RULES         = 0x00020000, 
00082             SEQDB_INSTALL_WRONG_WILDCARD    = 0x00040000, 
00083 
00084             // Additional information, but no need to update 
00085             SEQDB_INSTALL_CURRENT_RULES     = 0x01000000  
00086         };
00087 
00089 
00092         enum INST_FLAGS
00093         {
00094             IFLG_UPDATETAXONOMY          = 0x00000001,   
00095             IFLG_UPDATEPARSERULES        = 0x00000002,   
00096             IFLG_UPDATESWISSPROT         = 0x00000004,   
00097             IFLG_UPDATECLUSTER           = 0x00000008,   
00098             IFLG_UPDATEESTTAX            = 0x00000010,   
00099             IFLG_ADDMISSINGOPTIONS       = 0x00000020,   
00100             IFLG_ADDREPORTAUTO           = 0x00000040,   
00101             IFLG_UPDATEAPACHEFORKOPT     = 0x00000080,   
00102             IFLG_ADDPERCOLATOROPT        = 0x00000100,   
00103             IFLG_UPDATENCBIHTTPS         = 0x00000200,   
00104             IFLG_UPDATEPRIDECONTAMINANTS = 0x00000400,   
00105             IFLG_UPDATEDBMANAGERPERLPATH = 0x00000800,   
00106             IFLG_UPDATEMSPEPSEARCHOPTS   = 0x00001000,   
00107             IFLG_UPDATEEXECAFTERSEARCH   = 0x00002000,   
00108             IFLG_UPDATEPERCOLATORFEATS   = 0x00004000,   
00109             IFLG_UPDATEPROTFAMILYSWITCH  = 0x00008000,   
00110 
00111             IFLG_DEFAULTNEWINSTALL   = IFLG_UPDATECLUSTER       |
00112                                        IFLG_UPDATEAPACHEFORKOPT, 
00113             IFLG_DEFAULTUPGRADE      = IFLG_UPDATETAXONOMY      |
00114                                        IFLG_UPDATEPARSERULES    |
00115                                        IFLG_UPDATEESTTAX        |
00116                                        IFLG_ADDMISSINGOPTIONS   |
00117                                        IFLG_ADDREPORTAUTO       |
00118                                        IFLG_UPDATEAPACHEFORKOPT |
00119                                        IFLG_ADDPERCOLATOROPT    |
00120                                        IFLG_UPDATEPERCOLATORFEATS  |
00121                                        IFLG_UPDATENCBIHTTPS     |
00122                                        IFLG_UPDATEDBMANAGERPERLPATH | 
00123                                        IFLG_UPDATEMSPEPSEARCHOPTS  |
00124                                        IFLG_UPDATEEXECAFTERSEARCH |
00125                                        IFLG_UPDATEPROTFAMILYSWITCH 
00126         };
00127 
00129         ms_datfile();
00130 
00132         ms_datfile(const ms_datfile& src);
00133 
00135         ms_datfile(const char* filename, const int timeoutSec = 0,
00136                    const matrix_science::ms_connection_settings * cs = 0);
00137 
00139         ~ms_datfile();
00140 
00142         void defaultValues();
00143 
00145         void copyFrom(const ms_datfile* right);
00146 
00147 #ifndef SWIG
00148 
00149         ms_datfile& operator=(const ms_datfile& right);
00150 #endif
00151 
00152         std::string getFileName() const;
00153 
00155         void setFileName(const char* name);
00156 
00158         void setConnectionSettings(const matrix_science::ms_connection_settings & cs);
00159 
00161         matrix_science::ms_connection_settings getConnectionSettings() const;
00162 
00164         void read_file();
00165 
00166         void read_buffer(const char * buffer);
00167 
00169         void save_file();
00170 
00172         bool editedByDatabaseManager() const;
00173 
00175         const ms_databases* getDatabases() const;
00176 
00178         void setDatabases(const ms_databases* dbs);
00179 
00181         const ms_libraryoptions* getLibraryOptions() const;
00182 
00184         void setLibraryOptions(const ms_libraryoptions* spectralLibraryOptions);
00185 
00187         const ms_parseoptions* getParseOptions() const;
00188 
00190         void setParseOptions(const ms_parseoptions* rules);
00191 
00193         const ms_wwwoptions* getWWWOptions() const;
00194 
00196         void setWWWOptions(const ms_wwwoptions* www);
00197 
00199         const ms_processoroptions* getProcessors() const;
00200 
00202         void setProcessors(const ms_processoroptions* info);
00203 
00205         const ms_taxonomyrules* getTaxonomyRules(const int idx) const;
00206 
00208         void setTaxonomyRules(const int idx, const ms_taxonomyrules* rules);
00209 
00211         int getMaxTaxonomyRules() const;
00212 
00214         const ms_clusterparams* getClusterParams() const;
00215 
00217         void setClusterParams(const ms_clusterparams* params);
00218 
00220         const ms_unigeneoptions* getUniGeneOptions() const;
00221 
00223         void setUniGeneOptions(const ms_unigeneoptions * uoptions);
00224 
00226         const ms_mascotoptions* getMascotOptions() const;
00227 
00229         void setMascotOptions(const ms_mascotoptions* opt);
00230 
00232         const ms_cronoptions* getCronOptions() const;
00233 
00235         void setCronOptions(const ms_cronoptions* options);
00236 
00238         const ms_mascotfiles* getMascotFiles() const;
00239 
00241         void setMascotFiles(const ms_mascotfiles* src);
00242 
00244         void setFindFileTimeout(const int seconds);
00245 
00247         int getFindFileTimeout() const;
00248 
00250         unsigned int checkSeqDBInstallRequest(const std::string & dbName,
00251                                               const double newFastaSize) const;
00252 
00254         bool updateForInstaller(ms_errs    & log,
00255                                 const char         * not_mascot_dat_path, 
00256                                 const char         * mascot_dat_path,
00257                                 const char         * licenseFilePath,
00258                                 const char         * pathToMascot,
00259                                 const char         * mascotURL,
00260                                 const char         * sequenceDatabases,
00261                                 const bool           clusterEnable,
00262                                 const WST            wst,
00263                                 const char         * NTGuestName,
00264                                 const char         * NTAdminName,
00265                                 const unsigned int   flags);
00266 
00268         std::string getHeaderComments() const;
00269 
00271         void setHeaderComments(const std::string headerComments);
00272 
00273     private:
00274         std::string         filename_;
00275 
00276         int                 findFileTimeout_;
00277 
00278         ms_databases        Databases;
00279 
00280         ms_libraryoptions   libraryOptions;
00281 
00282         ms_parseoptions     parseOptions;
00283 
00284         ms_wwwoptions       wwwOptions;
00285 
00286         ms_processoroptions Processors;
00287 
00288         ms_taxonomyrules    **taxonomyRules;
00289 
00290         ms_clusterparams    clusterParams;
00291 
00292         ms_unigeneoptions   unigeneOptions;
00293 
00294         ms_mascotoptions    Options;
00295 
00296         ms_cronoptions      cronOptions;
00297 
00298         ms_mascotfiles      MascotFiles;
00299 
00300         std::string         headerComments_;
00301         std::string         footerComments_;
00302 
00303         ms_connection_settings  cs_;
00304 
00305     private:
00306         void defaultFileName();
00307 
00308         void defaultTaxonomyRules();
00309         void copyTaxonomyRules(const ms_datfile* right);
00310 
00311         void get_db_info(ms_filesource *f);
00312         void save_db_info(void *f);
00313 
00314         void get_library_options(ms_filesource *f, const std::string & preceedingComments);
00315         void save_library_options(void *f);
00316 
00317         void get_parse_rules(ms_filesource *f, const std::string & preceedingComments);
00318         void save_parse_rules(void *f);
00319 
00320         void get_www(ms_filesource *f, const std::string & preceedingComments);
00321         void save_www(void *f);
00322 
00323         void get_taxonomy_rules(ms_filesource *f, const char * sectionTitle, const std::string & preceedingComments);
00324         void save_taxonomy(void *f, const int index);
00325 
00326         void get_cluster_params(ms_filesource *f, const std::string & preceedingComments);
00327         void save_cluster_params(void *f);
00328 
00329         void get_unigene_options(ms_filesource *f, const std::string & preceedingComments);
00330         void save_unigene_options(void *f);
00331 
00332         void get_processors(ms_filesource *f, const std::string & preceedingComments);
00333         void save_processors(void *f);
00334 
00335         void get_options(ms_filesource *f, const std::string & preceedingComments);
00336         void save_options(void *f);
00337 
00338         void get_cron_job_list(ms_filesource *f, const std::string & preceedingComments);
00339         void save_cron_job_list(void *f);
00340 
00341         bool get_parse_rule_plus(const char *lineForError, char *pSrc, ms_parserule_plus *pRulePlus);
00342         void setIamParameter();
00343         void checkAndCompileParseRules();
00344         bool parseStringIntoCron(const char *szBuf, ms_cronjob & cron);
00345 
00346         int parseIntoArray(const char * szBufCopy, 
00347                            bool * array, 
00348                            int minVal, 
00349                            int maxVal, 
00350                            int starMeans, 
00351                            const char * wholeLine);
00352 
00353         bool skipToEndOfSection(ms_filesource *f);
00354         bool getStringExcludingQuotes(const char *line, char *pDst);
00355         void readToEndOfLine(const char * pSrc, char * pDst, int maximumLength);
00356         void replaceHashes(matrix_science::ms_customproperty & section,
00357                            const std::string & localPath,
00358                            const std::string & hostname,
00359                            const std::string & url);
00360 
00361         void read_filesource(ms_filesource & fsource);
00362         bool updateForInstallerDatabase(ms_errs               & log, 
00363                                         const std::string     & dbName, 
00364                                         const std::string     & defaultWildcard, 
00365                                         ms_databases          & dbs, 
00366                                         const ms_databases    * not_dbs,
00367                                         ms_parseoptions       & thisParse,
00368                                         const ms_parseoptions * notMascotDatParse);
00369         void updateForInstaller_ExecAfterSearch(ms_errs & log, matrix_science::ms_mascotoptions & options, const std::string & createPipCompleteString);
00370     }; // class ms_datfile // end of config_group
00372 } // namespace matrix_science
00373 
00374 #endif // MS_DATFILE_HPP
00375 
00376 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29