[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
|
---|
[4192] | 45 | # {'maxnumeric'}->string
|
---|
[6584] | 46 | # {'separate_cjk'}->string
|
---|
[810] | 47 |
|
---|
| 48 | # {'maintainer'}->array of strings
|
---|
[139] | 49 | # {'languages'}->array of strings
|
---|
[69] | 50 | # {'indexsubcollections'}->array of strings
|
---|
[4] | 51 | # {'indexes'}->array of strings
|
---|
[810] | 52 | # {'dontbuild'}->array of strings
|
---|
| 53 | # {'dontgdbm'}->array of strings
|
---|
[1377] | 54 | # {'mirror'}->array of strings
|
---|
[1572] | 55 | # {'phind'}->array of strings
|
---|
[1851] | 56 | # {'levels'}->array of strings (for mgpp eg Section, Paragraph)
|
---|
[4767] | 57 | # {'searchtype'}->array of strings (for mgpp, form or plain)
|
---|
[4] | 58 |
|
---|
[810] | 59 | # {'subcollection'}->hash of key-value pairs
|
---|
| 60 |
|
---|
[4818] | 61 | # {'acquire'}->array of arrays of strings
|
---|
[810] | 62 | # {'plugin'}->array of arrays of strings
|
---|
| 63 | # {'classify'}->array of arrays of strings
|
---|
| 64 |
|
---|
[2772] | 65 | # {'collectionmeta'}->hash of key->hash of param-value -used
|
---|
| 66 | # for language specification
|
---|
| 67 | # for example, collectionmeta->collectionname->default->demo
|
---|
| 68 | # ->mi->maori demo
|
---|
| 69 |
|
---|
[4] | 70 | sub read_collect_cfg {
|
---|
| 71 | my ($filename) = @_;
|
---|
| 72 |
|
---|
| 73 | return &cfgread::read_cfg_file ($filename,
|
---|
[2711] | 74 | q/^(creator|public|defaultindex|importdir|/ .
|
---|
[2336] | 75 | q/archivedir|cachedir|builddir|removeold|/ .
|
---|
[9547] | 76 | q/textcompress|buildtype|no_text|keepold|gzip|/ .
|
---|
| 77 | q/verbosity|remove_empty_classifications|OIDtype|/ .
|
---|
| 78 | q/groupsize|maxdocs|debug|mode|saveas|/ .
|
---|
| 79 | q/sortmeta|removesuffix|removeprefix|create_images|/ .
|
---|
[9667] | 80 | q/maxnumeric|separate_cjk|language_metadata|/ .
|
---|
[9547] | 81 | q/no_strip_html|index)$/,
|
---|
[810] | 82 | q/(maintainer|languages|indexsubcollections|/ .
|
---|
[9547] | 83 | q/indexes|dontbuild|dontgdbm|mirror|levels|/ .
|
---|
| 84 | q/searchtype|searchtypes)$/,
|
---|
[4767] | 85 | q/^(subcollection|format)$/,
|
---|
[4818] | 86 | q/^(acquire|plugin|classify)$/,
|
---|
[2772] | 87 | q/^(collectionmeta)$/);
|
---|
[4] | 88 | }
|
---|
| 89 |
|
---|
| 90 | sub write_collect_cfg {
|
---|
| 91 | my ($filename, $data) = @_;
|
---|
[4767] | 92 |
|
---|
[4] | 93 | &cfgread::write_cfg_file($filename, $data,
|
---|
[2711] | 94 | q/^(creator|public|defaultindex|importdir|/ .
|
---|
[2336] | 95 | q/archivedir|cachedir|builddir|removeold|/ .
|
---|
[9547] | 96 | q/textcompress|buildtype|no_text|keepold|gzip|/ .
|
---|
| 97 | q/verbosity|remove_empty_classifications|OIDtype|/.
|
---|
| 98 | q/groupsize|maxdocs|debug|mode|saveas|/ .
|
---|
| 99 | q/sortmeta|removesuffix|removeprefix|create_images|/ .
|
---|
| 100 | q/maxnumeric|separate_cjk|language_metadata/ .
|
---|
| 101 | q/no_strip_html|index)$/,
|
---|
[810] | 102 | q/^(maintainer|languages|indexsubcollections|/ .
|
---|
[9547] | 103 | q/indexes|dontbuild|dontgdbm|mirror|levels|/.
|
---|
| 104 | q/searchtype|searchtypes)$/,
|
---|
| 105 | q/^(subcollection|format)$/,
|
---|
[4818] | 106 | q/^(acquire|plugin|classify)$/,
|
---|
[2772] | 107 | q/^(collectionmeta)$/);
|
---|
[4] | 108 | }
|
---|
| 109 |
|
---|
| 110 |
|
---|
| 111 | # the build configuration file data is stored in the form
|
---|
| 112 | #
|
---|
| 113 | # {'builddate'}->string
|
---|
[1302] | 114 | # {'buildtype'}->string
|
---|
[4] | 115 | # {'metadata'}->array of strings
|
---|
| 116 | # {'languages'}->array of strings
|
---|
| 117 | # {'numdocs'}->string
|
---|
[10161] | 118 | # {'numsections'}->string
|
---|
[4] | 119 | # {'numwords'}->string
|
---|
| 120 | # {'numbytes'}->string
|
---|
[4192] | 121 | # {'maxnumeric'}->string
|
---|
[1302] | 122 | # {'indexfields'}->array of strings
|
---|
[2479] | 123 | # {'indexfieldmap'}->array of strings in the form "field->FI"
|
---|
| 124 | # {'indexmap'} -> array of strings
|
---|
[4810] | 125 | # {'indexlevels'} -> array of strings
|
---|
| 126 | # {'textlevel'}->string
|
---|
[9935] | 127 | # {'levelmap'} -> array of strings in the form "level->shortname"
|
---|
[4] | 128 | sub read_build_cfg {
|
---|
| 129 | my ($filename) = @_;
|
---|
| 130 |
|
---|
| 131 | return &cfgread::read_cfg_file ($filename,
|
---|
[10161] | 132 | q/^(builddate|buildtype|numdocs|numsections|numwords|numbytes|maxnumeric|textlevel|indexstem)$/,
|
---|
[9935] | 133 | q/^(metadata|languages|indexfields|indexfieldmap|indexmap|indexlevels|levelmap)$/);
|
---|
[4] | 134 | }
|
---|
| 135 |
|
---|
| 136 | sub write_build_cfg {
|
---|
| 137 | my ($filename, $data) = @_;
|
---|
| 138 |
|
---|
| 139 | &cfgread::write_cfg_file($filename, $data,
|
---|
[10161] | 140 | q/^(builddate|buildtype|numdocs|numsections|numwords|numbytes|maxnumeric|textlevel|indexstem)$/,
|
---|
[9935] | 141 | q/^(metadata|languages|indexfieldsindexfieldmap|indexmap|indexlevels|levelmap)$/);
|
---|
[4] | 142 | }
|
---|
| 143 |
|
---|
| 144 |
|
---|
| 145 | 1;
|
---|
[2772] | 146 |
|
---|