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

Last change on this file since 4764 was 4725, checked in by davidb, 21 years ago

support added for collection configuration file to use 'importfrom'
to specify a remote location for source documents. Currently only
used by oaiimport.pl

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