[15600] | 1 | ###########################################################################
|
---|
| 2 | #
|
---|
[20096] | 3 | # collConfigxml.pm --
|
---|
[15600] | 4 | # A component of the Greenstone digital library software
|
---|
| 5 | # from the New Zealand Digital Library Project at the
|
---|
| 6 | # University of Waikato, New Zealand.
|
---|
| 7 | #
|
---|
| 8 | # Copyright (C) 1999 New Zealand Digital Library Project
|
---|
| 9 | #
|
---|
| 10 | # This program is free software; you can redistribute it and/or modify
|
---|
| 11 | # it under the terms of the GNU General Public License as published by
|
---|
| 12 | # the Free Software Foundation; either version 2 of the License, or
|
---|
| 13 | # (at your option) any later version.
|
---|
| 14 | #
|
---|
| 15 | # This program is distributed in the hope that it will be useful,
|
---|
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 18 | # GNU General Public License for more details.
|
---|
| 19 | #
|
---|
| 20 | # You should have received a copy of the GNU General Public License
|
---|
| 21 | # along with this program; if not, write to the Free Software
|
---|
| 22 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 23 | #
|
---|
| 24 | ###########################################################################
|
---|
[14741] | 25 |
|
---|
[15600] | 26 | # reads in configuration files of xml form
|
---|
| 27 |
|
---|
[20096] | 28 | package collConfigxml;
|
---|
[15600] | 29 | use strict;
|
---|
| 30 | no strict 'refs';
|
---|
| 31 | no strict 'subs';
|
---|
| 32 |
|
---|
[23895] | 33 | use XMLParser;
|
---|
[15600] | 34 |
|
---|
[17895] | 35 | # A mapping hash to resolve name discrepancy between gs2 and gs3.
|
---|
[15600] | 36 | my $nameMap = {"key" => "value",
|
---|
| 37 | "creator" => "creator",
|
---|
| 38 | "maintainer" => "maintainer",
|
---|
| 39 | "public" => "public",
|
---|
[17895] | 40 | "infodb" => "infodbtype",
|
---|
[15600] | 41 | "defaultIndex" => "defaultindex",
|
---|
| 42 | "defaultLevel" => "defaultlevel",
|
---|
| 43 | "name" => "collectionname",
|
---|
| 44 | "description" => "collectionextra",
|
---|
| 45 | "smallicon" => "iconcollectionsmall",
|
---|
| 46 | "icon" => "iconcollection",
|
---|
| 47 | "level" => "levels",
|
---|
| 48 | "classifier" => "classify",
|
---|
| 49 | "indexSubcollection" => "indexsubcollections",
|
---|
| 50 | "indexLanguage" => "languages",
|
---|
| 51 | "defaultIndexLanguage" => "defaultlanguage",
|
---|
| 52 | "index" => "indexes",
|
---|
| 53 | "plugin" => "plugin",
|
---|
[17895] | 54 | "plugout" => "plugout",
|
---|
[15600] | 55 | "indexOption" => "indexoptions",
|
---|
| 56 | "searchType" => "searchtype",
|
---|
| 57 | "languageMetadata" => "languagemetadata",
|
---|
[22456] | 58 | "buildType" => "buildtype",
|
---|
[24464] | 59 | "orthogonalBuildTypes" => "orthogonalbuildtypes",
|
---|
| 60 | "buildOption" => "buildOption"
|
---|
[26451] | 61 | #"buildOptions" => "buildOptions", "importOptions" => "importOptions", no actual equivalents for importOptions and buildOptions in GS2
|
---|
[15600] | 62 | };
|
---|
| 63 | # A hash structure which is returned by sub read_cfg_file.
|
---|
| 64 | my $data = {};
|
---|
| 65 |
|
---|
[22456] | 66 | my $repeatedBlock = q/^(browse|pluginList)$/; #|buildOptionList)$/;
|
---|
[15600] | 67 |
|
---|
| 68 | # use those unique attribute values to locate the text within the elements
|
---|
[15619] | 69 | # creator, public, maintainer and within a displayItem.
|
---|
[15600] | 70 | my $currentLocation = "";
|
---|
[19898] | 71 | my $stringexp = q/^(creator|maintainer|public|buildType)$/;
|
---|
[15619] | 72 | my $displayItemNames = q/^(name|description)$/;
|
---|
| 73 |
|
---|
| 74 | # For storing the attributes during the StartTag subroutine, so that
|
---|
| 75 | # we can use it later in Text (or EndTag) subroutines
|
---|
| 76 | my $currentAttrRef = undef;
|
---|
[15600] | 77 |
|
---|
| 78 | my $currentLevel = "";
|
---|
| 79 |
|
---|
| 80 | # Count the elements with same name within the same block
|
---|
| 81 | # ("plugin", "option")
|
---|
| 82 | my $currentIndex = 0;
|
---|
[27097] | 83 | my $arrayexp = q/^(index|level|indexOption|indexSubcollection|indexLanguage|orthogonalBuildTypes)$/;
|
---|
[26451] | 84 | my $arrayarrayexp = q/^(plugin|classifier)$/; #|buildOption)$/;
|
---|
[15619] | 85 | my $hashexp = q/^(subcollection)$/; # add other element names that should be represented by hash expressions here
|
---|
| 86 | my $hashhashexp = q/^(displayItem)$/; # add other (collectionmeta) element names that should be represented by hashes of hashes here.
|
---|
[15600] | 87 |
|
---|
[26451] | 88 | my $generalOptions = q/^(importOptions|buildOptions)$/; # becomes GS2 toplevel map of (name, value) pairs
|
---|
| 89 |
|
---|
[15600] | 90 | my $defaults = q/^(defaultIndex|defaultLevel|defaultIndexLanguage|languageMetadata)$/;
|
---|
| 91 |
|
---|
[20099] | 92 | # Reads in the model collection configuration file, collectionConfig.xml,
|
---|
| 93 | # into a structure which complies with the one used by gs2 (i.e. one read
|
---|
| 94 | # in by &cfgread::read_cfg_file).
|
---|
| 95 | sub read_cfg_file {
|
---|
| 96 | my ($filename) = @_;
|
---|
| 97 | $data = {};
|
---|
| 98 | if ($filename !~ /collectionConfig\.xml$/ || !-f $filename) {
|
---|
| 99 | return undef;
|
---|
| 100 | }
|
---|
| 101 |
|
---|
[23895] | 102 | # Removed ProtocolEncoding (see MetadataXMLPlugin for details)
|
---|
| 103 |
|
---|
[20099] | 104 | # create XML::Parser object for parsing metadata.xml files
|
---|
[23895] | 105 | my $parser = new XML::Parser('Style' => 'Stream',
|
---|
| 106 | 'Pkg' => 'collConfigxml',
|
---|
| 107 | 'Handlers' => {'Char' => \&Char,
|
---|
[20099] | 108 | 'Doctype' => \&Doctype
|
---|
| 109 | });
|
---|
| 110 | if (!open (COLCFG, $filename)) {
|
---|
| 111 | print STDERR "cfgread::read_cfg_file couldn't read the cfg file $filename\n";
|
---|
| 112 | } else {
|
---|
| 113 |
|
---|
| 114 | $parser->parsefile ($filename);# (COLCFG);
|
---|
| 115 | close (COLCFG);
|
---|
| 116 | }
|
---|
| 117 |
|
---|
[22485] | 118 | #&Display;
|
---|
[20099] | 119 | return $data;
|
---|
| 120 | }
|
---|
| 121 |
|
---|
[15600] | 122 | sub StartTag {
|
---|
| 123 | # Those marked with #@ will not be executed at the same time when this sub is being called
|
---|
| 124 | # so that if/elsif is used to avoid unnecessary tests
|
---|
| 125 | my ($expat, $element) = @_;
|
---|
[15619] | 126 |
|
---|
| 127 | # See http://search.cpan.org/~msergeant/XML-Parser-2.36/Parser.pm#Stream
|
---|
[17895] | 128 | # %_ is a hash of all the attributes of this element, we want to store them so we can use the attributes
|
---|
[15619] | 129 | # when the textnode contents of the element are parsed in the subroutine Text (that's the handler for Text).
|
---|
| 130 | $currentAttrRef = \%_;
|
---|
[15600] | 131 |
|
---|
| 132 | my $name = $_{'name'};
|
---|
| 133 | my $value = $_{'value'};
|
---|
| 134 | my $type = $_{'type'};
|
---|
[24464] | 135 | my $orthogonal = $_{'orthogonal'};
|
---|
[15600] | 136 |
|
---|
| 137 | # for subcollections
|
---|
| 138 | my $filter = $_{'filter'};
|
---|
[20099] | 139 |
|
---|
[20104] | 140 | # was this just a flax thing??
|
---|
| 141 | my $assigned = $_{'assigned'};
|
---|
| 142 |
|
---|
[15600] | 143 | #@ Marking repeated block
|
---|
| 144 | if ($element =~ /$repeatedBlock/) {
|
---|
| 145 | $currentIndex = 0;
|
---|
| 146 | }
|
---|
| 147 |
|
---|
| 148 | #@ handling block metadataList
|
---|
| 149 | elsif (defined $name and $name =~ /$stringexp/){
|
---|
| 150 | $currentLocation = $name;
|
---|
| 151 | }
|
---|
| 152 | #@ handling default search index/level/indexLanguage and languageMetadata
|
---|
| 153 | elsif ($element =~ /$defaults/) {
|
---|
| 154 | if (defined $name and $name =~ /\w/) {
|
---|
| 155 | $data->{$nameMap->{$element}} = $name;
|
---|
| 156 | }
|
---|
| 157 | }
|
---|
| 158 |
|
---|
[15619] | 159 | #@ handling the displayItems name and description (known as collectionname and collectionextra in GS2)
|
---|
| 160 | elsif($element eq "displayItemList") {
|
---|
| 161 | $currentLevel = "displayItemList"; # storing the parent if it is displayItemList
|
---|
| 162 | }
|
---|
| 163 | elsif($element =~ /$hashhashexp/) { # can expand on this to check for other collectionmeta elements
|
---|
| 164 | if((!defined $assigned) || (defined $assigned and $assigned =~ /\w/ and $assigned eq "true")) {
|
---|
| 165 | # either when there is no "assigned" attribute, or when assigned=true (for displayItems):
|
---|
| 166 | $currentLocation = $name;
|
---|
| 167 | }
|
---|
| 168 | }
|
---|
[17895] | 169 |
|
---|
| 170 | #@ Handling database type: gdbm or gdbm-txtgz, later jdbm.
|
---|
| 171 | elsif ($element eq "infodb") {
|
---|
| 172 | $data->{'infodbtype'} = $type;
|
---|
| 173 | }
|
---|
[15619] | 174 |
|
---|
[15600] | 175 | #@ Handling indexer: mgpp/mg/lucene; stringexp
|
---|
[24464] | 176 | #@ Handling orthogonal indexers: audioDB; arrayexp
|
---|
[15600] | 177 | elsif ($element eq "search") {
|
---|
[24464] | 178 | if ((defined $orthogonal) && ($orthogonal =~ m/^(true|on|1)$/i)) {
|
---|
| 179 | push(@{$data->{'orthogonalbuildtypes'}},$type);
|
---|
| 180 | }
|
---|
| 181 | else {
|
---|
| 182 | $data->{'buildtype'} = $type;
|
---|
| 183 | }
|
---|
[15600] | 184 | }
|
---|
[24055] | 185 |
|
---|
[24464] | 186 | elsif ($element eq "store_metadata_coverage")
|
---|
| 187 | {
|
---|
| 188 | ## print STDERR "*&*&*&*&*& HERE &*&*&*&*&*&*";
|
---|
| 189 | $data->{'store_metadata_coverage'} = $value;
|
---|
| 190 | }
|
---|
[15600] | 191 |
|
---|
| 192 | #@ Handling searchtype: plain,form; arrayexp
|
---|
| 193 | #elsif ($element eq "format" and defined $name and $name =~ /searchType/) {
|
---|
| 194 | #@ Handling searchtype: plain, form
|
---|
| 195 | #$currentLocation = $name;
|
---|
| 196 | #}
|
---|
| 197 |
|
---|
[27097] | 198 | #@ Handle index|level|indexOption|indexSubcollection|indexLanguage
|
---|
[15600] | 199 | elsif ($element =~ /$arrayexp/) {
|
---|
| 200 | my $key = $nameMap->{$element};
|
---|
| 201 | if (!defined $data->{$key}) {
|
---|
| 202 | $data->{$key} = [];
|
---|
| 203 | }
|
---|
| 204 |
|
---|
[27192] | 205 | if (defined $name) {
|
---|
| 206 | push (@{$data->{$key}},$name);
|
---|
| 207 | }
|
---|
[15600] | 208 | }
|
---|
| 209 |
|
---|
[22456] | 210 | #*****************************************
|
---|
| 211 | elsif ($element eq "buildOption") {
|
---|
| 212 | print STDERR "**** BUILD OPTION PAIR $name $value\n";
|
---|
| 213 | $data->{$name} = $value;
|
---|
| 214 | }
|
---|
| 215 |
|
---|
[15600] | 216 | #@ plugout options
|
---|
| 217 | elsif ($element eq "plugout") {
|
---|
| 218 | $currentLevel = "plugout";
|
---|
| 219 | my $key = $nameMap->{$currentLevel};
|
---|
| 220 | if (!defined $data->{$key}) {
|
---|
| 221 | $data->{$key} = [];
|
---|
| 222 | }
|
---|
| 223 | if(defined $name and $name ne ""){
|
---|
| 224 | push (@{$data->{$key}},$name);
|
---|
| 225 | }
|
---|
| 226 | else{
|
---|
[17747] | 227 | push (@{$data->{$key}},"GreenstoneXMLPlugout");
|
---|
[15600] | 228 | }
|
---|
| 229 | }
|
---|
| 230 | if ($currentLevel eq "plugout" and $element eq "option") {
|
---|
| 231 | my $key = $nameMap->{$currentLevel};
|
---|
| 232 | if (defined $name and $name ne ""){
|
---|
| 233 | push (@{$data->{$key}},$name);
|
---|
| 234 | }
|
---|
| 235 | if (defined $value and $value ne ""){
|
---|
| 236 | push (@{$data->{$key}},$value);
|
---|
| 237 | }
|
---|
| 238 | }
|
---|
| 239 |
|
---|
| 240 | #@ use hash of hash of strings: hashexp
|
---|
[15619] | 241 | elsif ($element =~ /$hashexp/) {
|
---|
| 242 | if (!defined $data->{$element}) {
|
---|
| 243 | $data->{$element} = {};
|
---|
[15600] | 244 | }
|
---|
| 245 | if (defined $name and $name =~ /\w/) {
|
---|
| 246 | if (defined $filter and $filter =~ /\w/) {
|
---|
[15619] | 247 | $data->{$element}->{$name} = $filter;
|
---|
[15600] | 248 |
|
---|
| 249 | }
|
---|
| 250 | }
|
---|
| 251 | }
|
---|
| 252 |
|
---|
| 253 | #@ Handling each classifier/plugin element
|
---|
| 254 | elsif ($element =~ /$arrayarrayexp/) {
|
---|
| 255 | # find the gs2 mapping name
|
---|
| 256 | $currentLevel = $element;
|
---|
[26451] | 257 | my $key = $nameMap->{$element};
|
---|
| 258 |
|
---|
[15600] | 259 | # define an array of array of strings foreach $k (@{$data->{$key}}) {
|
---|
| 260 | if (!defined $data->{$key}) {
|
---|
[26451] | 261 | $data->{$key} = [];
|
---|
[15600] | 262 | }
|
---|
[26451] | 263 |
|
---|
[15600] | 264 | # Push classifier/plugin name (e.g. AZList) into $data as the first string
|
---|
[26451] | 265 | push (@{$data->{$key}->[$currentIndex]},$name);
|
---|
| 266 | if (defined $value and $value =~ /\w/) {
|
---|
| 267 | push (@{$data->{$key}->[$currentIndex]}, $value);
|
---|
| 268 | print "$value\n";
|
---|
| 269 | }
|
---|
[15600] | 270 | #print $currentIndex."indexup\n";
|
---|
[26450] | 271 | }
|
---|
| 272 |
|
---|
[15600] | 273 | #@ Handling the option elements in each classifier/plugin element (as the following strings)
|
---|
| 274 | elsif ($currentLevel =~ /$arrayarrayexp/ and $element eq "option") {
|
---|
| 275 | # find the gs2 mapping name for classifier and plugin
|
---|
| 276 | my $key = $nameMap->{$currentLevel};
|
---|
| 277 |
|
---|
| 278 | if (defined $name and $name =~ /\w/) {
|
---|
| 279 | push (@{$data->{$key}->[$currentIndex]}, $name);
|
---|
| 280 | }
|
---|
| 281 | if (defined $value and $value =~ /\w/) {
|
---|
| 282 | push (@{$data->{$key}->[$currentIndex]}, $value);
|
---|
| 283 | }
|
---|
| 284 |
|
---|
| 285 | }
|
---|
[26451] | 286 |
|
---|
| 287 | #@ Handling each importOptions/buildOptions element
|
---|
| 288 | elsif ($element =~ /$generalOptions/) {
|
---|
| 289 | $currentLevel = $element;
|
---|
| 290 | #my $key = $nameMap->{$element}; # importOptions and buildOptions map to themselves, no equivalents in GS2
|
---|
| 291 |
|
---|
| 292 | # define a map of string pairs
|
---|
| 293 | if (!defined $data->{$element}) {
|
---|
| 294 | $data->{$element} = {};
|
---|
| 295 | }
|
---|
| 296 | }
|
---|
| 297 | #@ Handling the option elements in an importOptions/buildOptions element, which are of the form:
|
---|
| 298 | # <importOptions><option name="n" value="v"/><option .../></importOptions>
|
---|
[26452] | 299 | # these get stored in-memory at the top level as (n, v) pairs, just as in GS2
|
---|
[26451] | 300 | elsif ($currentLevel =~ /$generalOptions/ and $element eq "option") {
|
---|
[26466] | 301 | if (defined $name and $name =~ /\w/) {
|
---|
| 302 |
|
---|
| 303 | # if a flag's value is on or 1, set it to true. If the value is off or 0, set it to false. (GS2 expects true/false)
|
---|
| 304 | # But such on/off flags (like -gli) need not be given a value, in which case the value defaults to 'true' again.
|
---|
| 305 |
|
---|
| 306 | if(defined $value and $value =~ /\w/) {
|
---|
| 307 |
|
---|
| 308 | if ($value =~ m/^(on|1)$/) {
|
---|
| 309 | $value = "true";
|
---|
| 310 | } elsif ($value =~ m/^(off|0)$/) {
|
---|
| 311 | $value = "false";
|
---|
| 312 | } # else, use whatever value is provided
|
---|
| 313 |
|
---|
| 314 | }
|
---|
| 315 | else {
|
---|
| 316 | $value = "true";
|
---|
| 317 | }
|
---|
| 318 | $data->{$name} = $value; #$data->{$currentLevel}->{$name} = $value;
|
---|
[26452] | 319 | #print "@@@@ Added $currentLevel option: $name=$value\n";
|
---|
[26451] | 320 | }
|
---|
| 321 | }
|
---|
| 322 |
|
---|
[15600] | 323 | }
|
---|
| 324 |
|
---|
| 325 | sub EndTag {
|
---|
| 326 | my ($expat, $element) = @_;
|
---|
[26451] | 327 | my $endTags = q/^(browse|pluginList|displayItemList|indexOption|importOptions|buildOptions)$/; #|buildOptionList)$/;
|
---|
[15600] | 328 | if ($element =~ /$endTags/) {
|
---|
| 329 | $currentIndex = 0;
|
---|
| 330 | $currentLevel = "";
|
---|
| 331 | }
|
---|
[26450] | 332 |
|
---|
[15600] | 333 | # $arrayarrayexp contains classifier|plugin
|
---|
[20102] | 334 | elsif($element =~ /$arrayarrayexp/ ){
|
---|
[15600] | 335 | $currentIndex = $currentIndex + 1;
|
---|
| 336 | }
|
---|
| 337 | }
|
---|
| 338 |
|
---|
| 339 | sub Text {
|
---|
[15619] | 340 | if (defined $currentLocation) {
|
---|
| 341 | #@ Handling block metadataList(creator, maintainer, public)
|
---|
| 342 | if($currentLocation =~ /$stringexp/){
|
---|
| 343 | #print $currentLocation;
|
---|
| 344 | my $key = $nameMap->{$currentLocation};
|
---|
| 345 | $data->{$key} = $_;
|
---|
| 346 | undef $currentLocation;
|
---|
| 347 | }
|
---|
[15600] | 348 |
|
---|
[15619] | 349 | #@ Handling displayItem metadata that are children of displayItemList
|
---|
| 350 | # that means we will be getting the collection's name and possibly description ('collectionextra' in GS2).
|
---|
| 351 | elsif($currentLevel eq "displayItemList" && $currentLocation =~ /$displayItemNames/) {
|
---|
| 352 | my $lang = $currentAttrRef->{'lang'};
|
---|
| 353 | my $name = $currentAttrRef->{'name'};
|
---|
| 354 |
|
---|
| 355 | # this is how data->collectionmeta's language is set in Greenstone 2.
|
---|
| 356 | # Need to be consistent, since export.pl accesses these values all in the same way
|
---|
| 357 | if(!defined $lang) {
|
---|
| 358 | $lang = 'default';
|
---|
| 359 | } else {
|
---|
| 360 | $lang = "[l=$lang]";
|
---|
| 361 | }
|
---|
| 362 |
|
---|
| 363 | if(defined $name and $name =~ /$displayItemNames/) { # attribute name = 'name' || 'description'
|
---|
| 364 | # using $nameMap->$name resolves to 'collectionname' if $name='name' and 'collectionextra' if $name='description'
|
---|
| 365 | $data->{'collectionmeta'}->{$nameMap->{$name}}->{$lang} = $_; # the value is the Text parsed
|
---|
| 366 | #print STDERR "***Found: $nameMap->{$name} collectionmeta, lang is $lang. Value: $data->{'collectionmeta'}->{$nameMap->{$name}}->{$lang}\n";
|
---|
| 367 | }
|
---|
| 368 | undef $currentLocation;
|
---|
[15600] | 369 | }
|
---|
[15619] | 370 |
|
---|
| 371 | #@ Handling searchtype: plain,form; arrayexp
|
---|
| 372 | elsif (defined $currentLocation and $currentLocation =~ /searchType/) {
|
---|
| 373 | # map 'searchType' into 'searchtype'
|
---|
| 374 | my $key = $nameMap->{$currentLocation};
|
---|
| 375 | # split it by ','
|
---|
| 376 | my ($plain, $form) = split (",", $_);
|
---|
| 377 |
|
---|
| 378 | if (!defined $data->{$key}) {
|
---|
| 379 | $data->{$key} = [];
|
---|
| 380 | }
|
---|
| 381 | if (defined $plain and $plain =~ /\w/) {
|
---|
| 382 | push @{ $data->{$key} }, $plain;
|
---|
| 383 | }
|
---|
| 384 | if (defined $form and $form =~ /\w/) {
|
---|
| 385 | push @{ $data->{$key} }, $form;
|
---|
| 386 | }
|
---|
[15600] | 387 | }
|
---|
[15619] | 388 | }
|
---|
[15600] | 389 | }
|
---|
[15619] | 390 |
|
---|
[15600] | 391 | # This sub is for debugging purposes
|
---|
| 392 | sub Display {
|
---|
| 393 | # metadataList
|
---|
[15619] | 394 | foreach my $k (keys %{$data}) {
|
---|
| 395 | print STDERR "*** metadatalist key $k\n";
|
---|
| 396 | }
|
---|
| 397 |
|
---|
[22456] | 398 | print STDERR "*** creator: ".$data->{'creator'}."\n" if (defined $data->{'creator'});
|
---|
| 399 | print STDERR "*** maintainer: ".$data->{"maintainer"}."\n" if (defined $data->{"maintainer"});
|
---|
| 400 | print STDERR "*** public: ".$data->{"public"}."\n" if (defined $data->{"public"});
|
---|
| 401 | print STDERR "*** default index: ".$data->{"defaultindex"}."\n" if (defined $data->{"defaultindex"});
|
---|
| 402 | print STDERR "*** default level: ".$data->{"defaultlevel"}."\n" if (defined $data->{"defaultlevel"});
|
---|
| 403 | print STDERR "*** build type: ".$data->{"buildtype"}."\n" if (defined $data->{"buildtype"});
|
---|
[24464] | 404 | print STDERR "*** orthogonal build types: ".join(",",$data->{"orthogonalbuildtypes"})."\n" if (defined $data->{"orthogonalbuildtypes"});
|
---|
[22456] | 405 | print STDERR "*** search types: \n";
|
---|
| 406 | print STDERR join(",",@{$data->{"searchtype"}})."\n" if (defined $data->{"searchtype"});
|
---|
| 407 | print STDERR "*** levels: \n";
|
---|
| 408 | print STDERR join(",",@{$data->{'levels'}})."\n" if (defined $data->{'levels'});
|
---|
| 409 | print STDERR "*** index subcollections: \n";
|
---|
| 410 | print STDERR join(",",@{$data->{'indexsubcollections'}})."\n" if (defined $data->{'indexsubcollections'});
|
---|
| 411 | print STDERR "*** indexes: \n";
|
---|
| 412 | print STDERR join(",",@{$data->{'indexes'}})."\n" if (defined $data->{'indexes'});
|
---|
| 413 | print STDERR "*** index options: \n";
|
---|
| 414 | print STDERR join(",",@{$data->{'indexoptions'}})."\n" if (defined $data->{'indexoptions'});
|
---|
| 415 | print STDERR "*** languages: \n";
|
---|
| 416 | print STDERR join(",",@{$data->{'languages'}})."\n" if (defined $data->{'languages'});
|
---|
| 417 | print STDERR "*** language metadata: \n";
|
---|
| 418 | print STDERR join(",",@{$data->{'languagemetadata'}})."\n" if (defined $data->{'languagemetadata'});
|
---|
[15600] | 419 |
|
---|
[22456] | 420 | print STDERR "*** Plugins: \n";
|
---|
[15600] | 421 | if (defined $data->{'plugin'}) {
|
---|
| 422 | foreach $a (@{$data->{'plugin'}}) {
|
---|
| 423 | print join(",",@$a);
|
---|
| 424 | print "\n";
|
---|
| 425 | }
|
---|
| 426 | }
|
---|
[22456] | 427 |
|
---|
| 428 | #print STDERR "*** Build options: \n";
|
---|
| 429 | #if (defined $data->{'store_metadata_coverage'}) {
|
---|
| 430 | #foreach $a (@{$data->{'store_metadata_coverage'}}) {
|
---|
| 431 | # print join(",",@$a,@$_);
|
---|
| 432 | # print "\n";
|
---|
| 433 | #}
|
---|
| 434 | #}
|
---|
| 435 |
|
---|
[15600] | 436 | if (defined $data->{'classify'}) {
|
---|
[22456] | 437 | print STDERR "*** Classifiers: \n";
|
---|
[15600] | 438 | map { print join(",",@$_)."\n"; } @{$data->{'classify'}};
|
---|
| 439 | }
|
---|
| 440 |
|
---|
| 441 | if (defined $data->{'subcollection'}) {
|
---|
| 442 | foreach my $key (keys %{$data->{'subcollection'}}) {
|
---|
| 443 | print "subcollection ".$key." ".$data->{'subcollection'}->{$key}."\n";
|
---|
| 444 | }
|
---|
| 445 | }
|
---|
| 446 | }
|
---|
[20104] | 447 | # is this actually used??
|
---|
[15600] | 448 | sub Doctype {
|
---|
| 449 | my ($expat, $name, $sysid, $pubid, $internal) = @_;
|
---|
| 450 |
|
---|
[20104] | 451 | die if ($name !~ /^CollectionConfig$/);
|
---|
[15600] | 452 | }
|
---|
| 453 |
|
---|
| 454 | # This Char function overrides the one in XML::Parser::Stream to overcome a
|
---|
| 455 | # problem where $expat->{Text} is treated as the return value, slowing
|
---|
| 456 | # things down significantly in some cases.
|
---|
| 457 | sub Char {
|
---|
| 458 | if ($]<5.008) {
|
---|
| 459 | use bytes; # Necessary to prevent encoding issues with XML::Parser 2.31+ and Perl 5.6
|
---|
| 460 | }
|
---|
| 461 | $_[0]->{'Text'} .= $_[1];
|
---|
| 462 | return undef;
|
---|
| 463 | }
|
---|
[15619] | 464 |
|
---|
[15600] | 465 |
|
---|
| 466 |
|
---|
| 467 |
|
---|
| 468 | #########################################################
|
---|
| 469 |
|
---|
| 470 | 1;
|
---|