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

Last change on this file since 14023 was 14023, checked in by xiao, 17 years ago

Changes made to use cfgread4gs3.pm in gs3 mode and cfgread.pm in gs2 mode.

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