IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17391


Ignore:
Timestamp:
Apr 8, 2008, 8:26:00 AM (18 years ago)
Author:
eugene
Message:

working on UPDATE / RESET for metadata folders

Location:
branches/eam_branch_20080408/psLib/src/types
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080408/psLib/src/types/psMetadata.c

    r16814 r17391  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.168 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2008-03-05 00:57:00 $
     14 *  @version $Revision: 1.168.2.1 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2008-04-08 18:26:00 $
    1616 *
    1717 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    498498    psMetadataItem *inItem = NULL;
    499499    while ((inItem = psMetadataGetAndIncrement(iter))) {
     500
     501        // XXX options:
     502        // input MULTI & RESET  : replace an existing MULTI or ITEM of same name
     503        // input MULTI & UPDATE : supplement an existing MULTI or ITEM of same name
     504        // in both cases the name must exist in 'out'
     505
     506        // XXX we can meet this condition by respecting the value of
     507        // XXX do we need to do something special if the existing item is not MULTI?
     508
    500509        // Need to look for MULTI, which won't be picked up using the iterator.
    501510        psMetadataItem *multiCheckItem = psMetadataLookup(in, inItem->name);
    502511        unsigned int flag = PS_META_REPLACE | PS_META_REQUIRE_ENTRY | PS_META_REQUIRE_TYPE; // Flag to indicate MULTI; otherwise, replace
     512
    503513        if (multiCheckItem->type == PS_DATA_METADATA_MULTI) {
    504514            psTrace("psLib.types", 10, "MULTI: %s (%s)\n", inItem->name, inItem->comment);
  • branches/eam_branch_20080408/psLib/src/types/psMetadataConfig.c

    r15505 r17391  
    1111*  @author Joshua Hoblitt, University of Hawaii 2006-2007
    1212*
    13 *  @version $Revision: 1.142 $ $Name: not supported by cvs2svn $
    14 *  @date $Date: 2007-11-08 04:24:01 $
     13*  @version $Revision: 1.142.4.1 $ $Name: not supported by cvs2svn $
     14*  @date $Date: 2008-04-08 18:26:00 $
    1515*
    1616*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    802802    }
    803803
    804     // If type is not MULTI or META then get the value and comment
    805     if((mdType != PS_DATA_METADATA_MULTI) && (mdType != PS_DATA_METADATA)) {
     804    // If type is MULTI or META then check for the (optional) directives UPDATE or RESET;
     805    // otherwise, get the value and comment.
     806    if((mdType == PS_DATA_METADATA_MULTI) || (mdType == PS_DATA_METADATA)) {
     807        // Get the metadata item value if there is one.
     808        status = 0;
     809        strValue = getToken (&linePtr, "#", &status, true);
     810
     811        if (status) {
     812            psError(PS_ERR_IO, true, _("Failed to examine line for optional directive."));
     813            psFree(strType);
     814            psFree(strValue);
     815            return false;
     816        }
     817
     818        if (strValue) {
     819            // found a directive, what does it say?
     820            if (strcasecmp (strValue, "UPDATE") && strcasecmp (strValue, "UPDATE")) {
     821                psError(PS_ERR_IO, true, _("Invalid directive %s for METADATA or MULTI.", strValue));
     822                psFree(strType);
     823                psFree(strValue);
     824                return false;
     825            }
     826
     827            // found a directive, what does it say?
     828            if (!strcasecmp (strValue, "UPDATE")) {
     829                // XXX set the flag DUPLICATE_OK (or whatver it is we need)
     830                flags |= UPDATE;
     831            }
     832            if (!strcasecmp (strValue, "RESET")) {
     833                // XXX set the flag REPLACE (or whatver it is we need)
     834                flags |= RESET;
     835            }
     836        }
     837        psFree(strValue);
     838        strValue = NULL;
     839
     840        // Not all lines will have comments, so NULL is ok.
     841        status = 0;
     842
     843        // XXX this is a very ugly way of finding from the current position to
     844        // the end of the line
     845        strComment = getToken(&linePtr, "", &status, true);
     846
     847        if (status) {
     848            psError(PS_ERR_IO, true, _("Error reading a metadata comment"));
     849            psFree(strType);
     850            psFree(strComment);
     851            return false;
     852        }
     853    } else {
    806854        // Get the metadata item value if there is one.
    807855        status = 0;
     
    833881            return false;
    834882        }
    835     }
     883    } 
    836884
    837885#define PARSE_ADD_CASE(NAME, TYPE, PARSEFUNC) \
Note: See TracChangeset for help on using the changeset viewer.