IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16578


Ignore:
Timestamp:
Feb 21, 2008, 3:17:15 PM (18 years ago)
Author:
eugene
Message:

xxUser, xxSite, xxSystem to user,site,system and complete

Location:
branches/eam_branch_20080219/psModules/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080219/psModules/src/camera/pmFPAfileDefine.c

    r16542 r16578  
    155155    } else {
    156156        bool mdok;                      // Status of MD lookup
    157         psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->xxSystem, "CAMERAS"); // Known cameras
     157        psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->complete, "CAMERAS"); // Known cameras
    158158        if (!mdok || !cameras) {
    159159            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  
    5252static void configFree(pmConfig *config)
    5353{
    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);
    5758    psFree(config->files);
    5859    psFree(config->camera);
     
    8283
    8384    // 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;
    8789    config->camera = NULL;
    8890    config->cameraName = NULL;
     
    426428    }
    427429
    428 
    429430    // 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.
    431432    // XXX move this section to pmConfigReadUser.c ?
    432433
    433     if (!pmConfigFileRead(&config->xxUser, configFile, "user")) {
     434    if (!pmConfigFileRead(&config->user, configFile, "user")) {
    434435        psFree(config);
    435436        return NULL;
     
    441442
    442443        // Set logging level
    443         int logLevel = psMetadataLookupS32(&mdok, config->xxUser, "LOGLEVEL");
     444        int logLevel = psMetadataLookupS32(&mdok, config->user, "LOGLEVEL");
    444445        if (mdok && logLevel >= 0)
    445446        {
     
    450451
    451452        // Set logging format
    452         psString logFormat = psMetadataLookupStr(&mdok, config->xxUser, "LOGFORMAT");
     453        psString logFormat = psMetadataLookupStr(&mdok, config->user, "LOGFORMAT");
    453454        if (mdok && logFormat)
    454455        {
     
    471472        }
    472473        if (!logDest) {
    473             logDest = psMemIncrRefCounter(psMetadataLookupStr(&mdok, config->xxUser, "LOGDEST"));
     474            logDest = psMemIncrRefCounter(psMetadataLookupStr(&mdok, config->user, "LOGDEST"));
    474475        }
    475476        if (logDest) {
     
    491492
    492493        // Set trace levels
    493         psMetadata *trace = psMetadataLookupMetadata(&mdok, config->xxUser, "TRACE");
     494        psMetadata *trace = psMetadataLookupMetadata(&mdok, config->user, "TRACE");
    494495        if (mdok && trace) {
    495496            psMetadataIterator *traceIter = psMetadataIteratorAlloc(trace, PS_LIST_HEAD, NULL); // Iterator
     
    509510
    510511        // Set trace formats
    511         psString traceFormat = psMetadataLookupStr(&mdok, config->xxUser, "TRACEFORMAT");
     512        psString traceFormat = psMetadataLookupStr(&mdok, config->user, "TRACEFORMAT");
    512513        if (mdok && traceFormat) {
    513514            psTrace("psModules.config", 7, "Setting trace format to %s\n", traceFormat);
     
    529530        }
    530531        if (!traceDest) {
    531             traceDest = psMemIncrRefCounter(psMetadataLookupStr(&mdok, config->xxUser, "TRACEDEST"));
     532            traceDest = psMemIncrRefCounter(psMetadataLookupStr(&mdok, config->user, "TRACEDEST"));
    532533        }
    533534        if (traceDest) {
     
    562563
    563564    // define the config-file search path (configPath). 
    564     psString path = psMetadataLookupStr(NULL, config->xxUser, "PATH");
     565    psString path = psMetadataLookupStr(NULL, config->user, "PATH");
    565566    pmConfigSet (path);
    566567
    567     // load the SITE file
    568     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")) {
    570571        psFree(config);
    571572        return NULL;
     
    573574
    574575    // 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")) {
    577578        psFree(config);
    578579        return NULL;
    579580    }
     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);
    580586
    581587    // XXX read TIME from SITE (or system?)
     
    585591        // Initialise the psLib time handling
    586592        // XXX is this still needed / desired?
    587         psString timeName = psMetadataLookupStr(&mdok, config->xxSite, "TIME");
     593        psString timeName = psMetadataLookupStr(&mdok, config->complete, "TIME");
    588594        if (mdok && timeName)
    589595        {
     
    605611            char *cameraName = argv[argNum]; // symbolic name of the camera
    606612
    607             // look for the CAMERAS list in config->xxSystem
    608             psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->xxSystem, "CAMERAS");
     613            // look for the CAMERAS list in config->complete
     614            psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->complete, "CAMERAS");
    609615            if (!cameras) {
    610616                psError(PS_ERR_IO, false, "Unable to find CAMERAS in site configuration.\n");
     
    652658                                  "Camera specified on command line", config->camera);
    653659
    654             if (!pmConfigCameraSkycellVersion(config->xxSystem, cameraName)) {
     660            if (!pmConfigCameraSkycellVersion(config->complete, cameraName)) {
    655661                psError(PS_ERR_UNKNOWN, false,
    656662                        "Unable to generate skycell versions of specified camera %s.\n",
     
    660666            }
    661667
    662             if (!pmConfigCameraMosaickedVersions(config->xxSystem, cameraName)) {
     668            if (!pmConfigCameraMosaickedVersions(config->complete, cameraName)) {
    663669                psError(PS_ERR_UNKNOWN, false,
    664670                        "Unable to generate mosaicked versions of specified camera %s.\n",
     
    673679    if (!config->camera && readCameraConfig) {
    674680        bool mdok;                      // Status of MD lookup
    675         psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->xxSystem, "CAMERAS"); // List of cameras
     681        psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->complete, "CAMERAS"); // List of cameras
    676682        if (!mdok || !cameras) {
    677683            psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the system configuration.\n");
     
    707713        psFree(iter);
    708714
    709         if (!pmConfigCameraSkycellVersionsAll(config->xxSystem)) {
     715        if (!pmConfigCameraSkycellVersionsAll(config->complete)) {
    710716            psError(PS_ERR_UNKNOWN, false, "Unable to generate skycell versions of cameras.\n");
    711717            psFree(config);
    712718            return NULL;
    713719        }
    714         if (!pmConfigCameraMosaickedVersionsAll(config->xxSystem)) {
     720        if (!pmConfigCameraMosaickedVersionsAll(config->complete)) {
    715721            psError(PS_ERR_UNKNOWN, false, "Unable to generate mosaicked versions of cameras.\n");
    716722            psFree(config);
     
    751757        psArgumentRemove(argNum, argc, argv);
    752758
    753         psMetadata *cameras = psMetadataLookupMetadata(NULL, config->xxSystem, "CAMERAS"); // List of cameras
     759        psMetadata *cameras = psMetadataLookupMetadata(NULL, config->complete, "CAMERAS"); // List of cameras
    754760        if (!cameras) {
    755761            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find CAMERAS in the site configuration.\n");
     
    799805        } else {
    800806            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)) {
    802808                psWarning("Failed to overwrite .ipprc DBSERVER value");
    803809            }
     
    814820        } else {
    815821            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)) {
    817823                psWarning("Failed to overwrite .ipprc DBNAME value");
    818824            }
     
    829835        } else {
    830836            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)) {
    832838                psWarning("Failed to overwrite .ipprc DBUSER value");
    833839            }
     
    844850        } else {
    845851            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,
    847853                                  NULL, dbpassword)) {
    848854                psWarning("Failed to overwrite .ipprc DBPASSWORD value");
     
    860866        } else {
    861867            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,
    863869                                  (psS32)atoi(dbport))) {
    864870                psWarning("Failed to overwrite .ipprc DBPORT value");
     
    10321038    if (! config->camera) {
    10331039        bool mdok;                      // Metadata lookup status
    1034         psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->xxSystem, "CAMERAS");
     1040        psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->complete, "CAMERAS");
    10351041        if (! mdok || !cameras) {
    10361042            psError(PS_ERR_IO, true, "Unable to find CAMERAS in the configuration.");
     
    11191125    PS_ASSERT_STRING_NON_EMPTY(cameraName, NULL);
    11201126
    1121     psMetadata *cameras = psMetadataLookupMetadata(NULL, config->xxSystem, "CAMERAS");
     1127    psMetadata *cameras = psMetadataLookupMetadata(NULL, config->complete, "CAMERAS");
    11221128    if (!cameras) {
    11231129        psError(PS_ERR_IO, true, "Unable to find CAMERAS in the configuration.");
     
    11451151{
    11461152    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);
    11481154
    11491155    #ifndef HAVE_PSDB
     
    11621168
    11631169    // 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");
    11691175    if (!mdStatus05) {
    11701176        dbPort = 0;
     
    13571363    // replace path://PATH with matched datapath
    13581364    if (!strncasecmp(filename, "path://", strlen("path://"))) {
    1359         PS_ASSERT_METADATA_NON_NULL(config->xxSite, NULL);
     1365        PS_ASSERT_METADATA_NON_NULL(config->complete, NULL);
    13601366
    13611367        psString newName = psStringCopy(filename);
    13621368
    13631369        // filename should be of the form: path://PATH/rest/of/file
    1364         // replace PATH with matching name from config->xxSite:DATAPATH
    1365         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");
    13661372        if (datapath == NULL) {
    13671373            psError(PS_ERR_UNKNOWN, true, "DATAPATH is not defined in config.site");
     
    14151421        // if env isn't set, check the config system
    14161422        if (!neb_server) {
    1417             neb_server = psMetadataLookupStr(&status, config->xxSite, "NEB_SERVER");
     1423            neb_server = psMetadataLookupStr(&status, config->complete, "NEB_SERVER");
    14181424            if (!status) {
    14191425                psError(PM_ERR_CONFIG, true, "failed to lookup config value for NEB_SERVER.");
  • branches/eam_branch_20080219/psModules/src/config/pmConfig.h

    r16542 r16578  
    55 *  @author Eugene Magnier, IfA
    66 *
    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 $
    99 *  Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    1010 */
     
    3737/// command-line arguments, the pmFPAfiles used, and the database handle.
    3838typedef 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
    4243    psMetadata *camera;                 ///< Camera specification
    4344    psString cameraName;                ///< Camera name
  • branches/eam_branch_20080219/psModules/src/config/pmConfigCommand.c

    r16542 r16578  
    1313    PS_ASSERT_PTR_NON_NULL(command, false);
    1414    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);
    1616
    1717    bool mdok;                          // Status of MD lookup
    18     const char *dbserver = psMetadataLookupStr(&mdok, config->xxSite, "DBSERVER"); // Database server
     18    const char *dbserver = psMetadataLookupStr(&mdok, config->complete, "DBSERVER"); // Database server
    1919    if (!mdok || strlen(dbserver) == 0) {
    2020        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBSERVER in site configuration.\n");
    2121        return false;
    2222    }
    23     const char *dbname = psMetadataLookupStr(&mdok, config->xxSite, "DBNAME"); // Database name
     23    const char *dbname = psMetadataLookupStr(&mdok, config->complete, "DBNAME"); // Database name
    2424    if (!mdok || strlen(dbname) == 0) {
    2525        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBNAME in site configuration.\n");
    2626        return false;
    2727    }
    28     const char *dbuser = psMetadataLookupStr(&mdok, config->xxSite, "DBUSER"); // Database user
     28    const char *dbuser = psMetadataLookupStr(&mdok, config->complete, "DBUSER"); // Database user
    2929    if (!mdok || strlen(dbuser) == 0) {
    3030        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBUSER in site configuration.\n");
    3131        return false;
    3232    }
    33     const char *dbpassword = psMetadataLookupStr(&mdok, config->xxSite, "DBPASSWORD"); // Database password
     33    const char *dbpassword = psMetadataLookupStr(&mdok, config->complete, "DBPASSWORD"); // Database password
    3434    if (!mdok || strlen(dbpassword) == 0) {
    3535        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  
    4646
    4747// 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 recipes
     48// three locations: config->complete, config->camera, and argv.  We cannot read the recipes
    4949// from config->camera until a camera has been read BUT, the argv recipes must override the
    5050// camera and system recipes.
     
    5959
    6060    // 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 their
     61    // It is an error for config->complete:recipes not to exist.  all programs install their
    6262    // 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)) {
    6565            psError(PS_ERR_IO, false, "Failed to read recipes from system config");
    6666            return false;
Note: See TracChangeset for help on using the changeset viewer.