source: trunk/gsdl/perllib/colcfg.pm@ 12697

Last change on this file since 12697 was 12326, checked in by shaoqun, 18 years ago

added code to handle plugout

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
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
26# reads in a collection configuration file
27
28package colcfg;
29
30use cfgread;
31use strict;
32
33# the collection configuration file data is stored in the form
34#
35# {'creator'}->string
36# {'public'}->string
37# {'defaultindex'}->string
38# {'importdir'}->string
39# {'archivedir'}->string
40# {'cachedir'}->string
41# {'builddir'}->string
42# {'removeold'}->string
43# {'textcompress'}->string
44# {'buildtype'}->string
45# {'maxnumeric'}->string
46# {'separate_cjk'}->string
47# {'sections_index_document_metadata'}->string (always, unless_section_metadata_exists)
48# {'maintainer'}->array of strings
49# {'languages'}->array of strings
50# {'indexsubcollections'}->array of strings
51# {'indexes'}->array of strings
52# {'dontbuild'}->array of strings
53# {'dontgdbm'}->array of strings
54# {'mirror'}->array of strings
55# {'phind'}->array of strings
56# {'plugout'}->array of strings
57# {'levels'}->array of strings (for mgpp eg Section, Paragraph)
58# {'searchtype'}->array of strings (for mgpp, form or plain)
59
60# {'subcollection'}->hash of key-value pairs
61
62# {'acquire'}->array of arrays of strings
63# {'plugin'}->array of arrays of strings
64# {'classify'}->array of arrays of strings
65
66# {'collectionmeta'}->hash of key->hash of param-value -used
67# for language specification
68# for example, collectionmeta->collectionname->default->demo
69# ->mi->maori demo
70
71sub read_collect_cfg {
72 my ($filename) = @_;
73
74 return &cfgread::read_cfg_file ($filename,
75 q/^(creator|public|defaultindex|importdir|/ .
76 q/archivedir|cachedir|builddir|removeold|/ .
77 q/textcompress|buildtype|no_text|keepold|gzip|/ .
78 q/verbosity|remove_empty_classifications|OIDtype|/ .
79 q/groupsize|maxdocs|debug|mode|saveas|/ .
80 q/sortmeta|removesuffix|removeprefix|create_images|/ .
81 q/maxnumeric|separate_cjk|language_metadata|/ .
82 q/no_strip_html|index|sections_index_document_metadata)$/,
83 q/(maintainer|languages|indexsubcollections|/ .
84 q/indexes|dontbuild|dontgdbm|mirror|levels|plugout|/ .
85 q/searchtype|searchtypes)$/,
86 q/^(subcollection|format)$/,
87 q/^(acquire|plugin|classify)$/,
88 q/^(collectionmeta)$/);
89}
90
91sub write_collect_cfg {
92 my ($filename, $data) = @_;
93
94 &cfgread::write_cfg_file($filename, $data,
95 q/^(creator|public|defaultindex|importdir|/ .
96 q/archivedir|cachedir|builddir|removeold|/ .
97 q/textcompress|buildtype|no_text|keepold|gzip|/ .
98 q/verbosity|remove_empty_classifications|OIDtype|/.
99 q/groupsize|maxdocs|debug|mode|saveas|/ .
100 q/sortmeta|removesuffix|removeprefix|create_images|/ .
101 q/maxnumeric|separate_cjk|language_metadata/ .
102 q/no_strip_html|index|sections_index_document_metadata)$/,
103 q/^(maintainer|languages|indexsubcollections|/ .
104 q/indexes|dontbuild|dontgdbm|mirror|levels|/.
105 q/searchtype|searchtypes)$/,
106 q/^(subcollection|format)$/,
107 q/^(acquire|plugin|classify)$/,
108 q/^(collectionmeta)$/);
109}
110
111
112# the build configuration file data is stored in the form
113#
114# {'builddate'}->string
115# {'buildtype'}->string
116# {'metadata'}->array of strings
117# {'languages'}->array of strings
118# {'numdocs'}->string
119# {'numsections'}->string
120# {'numwords'}->string
121# {'numbytes'}->string
122# {'maxnumeric'}->string
123# {'indexfields'}->array of strings
124# {'indexfieldmap'}->array of strings in the form "field->FI"
125# {'indexmap'} -> array of strings
126# {'indexlevels'} -> array of strings
127# {'textlevel'}->string
128# {'levelmap'} -> array of strings in the form "level->shortname"
129sub read_build_cfg {
130 my ($filename) = @_;
131
132 return &cfgread::read_cfg_file ($filename,
133 q/^(builddate|buildtype|numdocs|numsections|numwords|numbytes|maxnumeric|textlevel|indexstem)$/,
134 q/^(metadata|languages|indexfields|indexfieldmap|indexmap|indexlevels|levelmap)$/);
135}
136
137sub write_build_cfg {
138 my ($filename, $data) = @_;
139
140 &cfgread::write_cfg_file($filename, $data,
141 q/^(builddate|buildtype|numdocs|numsections|numwords|numbytes|maxnumeric|textlevel|indexstem)$/,
142 q/^(metadata|languages|indexfieldsindexfieldmap|indexmap|indexlevels|levelmap)$/);
143}
144
145
1461;
147
Note: See TracBrowser for help on using the repository browser.