source: trunk/gsdl/perllib/cfgread4gs3.pm@ 14105

Last change on this file since 14105 was 14105, checked in by qq6, 17 years ago

fixed a mistake

  • Property svn:keywords set to Author Date Id Revision
File size: 20.8 KB
Line 
1###########################################################################
2#
3# cfgread4gs3.pm --
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###########################################################################
25
26# reads in configuration files of xml form
27
28package cfgread4gs3;
29use strict;
30no strict 'refs';
31no strict 'subs';
32# Wrapper that ensures the right version of XML::Parser is loaded given
33# the version of Perl being used. Need to distinguish between Perl 5.6 and
34# Perl 5.8
35
36
37sub BEGIN {
38 my $perl_dir;
39
40 # Note: $] encodes the version number of perl
41 if ($]>5.008) {
42 # perl 5.8.1 or above
43 $perl_dir = "perl-5.8";
44 }
45 elsif ($]<5.008) {
46 # assume perl 5.6
47 $perl_dir = "perl-5.6";
48 }
49 else {
50 print STDERR "Warning: Perl 5.8.0 is not a maintained release.\n";
51 print STDERR " Please upgrade to a newer version of Perl.\n";
52 $perl_dir = "perl-5.8";
53 }
54
55 if ($ENV{'GSDLOS'} !~ /^windows$/i) {
56 # Use push to put this on the end, so an existing XML::Parser will be used by default
57 push (@INC, "$ENV{'GSDLHOME'}/perllib/cpan/$perl_dir");
58 }
59}
60
61#use XML::Parser;
62
63# A mapping hash to resolve name descrepency between gs2 and gs3.
64my $nameMap = {"key" => "value",
65 "creator" => "creator",
66 "maintainer" => "maintainer",
67 "public" => "public",
68 "defaultIndex" => "defaultindex",
69 "defaultLevel" => "defaultlevel",
70 "name" => "collectionname",
71 "description" => "collectionextra",
72 "smallicon" => "iconcollectionsmall",
73 "icon" => "iconcollection",
74 "level" => "levels",
75 "classifier" => "classify",
76 "indexSubcollection" => "indexsubcollections",
77 "indexLanguage" => "languages",
78 "defaultIndexLanguage" => "defaultlanguage",
79 "index" => "indexes",
80 "plugin" => "plugin",
81 "indexOption" => "indexoptions",
82 "searchType" => "searchtype",
83 "languageMetadata" => "languagemetadata",
84 };
85# A hash structure which is returned by sub read_cfg_file.
86my $data = {};
87
88my $repeatedBlock = q/^(browse|pluginList)$/;
89
90# use those unique attribute values to locate the text within the elements
91# creator, public, maintainer.
92my $currentLocation = "";
93my $stringexp = q/^(creator|maintainer|public)$/;
94
95my $currentLevel = "";
96
97# Count the elements with same name within the same block
98# ("plugin", "option")
99my $currentIndex = 0;
100my $arrayexp = q/^(index|level|indexSubcollection|indexLanguage)$/;
101my $arrayarrayexp= q/^(plugin|classifier)$/;
102
103my $defaults = q/^(defaultIndex|defaultLevel|defaultIndexLanguage|languageMetadata)$/;
104
105sub StartTag {
106# Those marked with #@ will not be executed at the same time when this sub is being called
107# so that if/elsif is used to avoid unnecessary tests
108 my ($expat, $element) = @_;
109
110 my $name = $_{'name'};
111 my $value = $_{'value'};
112 my $type = $_{'type'};
113
114 # for subcollections
115 my $filter = $_{'filter'};
116
117 #@ Marking repeated block
118 if ($element =~ /$repeatedBlock/) {
119 $currentIndex = 0;
120 }
121
122 #@ handling block metadataList
123 elsif (defined $name and $name =~ /$stringexp/){
124 $currentLocation = $name;
125 }
126 #@ handling default search index/level/indexLanguage and languageMetadata
127 elsif ($element =~ /$defaults/) {
128 if (defined $name and $name =~ /\w/) {
129 $data->{$nameMap->{$element}} = $name;
130 }
131 }
132
133 #@ Handling indexer: mgpp/mg/lucene; stringexp
134 elsif ($element eq "search") {
135 $data->{'buildtype'} = $type;
136 }
137
138 #@ Handling searchtype: plain,form; arrayexp
139 #elsif ($element eq "format" and defined $name and $name =~ /searchType/) {
140 #@ Handling searchtype: plain, form
141 #$currentLocation = $name;
142 #}
143
144
145
146 #@ Handle index|level|indexSubcollection|indexLanguage
147 elsif ($element =~ /$arrayexp/) {
148 my $key = $nameMap->{$element};
149 if (!defined $data->{$key}) {
150 $data->{$key} = [];
151 }
152
153 push (@{$data->{$key}},$name);
154 }
155
156 #@ indexoptions: accentfold/casefold/stem; arrayexp
157 elsif ($element eq "indexOption") {
158 $currentLevel = "indexOption";
159 }
160 if ($currentLevel eq "indexOption" and $element eq "option") {
161 my $key = $nameMap->{$currentLevel};
162 if (!defined $data->{$key}) {
163 $data->{$key} = [];
164 }
165 push (@{$data->{$key}},$name);
166 }
167
168 #@ use hash of hash of strings: hashexp
169 elsif ($element eq "subcollection") {
170 if (!defined $data->{'subcollection'}) {
171 $data->{'subcollection'} = {};
172 }
173 if (defined $name and $name =~ /\w/) {
174 if (defined $filter and $filter =~ /\w/) {
175 $data->{'subcollection'}->{$name} = $filter;
176
177 }
178 }
179 }
180
181 #@ Handling each classifier/plugin element
182 elsif ($element =~ /$arrayarrayexp/) {
183 # find the gs2 mapping name
184 $currentLevel = $element;
185 my $key = $nameMap->{$element};
186
187 # define an array of array of strings foreach $k (@{$data->{$key}}) {
188 if (!defined $data->{$key}) {
189 $data->{$key} = [];
190 }
191 # Push classifier/plugin name (e.g. AZList) into $data as the first string
192 push (@{$data->{$key}->[$currentIndex]},$name);
193 #print $currentIndex."indexup\n";
194 }
195
196 #@ Handling the option elements in each classifier/plugin element (as the following strings)
197 elsif ($currentLevel =~ /$arrayarrayexp/ and $element eq "option") {
198 # find the gs2 mapping name for classifier and plugin
199 my $key = $nameMap->{$currentLevel};
200
201 if (defined $name and $name =~ /\w/) {
202 push (@{$data->{$key}->[$currentIndex]}, $name);
203 }
204 if (defined $value and $value =~ /\w/) {
205 push (@{$data->{$key}->[$currentIndex]}, $value);
206 }
207
208 }
209
210}
211
212sub EndTag {
213 my ($expat, $element) = @_;
214 my $endTags = q/^(browse|pluginList)$/;
215 if ($element =~ /$endTags/) {
216 $currentIndex = 0;
217 $currentLevel = "";
218 }
219 # $arrayarrayexp contains classifier|plugin
220 elsif($element =~ /$arrayarrayexp/){
221 $currentIndex = $currentIndex + 1;
222 }
223
224}
225
226sub Text {
227 #@ Handling block metadataList(creator, maintainer, public)
228 if (defined $currentLocation and $currentLocation =~ /$stringexp/){
229 #print $currentLocation;
230 my $key = $nameMap->{$currentLocation};
231 $data->{$key} = $_;
232 undef $currentLocation;
233 }
234 #@ Handling searchtype: plain,form; arrayexp
235 if (defined $currentLocation and $currentLocation =~ /searchType/) {
236 # map 'searchType' into 'searchtype'
237 my $key = $nameMap->{$currentLocation};
238 # split it by ','
239 my ($plain, $form) = split (",", $_);
240
241 if (!defined $data->{$key}) {
242 $data->{$key} = [];
243 }
244 if (defined $plain and $plain =~ /\w/) {
245 push @{ $data->{$key} }, $plain;
246 }
247 if (defined $form and $form =~ /\w/) {
248 push @{ $data->{$key} }, $form;
249 }
250 }
251}
252# This sub is for debugging purposes
253sub Display {
254 # metadataList
255
256 print $data->{'creator'}."\n" if (defined $data->{'creator'});
257 print $data->{"maintainer"}."\n" if (defined $data->{"maintainer"});
258 print $data->{"public"}."\n" if (defined $data->{"public"});
259 print $data->{"defaultindex"}."\n" if (defined $data->{"defaultindex"});
260 print $data->{"defaultlevel"}."\n" if (defined $data->{"defaultlevel"});
261 print $data->{"buildtype"}."\n" if (defined $data->{"buildtype"});
262 print join(",",@{$data->{"searchtype"}})."\n" if (defined $data->{"searchtype"});
263 print join(",",@{$data->{'levels'}})."\n" if (defined $data->{'levels'});
264 print join(",",@{$data->{'indexsubcollections'}})."\n" if (defined $data->{'indexsubcollections'});
265 print join(",",@{$data->{'indexes'}})."\n" if (defined $data->{'indexes'});
266 print join(",",@{$data->{'indexoptions'}})."\n" if (defined $data->{'indexoptions'});
267 print join(",",@{$data->{'languages'}})."\n" if (defined $data->{'languages'});
268 print join(",",@{$data->{'languagemetadata'}})."\n" if (defined $data->{'languagemetadata'});
269
270 if (defined $data->{'plugin'}) {
271 foreach $a (@{$data->{'plugin'}}) {
272 print join(",",@$a);
273 print "\n";
274 }
275 }
276 if (defined $data->{'classify'}) {
277 print "Classifiers: \n";
278 map { print join(",",@$_)."\n"; } @{$data->{'classify'}};
279 }
280
281 if (defined $data->{'subcollection'}) {
282 foreach my $key (keys %{$data->{'subcollection'}}) {
283 print "subcollection ".$key." ".$data->{'subcollection'}->{$key}."\n";
284 }
285 }
286}
287sub Doctype {
288 my ($expat, $name, $sysid, $pubid, $internal) = @_;
289
290 # allow the short-lived and badly named "GreenstoneDirectoryMetadata" files
291 # to be processed as well as the "DirectoryMetadata" files which should now
292 # be created by import.pl
293 die if ($name !~ /^(Greenstone)?DirectoryMetadata$/);
294}
295
296# This Char function overrides the one in XML::Parser::Stream to overcome a
297# problem where $expat->{Text} is treated as the return value, slowing
298# things down significantly in some cases.
299sub Char {
300 if ($]<5.008) {
301 use bytes; # Necessary to prevent encoding issues with XML::Parser 2.31+ and Perl 5.6
302 }
303 $_[0]->{'Text'} .= $_[1];
304 return undef;
305}
306# Reads in the model collection configuration file, collectionConfig.xml,
307# into a structure which complies with the one used by gs2 (i.e. one read
308# in by &cfgread::read_cfg_file).
309sub read_cfg_file {
310 my ($filename) = @_;
311 $data = {};
312 if ($filename !~ /collectionConfig\.xml$/ || !-f $filename) {
313 return undef;
314 }
315
316 # create XML::Parser object for parsing metadata.xml files
317 my $parser;
318 if ($]<5.008) {
319 # Perl 5.6
320 $parser = new XML::Parser('Style' => 'Stream',
321 'Handlers' => {'Char' => \&Char,
322 'Doctype' => \&Doctype
323 });
324 }
325 else {
326 # Perl 5.8
327 $parser = new XML::Parser('Style' => 'Stream',
328 'ProtocolEncoding' => 'ISO-8859-1',
329 'Handlers' => {'Char' => \&Char,
330 'Doctype' => \&Doctype
331 });
332 }
333
334 if (!open (COLCFG, $filename)) {
335 print STDERR "cfgread::read_cfg_file couldn't read the cfg file $filename\n";
336 } else {
337
338 $parser->parsefile ($filename);# (COLCFG);
339 close (COLCFG);
340 }
341
342 #&Display; print "***********";
343 return $data;
344}
345
346
347sub write_line {
348 my ($filehandle, $line) = @_;
349 print $filehandle join ("", @$line), "\n";
350}
351
352sub write_cfg_file {
353 # information needed from $collectcfg: defaultindex, defaultlevel, classifiers,
354 # the rest is from $buildcfg
355 my ($buildoutfile, $buildcfg, $collectcfg) = @_;
356 my $line = [];
357
358 if (!open (COLCFG, ">$buildoutfile")) {
359 print STDERR "cfgread::write_cfg_file couldn't write the cfg file $buildoutfile\n";
360 die;
361 }
362
363 &write_line('COLCFG', ["<buildConfig xmlns:gsf=\"http://www.greenstone.org/greenstone3/schema/ConfigFormat\">"]);
364
365 # output building metadata to build config file
366 my $buildtype;
367 if (defined $buildcfg->{"buildtype"}) {
368 $buildtype = $buildcfg->{"buildtype"};
369 } else {
370 $buildtype = "mgpp";
371 }
372 my $numdocs;
373 if (defined $buildcfg->{"numdocs"}) {
374 $numdocs = $buildcfg->{"numdocs"};
375 }
376 &write_line('COLCFG', ["<metadataList>"]);
377 &write_line('COLCFG', ["<metadata name=\"numDocs\">", $numdocs, "</metadata>"]);
378 &write_line('COLCFG', ["<metadata name=\"buildType\">", $buildtype, "</metadata>"]);
379 &write_line('COLCFG', ["</metadataList>"]);
380
381 my $service_type = "MGPP";
382 if ($buildtype eq "mg") {
383 $service_type = "MG";
384 } elsif ($buildtype eq "lucene") {
385 $service_type = "Lucene";
386 }
387
388 # output serviceRackList
389 &write_line('COLCFG', ["<serviceRackList>"]);
390
391 # do the search service
392 &write_line('COLCFG', ["<serviceRack name=\"GS2", $service_type, "Search\">"]);
393 if (defined $buildcfg->{'indexstem'}) {
394 my $indexstem = $buildcfg->{'indexstem'};
395 &write_line('COLCFG', ["<indexStem name=\"", $indexstem, "\" />"]);
396 }
397
398 #indexes
399 # maps index name to shortname
400 my $indexmap = {};
401 # keeps the order for indexes
402 my @indexlist = ();
403
404 my $defaultindex = "";
405 my $first = 1;
406 my $maptype = "indexfieldmap";
407 if ($buildtype eq "mg") {
408 $maptype = "indexmap";
409 }
410 if (defined $buildcfg->{$maptype}) {
411 my $indexmap_t = $buildcfg->{$maptype};
412 foreach my $i (@$indexmap_t) {
413 my ($k, $v) = $i =~ /^(.*)\-\>(.*)$/;
414 $indexmap->{$k} = $v;
415 push @indexlist, $k;
416 if ($first) {
417 $defaultindex = $v;
418 $first = 0;
419 }
420 }
421 # now if the user has assigned a default index, we use it
422 if (defined $collectcfg->{"defaultindex"}) {
423 $defaultindex = $indexmap->{$collectcfg->{"defaultindex"}};
424 }
425
426 } else {
427 print STDERR "$maptype not defined";
428 }
429 #for each index in indexList, write them out
430 &write_line('COLCFG', ["<indexList>"]);
431 foreach my $i (@indexlist) {
432 my $index = $indexmap->{$i};
433 &write_line('COLCFG', ["<index name=\"", $i, "\" ", "shortname=\"", $index, "\" />"]);
434 }
435 &write_line('COLCFG', ["</indexList>"]);
436
437 # do default index only for mg
438 if ($buildtype eq "mg") {
439 &write_line('COLCFG', ["<defaultIndex shortname=\"", $defaultindex, "\" />"]);
440 }
441
442 # do indexOptionList
443 if ($buildtype eq "mg" || $buildtype eq "mgpp") {
444 &write_line('COLCFG', ["<indexOptionList>"]);
445 my $stemindexes = 3; # default is stem and casefold
446 if (defined $buildcfg->{'stemindexes'} && $buildcfg->{'stemindexes'} =~ /^\d+$/ ) {
447 $stemindexes = $buildcfg->{'stemindexes'};
448 }
449 &write_line('COLCFG', ["<indexOption name=\"stemIndexes\" value=\"", $stemindexes, "\" />"]);
450
451 my $maxnumeric = 4; # default
452 if (defined $buildcfg->{'maxnumeric'} && $buildcfg->{'maxnumeric'} =~ /^\d+$/) {
453 $maxnumeric = $buildcfg->{'maxnumeric'};
454 }
455 &write_line('COLCFG', ["<indexOption name=\"maxnumeric\" value=\"", $maxnumeric, "\" />"]);
456 &write_line('COLCFG', ["</indexOptionList>"]);
457 }
458
459 # levelList
460 my $levelmap = {};
461 my @levellist = ();
462 my $default_search_level = "";
463 my $default_retrieve_level = "Doc";#this is defaultGDBMLevel (also for the retrieve service)
464 $first = 1;
465 if ($buildtype eq "mgpp" || $buildtype eq "lucene") {
466 if (defined $buildcfg->{'levelmap'}) {
467 my $levelmap_t = $buildcfg->{'levelmap'};
468 foreach my $l (@$levelmap_t) {
469 my ($key, $val) = $l =~ /^(.*)\-\>(.*)$/;
470 $levelmap->{$key} = $val;
471 push @levellist, $key;
472 if ($first) {
473 $default_search_level = $val;
474 $first = 0;
475 }
476 }
477 }
478 # now if the user has assigned a default level, we use it
479 if (defined $collectcfg->{"defaultlevel"}) {
480 $default_search_level = $levelmap->{$collectcfg->{"defaultlevel"}};
481 $default_retrieve_level = $default_search_level;
482 }
483 #if (defined $buildcfg->{'textlevel'}) {
484 # $default_retrieve_level = $buildcfg->{'textlevel'};
485 #}
486 }
487 #for each level in levelList, write them out
488 if ($buildtype ne "mg") {
489 &write_line('COLCFG', ["<levelList>"]);
490 foreach my $lv (@levellist) {
491 my $level = $levelmap->{$lv};
492 &write_line('COLCFG', ["<level name=\"", $lv, "\" shortname=\"", $level, "\" />"]);
493 }
494 &write_line('COLCFG', ["</levelList>"]);
495 }
496 # add in defaultLevel as the same level as indexLevelList, making the reading job easier
497 if ($buildtype eq "lucene" || $buildtype eq "mgpp") {
498 &write_line('COLCFG', ["<defaultLevel shortname=\"", $default_search_level, "\" />"]);
499 }
500 &write_line('COLCFG', ["<defaultGDBMLevel shortname=\"", $default_retrieve_level, "\" />"]);
501
502 # do searchTypeList
503 if ($buildtype eq "mgpp" || $buildtype eq "lucene") {
504 &write_line('COLCFG', ["<searchTypeList>"]);
505
506 if (defined $buildcfg->{"searchtype"}) {
507 my $searchtype_t = $buildcfg->{"searchtype"};
508 foreach my $s (@$searchtype_t) {
509 &write_line('COLCFG', ["<searchType name=\"", $s, "\" />"]);
510 }
511 } else {
512 &write_line('COLCFG', ["<searchType name=\"plain\" />"]);
513 &write_line('COLCFG', ["<searchType name=\"form\" />"]);
514 }
515 &write_line('COLCFG', ["</searchTypeList>"]);
516 }
517
518 # do indexLanguageList [in collect.cfg: languages; in build.cfg: languagemap]
519 $first = 1;
520 my $default_lang = "";
521 my $default_lang_short = "";
522 if (defined $buildcfg->{"languagemap"}) {
523 &write_line('COLCFG', ["<indexLanguageList>"]);
524
525 my $langmap_t = $buildcfg->{"languagemap"};
526 foreach my $l (@$langmap_t) {
527 my ($k, $v) = $l =~ /^(.*)\-\>(.*)$/;
528
529 &write_line('COLCFG', ["<indexLanguage name=\"", $k, "\" shortname=\"", $v, "\" />"]);
530 if ($first) {
531 $default_lang = $k; #name
532 $default_lang_short = $v; #shortname
533 $first = 0;
534 }
535 }
536
537 &write_line('COLCFG', ["</indexLanguageList>"]);
538 # now if the user has assigned a default language (as "en", "ru" etc.)
539 if (defined $collectcfg->{"defaultlanguage"}) {
540 $default_lang = $collectcfg->{"defaultlanguage"};
541 }
542 &write_line('COLCFG', ["<defaultIndexLanguage name=\"", $default_lang, "\" shortname=\"", $default_lang_short, "\" />"]);
543 }
544
545
546 # do indexSubcollectionList
547 my $default_subcol = "";# make it in sub scope to be used in the concatenation
548 if (defined $buildcfg->{'subcollectionmap'}) {
549 &write_line('COLCFG', ["<indexSubcollectionList>"]);
550 my $subcolmap = {};
551 my @subcollist = ();
552 $first = 1;
553 my $subcolmap_t = $buildcfg->{'subcollectionmap'};
554 foreach my $l (@$subcolmap_t) {
555 my ($k, $v) = $l =~ /^(.*)\-\>(.*)$/;
556 $subcolmap->{$k} = $v;
557 push @subcollist, $k;
558 if ($first) {
559 $default_subcol = $v;
560 $first = 0;
561 }
562 }
563 foreach my $sl (@subcollist) {
564 my $subcol = $subcolmap->{$sl};
565 &write_line('COLCFG', ["<indexSubcollection name=\"", $sl, "\" shortname=\"", $subcol, "\" />"]);
566 }
567
568 &write_line('COLCFG', ["</indexSubcollectionList>"]);
569 &write_line('COLCFG', ["<defaultIndexSubcollection shortname=\"", $default_subcol, "\" />"]);
570 }
571
572 # close off search service
573 &write_line('COLCFG', ["</serviceRack>"]);
574
575 # do the retrieve service
576 &write_line('COLCFG', ["<serviceRack name=\"GS2", $service_type, "Retrieve\">"]);
577
578 # do default index
579 if (defined $buildcfg->{"languagemap"}) {
580 &write_line('COLCFG', ["<defaultIndexLanguage shortname=\"", $default_lang, "\" />"]);
581 }
582 if (defined $buildcfg->{'subcollectionmap'}) {
583 &write_line('COLCFG', ["<defaultIndexSubcollection shortname=\"", $default_subcol, "\" />"]);
584 }
585 if ($buildtype eq "mg") {
586 &write_line('COLCFG', ["<defaultIndex shortname=\"", $defaultindex, "\" />"]);
587 }
588
589 if (defined $buildcfg->{'indexstem'}) {
590 my $indexstem = $buildcfg->{'indexstem'};
591 &write_line('COLCFG', ["<indexStem name=\"", $indexstem, "\" />"]);
592 }
593 if ($buildtype eq "mgpp" || $buildtype eq "lucene") {
594 &write_line('COLCFG', ["<defaultLevel shortname=\"", $default_retrieve_level, "\" />"]);
595 }
596 &write_line('COLCFG', ["</serviceRack>"]);
597
598 # do the browse service
599 my $count = 1;
600 my $phind = 0;
601 my $started_classifiers = 0;
602
603 my $classifiers = $collectcfg->{"classify"};
604 foreach my $cl (@$classifiers) {
605 my $name = "CL$count";
606 $count++;
607 my ($classname) = @$cl[0];
608 if ($classname =~ /^phind$/i) {
609 $phind=1;
610 #should add it into coll config classifiers
611 next;
612 }
613
614 if (not $started_classifiers) {
615 &write_line('COLCFG', ["<serviceRack name=\"GS2Browse\">"]);
616 if (defined $buildcfg->{'indexstem'}) {
617 my $indexstem = $buildcfg->{'indexstem'};
618 &write_line('COLCFG', ["<indexStem name=\"", $indexstem, "\" />"]);
619 }
620 &write_line('COLCFG', ["<classifierList>"]);
621 $started_classifiers = 1;
622 }
623 my $content = ''; #use buttonname first, then metadata
624 if ($classname eq "DateList") {
625 $content = "Date";
626 } else {
627 for (my $j=0; $j<scalar(@$cl); $j++) {
628 my $arg = @$cl[$j];
629 if ($arg eq "-buttonname"){
630 $content = @$cl[$j+1];
631 last;
632 } elsif ($arg eq "-metadata") {
633 $content = @$cl[$j+1];
634 }
635
636 }
637 }
638 &write_line('COLCFG', ["<classifier name=\"", $name, "\" content=\"", $content, "\" />"]);
639 }
640 if ($started_classifiers) {
641 # end the classifiers
642 &write_line('COLCFG', ["</classifierList>"]);
643 # close off the Browse service
644 &write_line('COLCFG', ["</serviceRack>"]);
645 }
646
647 # the phind classifier is a separate service
648 if ($phind) {
649 # if phind classifier
650 &write_line('COLCFG', ["<serviceRack name=\"PhindPhraseBrowse\" />"]);
651 }
652
653 &write_line('COLCFG', ["</serviceRackList>"]);
654 &write_line('COLCFG', ["</buildConfig>"]);
655
656 close (COLCFG);
657 }
658
659
660#########################################################
661
6621;
Note: See TracBrowser for help on using the repository browser.