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