# reads in a collection configuration file

package colcfg;

use cfgread;


# the collection configuration file data is stored in the form
#
# {'creator'}->string
# {'maintainer'}->array of strings
# {'public'}->string
# {'beta'}->string
# {'key'}->string
# {'languages'}->array of strings
# {'subcollection'}->hash of key-value pairs
# {'indexsubcollections'}->array of strings
# {'indexes'}->array of strings
# {'defaultindex'}->string
# {'plugins'}->array of strings

sub read_collect_cfg {
    my ($filename) = @_;

    return &cfgread::read_cfg_file ($filename, 
		    '^(creator|public|beta|key|defaultindex|importdir|' .
				    'archivedir|cachedir|builddir|textindex|removeold)$',
		    '^(maintainer|languages|indexsubcollections|indexes|plugins|dontbuild)$',
		    '^(subcollection|collectionmeta)$');
}

sub write_collect_cfg {
    my ($filename, $data) = @_;

    &cfgread::write_cfg_file($filename, $data,
		    '^(creator|public|beta|key|defaultindex|importdir|' .
				    'archivedir|cachedir|builddir|textindex|removeold)$',
		    '^(maintainer|languages|indexsubcollections|indexes|plugins|dontbuild)$',
		    '^(subcollection|collectionmeta)$');
}


# the build configuration file data is stored in the form
#
# {'builddate'}->string
# {'metadata'}->array of strings
# {'languages'}->array of strings
# {'numdocs'}->string
# {'numwords'}->string
# {'numbytes'}->string

sub read_build_cfg {
    my ($filename) = @_;

    return &cfgread::read_cfg_file ($filename, 
		    '^(builddate|numdocs|numwords|numbytes)$', 
		    '^(metadata|languages)$');
}

sub write_build_cfg {
    my ($filename, $data) = @_;

    &cfgread::write_cfg_file($filename, $data,
		    '^(builddate|numdocs|numwords|numbytes)$', 
		    '^(metadata|languages)$');
}


1;
