source: main/tags/2.41-fiji/gsdl/perllib/colcfg.pm@ 23214

Last change on this file since 23214 was 4818, checked in by davidb, 21 years ago

Changed 'importfrom' keyword to 'acquire'

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 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;
31
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
47# {'maintainer'}->array of strings
48# {'languages'}->array of strings
49# {'indexsubcollections'}->array of strings
50# {'indexes'}->array of strings
51# {'dontbuild'}->array of strings
52# {'dontgdbm'}->array of strings
53# {'mirror'}->array of strings
54# {'phind'}->array of strings
55# {'levels'}->array of strings (for mgpp eg Section, Paragraph)
56# {'searchtype'}->array of strings (for mgpp, form or plain)
57
58# {'subcollection'}->hash of key-value pairs
59
60# {'acquire'}->array of arrays of strings
61# {'plugin'}->array of arrays of strings
62# {'classify'}->array of arrays of strings
63
64# {'collectionmeta'}->hash of key->hash of param-value -used
65# for language specification
66# for example, collectionmeta->collectionname->default->demo
67# ->mi->maori demo
68
69sub read_collect_cfg {
70 my ($filename) = @_;
71
72 return &cfgread::read_cfg_file ($filename,
73 q/^(creator|public|defaultindex|importdir|/ .
74 q/archivedir|cachedir|builddir|removeold|/ .
75 q/textcompress|buildtype|no_text|keepold|gzip/ .
76 q/verbosity|allclassifications|OIDtype|maxdocs|/ .
77 q/groupsize|sortmeta|debug|mode|create_images|/ .
78 q/maxnumeric)$/,
79 q/(maintainer|languages|indexsubcollections|/ .
80 q/indexes|dontbuild|dontgdbm|mirror|phind|levels|searchtype)$/,
81 q/^(subcollection|format)$/,
82 q/^(acquire|plugin|classify)$/,
83 q/^(collectionmeta)$/);
84}
85
86sub write_collect_cfg {
87 my ($filename, $data) = @_;
88
89 &cfgread::write_cfg_file($filename, $data,
90 q/^(creator|public|defaultindex|importdir|/ .
91 q/archivedir|cachedir|builddir|removeold|/ .
92 q/textcompress|buildtype|collectdir|no_text|/ .
93 q/allclassifications|maxnumeric)$/,
94 q/^(maintainer|languages|indexsubcollections|/ .
95 q/indexes|dontbuild|dontgdbm|levels|searchtype)$/,
96 q/^(subcollection)$/,
97 q/^(acquire|plugin|classify)$/,
98 q/^(collectionmeta)$/);
99}
100
101
102# the build configuration file data is stored in the form
103#
104# {'builddate'}->string
105# {'buildtype'}->string
106# {'metadata'}->array of strings
107# {'languages'}->array of strings
108# {'numdocs'}->string
109# {'numwords'}->string
110# {'numbytes'}->string
111# {'maxnumeric'}->string
112# {'indexfields'}->array of strings
113# {'indexfieldmap'}->array of strings in the form "field->FI"
114# {'indexmap'} -> array of strings
115# {'indexlevels'} -> array of strings
116# {'textlevel'}->string
117sub read_build_cfg {
118 my ($filename) = @_;
119
120 return &cfgread::read_cfg_file ($filename,
121 q/^(builddate|buildtype|numdocs|numwords|numbytes|maxnumeric|textlevel)$/,
122 q/^(metadata|languages|indexfields|indexfieldmap|indexmap|indexlevels)$/);
123}
124
125sub write_build_cfg {
126 my ($filename, $data) = @_;
127
128 &cfgread::write_cfg_file($filename, $data,
129 q/^(builddate|buildtype|numdocs|numwords|numbytes|maxnumeric|textlevel)$/,
130 q/^(metadata|languages|indexfieldsindexfieldmap|indexmap|indexlevels)$/);
131}
132
133
1341;
135
Note: See TracBrowser for help on using the repository browser.