Ignore:
Timestamp:
2012-11-07T20:42:12+13:00 (11 years ago)
Author:
ak19
Message:
  1. Added GS3 colconfig.xml processing of any OIDtype and OIDmetadata options specified (under new element importOptions) in collectionConfig.xml 2. Any OIDtype and/or OIDmetadata options provided to import.pl on the commandline still override what's in the collectionConfig.xml. Note: as these are not to be written back out to the collectionConfig file, buildcol.pl (which does not take either as argument) will have no recollection of either of these options specified as cmdline arguments to import.pl, and can at best consult whatever may be in collectionConfig.xml
Location:
main/trunk/greenstone2/perllib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/collConfigxml.pm

    r26342 r26450  
    7575my $currentAttrRef = undef;
    7676
     77# for storing plugin options if of type importOptions or buildOptions
     78my $currentPluginOptionsType = undef; # can be import or build
     79
    7780my $currentLevel = "";
    7881
     
    277280      }
    278281   
     282    # need to process the options of any build- and importOptions lists inside a plugin
     283    # <pluginList><plugin><option.../><option.../><importOptions><option .../></importOptions></plugin></pluginList>
     284    elsif ($currentLevel eq "plugin" and $element =~ m/^(importOptions|buildOptions)$/) {
     285    if($element eq "importOptions") {
     286        $currentPluginOptionsType="import";
     287    }
     288    else {
     289        $currentPluginOptionsType="build";
     290    }
     291    }
     292
    279293    #@ Handling the option elements in each classifier/plugin element (as the following strings)
    280294    elsif ($currentLevel =~ /$arrayarrayexp/ and $element eq "option") {
     
    288302            push (@{$data->{$key}->[$currentIndex]}, $value);
    289303    }
     304    # besides regular options, plugins can have buildOptions and importOptions
     305    #if (defined $currentPluginOptionsType and $currentPluginOptionsType =~ /\w/) {
     306            #push (@{$data->{$key}->[$currentIndex]}, $currentPluginOptionsType);
     307        ##print "@@@@ Found $currentPluginOptionsType option with name: $name and value: $value\n";
     308    #}
    290309
    291310    }
     
    300319        $currentLevel = "";
    301320    }
     321    elsif ($element =~ m/^(importOptions|buildOptions)$/) { # can be nested inside a plugin of pluginList
     322    $currentPluginOptionsType = undef;
     323    }
     324
    302325    # $arrayarrayexp contains classifier|plugin
    303326    elsif($element =~ /$arrayarrayexp/ ){
  • main/trunk/greenstone2/perllib/inexport.pm

    r25957 r26450  
    227227    $collectcfg->{'infodbtype'} = "gdbm";
    228228    }
     229
     230    # if OIDtype and/or OIDmetadata args are specified on the commandline, they override what's
     231    # in collectcfg but may not overwrite it (by writing it into the collectcfg file)
     232    if (defined $self->{'OIDtype'} && $self->{'OIDtype'} =~ /\w/)
     233    {
     234    $collectcfg->{'OIDtype'} = $self->{'OIDtype'}; # store in the in-memory collectcfg hash
     235    }
     236    if (defined $self->{'OIDmetadata'} && $self->{'OIDmetadata'} =~ /\w/)
     237    {
     238    $collectcfg->{'OIDmetadata'} = $self->{'OIDmetadata'}; # store in the in-memory collectcfg hash
     239    }   
     240
    229241    if (defined $collectcfg->{'importdir'} && $importdir eq "") {
    230242    $importdir = $collectcfg->{'importdir'};
Note: See TracChangeset for help on using the changeset viewer.