Changeset 22456


Ignore:
Timestamp:
2010-07-21T09:50:35+12:00 (12 years ago)
Author:
sjb48
Message:

Modified collConfigxml.pm to read and configure build options for metadata coverage

File:
1 edited

Legend:

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

    r21822 r22456  
    8686           "searchType" => "searchtype",
    8787           "languageMetadata" => "languagemetadata",
    88            "buildType" => "buildtype"
     88           "buildType" => "buildtype",
     89           "buildOption" => "buildOption"
    8990           };
    9091# A hash structure which is returned by sub read_cfg_file.
    9192my $data = {};
    9293
    93 my $repeatedBlock = q/^(browse|pluginList)$/;
     94my $repeatedBlock = q/^(browse|pluginList)$/; #|buildOptionList)$/;
    9495
    9596# use those unique attribute values to locate the text within the elements
     
    109110my $currentIndex = 0;
    110111my $arrayexp = q/^(index|level|indexSubcollection|indexLanguage)$/;
    111 my $arrayarrayexp= q/^(plugin|classifier)$/;
     112my $arrayarrayexp= q/^(plugin|classifier)$/; #|buildOption)$/;
    112113my $hashexp = q/^(subcollection)$/; # add other element names that should be represented by hash expressions here
    113114my $hashhashexp = q/^(displayItem)$/; # add other (collectionmeta) element names that should be represented by hashes of hashes here.
     
    151152    }
    152153
    153     #&Display;
     154    &Display;
    154155    return $data;
    155156}
     
    228229    }
    229230
     231    #*****************************************
     232    elsif ($element eq "buildOption") {
     233        print STDERR "**** BUILD OPTION PAIR $name $value\n";
     234        $data->{$name} = $value;
     235    }   
     236
     237
    230238    #@ indexoptions: accentfold/casefold/stem; arrayexp
    231239    elsif ($element eq "indexOption") {
     
    288296    # Push classifier/plugin name (e.g. AZList) into $data as the first string
    289297    push (@{$data->{$key}->[$currentIndex]},$name);
     298    if (defined $value and $value =~ /\w/) {
     299        push (@{$data->{$key}->[$currentIndex]}, $value);
     300        print "$value\n";
     301    }
    290302    #print $currentIndex."indexup\n";
    291303      }
     
    309321sub EndTag {
    310322    my ($expat, $element) = @_;
    311     my $endTags = q/^(browse|pluginList|displayItemList)$/;  
     323    my $endTags = q/^(browse|pluginList|displayItemList)$/; #|buildOptionList)$/;  
    312324    if ($element =~ /$endTags/) {
    313325        $currentIndex = 0;
     
    379391    }
    380392 
    381     print $data->{'creator'}."\n" if (defined $data->{'creator'});
    382     print $data->{"maintainer"}."\n" if (defined $data->{"maintainer"});
    383     print $data->{"public"}."\n" if (defined $data->{"public"});
    384     print $data->{"defaultindex"}."\n" if (defined $data->{"defaultindex"});
    385     print $data->{"defaultlevel"}."\n" if (defined $data->{"defaultlevel"});
    386     print $data->{"buildtype"}."\n" if (defined $data->{"buildtype"});
    387     print  join(",",@{$data->{"searchtype"}})."\n" if (defined $data->{"searchtype"});
    388     print  join(",",@{$data->{'levels'}})."\n" if (defined $data->{'levels'});
    389     print  join(",",@{$data->{'indexsubcollections'}})."\n" if (defined $data->{'indexsubcollections'});
    390     print  join(",",@{$data->{'indexes'}})."\n" if (defined $data->{'indexes'});
    391     print  join(",",@{$data->{'indexoptions'}})."\n" if (defined $data->{'indexoptions'});
    392     print  join(",",@{$data->{'languages'}})."\n" if (defined $data->{'languages'});
    393     print  join(",",@{$data->{'languagemetadata'}})."\n" if (defined $data->{'languagemetadata'});
     393    print STDERR "*** creator: ".$data->{'creator'}."\n" if (defined $data->{'creator'});
     394    print STDERR "*** maintainer: ".$data->{"maintainer"}."\n" if (defined $data->{"maintainer"});
     395    print STDERR "*** public: ".$data->{"public"}."\n" if (defined $data->{"public"});
     396    print STDERR "*** default index: ".$data->{"defaultindex"}."\n" if (defined $data->{"defaultindex"});
     397    print STDERR "*** default level: ".$data->{"defaultlevel"}."\n" if (defined $data->{"defaultlevel"});
     398    print STDERR "*** build type: ".$data->{"buildtype"}."\n" if (defined $data->{"buildtype"});
     399    print STDERR "*** search types: \n";
     400    print STDERR join(",",@{$data->{"searchtype"}})."\n" if (defined $data->{"searchtype"});
     401    print STDERR "*** levels: \n";
     402    print STDERR join(",",@{$data->{'levels'}})."\n" if (defined $data->{'levels'});
     403    print STDERR "*** index subcollections: \n";
     404    print STDERR join(",",@{$data->{'indexsubcollections'}})."\n" if (defined $data->{'indexsubcollections'});
     405    print STDERR "*** indexes: \n";
     406    print STDERR join(",",@{$data->{'indexes'}})."\n" if (defined $data->{'indexes'});
     407    print STDERR "*** index options: \n";
     408    print STDERR join(",",@{$data->{'indexoptions'}})."\n" if (defined $data->{'indexoptions'});
     409    print STDERR "*** languages: \n";
     410    print STDERR join(",",@{$data->{'languages'}})."\n" if (defined $data->{'languages'});
     411    print STDERR "*** language metadata: \n";
     412    print STDERR join(",",@{$data->{'languagemetadata'}})."\n" if (defined $data->{'languagemetadata'});
    394413 
     414    print STDERR "*** Plugins: \n";
    395415    if (defined $data->{'plugin'}) {
    396416    foreach $a (@{$data->{'plugin'}}) {
     
    399419    }
    400420    }
     421
     422    #print STDERR "*** Build options: \n";
     423    #if (defined $data->{'store_metadata_coverage'}) {
     424    #foreach $a (@{$data->{'store_metadata_coverage'}}) {
     425    #    print join(",",@$a,@$_);
     426    #    print "\n";
     427    #}
     428    #}
     429
    401430    if (defined $data->{'classify'}) {
    402     print "Classifiers: \n";
     431    print STDERR "*** Classifiers: \n";
    403432    map { print join(",",@$_)."\n"; } @{$data->{'classify'}};
    404433    }
Note: See TracChangeset for help on using the changeset viewer.