NAME

Gestinanna::POF::Repository - basic support for a revision controlled repository

SYNOPSIS

Creating a repository based on the Files table:

package My::Files;

use Gestinanna::POF::Repository qw(Files);

Using the above repository:

My::Files -> register_factory_types($factory => file);

my $factory = Factory -> new(_factory => (
    alzabo_schema => $alzabo_schema,
    tag_path => [ qw(list of tags) ],
) );

my $object = $factory -> ( file => (object_id => '/name') );
my $description = $factory -> ( file_description => (object_id => '/name') );
my $tag = $factory -> ( file_tag => (object_id => '/name', tag => 'tag name') );
my $repository = $factory -> ( file_repository );

my($files, $folders) = $repository -> listing($path);

DESCRIPTION

A repository (for the purposes of this module) is a collection of revision-controlled objects in an RDBMS accessed through Alzabo.

Each repository is managed by four Perl classes: the repository, the object store, the description, and the tags. See Gestinanna::POF::Repository::Object, Gestinanna::POF::Repository::Description, and Gestinanna::POF::Repository::Tag for more information.

SCHEMA

The repository expects the following schema. This assumes use Gestinanna::POF::Repository qw(Prefix). The tests in the distribution have an example of the Alzabo code to create these tables. Additional columns that are not under revision control will be treated as additional attributes as if the object were a simple Gestinanna::POF::Alzabo-based object.

Table `Prefix'

This is the primary object store and has the following columns. Additional text columns named data or starting with data_ may be added. These columns are then the default set of revision-controlled columns.

The names of the revision controlled columns are returned by the object method data_columns in the __PACKAGE__::Object class.

prefix

This is the unique id of the object revision. This may be used to establish relationships with other tables.

name

This is the name of the object. The name and revision (together) must be unique.

revision

This is the revision of the object. This is a unicode string of characters (e.g., the Perl code v1.1) following the RCS/CVS convention for denoting branches and versions.

modify_timestamp

This is the timestamp of the revision (when it was saved to the RDBMS).

log

This is any log text added by the user when the revision was created.

Table `Prefix_Tag'

This table maps tags and names to revisions. Any tag and name combination must be unique.

tag

This is the name of the tag. This is part of the primary key.

name

This is the name of the tagged object. This is also part of the primary key.

revision

This is the revision of the object the tag points to (in the same unicode format).

Table `Prefix_Drescription'

This table is for convenience. It holds metadata that is not tied to a particular revision.

name

This is the name of the object being described.

description

This is a text description of the object.

METHODS

While the repository classes are based on Gestinanna::POF::Alzabo, they extend the functionality to allow management of the repository while still allowing simple use of the objects within the repository.

add_factory_types

__PACKAGE__ -> add_factory_types($factory, $type);

This will add the various object types to the factory, mapping them to the appropriate Perl classes. The type is optional and will default the the primary table name (except all lowercase). For example:

package My::Repository;

use Gestinanna::POF::Repository qw(Foo);

package main;

My::Repository -> add_factory_types($factory);

This will add the following object mappings:

foo             => My::Repository::Object
foo_description => My::Repository::Description
foo_repository  => My::Repository
foo_tag         => My::Repository::Tag

Class::Factory will try to load each of the Perl classes immediately.

register_factory_types

This is the same as add_factory_types except that Class::Factory will delay loading the Perl classes until it creates an object of that particular type.

listing

($files, $folders) = $repository -> listing($path);

This will return a list of the objects and the folders that match the path. The objects and folders are a union of the names in the object table and the description table.

This method assumes that path components are separated in a UNIX fashion by /.

AUTHOR

James G. Smith, <jsmith@cpan.org>

COPYRIGHT

Copyright (C) 2002-2003 Texas A&M University. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.