Changeset 16578
- Timestamp:
- Feb 21, 2008, 3:17:15 PM (18 years ago)
- Location:
- branches/eam_branch_20080219/psModules/src
- Files:
-
- 5 edited
-
camera/pmFPAfileDefine.c (modified) (1 diff)
-
config/pmConfig.c (modified) (29 diffs)
-
config/pmConfig.h (modified) (2 diffs)
-
config/pmConfigCommand.c (modified) (1 diff)
-
config/pmConfigRecipes.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080219/psModules/src/camera/pmFPAfileDefine.c
r16542 r16578 155 155 } else { 156 156 bool mdok; // Status of MD lookup 157 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config-> xxSystem, "CAMERAS"); // Known cameras157 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->complete, "CAMERAS"); // Known cameras 158 158 if (!mdok || !cameras) { 159 159 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the system configuration.\n"); -
branches/eam_branch_20080219/psModules/src/config/pmConfig.c
r16542 r16578 52 52 static void configFree(pmConfig *config) 53 53 { 54 psFree(config->xxUser); 55 psFree(config->xxSite); 56 psFree(config->xxSystem); 54 psFree(config->user); 55 psFree(config->site); 56 psFree(config->system); 57 psFree(config->complete); 57 58 psFree(config->files); 58 59 psFree(config->camera); … … 82 83 83 84 // Initialise 84 config->xxUser = NULL; 85 config->xxSite = NULL; 86 config->xxSystem = NULL; 85 config->user = NULL; 86 config->site = NULL; 87 config->system = NULL; 88 config->complete = NULL; 87 89 config->camera = NULL; 88 90 config->cameraName = NULL; … … 426 428 } 427 429 428 429 430 // We have the configuration filename; now we read and parse the config 430 // file and store in psMetadata struct xxUser.431 // file and store in psMetadata struct user. 431 432 // XXX move this section to pmConfigReadUser.c ? 432 433 433 if (!pmConfigFileRead(&config-> xxUser, configFile, "user")) {434 if (!pmConfigFileRead(&config->user, configFile, "user")) { 434 435 psFree(config); 435 436 return NULL; … … 441 442 442 443 // Set logging level 443 int logLevel = psMetadataLookupS32(&mdok, config-> xxUser, "LOGLEVEL");444 int logLevel = psMetadataLookupS32(&mdok, config->user, "LOGLEVEL"); 444 445 if (mdok && logLevel >= 0) 445 446 { … … 450 451 451 452 // Set logging format 452 psString logFormat = psMetadataLookupStr(&mdok, config-> xxUser, "LOGFORMAT");453 psString logFormat = psMetadataLookupStr(&mdok, config->user, "LOGFORMAT"); 453 454 if (mdok && logFormat) 454 455 { … … 471 472 } 472 473 if (!logDest) { 473 logDest = psMemIncrRefCounter(psMetadataLookupStr(&mdok, config-> xxUser, "LOGDEST"));474 logDest = psMemIncrRefCounter(psMetadataLookupStr(&mdok, config->user, "LOGDEST")); 474 475 } 475 476 if (logDest) { … … 491 492 492 493 // Set trace levels 493 psMetadata *trace = psMetadataLookupMetadata(&mdok, config-> xxUser, "TRACE");494 psMetadata *trace = psMetadataLookupMetadata(&mdok, config->user, "TRACE"); 494 495 if (mdok && trace) { 495 496 psMetadataIterator *traceIter = psMetadataIteratorAlloc(trace, PS_LIST_HEAD, NULL); // Iterator … … 509 510 510 511 // Set trace formats 511 psString traceFormat = psMetadataLookupStr(&mdok, config-> xxUser, "TRACEFORMAT");512 psString traceFormat = psMetadataLookupStr(&mdok, config->user, "TRACEFORMAT"); 512 513 if (mdok && traceFormat) { 513 514 psTrace("psModules.config", 7, "Setting trace format to %s\n", traceFormat); … … 529 530 } 530 531 if (!traceDest) { 531 traceDest = psMemIncrRefCounter(psMetadataLookupStr(&mdok, config-> xxUser, "TRACEDEST"));532 traceDest = psMemIncrRefCounter(psMetadataLookupStr(&mdok, config->user, "TRACEDEST")); 532 533 } 533 534 if (traceDest) { … … 562 563 563 564 // define the config-file search path (configPath). 564 psString path = psMetadataLookupStr(NULL, config-> xxUser, "PATH");565 psString path = psMetadataLookupStr(NULL, config->user, "PATH"); 565 566 pmConfigSet (path); 566 567 567 // load the SITE file568 psString siteFile = psMetadataLookupStr(NULL, config-> xxUser, "SITE");569 if (!pmConfigFileRead(&config-> xxSite, siteFile, "site")) {568 // read the SITE file 569 psString siteFile = psMetadataLookupStr(NULL, config->user, "SITE"); 570 if (!pmConfigFileRead(&config->site, siteFile, "site")) { 570 571 psFree(config); 571 572 return NULL; … … 573 574 574 575 // load the SYSTEM file 575 psString systemFile = psMetadataLookupStr(NULL, config-> xxUser, "SYSTEM");576 if (!pmConfigFileRead(&config-> xxSystem, systemFile, "system")) {576 psString systemFile = psMetadataLookupStr(NULL, config->user, "SYSTEM"); 577 if (!pmConfigFileRead(&config->system, systemFile, "system")) { 577 578 psFree(config); 578 579 return NULL; 579 580 } 581 582 // interpolate USER, SITE and SYSTEM into the config->complete metadata 583 config->complete = psMetadataCopy (NULL, config->user); 584 config->complete = psMetadataCopy (config->complete, config->site); 585 config->complete = psMetadataCopy (config->complete, config->system); 580 586 581 587 // XXX read TIME from SITE (or system?) … … 585 591 // Initialise the psLib time handling 586 592 // XXX is this still needed / desired? 587 psString timeName = psMetadataLookupStr(&mdok, config-> xxSite, "TIME");593 psString timeName = psMetadataLookupStr(&mdok, config->complete, "TIME"); 588 594 if (mdok && timeName) 589 595 { … … 605 611 char *cameraName = argv[argNum]; // symbolic name of the camera 606 612 607 // look for the CAMERAS list in config-> xxSystem608 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config-> xxSystem, "CAMERAS");613 // look for the CAMERAS list in config->complete 614 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->complete, "CAMERAS"); 609 615 if (!cameras) { 610 616 psError(PS_ERR_IO, false, "Unable to find CAMERAS in site configuration.\n"); … … 652 658 "Camera specified on command line", config->camera); 653 659 654 if (!pmConfigCameraSkycellVersion(config-> xxSystem, cameraName)) {660 if (!pmConfigCameraSkycellVersion(config->complete, cameraName)) { 655 661 psError(PS_ERR_UNKNOWN, false, 656 662 "Unable to generate skycell versions of specified camera %s.\n", … … 660 666 } 661 667 662 if (!pmConfigCameraMosaickedVersions(config-> xxSystem, cameraName)) {668 if (!pmConfigCameraMosaickedVersions(config->complete, cameraName)) { 663 669 psError(PS_ERR_UNKNOWN, false, 664 670 "Unable to generate mosaicked versions of specified camera %s.\n", … … 673 679 if (!config->camera && readCameraConfig) { 674 680 bool mdok; // Status of MD lookup 675 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config-> xxSystem, "CAMERAS"); // List of cameras681 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->complete, "CAMERAS"); // List of cameras 676 682 if (!mdok || !cameras) { 677 683 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the system configuration.\n"); … … 707 713 psFree(iter); 708 714 709 if (!pmConfigCameraSkycellVersionsAll(config-> xxSystem)) {715 if (!pmConfigCameraSkycellVersionsAll(config->complete)) { 710 716 psError(PS_ERR_UNKNOWN, false, "Unable to generate skycell versions of cameras.\n"); 711 717 psFree(config); 712 718 return NULL; 713 719 } 714 if (!pmConfigCameraMosaickedVersionsAll(config-> xxSystem)) {720 if (!pmConfigCameraMosaickedVersionsAll(config->complete)) { 715 721 psError(PS_ERR_UNKNOWN, false, "Unable to generate mosaicked versions of cameras.\n"); 716 722 psFree(config); … … 751 757 psArgumentRemove(argNum, argc, argv); 752 758 753 psMetadata *cameras = psMetadataLookupMetadata(NULL, config-> xxSystem, "CAMERAS"); // List of cameras759 psMetadata *cameras = psMetadataLookupMetadata(NULL, config->complete, "CAMERAS"); // List of cameras 754 760 if (!cameras) { 755 761 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find CAMERAS in the site configuration.\n"); … … 799 805 } else { 800 806 char *dbserver = argv[argNum]; // The camera configuration file to read 801 if (!psMetadataAddStr(config-> xxSite, PS_LIST_TAIL, "DBSERVER", PS_META_REPLACE, NULL, dbserver)) {807 if (!psMetadataAddStr(config->complete, PS_LIST_TAIL, "DBSERVER", PS_META_REPLACE, NULL, dbserver)) { 802 808 psWarning("Failed to overwrite .ipprc DBSERVER value"); 803 809 } … … 814 820 } else { 815 821 char *dbname = argv[argNum]; // The camera configuration file to read 816 if (!psMetadataAddStr(config-> xxSite, PS_LIST_TAIL, "DBNAME", PS_META_REPLACE, NULL, dbname)) {822 if (!psMetadataAddStr(config->complete, PS_LIST_TAIL, "DBNAME", PS_META_REPLACE, NULL, dbname)) { 817 823 psWarning("Failed to overwrite .ipprc DBNAME value"); 818 824 } … … 829 835 } else { 830 836 char *dbuser = argv[argNum]; // The camera configuration file to read 831 if (!psMetadataAddStr(config-> xxSite, PS_LIST_TAIL, "DBUSER", PS_META_REPLACE, NULL, dbuser)) {837 if (!psMetadataAddStr(config->complete, PS_LIST_TAIL, "DBUSER", PS_META_REPLACE, NULL, dbuser)) { 832 838 psWarning("Failed to overwrite .ipprc DBUSER value"); 833 839 } … … 844 850 } else { 845 851 char *dbpassword = argv[argNum]; // The camera configuration file to read 846 if (!psMetadataAddStr(config-> xxSite, PS_LIST_TAIL, "DBPASSWORD", PS_META_REPLACE,852 if (!psMetadataAddStr(config->complete, PS_LIST_TAIL, "DBPASSWORD", PS_META_REPLACE, 847 853 NULL, dbpassword)) { 848 854 psWarning("Failed to overwrite .ipprc DBPASSWORD value"); … … 860 866 } else { 861 867 char *dbport = argv[argNum]; // The camera configuration file to read 862 if (!psMetadataAddS32(config-> xxSite, PS_LIST_TAIL, "DBPORT", PS_META_REPLACE, NULL,868 if (!psMetadataAddS32(config->complete, PS_LIST_TAIL, "DBPORT", PS_META_REPLACE, NULL, 863 869 (psS32)atoi(dbport))) { 864 870 psWarning("Failed to overwrite .ipprc DBPORT value"); … … 1032 1038 if (! config->camera) { 1033 1039 bool mdok; // Metadata lookup status 1034 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config-> xxSystem, "CAMERAS");1040 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->complete, "CAMERAS"); 1035 1041 if (! mdok || !cameras) { 1036 1042 psError(PS_ERR_IO, true, "Unable to find CAMERAS in the configuration."); … … 1119 1125 PS_ASSERT_STRING_NON_EMPTY(cameraName, NULL); 1120 1126 1121 psMetadata *cameras = psMetadataLookupMetadata(NULL, config-> xxSystem, "CAMERAS");1127 psMetadata *cameras = psMetadataLookupMetadata(NULL, config->complete, "CAMERAS"); 1122 1128 if (!cameras) { 1123 1129 psError(PS_ERR_IO, true, "Unable to find CAMERAS in the configuration."); … … 1145 1151 { 1146 1152 PS_ASSERT_PTR_NON_NULL(config, NULL); 1147 PS_ASSERT_PTR_NON_NULL(config-> xxSite, NULL);1153 PS_ASSERT_PTR_NON_NULL(config->complete, NULL); 1148 1154 1149 1155 #ifndef HAVE_PSDB … … 1162 1168 1163 1169 // XXX leaky strings 1164 psString dbServer = psMetadataLookupStr(&mdStatus01, config-> xxSite, "DBSERVER");1165 psString dbUsername = psMetadataLookupStr(&mdStatus02, config-> xxSite, "DBUSER");1166 psString dbPassword = psMetadataLookupStr(&mdStatus03, config-> xxSite, "DBPASSWORD");1167 psString dbName = psMetadataLookupStr(&mdStatus04, config-> xxSite, "DBNAME");1168 psS32 dbPort = psMetadataLookupS32(&mdStatus05, config-> xxSite, "DBPORT");1170 psString dbServer = psMetadataLookupStr(&mdStatus01, config->complete, "DBSERVER"); 1171 psString dbUsername = psMetadataLookupStr(&mdStatus02, config->complete, "DBUSER"); 1172 psString dbPassword = psMetadataLookupStr(&mdStatus03, config->complete, "DBPASSWORD"); 1173 psString dbName = psMetadataLookupStr(&mdStatus04, config->complete, "DBNAME"); 1174 psS32 dbPort = psMetadataLookupS32(&mdStatus05, config->complete, "DBPORT"); 1169 1175 if (!mdStatus05) { 1170 1176 dbPort = 0; … … 1357 1363 // replace path://PATH with matched datapath 1358 1364 if (!strncasecmp(filename, "path://", strlen("path://"))) { 1359 PS_ASSERT_METADATA_NON_NULL(config-> xxSite, NULL);1365 PS_ASSERT_METADATA_NON_NULL(config->complete, NULL); 1360 1366 1361 1367 psString newName = psStringCopy(filename); 1362 1368 1363 1369 // filename should be of the form: path://PATH/rest/of/file 1364 // replace PATH with matching name from config-> xxSite:DATAPATH1365 psMetadata *datapath = psMetadataLookupPtr (NULL, config-> xxSite, "DATAPATH");1370 // replace PATH with matching name from config->complete:DATAPATH 1371 psMetadata *datapath = psMetadataLookupPtr (NULL, config->complete, "DATAPATH"); 1366 1372 if (datapath == NULL) { 1367 1373 psError(PS_ERR_UNKNOWN, true, "DATAPATH is not defined in config.site"); … … 1415 1421 // if env isn't set, check the config system 1416 1422 if (!neb_server) { 1417 neb_server = psMetadataLookupStr(&status, config-> xxSite, "NEB_SERVER");1423 neb_server = psMetadataLookupStr(&status, config->complete, "NEB_SERVER"); 1418 1424 if (!status) { 1419 1425 psError(PM_ERR_CONFIG, true, "failed to lookup config value for NEB_SERVER."); -
branches/eam_branch_20080219/psModules/src/config/pmConfig.h
r16542 r16578 5 5 * @author Eugene Magnier, IfA 6 6 * 7 * @version $Revision: 1.32.6. 1$ $Name: not supported by cvs2svn $8 * @date $Date: 2008-02- 19 20:09:09$7 * @version $Revision: 1.32.6.2 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-02-22 01:17:15 $ 9 9 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 10 10 */ … … 37 37 /// command-line arguments, the pmFPAfiles used, and the database handle. 38 38 typedef struct { 39 psMetadata *xxUser; ///< User configuration 40 psMetadata *xxSite; ///< Site configuration 41 psMetadata *xxSystem; ///< System configuration 39 psMetadata *user; ///< User configuration 40 psMetadata *site; ///< Site configuration 41 psMetadata *system; ///< System configuration 42 psMetadata *complete; ///< Full merged configuration 42 43 psMetadata *camera; ///< Camera specification 43 44 psString cameraName; ///< Camera name -
branches/eam_branch_20080219/psModules/src/config/pmConfigCommand.c
r16542 r16578 13 13 PS_ASSERT_PTR_NON_NULL(command, false); 14 14 PS_ASSERT_PTR_NON_NULL(config, false); 15 PS_ASSERT_PTR_NON_NULL(config-> xxSite, false);15 PS_ASSERT_PTR_NON_NULL(config->complete, false); 16 16 17 17 bool mdok; // Status of MD lookup 18 const char *dbserver = psMetadataLookupStr(&mdok, config-> xxSite, "DBSERVER"); // Database server18 const char *dbserver = psMetadataLookupStr(&mdok, config->complete, "DBSERVER"); // Database server 19 19 if (!mdok || strlen(dbserver) == 0) { 20 20 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBSERVER in site configuration.\n"); 21 21 return false; 22 22 } 23 const char *dbname = psMetadataLookupStr(&mdok, config-> xxSite, "DBNAME"); // Database name23 const char *dbname = psMetadataLookupStr(&mdok, config->complete, "DBNAME"); // Database name 24 24 if (!mdok || strlen(dbname) == 0) { 25 25 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBNAME in site configuration.\n"); 26 26 return false; 27 27 } 28 const char *dbuser = psMetadataLookupStr(&mdok, config-> xxSite, "DBUSER"); // Database user28 const char *dbuser = psMetadataLookupStr(&mdok, config->complete, "DBUSER"); // Database user 29 29 if (!mdok || strlen(dbuser) == 0) { 30 30 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBUSER in site configuration.\n"); 31 31 return false; 32 32 } 33 const char *dbpassword = psMetadataLookupStr(&mdok, config-> xxSite, "DBPASSWORD"); // Database password33 const char *dbpassword = psMetadataLookupStr(&mdok, config->complete, "DBPASSWORD"); // Database password 34 34 if (!mdok || strlen(dbpassword) == 0) { 35 35 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBPASSWORD in site configuration.\n"); -
branches/eam_branch_20080219/psModules/src/config/pmConfigRecipes.c
r16542 r16578 46 46 47 47 // this function may be called several times. it attempts to load the recipe data from one of 48 // three locations: config-> xxSystem, config->camera, and argv. We cannot read the recipes48 // three locations: config->complete, config->camera, and argv. We cannot read the recipes 49 49 // from config->camera until a camera has been read BUT, the argv recipes must override the 50 50 // camera and system recipes. … … 59 59 60 60 // Read the recipe file names from the system configuration and camera configuration 61 // It is an error for config-> xxSystem:recipes not to exist. all programs install their61 // It is an error for config->complete:recipes not to exist. all programs install their 62 62 // master recipe files in the system:recipe location when they are built. 63 if (config-> xxSystem&& (source & PM_RECIPE_SOURCE_SYSTEM)) {64 if (!loadRecipeSystem(&status, config, config-> xxSystem)) {63 if (config->complete && (source & PM_RECIPE_SOURCE_SYSTEM)) { 64 if (!loadRecipeSystem(&status, config, config->complete)) { 65 65 psError(PS_ERR_IO, false, "Failed to read recipes from system config"); 66 66 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
