[537] | 1 | ###########################################################################
|
---|
| 2 | #
|
---|
| 3 | # colcfg.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 |
|
---|
[4] | 26 | # reads in a collection configuration file
|
---|
| 27 |
|
---|
| 28 | package colcfg;
|
---|
| 29 |
|
---|
| 30 | use cfgread;
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 | # the collection configuration file data is stored in the form
|
---|
| 34 | #
|
---|
| 35 | # {'creator'}->string
|
---|
| 36 | # {'public'}->string
|
---|
| 37 | # {'beta'}->string
|
---|
[810] | 38 | # {'defaultindex'}->string
|
---|
| 39 | # {'importdir'}->string
|
---|
| 40 | # {'archivedir'}->string
|
---|
| 41 | # {'cachedir'}->string
|
---|
| 42 | # {'builddir'}->string
|
---|
| 43 | # {'removeold'}->string
|
---|
[932] | 44 | # {'textcompress'}->string
|
---|
[1851] | 45 | # {'buildtype'}->string
|
---|
[810] | 46 |
|
---|
| 47 | # {'maintainer'}->array of strings
|
---|
[139] | 48 | # {'languages'}->array of strings
|
---|
[69] | 49 | # {'indexsubcollections'}->array of strings
|
---|
[4] | 50 | # {'indexes'}->array of strings
|
---|
[810] | 51 | # {'dontbuild'}->array of strings
|
---|
| 52 | # {'dontgdbm'}->array of strings
|
---|
[1377] | 53 | # {'mirror'}->array of strings
|
---|
[1572] | 54 | # {'phind'}->array of strings
|
---|
[1851] | 55 | # {'levels'}->array of strings (for mgpp eg Section, Paragraph)
|
---|
[4] | 56 |
|
---|
[810] | 57 | # {'subcollection'}->hash of key-value pairs
|
---|
| 58 | # {'collectionmeta'}->hash of key-value pairs
|
---|
| 59 |
|
---|
| 60 | # {'plugin'}->array of arrays of strings
|
---|
| 61 | # {'classify'}->array of arrays of strings
|
---|
| 62 |
|
---|
[4] | 63 | sub read_collect_cfg {
|
---|
| 64 | my ($filename) = @_;
|
---|
| 65 |
|
---|
| 66 | return &cfgread::read_cfg_file ($filename,
|
---|
[810] | 67 | q/^(creator|public|beta|defaultindex|importdir|/ .
|
---|
[2336] | 68 | q/archivedir|cachedir|builddir|removeold|/ .
|
---|
[2355] | 69 | q/textcompress|buildtype|no_text|keepold|gzip/ .
|
---|
| 70 | q/verbosity|allclassifications|OIDtype|maxdocs|/ .
|
---|
| 71 | q/groupsize|sortmeta|debug|mode|create_images)$/,
|
---|
[810] | 72 | q/(maintainer|languages|indexsubcollections|/ .
|
---|
[1851] | 73 | q/indexes|dontbuild|dontgdbm|mirror|phind|levels)$/,
|
---|
[810] | 74 | q/^(subcollection|collectionmeta)$/,
|
---|
| 75 | q/^(plugin|classify)$/);
|
---|
[4] | 76 | }
|
---|
| 77 |
|
---|
| 78 | sub write_collect_cfg {
|
---|
| 79 | my ($filename, $data) = @_;
|
---|
| 80 |
|
---|
| 81 | &cfgread::write_cfg_file($filename, $data,
|
---|
[810] | 82 | q/^(creator|public|beta|defaultindex|importdir|/ .
|
---|
[2336] | 83 | q/archivedir|cachedir|builddir|removeold|/ .
|
---|
| 84 | q/textcompress|buildtype|collectdir|no_text|allclassifications)$/,
|
---|
[810] | 85 | q/^(maintainer|languages|indexsubcollections|/ .
|
---|
[1851] | 86 | q/indexes|dontbuild|dontgdbm|levels)$/,
|
---|
[810] | 87 | q/^(subcollection|collectionmeta)$/,
|
---|
| 88 | q/^(plugin|classify)$/);
|
---|
[4] | 89 | }
|
---|
| 90 |
|
---|
| 91 |
|
---|
| 92 | # the build configuration file data is stored in the form
|
---|
| 93 | #
|
---|
| 94 | # {'builddate'}->string
|
---|
[1302] | 95 | # {'buildtype'}->string
|
---|
[4] | 96 | # {'metadata'}->array of strings
|
---|
| 97 | # {'languages'}->array of strings
|
---|
| 98 | # {'numdocs'}->string
|
---|
| 99 | # {'numwords'}->string
|
---|
| 100 | # {'numbytes'}->string
|
---|
[1302] | 101 | # {'indexfields'}->array of strings
|
---|
[4] | 102 |
|
---|
| 103 | sub read_build_cfg {
|
---|
| 104 | my ($filename) = @_;
|
---|
| 105 |
|
---|
| 106 | return &cfgread::read_cfg_file ($filename,
|
---|
[1302] | 107 | q/^(builddate|buildtype|numdocs|numwords|numbytes)$/,
|
---|
| 108 | q/^(metadata|languages|indexfields)$/);
|
---|
[4] | 109 | }
|
---|
| 110 |
|
---|
| 111 | sub write_build_cfg {
|
---|
| 112 | my ($filename, $data) = @_;
|
---|
| 113 |
|
---|
| 114 | &cfgread::write_cfg_file($filename, $data,
|
---|
[1851] | 115 | q/^(builddate|buildtype|numdocs|numwords|numbytes)$/,
|
---|
| 116 | q/^(metadata|languages|indexfields)$/);
|
---|
[4] | 117 | }
|
---|
| 118 |
|
---|
| 119 |
|
---|
| 120 | 1;
|
---|