Index: /tags/ipp-1-X/rel-0_07/DataStore/.cvsignore
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/.cvsignore	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/.cvsignore	(revision 22005)
@@ -0,0 +1,6 @@
+Build
+META.yml
+Makefile
+Makefile.PL
+_build
+blib
Index: /tags/ipp-1-X/rel-0_07/DataStore/Build.PL
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/Build.PL	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/Build.PL	(revision 22005)
@@ -0,0 +1,40 @@
+use Module::Build;
+# See perldoc Module::Build for details of how this works
+
+Module::Build->new(
+    module_name         => 'DataStore',
+    dist_version_from   => 'lib/DataStore.pm',
+    author              => 'Joshua Hoblitt <jhoblitt@cpan.org>',
+    license             => 'gpl',
+    create_makefile_pl  => 'passthrough',
+    requires            => {
+        'Carp'                  => 0,
+        'Data::Validate::URI'   => '0.01',
+        'Digest::MD5::File'     => '0.03',
+        'IPC::Cmd'              => '0.36',
+        'File::Basename'        => 0,
+        'File::Temp'            => '0.16',
+        'File::Path'            => 0,
+        'File::stat'            => 0,
+        'LWP::UserAgent'        => 0,
+        'Params::Validate'      => '0.77',
+        'YAML'                  => '0.58',
+    },
+    build_requires      => {
+        'CGI'                   => '3',
+        'Net::HTTPServer'       => '1.1.1',
+        'Test::Cmd'             => '1.05',
+        'Test::More'            => 0,
+        'Test::Warn'            => '0.08',
+    },
+    recommends          => {
+        'Test::Distribution'    => '1.22',
+    },
+    script_files        => [qw(
+        scripts/dsget
+        scripts/dsproductls
+        scripts/dsleech
+        scripts/dsfilesetls
+        scripts/dsrootls
+    )],
+)->create_build_script;
Index: /tags/ipp-1-X/rel-0_07/DataStore/Changes
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/Changes	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/Changes	(revision 22005)
@@ -0,0 +1,52 @@
+Revision history for Perl module DataStore
+
+0.07 Mon May 12 12:04:24 HST 2008
+    - add --timeout option to all ds*ls utilties and other minor doc changes
+    - add the ability to all DataStore::* classes that handle HTTP to pass
+      options directly to LWP::UserAgent
+    - add support for checksumming compressed fits files
+    - Change DateStore::File to handle passing args to LWP::UserAgent
+    - change dsget to return the HTTP status code on failure
+    - remove use of parse_neb_key() from dsget
+    - dsget doc updates
+    - fix error reporting bug is dsfilesetls
+    - change dsget to overwrite existing Nebulous keys
+    - trap exceptions from DateStore::File::Parse in DataStore::FileSet being
+      caused by empty file lists
+
+0.06 Thu Feb  1 13:57:56 HST 2007
+    - fix dsleech to handle valid but empty filesets
+    - change dsfilesetls to output "extra" fields
+    - add --overwrite option to dsleech
+    - distcheck fixes
+
+0.05 Fri Sep  1 11:28:13 HST 2006
+    - add --recall, --remember, & rcfile support to dsleech
+    - add a dep on YAML 0.58
+
+0.04 Thu Aug 31 13:01:59 HST 2006
+    - allow upper & lower case characters in DataStore fields
+    - change from lower to upper case all fileset types
+    - change DataStore::File to always return a DataStore::Response (even when
+      there is a problem with the retrieved file)
+    - add dsleech script
+
+0.03 Wed Aug 30 12:46:00 HST 2006
+    - fix a bug in dsproductls where ->status was being called on a
+      DataStore::Response instead of ->status_line
+    - Added a Root object and associated Product::Parser to query the root of
+      the datastore.
+    - The 'is_success' field in a Response now gets its value carried over from
+      the HTTP::Response as intended.
+    - The 'data' field in a Response can now be undef to indicate that no
+      records were parsed.
+    - Root::request, Product::request, FileSet::request now always return a
+      Response object.
+    - FileSets and Files will now have any additional non-standard fields
+      parsed into the @extra array.
+    - Updated tests.
+
+0.01 Thu Feb 23 13:55:57 2006
+    - original version; created by ExtUtils::ModuleMaker 0.44
+
+
Index: /tags/ipp-1-X/rel-0_07/DataStore/LICENSE
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/LICENSE	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/LICENSE	(revision 22005)
@@ -0,0 +1,260 @@
+The General Public License (GPL)
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
+Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
+verbatim copies of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share
+and change it. By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users. This General Public License applies to most of
+the Free Software Foundation's software and to any other program whose
+authors commit to using it. (Some other Free Software Foundation software is
+covered by the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our
+General Public Licenses are designed to make sure that you have the freedom
+to distribute copies of free software (and charge for this service if you wish), that
+you receive source code or can get it if you want it, that you can change the
+software or use pieces of it in new free programs; and that you know you can do
+these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights. These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a
+fee, you must give the recipients all the rights that you have. You must make
+sure that they, too, receive or can get the source code. And you must show
+them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer
+you this license which gives you legal permission to copy, distribute and/or
+modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software. If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced by
+others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish
+to avoid the danger that redistributors of a free program will individually obtain
+patent licenses, in effect making the program proprietary. To prevent this, we
+have made it clear that any patent must be licensed for everyone's free use or
+not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+GNU GENERAL PUBLIC LICENSE
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
+MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License. The "Program", below, refers to any such program
+or work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or translated
+into another language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope. The act of running the Program is not
+restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as
+you receive it, in any medium, provided that you conspicuously and appropriately
+publish on each copy an appropriate copyright notice and disclaimer of warranty;
+keep intact all the notices that refer to this License and to the absence of any
+warranty; and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at
+your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus
+forming a work based on the Program, and copy and distribute such
+modifications or work under the terms of Section 1 above, provided that you also
+meet all of these conditions:
+
+a) You must cause the modified files to carry prominent notices stating that you
+changed the files and the date of any change.
+
+b) You must cause any work that you distribute or publish, that in whole or in
+part contains or is derived from the Program or any part thereof, to be licensed
+as a whole at no charge to all third parties under the terms of this License.
+
+c) If the modified program normally reads commands interactively when run, you
+must cause it, when started running for such interactive use in the most ordinary
+way, to print or display an announcement including an appropriate copyright
+notice and a notice that there is no warranty (or else, saying that you provide a
+warranty) and that users may redistribute the program under these conditions,
+and telling the user how to view a copy of this License. (Exception: if the
+Program itself is interactive but does not normally print such an announcement,
+your work based on the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License,
+and its terms, do not apply to those sections when you distribute them as
+separate works. But when you distribute the same sections as part of a whole
+which is a work based on the Program, the distribution of the whole must be on
+the terms of this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to
+work written entirely by you; rather, the intent is to exercise the right to control
+the distribution of derivative or collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+3. You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and 2
+above provided that you also do one of the following:
+
+a) Accompany it with the complete corresponding machine-readable source
+code, which must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange; or,
+
+b) Accompany it with a written offer, valid for at least three years, to give any
+third party, for a charge no more than your cost of physically performing source
+distribution, a complete machine-readable copy of the corresponding source
+code, to be distributed under the terms of Sections 1 and 2 above on a medium
+customarily used for software interchange; or,
+
+c) Accompany it with the information you received as to the offer to distribute
+corresponding source code. (This alternative is allowed only for noncommercial
+distribution and only if you received the program in object code or executable
+form with such an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it. For an executable work, complete source code means all the
+source code for all modules it contains, plus any associated interface definition
+files, plus the scripts used to control compilation and installation of the
+executable. However, as a special exception, the source code distributed need
+not include anything that is normally distributed (in either source or binary form)
+with the major components (compiler, kernel, and so on) of the operating system
+on which the executable runs, unless that component itself accompanies the
+executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source
+code from the same place counts as distribution of the source code, even though
+third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License. Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License. However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so long
+as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the Program
+or its derivative works. These actions are prohibited by law if you do not accept
+this License. Therefore, by modifying or distributing the Program (or any work
+based on the Program), you indicate your acceptance of this License to do so,
+and all its terms and conditions for copying, distributing or modifying the
+Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program),
+the recipient automatically receives a license from the original licensor to copy,
+distribute or modify the Program subject to these terms and conditions. You
+may not impose any further restrictions on the recipients' exercise of the rights
+granted herein. You are not responsible for enforcing compliance by third parties
+to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent infringement
+or for any other reason (not limited to patent issues), conditions are imposed on
+you (whether by court order, agreement or otherwise) that contradict the
+conditions of this License, they do not excuse you from the conditions of this
+License. If you cannot distribute so as to satisfy simultaneously your obligations
+under this License and any other pertinent obligations, then as a consequence
+you may not distribute the Program at all. For example, if a patent license would
+not permit royalty-free redistribution of the Program by all those who receive
+copies directly or indirectly through you, then the only way you could satisfy
+both it and this License would be to refrain entirely from distribution of the
+Program.
+
+If any portion of this section is held invalid or unenforceable under any particular
+circumstance, the balance of the section is intended to apply and the section as
+a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other
+property right claims or to contest validity of any such claims; this section has
+the sole purpose of protecting the integrity of the free software distribution
+system, which is implemented by public license practices. Many people have
+made generous contributions to the wide range of software distributed through
+that system in reliance on consistent application of that system; it is up to the
+author/donor to decide if he or she is willing to distribute software through any
+other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain countries
+either by patents or by copyrighted interfaces, the original copyright holder who
+places the Program under this License may add an explicit geographical
+distribution limitation excluding those countries, so that distribution is permitted
+only in or among countries not thus excluded. In such case, this License
+incorporates the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the
+General Public License from time to time. Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems or
+concerns.
+
+Each version is given a distinguishing version number. If the Program specifies a
+version number of this License which applies to it and "any later version", you
+have the option of following the terms and conditions either of that version or of
+any later version published by the Free Software Foundation. If the Program does
+not specify a version number of this License, you may choose any version ever
+published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission. For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of all
+derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS
+NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
+COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
+"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
+IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
+CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
+TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY
+WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS
+PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
+(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
+OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
Index: /tags/ipp-1-X/rel-0_07/DataStore/MANIFEST
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/MANIFEST	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/MANIFEST	(revision 22005)
@@ -0,0 +1,39 @@
+Build.PL
+Changes
+LICENSE
+MANIFEST
+META.yml
+Makefile.PL
+README
+Todo
+lib/DataStore.pm
+lib/DataStore/File.pm
+lib/DataStore/File/Parser.pm
+lib/DataStore/FileSet.pm
+lib/DataStore/FileSet/Parser.pm
+lib/DataStore/Product.pm
+lib/DataStore/Product/Parser.pm
+lib/DataStore/Record.pm
+lib/DataStore/Response.pm
+lib/DataStore/Root.pm
+lib/DataStore/Utils.pm
+scripts/dsfilesetls
+scripts/dsget
+scripts/dsleech
+scripts/dsproductls
+scripts/dsrootls
+t/00_distribution.t
+t/01_load.t
+t/02_fileset_parse.t
+t/03_file_parse.t
+t/04_record.t
+t/05_product.t
+t/06_fileset.t
+t/07_file.t
+t/08_response.t
+t/09_datastore.t
+t/10_dsget.t
+t/11_dsproductls.t
+t/12_dsfilesetls.t
+t/13_dsrootls.t
+t/14_root.t
Index: /tags/ipp-1-X/rel-0_07/DataStore/README
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/README	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/README	(revision 22005)
@@ -0,0 +1,15 @@
+pod2text DataStore.pm > README
+
+If this is still here it means the programmer was too lazy to create the readme file.
+
+You can create it now by using the command shown above from this directory.
+
+At the very least you should be able to use this set of instructions
+to install the module...
+
+perl Build.PL
+./Build
+./Build test
+./Build install
+
+If you are on a windows box you should use 'nmake' rather than 'make'.
Index: /tags/ipp-1-X/rel-0_07/DataStore/Todo
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/Todo	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/Todo	(revision 22005)
@@ -0,0 +1,5 @@
+TODO list for Perl module DataStore
+
+- Nothing yet
+
+
Index: /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore.pm
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore.pm	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore.pm	(revision 22005)
@@ -0,0 +1,159 @@
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: DataStore.pm,v 1.10 2007-09-25 23:52:46 jhoblitt Exp $
+
+package DataStore;
+
+use strict;
+use warnings;
+
+use vars qw($VERSION);
+$VERSION = '0.07';
+
+=pod
+
+=head1 NAME
+
+DataStore - client interface to a DataStore server
+
+=head1 SYNOPSIS
+
+    use DataStore;
+
+    # equivalent to:
+
+    use DataStore::File::Parser;
+    use DataStore::File;
+    use DataStore::FileSet::Parser;
+    use DataStore::FileSet;
+    use DataStore::Product;
+    use DataStore::Response;
+    use DataStore::Utils;
+
+=head1 DESCRIPTION
+
+This is a convenience module so that that don't have to individualy load (C<use
+...;>) all of the common DataStore inteface modules.  Please see the POD of the
+individual modules for usage information.  If this is your browsing of the
+documentation you may want to start with L<DataStore::Product>.
+
+=head1 USAGE
+
+=head2 Import Parameters
+
+This module accepts no arguments to it's C<import> method and exports no
+I<symbols>.
+
+=head2 Methods
+
+None.
+
+=head1 EXAMPLE PROGRAM
+
+    #!/usr/bin/perl
+
+    use strict;
+    use warnings;
+
+    # loads DataStore::*
+    use DataStore;
+
+    my $dsp = DataStore::Product->new(
+        uri => 'http://example.org/productid/',
+        last_fileset => 'foobarbaz',
+    );
+
+    # returns a DataStore::Response object
+    my $response = $dsp->request;
+
+    unless ($response->is_success) {
+        die $response->status;
+    }
+
+    # arrayref of DataStore::FileSet objects
+    my $filesets = $response->data;
+
+    # the query could be a success but still return no filesets
+    unless ($filesets) {
+        warn "no filesets returned";
+        exit(0);
+    }
+
+    # returns a DataStore::Response object
+    my $response2 = @$filesets[0]->request;
+
+    unless ($response2->is_success) {
+        die $response2->status;
+    }
+
+    # arrayref of DataStore::File objects
+    my $files = $response->data;
+
+    # the query could be a success but still return no files (is that legal?)
+    unless (@$files) {
+        warn "no files returned";
+        exit(0);
+    }
+
+    # requires a filename
+    my $response3 = @$files[0]->request( filename => '/dev/null' );
+    unless ($response3->is_success) {
+        warn $response3->status;
+        die;
+    }
+
+    # $response3->data is '/dev/null'
+
+=cut
+
+use DataStore::File::Parser;
+use DataStore::File;
+use DataStore::FileSet::Parser;
+use DataStore::FileSet;
+use DataStore::Product::Parser;
+use DataStore::Product;
+use DataStore::Root;
+use DataStore::Response;
+use DataStore::Utils;
+
+=head1 CREDITS
+
+Just me, myself, and I.
+
+=head1 SUPPORT
+
+Please contact the author directly via e-mail.
+
+=head1 AUTHOR
+
+Joshua Hoblitt <jhoblitt@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2006  Joshua Hoblitt.  All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA  02111-1307, USA.
+
+The full text of the license can be found in the LICENSE file included with
+this module, or in the L<perlgpl> Pod as supplied with Perl 5.8.1 and later.
+
+=head1 SEE ALSO
+
+L<DataStore::File::Parser>, L<DataStore::File>, L<DataStore::FileSet::Parser>, L<DataStore::FileSet>, L<DataStore::Product>, L<DataStore::Response>
+
+=cut
+
+1;
+
+__END__
Index: /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/File.pm
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/File.pm	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/File.pm	(revision 22005)
@@ -0,0 +1,338 @@
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: File.pm,v 1.18 2008-05-07 03:05:03 jhoblitt Exp $
+
+package DataStore::File;
+
+use strict;
+use warnings;
+
+use vars qw($VERSION);
+$VERSION = '0.03';
+
+use base qw( DataStore::Record );
+
+use Carp qw( carp );
+use DataStore::Response;
+use DataStore::Utils qw( $STD_FIELD $BYTE_FIELD $MD5_FIELD %KNOWN_FILE_TYPES );
+use Digest::MD5::File qw( file_md5_hex );
+use File::Basename qw( basename );
+use File::Temp ();
+use File::stat;
+use IPC::Cmd 0.36 qw( can_run run );
+use Params::Validate qw( validate SCALAR ARRAYREF UNDEF );
+
+use vars qw( @BASE_FIELDS );
+
+@BASE_FIELDS = qw( fileid bytes md5sum type extra compressed );
+
+__PACKAGE__->mk_accessors(@BASE_FIELDS);
+
+=pod
+
+=head1 NAME
+
+DataStore::File - represents a DataStore File
+
+=head1 SYNOPSIS
+
+    use DataStore::file;
+
+    my $dsf = DateStore::File->new(
+        uri         => 'http://example.org/foo',
+        fileid      => '12buckelyourshoe',
+        bytes       => 12345,
+        md5sum      => 'fe6a2b6564c0d4cfb3bbf1db813824ba',
+        type        => 'foo',
+    );
+
+    my $uri     = $dsf->uri;
+    my fileid   = $dsf->fileid;
+    my $bytes   = $dsf-bytes;
+    my $md5sum  = $dsf->md5sum;
+    my $type    = $dsf-type;
+    my DataStore::Response $response = $dsf->request( filename => "/foo/bar" );
+
+=head1 DESCRIPTION
+
+This class I<isa> L<DataStore::Record>
+
+=head1 USAGE
+
+=head2 Import Parameters
+
+This module accepts no arguments to it's C<import> method and exports no
+I<symbols>.
+
+=head2 Methods
+
+=head3 Constructors
+
+=over 4
+
+=item * C<new()>
+
+Basic constructor.
+
+    my $dsf = DateStore::File->new(
+        uri         => 'http://example.org/foo',
+        fileid      => '12buckelyourshoe',
+        bytes       => 12345,
+        md5sum      => 'fe6a2b6564c0d4cfb3bbf1db813824ba',
+        type        => 'foo',
+    );
+
+Accepts a mandatory hash and returns a L<DataStore::Product> object.
+
+=over 4
+
+=item * uri
+
+A valid I<HTTP> URI as a string.  I<No trailing slash is allowed.>
+
+=item * fileid
+
+The FIle ID as a string.
+
+This key is optional.
+
+=item * bytes
+
+The size of the file as an integer number of bytes.
+
+This key is optional.
+
+=item * md5sum
+
+The hex encoded md5 checksum of the file.
+
+This key is optional.
+
+=item * type
+
+The type of file as a string.
+
+This key is optional.
+
+=back
+
+=cut
+
+sub new
+{
+    my $class = shift;
+
+    # validates uri, doesn't check other params
+    my $self = $class->SUPER::new(@_);
+
+    validate(@_,
+        {
+            uri     => {
+                type        => SCALAR,
+                callbacks   => {
+                    'is valid uri filename' => sub { $_[0] !~ m|/$| },
+                },
+            },
+            fileid  => {
+                type        => SCALAR,
+                regex       => $STD_FIELD,
+                optional    => 1,
+            },
+            bytes   => {
+                type        => SCALAR,
+                regex       => $BYTE_FIELD,
+                optional    => 1,
+            },
+            md5sum  => {
+                type        => SCALAR,
+                regex       => $MD5_FIELD,
+                optional    => 1,
+            },
+            type    => {
+                type        => SCALAR,
+                callbacks   => {
+                    'is valid type' =>
+                        sub { exists $KNOWN_FILE_TYPES{$_[0]} },
+                },
+                optional    => 1,
+            },
+            extra   => {
+                type        => SCALAR | ARRAYREF,
+                optional    => 1,
+            },
+            compressed => {
+                type        => SCALAR | UNDEF,
+                optional    => 1,
+            },
+        },
+    );
+
+    return $self;
+}
+
+=back
+
+=head3 Object Methods
+
+=over 4
+
+=item * C<uri()>
+
+Basic accessor.
+
+=item * C<fileid()>
+
+Basic accessor.
+
+=item * C<bytes()>
+
+Basic accessor.
+
+=item * C<md5sum()>
+
+Basic accessor.
+
+=item * C<type()>
+
+Basic accessor.
+
+=item * C<request()>
+
+Retrieves and processes the File listing pointed to by the L<uri> of this
+object.
+
+XXX writing the file into memory or to a filehandle will be implemented upon
+request.
+
+    my $response = $dsf->request( filename => "/foo/bar" );
+
+Accepts a mandatory hash and returns a L<DataStore::Response> object.
+
+=over 4
+
+=item * filename
+
+The filename/path to save the file to disk as.  It is the user's responsibility
+to make sure that this is a valid filename/path.
+
+=back
+
+=cut
+
+sub request 
+{
+    my $self = shift;
+
+    my %p = validate(@_,
+        {
+            filename    => {
+                type        => SCALAR,
+                regex       => qr/\S+/, # string with at least 1 non WS char
+            },
+            ua_args     => {
+                optional    => 1,
+            },
+        },
+    );
+
+    my $verbose = 0;
+
+    # make request
+    my $ua;
+    if (defined $p{ua_args}) {
+        $ua = LWP::UserAgent->new(%{$p{ua_args}});
+    } else {
+        $ua = LWP::UserAgent->new;
+    }
+    my $request = HTTP::Request->new(GET => $self->uri);
+    my $filename = $p{filename};
+    my $response = $ua->request($request, $filename);
+
+    if ($response->is_success) {
+        my $funpack;
+        if ($self->compressed) {
+            $funpack = can_run('funpack')
+                or warn "can't find funpack -- unable to compute checksum";
+        }
+
+        my $chk_file = $filename;
+        # so that the tmp file stays in scope until we're done processing
+        my $tmp;
+        if ($funpack) {
+            $tmp = File::Temp->new(
+                DIR         => '/tmp',
+                TEMPLATE    => basename($filename) . '.XXXXXXXX',
+                SUFFIX      => '.tmp',
+                UNLINK      => 1,
+            );
+
+            my $unpacked_path = $tmp->filename;
+
+            my $command = "$funpack -S -C $filename > $unpacked_path";
+            my ($success, $status, $full_buf, $stdout_buf, $stderr_buf)
+                = run(command => $command, verbose => $verbose);
+
+            unless ($success) {
+                die "funpack returned exit status $status\n";
+            }
+
+            $chk_file = $unpacked_path;
+        }
+
+        # check size
+        if (defined $self->bytes) {
+            my $size = stat($chk_file)->size;
+            if (! ($self->bytes == $size)) {
+                unlink $filename;
+                carp "uri: ", $self->uri,
+                     " - expected size: ", $self->bytes,
+                     " got: ", $size;
+                # set the filename to undef to indicate an error
+                $filename = undef;
+            } else {
+                carp "uri: ", $self->uri,
+                     " - expected size: ", $self->bytes,
+                     " got: ", $size
+                if $verbose;
+            }
+        }
+
+        if (defined $filename and defined $self->md5sum) {
+            my $md5 = file_md5_hex($chk_file);
+            if (! ($self->md5sum eq $md5)) {
+                unlink $filename;
+                carp "uri: ", $self->uri,
+                     " - expected md5: ", $self->md5sum,
+                     " got: ", $md5;
+                # set the filename to undef to indicate an error
+                $filename = undef;
+            } else {
+                carp "uri: ", $self->uri,
+                     " - expected md5: ", $self->md5sum,
+                     " got: ", $md5
+                if $verbose;
+            }
+        }
+    }
+
+    # return DS::Response object
+    my $dsr = DataStore::Response->new(
+        is_success  => $response->is_success,
+        code        => $response->code,
+        status_line => $response->status_line,
+        data        => $filename,
+        request     => $self,
+    );
+}
+
+=back
+
+=head1 SEE ALSO
+
+L<DataStore::Response>
+
+=cut
+
+1;
+
+__END__
Index: /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/File/Parser.pm
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/File/Parser.pm	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/File/Parser.pm	(revision 22005)
@@ -0,0 +1,232 @@
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: Parser.pm,v 1.15 2007-09-26 03:41:00 jhoblitt Exp $
+
+package DataStore::File::Parser;
+
+use strict;
+use warnings;
+
+use vars qw($VERSION);
+$VERSION = '0.02';
+
+use base qw( Class::Accessor::Fast );
+
+use Carp qw( carp );
+use Data::Validate::URI qw( is_uri ); 
+use DataStore::Utils qw( $STD_FIELD $BYTE_FIELD $MD5_FIELD %KNOWN_FILE_TYPES );
+use DataStore::File;
+use Params::Validate qw( validate validate_pos SCALAR );
+
+__PACKAGE__->mk_ro_accessors(qw(base_uri));
+
+=pod
+
+=head1 NAME
+
+DataStore::File::Parser - parses the DataStore 'File' list format
+
+=head1 SYNOPSIS
+
+    use DataStore::File::Parser;
+
+    my $parser = DataStore::File::Parser->new(
+        base_uri => 'http://example.org/',
+    );
+
+    my @data = $parser->parse($str);
+        or
+    my $data = $parser->parse($str);
+
+
+=head1 DESCRIPTION
+
+This class parses a DataStore listing of I<File>s into an array of L<DataStore::File> objects.
+
+=head1 USAGE
+
+=head2 Import Parameters
+
+This module accepts no arguments to it's C<import> method and exports no
+I<symbols>.
+
+=head2 Methods
+
+=head3 Constructors
+
+=over 4
+
+=item * C<new()>
+
+Basic constructor.
+
+    my $parser = DataStore::File::Parser->new(
+        base_uri => 'http://example.org/',
+    );
+
+Accepts an optional hash and returns a L<DataStore::FileSet::Parser> object.
+
+=over 4
+
+=item * base_uri
+
+The base of the URI to set in the created L<DataStore::File> objects.
+
+This key is optional and defaults to C<http://example.org/>.
+
+=back
+
+=cut
+
+sub new
+{
+    my $class = shift;
+
+    my %p = validate(@_,
+        {
+            base_uri => {
+                type        => SCALAR,
+                callbacks   => {
+                    'is valid http uri' =>
+                        sub { is_uri($_[0]) and $_[0] =~ /^http:/ },
+                    'uri ends with /index.txt' =>
+                        sub { $_[0] =~ m|/index.txt$| },
+
+                },
+                default =>  'http://example.org/index.txt',
+            },
+        },
+    );
+
+    my $self = bless {}, ref $class || $class;
+
+    $p{base_uri} =~ qr|(.*?/)index.txt|;
+    $self->{base_uri} = $1;
+
+    return $self;
+}
+
+
+=back
+
+=head3 Object Methods
+
+=over 4
+
+=item * C<base_uri()>
+
+Basic accessor.
+
+=item * C<parse()>
+
+Accepts a string and returns a list in list context or an arrayref is scalar
+context.  An empty list or undef is returned if the string contained no rows.
+
+=cut
+
+sub parse
+{
+    my $self = shift;
+
+    my ($doc) = validate_pos(@_,
+        {
+            type    => SCALAR,
+            regex   => qr/\S+/, # string with at least 1 non WS char
+        }
+    );
+
+    my @data;
+    my $lineno = 1;
+LINE: foreach my $line (split /\n/, $doc) {
+        # blank lines
+        next LINE if $line =~ /^\s*$/;
+
+        # comment lines   
+        next LINE if $line =~ /^\s*\#/;
+
+        my @fields = split /\|/, $line;
+
+        # at least fileid, bytes, md5sum, and type fields are required
+        if (scalar @fields < 4) {
+            carp "line $lineno: not enough fields: $line";
+            next LINE;
+        }
+
+        foreach my $field (@fields) {
+            # fields are not allowed to contain \#
+            if ($field =~ /\#/) {
+                carp "line $lineno: field $field: contains #: $line";
+                next LINE;
+            }
+
+            # strip leading and trailing whitespace
+            $field =~ s/^\s+//;
+            $field =~ s/\s+$//;
+        }
+
+        my ($fileid, $bytes, $md5sum, $type) = @fields;
+
+        # validate format of fileid and type
+        foreach my $field ($fileid, $type) {
+            unless ($field =~ $STD_FIELD) {
+                carp "line $lineno: field $field:"
+                   . " does not conform to $STD_FIELD: $line";
+                next LINE;
+            }
+        }
+
+        # validate format of bytes
+        unless ($bytes =~ $BYTE_FIELD) {
+            carp "line $lineno: field $bytes:"
+               . " does not conform to $BYTE_FIELD: $line";
+            next LINE;
+        }
+
+        # validate format of md5sum, hex encoded
+        unless ($md5sum =~ $MD5_FIELD) {
+            # allow md5sum to be empty
+            unless ($md5sum =~ /^\s*$/) {
+                carp "line $lineno: field $md5sum:"
+                . " does not conform to $MD5_FIELD: $line";
+                next LINE;
+            }
+            $md5sum = undef;
+        }
+
+        unless (exists $KNOWN_FILE_TYPES{$type}) {
+            carp "line $lineno: type $type unknown: $line";
+            next LINE;
+        }
+
+	my @extra = @fields[4 .. $#fields] if $#fields >= 4;
+
+        my %p = (
+            fileid  => $fileid,
+            bytes   => $bytes,
+            type    => $type,
+            extra   => \@extra, 
+            uri     => $self->base_uri . $fileid,
+        );
+        $p{md5sum} = $md5sum if $md5sum;
+
+        # fifo  
+        push @data, DataStore::File->new(%p);
+    } continue {
+        $lineno++;
+    }
+
+    return unless @data;
+    return wantarray ? @data : \@data;
+}
+
+=back
+
+=head1 SEE ALSO
+
+L<DataStore::File>, L<DataStore::FileSet::Parser>
+
+=cut
+
+1;
+
+__END__
Index: /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/FileSet.pm
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/FileSet.pm	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/FileSet.pm	(revision 22005)
@@ -0,0 +1,240 @@
+# Copyright (C) 2006-2008  Joshua Hoblitt
+#
+# $Id: FileSet.pm,v 1.15 2008-05-12 22:04:53 jhoblitt Exp $
+
+package DataStore::FileSet;
+
+use strict;
+use warnings;
+
+use vars qw($VERSION);
+$VERSION = '0.04';
+
+use base qw( DataStore::Record );
+
+use Carp qw( carp );
+use DataStore::File::Parser;
+use DataStore::Response;
+use DataStore::Utils qw( $STD_FIELD $TIME_FIELD %KNOWN_FILESET_TYPES );
+use LWP::UserAgent;
+use Params::Validate qw( validate SCALAR ARRAYREF );
+
+use vars qw( @BASE_FIELDS );
+
+@BASE_FIELDS = qw( fileset datetime type extra );
+
+__PACKAGE__->mk_accessors(@BASE_FIELDS);
+
+=pod
+
+=head1 NAME
+
+DataStore::FileSet - represents a DataStore FileSet 
+
+=head1 SYNOPSIS
+
+    use DataStore::FileSet;
+
+    my $dsfs = DateStore::FileSet->new(
+        uri         => 'http://example.org/',
+        fileset     => '12buckelyourshoe',
+        datetime    => '2042-01-01T00:00:00Z',
+        type        => 'foo',
+    );
+
+    my $uri         = $dsfs->uri;
+    my $fileset     = $dsfs->fileset;
+    my $datatime    = $dsfs->datetime;
+    my $type        = $dsfs->type;
+    my DataStore::Response $response = $dsfs->request;
+
+=head1 DESCRIPTION
+
+This class I<isa> L<DataStore::Record>
+
+=head1 USAGE
+
+=head2 Import Parameters
+
+This module accepts no arguments to it's C<import> method and exports no
+I<symbols>.
+
+=head2 Methods
+
+=head3 Constructors
+
+=over 4
+
+=item * C<new()>
+
+Basic constructor.
+
+    my $dsfs = DateStore::FileSet->new(
+        uri         => 'http://example.org/',
+        fileset     => '12buckelyourshoe',
+        datetime    => '2042-01-01T00:00:00Z',
+        type        => 'foo',
+    );
+
+Accepts a mandatory hash and returns a L<DataStore::FileSet> object.
+
+=over 4
+
+=item * uri
+
+A valid I<HTTP> URI as a string.  I<A trailing slash is required.>
+
+=item * fileset
+
+The FileSet ID as a string.
+
+This key is optional.
+
+=item * datetime
+
+The time and date as a string.
+
+This key is optional.
+
+=item * type
+
+The I<type> of record as a string.
+
+This key is optional.
+
+=back
+
+=cut
+
+sub new
+{
+    my $class = shift;
+
+    # validates uri, doesn't check other params
+    my $self = $class->SUPER::new(@_);
+
+    validate(@_,
+        {
+            uri         => {
+                type        => SCALAR,
+                callbacks   => {
+                    'uri ends with /index.txt'
+                        => sub { $_[0] =~ m|/index.txt$| },
+                }
+            },
+            fileset     => {
+                type        => SCALAR,
+                regex       => $STD_FIELD,
+                optional    => 1,
+            },
+            datetime    => {
+                type        => SCALAR,
+                regex       => $TIME_FIELD,
+                optional    => 1,
+            },
+            type        => {
+                type        => SCALAR,
+                callbacks   => {
+                    'is valid type' => 
+                        sub { exists $KNOWN_FILESET_TYPES{$_[0]} },
+                },
+                optional    => 1,
+            },
+            extra       => {
+                type        => SCALAR | ARRAYREF,
+                optional    => 1,
+            },
+        },
+    );
+
+    return $self;
+}
+
+=back
+
+=head3 Object Methods
+
+=over 4
+
+=item * C<uri()>
+
+Basic accessor.
+
+=item * C<fileset()>
+
+Basic accessor.
+
+=item * C<datetime()>
+
+Basic accessor.
+
+=item * C<type()>
+
+Basic accessor.
+
+=item * C<request()>
+
+Retrieves and processes the File listing pointed to by the L<uri> of this
+object.
+
+Accepts no parameters and returns a L<DataStore::Response> object.
+
+=cut
+
+sub request 
+{
+    my $self = shift;
+
+    my %p = validate(@_,
+        {
+            ua_args     => {
+                optional    => 1,
+            },
+        },
+    );
+
+    # make request
+    my $ua;
+    if (defined $p{ua_args}) {
+        $ua = LWP::UserAgent->new(%{$p{ua_args}});
+    } else {
+        $ua = LWP::UserAgent->new;
+    }
+    my $request = HTTP::Request->new(GET => $self->uri);
+    my $response = $ua->request($request);
+
+    my $data;
+
+    if ($response->is_success) {
+        # parse document
+        my $parser = DataStore::File::Parser->new(base_uri => $self->uri);
+
+        eval {
+            $data = $parser->parse($response->content);
+        };
+        if ($@) {
+            carp "error parsing DataStore File format: $@";
+        }
+    }
+
+    # return DS::Response object
+    my $dsr = DataStore::Response->new(
+        is_success  => $response->is_success,
+        code        => $response->code,
+        status_line => $response->status_line,
+        data        => $data,
+        request     => $self,
+    );
+}
+
+=back
+
+=head1 SEE ALSO
+
+L<DataStore::Response>
+
+=cut
+
+1;
+
+__END__
Index: /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/FileSet/Parser.pm
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/FileSet/Parser.pm	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/FileSet/Parser.pm	(revision 22005)
@@ -0,0 +1,215 @@
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: Parser.pm,v 1.17 2007-09-26 00:09:52 jhoblitt Exp $
+
+package DataStore::FileSet::Parser;
+
+use strict;
+use warnings;
+
+use vars qw($VERSION);
+$VERSION = '0.02';
+
+use base qw( Class::Accessor::Fast );
+
+use Carp qw( carp );
+use Data::Validate::URI qw( is_uri );
+use DataStore::FileSet;
+use DataStore::Utils qw( $STD_FIELD $TIME_FIELD %KNOWN_FILESET_TYPES );
+use Params::Validate qw( validate validate_pos SCALAR);
+
+__PACKAGE__->mk_ro_accessors(qw(base_uri));
+
+=pod
+
+=head1 NAME
+
+DataStore::FileSet::Parser - parses the DataStore 'FileSet' list format
+
+=head1 SYNOPSIS
+
+    use DataStore::FileSet::Parser;
+
+    my $parser = DataStore::FileSet::Parser->new(
+        base_uri => 'http://example.org/index.txt',
+    );
+
+    my @data = $parser->parse($str);
+        or
+    my $data = $parser->parse($str);
+
+=head1 DESCRIPTION
+
+This class parses a DataStore listing of I<FileSet>s into an array of L<DataStore::FileSet> objects.
+
+=head1 USAGE
+
+=head2 Import Parameters
+
+This module accepts no arguments to it's C<import> method and exports no
+I<symbols>.
+
+=head2 Methods
+
+=head3 Constructors
+
+=over 4
+
+=item * C<new()>
+
+Basic constructor.
+
+    my $parser = DataStore::FileSet::Parser->new(
+        base_uri => 'http://example.org/index.txt',
+    );
+
+Accepts an optional hash and returns a L<DataStore::FileSet::Parser> object.
+
+=over 4
+
+=item * base_uri
+
+The base of the URI to set in the created L<DataStore::FileSet> objects.
+
+This key is optional and defaults to C<http://example.org/>.
+
+=back
+
+=cut
+
+sub new
+{
+    my $class = shift;
+
+    my %p = validate(@_,
+        {
+            base_uri => {
+                type        => SCALAR,
+                callbacks   => {
+                    'is valid http uri' =>
+                        sub { is_uri($_[0]) and $_[0] =~ /^http:/ },
+                    'uri ends with /index.txt' =>
+                        sub { $_[0] =~ m|/index.txt$| },
+                },
+                default =>  'http://example.org/index.txt',
+            },
+        },
+    );
+
+    my $self = bless {}, ref $class || $class;
+
+    $p{base_uri} =~ qr|(.*?/)index.txt|;
+    $self->{base_uri} = $1; 
+
+    return $self;
+}
+
+=back
+
+=head3 Object Methods
+
+=over 4
+
+=item * C<base_uri()>
+
+Basic accessor.
+
+=item * C<parse()>
+
+Accepts a string and returns a list in list context or an arrayref is scalar
+context.  An empty list or undef is returned if the string contained no rows.
+
+=cut
+
+sub parse
+{
+    my $self = shift;
+
+    my ($doc) = validate_pos(@_,
+        {
+            type    => SCALAR,
+            regex   => qr/\S+/, # string with at least 1 non WS char
+        }
+    );
+
+    my @data;
+    my $lineno = 1;
+LINE: foreach my $line (split /\n/, $doc) {
+        # blank lines
+        next LINE if $line =~ /^\s*$/;
+
+        # comment lines   
+        next LINE if $line =~ /^\s*\#/;
+
+        my @fields = split /\|/, $line;
+
+        # at least fileset, datatime, and type fields are required
+        if (scalar @fields < 3) {
+            carp "line $lineno: not enough fields: $line";
+            next LINE;
+        }
+
+        foreach my $field (@fields) {
+            # fields are not allowed to contain #
+            if ($field =~ /\#/) {
+                carp "line $lineno: field $field: contains #: $line";
+                next LINE;
+            }
+
+            # strip leading and trailing whitespace
+            $field =~ s/^\s+//;
+            $field =~ s/\s+$//;
+        }
+
+        my ($fileset, $datetime, $type) = @fields;
+
+        # validate format of fileset and type
+        foreach my $field ($fileset, $type) {
+            unless ($field =~ $STD_FIELD) {
+                carp "line $lineno: field $field:"
+                   . " does not conform to $STD_FIELD: $line";
+                next LINE;
+            }
+        }
+
+        # validate format of datetime
+        unless ($datetime =~ $TIME_FIELD) {
+            carp "line $lineno: field $datetime:"
+               . " does not conform to $TIME_FIELD";
+            next LINE;
+        }
+
+        unless (exists $KNOWN_FILESET_TYPES{$type}) {
+            carp "line $lineno: type $type unknown: $line";
+            next LINE;
+        } 
+
+        my @extra = @fields[3 .. $#fields] if $#fields >= 3;
+
+        # fifo
+        push @data, DataStore::FileSet->new({
+            fileset     => $fileset,
+            datetime    => $datetime,
+            type        => $type,
+            extra       => \@extra, 
+            uri         => $self->base_uri . $fileset . '/index.txt',
+        });
+    } continue {
+        $lineno++;
+    }
+
+    return unless @data;
+    return wantarray ? @data : \@data;
+}
+
+=back
+
+=head1 SEE ALSO
+
+L<DataStore::FileSet>, L<DataStore::File:Parser>
+
+=cut
+
+1;
+
+__END__
Index: /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Product.pm
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Product.pm	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Product.pm	(revision 22005)
@@ -0,0 +1,224 @@
+# Copyright (C) 2006-2008  Joshua Hoblitt
+#
+# $Id: Product.pm,v 1.11 2008-05-12 22:04:53 jhoblitt Exp $
+
+package DataStore::Product;
+
+use strict;
+use warnings;
+
+use vars qw($VERSION);
+$VERSION = '0.02';
+
+use base qw( DataStore::Record );
+
+use Carp qw( carp );
+use DataStore::FileSet::Parser;
+use DataStore::Record;
+use DataStore::Response;
+use DataStore::Utils qw( $STD_FIELD $TIME_FIELD %KNOWN_PRODUCT_TYPES );
+use LWP::UserAgent;
+use Params::Validate qw( validate SCALAR);
+
+use vars qw( @BASE_FIELDS );
+
+@BASE_FIELDS = qw( product last_fileset last_datetime type desc );
+
+__PACKAGE__->mk_ro_accessors(@BASE_FIELDS);
+
+=pod
+
+=head1 NAME
+
+DataStore::Product - represents a DataStore Product ID
+
+=head1 SYNOPSIS
+
+    use DataStore::Product;
+
+    my $dsp = DataStore::Product->new(
+        uri             => 'http://example.com/productid/',
+        last_fileset    => 'foobar',
+    );
+
+    my $uri     = $dsp->uri;
+    my $fileset = $dsp_fileset;
+    my DataStore::Response $response = $dsp->request;
+
+=head1 DESCRIPTION
+
+This class I<isa> L<DataStore::Record>
+
+=head1 USAGE
+
+=head2 Import Parameters
+
+This module accepts no arguments to it's C<import> method and exports no
+I<symbols>.
+
+=head2 Methods
+
+=head3 Constructors
+
+=over 4
+
+=item * C<new()>
+
+Basic constructor.
+
+    my $dsp = DataStore::Product->new(
+        uri             => 'http://example.com/productid/',
+        last_fileset    => 'foobar',
+    );
+
+Accepts a mandatory hash and returns a L<DataStore::Product> object.
+
+=over 4
+
+=item * uri
+
+A valid I<HTTP> URI as a string.  I<A trailing slash is required.>
+
+=item * last_fileset
+
+The last FileSet ID that was requested as a string.
+
+This key is optional.
+
+=back
+
+=cut
+
+sub new
+{
+    my $class = shift;
+
+    # validates uri, doesn't check other params
+    my $self = $class->SUPER::new(@_);
+
+    validate(@_,
+        {
+            uri             => {
+                type        => SCALAR,
+                callbacks   => {
+                    'uri ends with /index.txt'
+                        => sub { $_[0] =~ m|/index.txt$| },
+                }
+            },
+            product         => {
+                type        => SCALAR,
+                optional    => 1,
+            },
+            last_fileset    => { 
+                type        => SCALAR,
+                callbacks   => {
+                    'is valid fileset ID' => sub { $_[0] =~ $STD_FIELD },
+                },
+                optional    => 1,
+            },
+            last_datetime    => {
+                type        => SCALAR,
+                regex       => $TIME_FIELD,
+                optional    => 1,
+            },
+            type        => {
+                type        => SCALAR,
+                callbacks   => {
+                    'is valid type' =>
+                        sub { exists $KNOWN_PRODUCT_TYPES{$_[0]} },
+                },
+                optional    => 1,
+            },
+            desc        => {
+                 type       => SCALAR,
+                 optional   => 1,
+            },
+        },
+    );
+
+    return $self;
+}
+
+=back
+
+=head3 Object Methods
+
+=over 4
+
+=item * C<uri()>
+
+Basic accessor.
+
+=item * C<last_fileset()>
+
+Basic accessor.
+
+=item * C<request()>
+
+Retrieves and processes the FileSet listing pointed to by the L<uri> of this
+object.
+
+Accepts no parameters and returns a L<DataStore::Response> object.
+
+=cut
+
+sub request 
+{
+    my $self = shift;
+
+    my %p = validate(@_,
+        {
+            ua_args     => {
+                optional    => 1,
+            },
+        },
+    );
+
+    # make request
+    my $ua;
+    if (defined $p{ua_args}) {
+        $ua = LWP::UserAgent->new(%{$p{ua_args}});
+    } else {
+        $ua = LWP::UserAgent->new;
+    }
+
+    my $request;
+    if ($self->last_fileset) {
+        $request = HTTP::Request->new(
+            GET => $self->uri . "?" . $self->last_fileset,
+        );
+    } else {
+        $request = HTTP::Request->new(GET => $self->uri);
+    }
+    my $response = $ua->request($request);
+
+    my $data;
+
+    if ($response->is_success) {
+        # parse document
+        my $parser = DataStore::FileSet::Parser->new(base_uri => $self->uri);
+
+        $data = $parser->parse($response->content);
+    }
+
+    # return DS::Response object
+    my $dsr = DataStore::Response->new(
+        is_success  => $response->is_success,
+        code        => $response->code,
+        status_line => $response->status_line,
+        data        => $data,
+        request     => $self,
+    );
+}
+
+=back
+
+=head1 SEE ALSO
+
+L<DataStore::Response>
+
+=cut
+
+1;
+
+__END__
Index: /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Product/Parser.pm
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Product/Parser.pm	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Product/Parser.pm	(revision 22005)
@@ -0,0 +1,215 @@
+# Adapted from FileSet/Parser.pm
+#
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: Parser.pm,v 1.2 2007-09-26 00:13:29 jhoblitt Exp $
+
+package DataStore::Product::Parser;
+
+use strict;
+use warnings;
+
+use vars qw($VERSION);
+$VERSION = '0.01';
+
+use base qw( Class::Accessor::Fast );
+
+use Carp qw( carp );
+use Data::Validate::URI qw( is_uri );
+use DataStore::Product;
+use DataStore::Utils qw( $STD_FIELD $TIME_FIELD %KNOWN_PRODUCT_TYPES );
+use Params::Validate qw( validate validate_pos SCALAR);
+
+__PACKAGE__->mk_ro_accessors(qw(base_uri));
+
+=pod
+
+=head1 NAME
+
+DataStore::Product::Parser - parses the DataStore 'Product' list format
+
+=head1 SYNOPSIS
+
+    use DataStore::Product::Parser;
+
+    my $parser = DataStore::Product::Parser->new(
+        base_uri => 'http://example.org/index.txt',
+    );
+
+    my @data = $parser->parse($str);
+        or
+    my $data = $parser->parse($str);
+
+=head1 DESCRIPTION
+
+This class parses a root DataStore listing into an array of L<DataStore::Product> objects.
+
+=head1 USAGE
+
+=head2 Import Parameters
+
+This module accepts no arguments to it's C<import> method and exports no
+I<symbols>.
+
+=head2 Methods
+
+=head3 Constructors
+
+=over 4
+
+=item * C<new()>
+
+Basic constructor.
+
+    my $parser = DataStore::Product::Parser->new(
+        base_uri => 'http://example.org/index.txt',
+    );
+
+Accepts an optional hash and returns a L<DataStore::Product::Parser> object.
+
+=over 4
+
+=item * base_uri
+
+The base of the URI to set in the created L<DataStore::Product> objects.
+
+This key is optional and defaults to C<http://example.org/>.
+
+=back
+
+=cut
+
+sub new
+{
+    my $class = shift;
+
+    my %p = validate(@_,
+        {
+            base_uri => {
+                type        => SCALAR,
+                callbacks   => {
+                    'is valid http uri' =>
+                        sub { is_uri($_[0]) and $_[0] =~ /^http:/ },
+                    'uri ends with /index.txt' =>
+                        sub { $_[0] =~ m|/index.txt$| },
+
+                },
+                default =>  'http://example.org/index.txt',
+            },
+        },
+    );
+
+    my $self = bless {}, ref $class || $class;
+
+    $p{base_uri} =~ qr|(.*?/)index.txt|;
+    $self->{base_uri} = $1;
+
+    return $self;
+}
+
+=back
+
+=head3 Object Methods
+
+=over 4
+
+=item * C<base_uri()>
+
+Basic accessor.
+
+=item * C<parse()>
+
+Accepts a string and returns a list in list context or an arrayref is scalar
+context.  An empty list or undef is returned if the string contained no rows.
+
+=cut
+
+sub parse
+{
+    my $self = shift;
+
+    my ($doc) = validate_pos(@_,
+        {
+            type    => SCALAR,
+            regex   => qr/\S+/, # string with at least 1 non WS char
+        }
+    );
+
+    my @data;
+    my $lineno = 1;
+LINE: foreach my $line (split /\n/, $doc) {
+        # blank lines
+        next LINE if $line =~ /^\s*$/;
+
+        # comment lines   
+        next LINE if $line =~ /^\s*\#/;
+
+        my @fields = split /\|/, $line;
+
+        # at least fileset, datatime, and type fields are required
+        if (scalar @fields < 5) {
+            carp "line $lineno: not enough fields: $line";
+            next LINE;
+        }
+
+        foreach my $field (@fields) {
+            # fields are not allowed to contain #
+            if ($field =~ /\#/) {
+                carp "line $lineno: field $field: contains #: $line";
+                next LINE;
+            }
+        
+            # strip leading and trailing whitespace
+            $field =~ s/^\s+//;
+            $field =~ s/\s+$//;
+        }
+
+        my ($product, $last_fileset, $last_datetime, $type, $desc) = @fields;
+
+        # validate format of fileset
+        unless ($last_fileset =~ $STD_FIELD) {
+            carp "line $lineno: field $last_fileset:"
+               . " does not conform to $STD_FIELD: $line";
+            next LINE;
+        }
+
+        # validate format of datetime
+        unless ($last_datetime =~ $TIME_FIELD) {
+            carp "line $lineno: field $last_datetime:"
+               . " does not conform to $TIME_FIELD";
+            next LINE;
+        }
+
+        unless (exists $KNOWN_PRODUCT_TYPES{$type}) {
+            carp "line $lineno: type $type unknown: $line";
+            next LINE;
+        } 
+
+        # fifo
+        push @data, DataStore::Product->new({
+            product       => $product,
+            last_fileset  => $last_fileset,
+            last_datetime => $last_datetime,
+            type          => $type,
+            desc          => $desc,
+            uri           => $self->base_uri . $product . '/index.txt',
+        });
+    } continue {
+        $lineno++;
+    }
+
+    return unless @data;
+    return wantarray ? @data : \@data;
+}
+
+=back
+
+=head1 SEE ALSO
+
+L<DataStore::Product>, L<DataStore::FileSet::Parser>
+
+=cut
+
+1;
+
+__END__
Index: /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Record.pm
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Record.pm	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Record.pm	(revision 22005)
@@ -0,0 +1,118 @@
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: Record.pm,v 1.7 2006-03-16 22:03:53 jhoblitt Exp $
+
+package DataStore::Record;
+
+use strict;
+use warnings;
+
+use vars qw($VERSION);
+$VERSION = '0.01';
+
+use base qw( Class::Accessor::Fast );
+
+use Carp qw( carp croak );
+use Data::Validate::URI qw( is_uri );
+use Params::Validate qw( validate_with validate SCALAR );
+
+use vars qw( @BASE_FIELDS );
+
+@BASE_FIELDS = qw( uri );
+
+__PACKAGE__->mk_ro_accessors(@BASE_FIELDS);
+
+=pod
+
+=head1 NAME
+
+DataStore::Record - base class of DataStore list records or rows
+
+=head1 SYNOPSIS
+
+    use base qw( DataStore::Record );
+
+=head1 DESCRIPTION
+
+=head1 USAGE
+
+=head2 Import Parameters
+
+This module accepts no arguments to it's C<import> method and exports no
+I<symbols>.
+
+=head2 Methods
+
+=head3 Constructors
+
+=over 4
+
+=item * C<new()>
+
+Basic constructor.
+
+    my $dsp = DataStore::Record->new(
+        uri => 'http://example.com/',
+    );
+
+Accepts a mandatory hash and returns a L<DataStore::Record> object.
+
+=over 4
+
+=item * uri
+
+A valid I<HTTP> URI as a string. 
+
+=back
+
+=cut
+
+sub new
+{
+    my $class = shift;
+
+    my %p = validate_with(
+        params  => \@_,
+        spec    => {
+            uri => {
+                type        => SCALAR,
+                callbacks   => {
+                    'is valid http uri' =>
+                        sub { is_uri($_[0]) and $_[0] =~ /^http:/ },
+                },
+                default =>  'http://example.org/',
+            },
+        },
+        allow_extra => 1,
+    );
+
+    my $self = bless \%p, ref $class || $class;
+
+    return $self;
+}
+
+=back
+
+=head3 Object Methods
+
+=over 4
+
+=item * C<uri()>
+
+=cut
+
+=item * C<request()>
+
+This method must be overloaded in sub-classes.
+
+=cut
+
+sub request
+{
+    croak "sub classes of " . __PACKAGE__
+        . " must override the ->request() method";
+}
+
+1;
+
+__END__
Index: /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Response.pm
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Response.pm	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Response.pm	(revision 22005)
@@ -0,0 +1,173 @@
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: Response.pm,v 1.4 2006-07-22 01:17:33 smalle Exp $
+
+package DataStore::Response;
+
+use strict;
+use warnings;
+
+use vars qw($VERSION);
+$VERSION = '0.01';
+
+use base qw( Class::Accessor::Fast );
+
+use Params::Validate qw( validate ARRAYREF BOOLEAN SCALAR UNDEF );
+
+use vars qw( @BASE_FIELDS );
+
+@BASE_FIELDS = qw( is_success code status_line data request );
+
+__PACKAGE__->mk_accessors(@BASE_FIELDS);
+
+=pod
+
+=head1 NAME
+
+DataStore::Response - represents a DataStore response
+
+=head1 SYNOPSIS
+
+    use DataStore::Response;
+
+    my $dsr = DateStore::Response->new(
+        is_success  => undef,
+        code        => 500,
+        status_line => 'foo',
+        data        => 'bar',
+        request     => DataStore::Product->new( uri => 'http://example.org/' ),
+    );
+
+    if ($data) {
+        my $success     = $dsr->is_success;
+        my $code        = $dsr->code;
+        my $status_line = $dsr->status_line;
+        my $data        = $dsr->data;
+        my DataStore::Response $response = $dsp->request;
+    }
+
+=head1 DESCRIPTION
+
+This class represent the return state of the C<request()> method in
+L<DataStore::Record> sub-classes.
+
+=head1 USAGE
+
+=head2 Import Parameters
+
+This module accepts no arguments to it's C<import> method and exports no
+I<symbols>.
+
+=head2 Methods
+
+=head3 Constructors
+
+=over 4
+
+=item * C<new()>
+
+Basic constructor.
+
+    my $dsr = DateStore::Response->new(
+        is_success  => undef,
+        code        => 500,
+        status_line => 'foo',
+        data        => 'bar',
+        request     => DataStore::Product->new( uri => 'http://example.org/' ),
+    );
+
+Accepts a mandatory hash and returns a L<DataStore::Product> object.
+
+=over 4
+
+=item * uri
+
+A vvalid I<HTTP> URI as a string.
+
+=item * code
+
+An HTTP status code.
+
+=item * status_line
+
+An HTTP status line.
+
+=item * data
+
+A scalar value, an arrayref of scalar data, or undef.
+
+=item * request
+
+An object that I<isa> L<DataStore::Record>.
+
+=back
+
+=cut
+
+sub new
+{
+    my $class = shift;
+
+    my %p = validate(@_,
+        {
+            is_success  => {
+                type        => BOOLEAN,
+                callbacks   => {
+                    'is 0, 1, or undef' =>
+                        sub { ! defined( $_[0] ) || $_[0] == 0 || $_[0] == 1 },
+                },
+            },
+            code        => {
+                type        => SCALAR,
+                regex       => qr/^\d{3}$/,
+            },
+            status_line => {
+                type        => SCALAR,
+                regex       => qr/\S+/, # string with atleast 1 non WS char
+
+            },
+            data        => {
+                type        => SCALAR | ARRAYREF | UNDEF,
+            },
+            request     => {
+                isa         => qw( DataStore::Record ),
+            },
+        }
+    );
+
+    my $self = bless \%p, ref $class || $class;
+
+    return $self;
+}
+
+=back
+
+=head3 Object Methods
+
+=over 4
+
+=item * C<uri()>
+
+Basic accessor.
+
+=item * C<code()>
+
+Basic accessor.
+
+=item * C<status_line()>
+
+Basic accessor.
+
+=item * C<data()>
+
+Basic accessor.
+
+=item * C<request()>
+
+Basic accessor.
+
+=cut
+
+1;
+
+__END__
Index: /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Root.pm
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Root.pm	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Root.pm	(revision 22005)
@@ -0,0 +1,181 @@
+# Adapted from Product.pm
+#
+# Copyright (C) 2006-2008  Joshua Hoblitt
+#
+# $Id: Root.pm,v 1.5 2008-05-12 22:04:53 jhoblitt Exp $
+
+package DataStore::Root;
+
+use strict;
+use warnings;
+
+use vars qw($VERSION);
+$VERSION = '0.02';
+
+use base qw( DataStore::Record );
+
+use Carp qw( carp );
+use DataStore::Product::Parser;
+use DataStore::Record;
+use DataStore::Response;
+use DataStore::Utils qw( $STD_FIELD );
+use LWP::UserAgent;
+use Params::Validate qw( validate SCALAR);
+
+use vars qw( @BASE_FIELDS );
+
+@BASE_FIELDS = qw( last_fileset );
+
+__PACKAGE__->mk_ro_accessors(@BASE_FIELDS);
+
+=pod
+
+=head1 NAME
+
+DataStore::Root - container for root DataStore index
+
+=head1 SYNOPSIS
+
+    use DataStore::Root;
+
+    my $dsp = DataStore::Root->new(
+        uri             => 'http://example.com/productid/',
+    );
+
+    my DataStore::Response $response = $dsp->request;
+
+=head1 DESCRIPTION
+
+This class I<isa> L<DataStore::Record>
+
+=head1 USAGE
+
+=head2 Import Parameters
+
+This module accepts no arguments to it's C<import> method and exports no
+I<symbols>.
+
+=head2 Methods
+
+=head3 Constructors
+
+=over 4
+
+=item * C<new()>
+
+Basic constructor.
+
+    my $dsp = DataStore::Root->new(
+        uri             => 'http://example.com/productid/',
+    );
+
+Accepts a mandatory hash and returns a L<DataStore::Root> object.
+
+=over 4
+
+=item * uri
+
+A valid I<HTTP> URI as a string.  I<A trailing slash is required.>
+
+=back
+
+=cut
+
+sub new
+{
+    my $class = shift;
+
+    # validates uri, doesn't check other params
+    my $self = $class->SUPER::new(@_);
+
+    validate(@_,
+        {
+            uri             => {
+                type        => SCALAR,
+                callbacks   => {
+                    'uri ends with /index.txt' =>
+                        sub { $_[0] =~ m|/index.txt$| },
+                }
+            },
+       },
+    );
+
+    return $self;
+}
+
+=back
+
+=head3 Object Methods
+
+=over 4
+
+=item * C<uri()>
+
+Basic accessor.
+
+=item * C<last_fileset()>
+
+Basic accessor.
+
+=item * C<request()>
+
+Retrieves and processes the FileSet listing pointed to by the L<uri> of this
+object.
+
+Accepts no parameters and returns a L<DataStore::Response> object.
+
+=cut
+
+sub request 
+{
+    my $self = shift;
+
+    my %p = validate(@_,
+        {
+            ua_args     => {
+                optional    => 1,
+            },
+        },
+    );
+
+    # make request
+    my $ua;
+    if (defined $p{ua_args}) {
+        $ua = LWP::UserAgent->new(%{$p{ua_args}});
+    } else {
+        $ua = LWP::UserAgent->new;
+    }
+
+    my $request = HTTP::Request->new(GET => $self->uri);
+    my $response = $ua->request($request);
+
+    my $data;
+
+    if ($response->is_success) {
+        # parse document
+        my $parser = DataStore::Product::Parser->new(base_uri => $self->uri);
+
+        $data = $parser->parse($response->content);
+    }
+
+    # return DS::Response object
+    my $dsr = DataStore::Response->new(
+        is_success  => $response->is_success,
+        code        => $response->code,
+        status_line => $response->status_line,
+        data        => $data,
+        request     => $self,
+    );
+}
+
+=back
+
+=head1 SEE ALSO
+
+L<DataStore::Response>
+
+=cut
+
+1;
+
+__END__
Index: /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Utils.pm
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Utils.pm	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/lib/DataStore/Utils.pm	(revision 22005)
@@ -0,0 +1,104 @@
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: Utils.pm,v 1.8 2008-05-04 17:10:34 bills Exp $
+
+package DataStore::Utils;
+
+use strict;
+use warnings;
+
+use vars qw( $VERSION );
+$VERSION = '0.02';
+
+use base qw( Exporter );
+
+use Carp qw( carp );
+use Data::Validate::URI qw( is_uri );
+
+use vars qw(
+    @EXPORT_OK
+    $STD_FIELD
+    $TIME_FIELD
+    $BYTE_FIELD
+    $MD5_FIELD
+    %KNOWN_FILE_TYPES
+    %KNOWN_FILESET_TYPES
+    %KNOWN_PRODUCT_TYPES
+);
+
+@EXPORT_OK = qw(
+    @EXPORT_OK
+    $STD_FIELD
+    $TIME_FIELD
+    $BYTE_FIELD
+    $MD5_FIELD
+    %KNOWN_FILE_TYPES
+    %KNOWN_FILESET_TYPES
+    %KNOWN_PRODUCT_TYPES
+);
+
+$STD_FIELD = qr/^[A-z0-9-_.: ]+$/;
+$TIME_FIELD = qr/^(\d{4})-(\d\d)-(\d\d) T (\d\d):(\d\d):(\d\d) Z$/x;
+$BYTE_FIELD = qr/^\d+$/;
+$MD5_FIELD = qr/^[0-9a-f]{32}$/;
+%KNOWN_FILE_TYPES = map { $_ => 1 } qw( chip psrequest psresults pstamp chipproc warp stack diff ipp-mops);
+%KNOWN_FILESET_TYPES = map { $_ => 1 } qw( OBJECT BIAS DARK SKYFLAT DOMEFLAT PSREQUEST PSRESULTS IPP-MOPS XRAY FOCUS );
+%KNOWN_PRODUCT_TYPES = map { $_ => 1 } qw( image dump psrequest psresults table );
+
+=pod
+
+=head1 NAME
+
+DataStore::Utils - functions and/or regexs common to DataStore::* modules
+
+=head1 SYNOPSIS
+
+    use DataStore::Utils qw( ... );
+
+=head1 DESCRIPTION
+
+This class parses a DataStore listing of I<FileSet>s into an array of L<DataStore::FileSet> objects.
+
+=head1 USAGE
+
+=head2 Import Parameters
+
+This module exports no I<symbols> by default. It will export these symbols upon request:
+
+=over 4
+
+=item * C<$STD_FIELD>
+
+A C<qr> for the standard DataStore list field type.
+
+=item * C<$TIME_FIELD>
+
+A C<qr> for the standard DataStore time field type.
+
+=item * C<$BYTE_FIELD>
+
+A C<qr> for the standard DataStore byte field type.
+
+=item * C<$MD5_FIELD>
+
+A C<qr> for the standard DataStore hex encoded md5 field type.
+
+=item * C%<KNOWN_FILE_TYPES>
+
+A a hash of the known I<File> types.
+
+=item * C%<KNOWN_FILESET_TYPES>
+
+A a hash of the known I<FileSet> types.
+
+=back
+
+=head2 Methods
+
+None.
+
+=cut
+
+1;
+
+__END__
Index: /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsfilesetls
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsfilesetls	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsfilesetls	(revision 22005)
@@ -0,0 +1,129 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006-2008  Joshua Hoblitt
+#
+# $Id: dsfilesetls,v 1.7 2008-05-12 22:04:53 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use vars qw( $VERSION );
+$VERSION = '0.02';
+
+use DataStore;
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+
+my ($uri, $timeout);
+
+GetOptions(
+    'uri|u=s'           => \$uri,
+    'timeout|t'     => \$timeout,
+) or pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage(
+    -msg => "Required options: --uri",
+    -exitval => 3,
+) unless defined $uri;
+
+# default http request timeout is 30s
+$timeout ||= 30;
+
+my $response = DataStore::FileSet->new( uri => $uri )->request(
+        ua_args  => { timeout => $timeout },
+    );
+
+die "request failed" unless defined $response;
+die "request failed: ", $response->status_line unless $response->is_success;
+
+# file retreival succeed
+
+my $data = $response->data;
+
+unless ($data) {
+    warn "no files found";
+    exit(0);
+}
+
+print "# uri fileid bytes md5sum type \n";
+foreach my $fs (@$data) {
+    print 
+        $fs->uri, " ",
+        $fs->fileid, " ",
+        $fs->bytes, " ",
+        $fs->md5sum || 0, " ",
+        $fs->type;
+    print " ", join(" ", @{$fs->extra}) if defined $fs->extra;   
+    print "\n";
+}
+
+__END__
+
+=pod
+
+=head1 NAME
+
+dsfilesetls - list all the Files under a FileSet from a DataStore server
+
+=head1 SYNOPSIS
+
+    dsfilesetls --uri <uri> 
+
+=head1 DESCRIPTION
+
+=head1 OPTIONS
+
+=over 4
+
+=item * --uri|-u <uri>
+
+The URI of the file to be retrieved.
+
+=item * --timeout|-t
+
+The ammount of time (in seconds) to wait for a response from the DataStore
+after making an HTTP request.  The default is 30s.
+
+Optional.
+
+=back
+
+=head1 CREDITS
+
+Just me, myself, and I.
+
+=head1 SUPPORT
+
+Please contact the author directly via e-mail.
+
+=head1 AUTHOR
+
+Joshua Hoblitt <jhoblitt@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2006-2008  Joshua Hoblitt.  All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA  02111-1307, USA.
+
+The full text of the license can be found in the L<perlgpl> Pod as supplied
+with Perl 5.8.1 and later.
+
+=head1 SEE ALSO
+
+L<dsget>, L<dsleech>, L<dsrootls>, L<dsproductls>, L<dsfilesetls>, L<DataStore>
+
+=cut
Index: /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsget
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsget	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsget	(revision 22005)
@@ -0,0 +1,286 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006-2008  Joshua Hoblitt
+#
+# $Id: dsget,v 1.24 2008-05-12 22:04:53 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use vars qw( $VERSION );
+$VERSION = '0.02';
+
+use DataStore;
+use File::Path qw( mkpath );
+use File::Temp ();
+use File::Basename qw( basename dirname );
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+
+my ($uri,
+    $bytes,
+    $md5,
+    $nebulous,
+    $filename,
+    $volume,
+    $server,
+    $compress,
+    $timeout
+);
+
+$server = $ENV{'NEB_SERVER'} unless $server;
+
+GetOptions(
+    'uri|u=s'       => \$uri,
+    'bytes|m=s'     => \$bytes,
+    'nebulous|n'    => \$nebulous,
+    'volume|v=s'    => \$volume,
+    'server|s=s'    => \$server,
+    'md5|m=s'       => \$md5,
+    'filename|f=s'  => \$filename,
+    'compress|c'    => \$compress,
+    'timeout|t'     => \$timeout,
+) or pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage(
+    -msg => "Required options: --uri --filename",
+    -exitval => 3,
+) unless defined $uri and defined $filename;
+
+# XXX EAM : should not need parse_neb_key, but how to handle case
+# where we supply --volume and neb://volume/path ? 
+# 1) parse anyway and check for conflict
+# 2) drop --volume option
+# JH: the Nebulous server contains the policy to handle this conflict.
+# At present --volume will overide the volume in neb://volume/...
+
+# --volume implies --nebulous
+if ($volume) {
+    $nebulous ||=1;
+} 
+
+if ($compress) {
+    $uri = "$uri?compress";
+}
+
+# default http request timeout is 30s
+$timeout ||= 30;
+
+my %p = (
+    uri     => $uri,
+    type    => 'chip',
+);
+
+$p{bytes} = $bytes if defined $bytes; 
+$p{md5sum} = $md5 if defined $md5;
+$p{compressed} = 1 if defined $compress;
+
+my $tmp;
+
+if (!$nebulous) {
+
+    # create path and possibly fix up permissions
+    my $dirname = dirname($filename);
+    if (!-d $dirname) {
+        mkpath([$dirname], 1, 0775);
+    }
+
+    # can we truly write to filename?
+{
+    # open file for read/write but not create
+    my $fh;
+    if (open($fh, '+<', $filename)) {
+        # do nothing and fall through
+    } elsif (open($fh, '>>', $filename)) {
+        # this is the "stomp on it behavior" this probably shouldn't be the
+        # default and it may make sense to check the md5sum/bytes count of the
+        # files that's already in place to see if we really need to re-fetch it
+        unlink $filename or die "can't unlink $filename: $!";
+    } else {
+        die "can't write to $filename";
+    }
+}
+
+    # for non-neb files, use the download directory for the tmp file
+    $tmp = File::Temp->new(
+               DIR         => $dirname,
+               TEMPLATE    => '.' . basename($filename) . '.XXXXXXXX',
+               SUFFIX      => '.tmp',
+               UNLINK      => 1,
+               );
+} else {
+    # for neb files, use /tmp for the tmp file
+    $tmp = File::Temp->new(
+               DIR         => '/tmp',
+               TEMPLATE    => basename($filename) . '.XXXXXXXX',
+               SUFFIX      => '.tmp',
+               UNLINK      => 1,
+               );
+}
+
+my $tmpfilename = $tmp->filename;
+print "downloading file to $tmpfilename\n";
+
+# request the file from the remote data store server (save in tmpfilename)
+my $response = DataStore::File->new(%p)->request(
+        filename => $tmpfilename,
+        ua_args  => { timeout => $timeout },
+    );
+
+die "request failed" unless defined $response;
+unless ($response->is_success) {
+    warn "request failed: ", $response->status_line;
+    exit($response->code - 300);
+}
+die "checksum failed" unless $response->data;
+
+# file retreival succeed
+
+# this can't cross a file system boundry so we can assume that a move will
+# always be a rename operation instead of a copy and delete.
+
+if ($nebulous) {
+    require Nebulous::Client;
+    import Nebulous::Client;
+    require File::Copy;
+    import File::Copy;
+
+    my $neb = Nebulous::Client->new(
+        proxy   => $server,
+    );
+
+    die "can't connected to Nebulous Server: $server"
+        unless defined $neb;
+
+    # XXX see comment above about not blindly stomping the file
+    # - if the key doesn't already exist then create it
+    # - if it does, delete it so that we end up on the right storage volume
+    if ($neb->stat($filename)) {
+        $neb->delete($filename)
+            or die "Nebulous can't delete key $filename";
+    }
+
+    my $fh = $neb->open_create( $filename, $volume )
+        or die "Nebulous can't create key $filename";
+
+    open(my $src_fh, $tmpfilename) or die "can't open file $tmpfilename: $!";
+
+    File::Copy::copy( $src_fh, $fh ) or die "file copy failed";
+
+    close($src_fh) or die "can't close file $tmpfilename: $!";
+    close($fh) or die "can't close nebulous filehandle";
+} else {
+    rename $tmpfilename, $filename
+        or die "renaming $tmpfilename to $filename failed: $!";
+}
+
+DESTROY {
+    unlink $tmpfilename if -e $tmpfilename;
+}
+
+__END__
+
+=pod
+
+=head1 NAME
+
+gsget - download a file from a DataStore server
+
+=head1 SYNOPSIS
+
+    dsget --uri <uri> --filename <filename> [--bytes <nbytes>] [--md5 <hex>]
+        [--compress] [--nebulous] [--volume <volume name>]
+
+=head1 DESCRIPTION
+
+=head1 OPTIONS
+
+=over 4
+
+=item * --uri|-u <uri>
+
+The URI of the file to be retrieved.
+
+=item * --filename|-f <filename>
+
+The name to use when writing the file to disk.
+
+=item * --bytes|-s <nbytes>
+
+The size of the file in bytes.
+
+Optional, the size check is skipped if no value is specified.
+
+=item * --md5|-m <hex>
+
+The md5 checksum of the file in hex.
+
+Optional, the md5check is skipped if no value is specified.
+
+=item * --nebulous|-n
+
+Flag to enable C<nebulous> support.  When set C<--filename> is used as the
+Nebulous key.
+
+Optional.
+
+=item * --compress|-c
+
+When set C<dsget> will request a compressed version of the file.
+
+Optional.
+
+=item * --volume|-v <volume name>
+
+The volume name to request the first Nebulous instance be stored on.
+
+Optional, implies C<--nebulous>
+
+=item * --timeout|-t
+
+The ammount of time (in seconds) to wait for a response from the DataStore
+after making an HTTP request.  The default is 30s.
+
+Optional.
+
+=back
+
+=head1 CREDITS
+
+Just me, myself, and I.
+
+=head1 SUPPORT
+
+Please contact the author directly via e-mail.
+
+=head1 AUTHOR
+
+Joshua Hoblitt <jhoblitt@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2006-2008  Joshua Hoblitt.  All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA  02111-1307, USA.
+
+The full text of the license can be found in the L<perlgpl> Pod as supplied
+with Perl 5.8.1 and later.
+
+=head1 SEE ALSO
+
+L<dsget>, L<dsleech>, L<dsrootls>, L<dsproductls>, L<dsfilesetls>, L<DataStore>
+
+=cut
Index: /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsleech
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsleech	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsleech	(revision 22005)
@@ -0,0 +1,320 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006-2008  Joshua Hoblitt
+#
+# $Id: dsleech,v 1.10 2008-05-12 22:04:53 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use vars qw( $VERSION );
+$VERSION = '0.02';
+
+use DataStore;
+use File::Spec;
+use YAML ();
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+
+my ($dir, $uri, $last_fileset, $overwrite, $recall, $remember, $verbose, $timeout);
+
+GetOptions(
+    'dir|d=s'           => \$dir,
+    'uri|u=s'           => \$uri,
+    'last_fileset|l=s'  => \$last_fileset,
+    'overwrite|o'       => \$overwrite,
+    'recall'            => \$recall,
+    'remember'          => \$remember,
+    'verbose|v'         => \$verbose,
+    'timeout|t'         => \$timeout,
+) or pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage(
+    -msg => "Required options: --uri",
+    -exitval => 3,
+) unless defined $uri;
+
+# default http request timeout is 30s
+$timeout ||= 30;
+
+my %p = (
+    uri     => $uri,
+);
+
+# rc file path
+my $rcfilename = File::Spec->catfile($ENV{'HOME'}, '.dsleechrc');
+
+# load rc file
+my $rc = load_rc($rcfilename) or die "failed to load rcfile";
+
+$p{last_fileset} = $last_fileset if defined $last_fileset; 
+if ($recall) {
+    # if --last_fileset was specified it's value should override --recall
+    if (defined $last_fileset) {
+        warn "--last_fileset overriding --recall" if defined $verbose;
+    } elsif (defined $rc->{$uri}) {
+        $p{last_fileset} = $rc->{$uri};
+    } else {
+        warn "--recall couldn't find a previous fileset ID"
+            if defined $verbose;
+    }
+}
+
+my $response = DataStore::Product->new(%p)->request(
+    ua_args  => { timeout => $timeout },
+);
+
+unless (defined $response->is_success) {
+    die "request failed: ", $response->status_line;
+}
+
+# file retreival succeed
+
+my $filesets = $response->data;
+unless ($filesets) {
+    warn "no filesets found";
+    exit(0);
+}
+
+print "@$filesets filesets found\n" if $verbose;
+
+process_filesets($filesets, $dir, $overwrite, $verbose) or die "failed to process filesets";
+
+# if we got this far we're assuming that the downloads completed and we can
+# save the last fileset 
+if ($remember) {
+    my $lowest_fileset = $filesets->[-1];
+    if (defined $lowest_fileset) {
+        $rc->{$uri} = $lowest_fileset->fileset;
+    }
+
+    save_rc($rcfilename, $rc) or die "failed to save rcfile";
+}
+
+sub process_filesets
+{
+    my ($filsets, $dir, $overwrite, $verbose) = @_;
+
+    my $n = 0;
+    foreach my $fileset (@$filesets) {
+        $n++;
+        print "processing fileset: $fileset->fileset $n/@$filesets\n" if $verbose;
+
+        my $response = $fileset->request(
+                ua_args  => { timeout => $timeout },
+            );
+        unless (defined $response->is_success) {
+            warn "request failed: ", $response->status_line;
+            return;
+        }
+
+        my $files = $response->data;
+        # if we get an empty fileset ->request will sucessed but ->data will
+        # return undef   
+        next unless defined $files;
+        unless (@$files) {
+            print "no files in fileset ", $fileset->set, "\n" if $verbose;
+            next;
+        }
+
+        if (!process_files($files, $dir, $overwrite, $verbose)) {
+            warn "failed to process files";
+            return;
+        }
+    }
+
+    return 1;
+}
+
+sub process_files
+{
+    my ($files, $dir, $overwrite, $vebose) = @_;
+
+    foreach my $file (@$files) {
+        # generate the filename to downloda too
+        my $filename;
+        if (defined $dir) {
+            if (!-e $dir) {
+                print "creating dir $dir\n" if $verbose;
+                mkdir $dir or die "can't create dir: $!";
+            }
+            if (!-d $dir) {
+                warn "$dir is not a directory";
+                return;
+            }
+
+            $filename = File::Spec->catfile($dir, $file->fileid);
+        } else {
+            $filename = $file->fileid;
+        }
+
+        # make sure that filename doesn't already exist
+        if (-e $filename) {
+            if ($overwrite) {
+                warn "file $filename already exists, overwriting...";
+            } else {
+                warn "file $filename already exists, skipping...";
+                next;
+            }
+        }
+
+        # use the short version of the filename (with out the path) 
+        print "fetching ", $file->fileid, "..." if $verbose;
+
+        my $response = $file->request(
+                filename => $filename,
+                ua_args  => { timeout => $timeout },
+            );
+        unless (defined $response->is_success) {
+            warn "request failed: ", $response->status_line;
+            return;
+        }
+
+        unless ($response->data) {
+            warn "there was a problem retreiving ", $file->fileid;
+            return;
+        }
+
+        print "    ok\n" if $verbose;
+    }
+
+    return 1;
+}
+
+sub load_rc {
+    my $rcfilename = shift;
+
+    # initalize $sums with an empty hash so if there isn't a pre-existing
+    # database we still end up with a hashref instead of an undef scalar
+    my $rc;
+    if (-e $rcfilename) {
+        if (-f $rcfilename) {
+            $rc = YAML::LoadFile($rcfilename) or die "failed to load rc file";
+        } else {
+            warn "$rcfilename is not a plain file";
+            return;
+        }
+    }
+
+    # if the rcfile exists but is empty YAML will return undef
+    $rc ||= {};
+
+    return $rc;
+}
+
+sub save_rc {
+    my ($rcfilename, $rc) = @_;
+
+    my $yaml = YAML::DumpFile($rcfilename, $rc)
+            or die "failed to write rc file";
+
+    return 1;
+}
+
+__END__
+
+=pod
+
+=head1 NAME
+
+dsleech - batch retrieve files from a DataStore server product
+
+=head1 SYNOPSIS
+
+    dsleech --uri <uri> [--dir <dir>] [--last_fileset <filesetid>]
+                [--overwrite] [--recall] [--remember] [--verbose]
+
+=head1 DESCRIPTION
+
+=head1 OPTIONS
+
+=over 4
+
+=item * --uri|-u <uri>
+
+The URI of the DataStore product to retrive files from.
+
+=item * --dir|-d <dir>
+
+This flag is optional.
+
+The directory to download retrived files into.  The default is to fetch files into the current directory.
+
+=item * --last_fileset|-l <filesetid>
+
+The FileSet ID of the last FileSet that you've seen.  Only filesets registered after C<filesetid> will be polled for files to retreive.
+
+This flag is optional.
+
+=item * --overwrite
+
+If a file already exists, overwrite it.
+
+This flag is optional.
+
+=item * --recall
+
+Load the last fileset ID seen for C<--uri> from the I<rcfile>, if it exists.
+
+This flag is optional.
+
+=item * --remember
+
+Store the last fileset ID seen for C<--uri> in the I<rcfile>.
+
+This flag is optional.
+
+=item * --verbose|-v
+
+Be more verbose in reporting actions.
+
+This flag is optional.
+
+=item * --timeout|-t
+
+The ammount of time (in seconds) to wait for a response from the DataStore
+after making an HTTP request.  The default is 30s.
+
+Optional.
+
+=back
+
+=head1 CREDITS
+
+Just me, myself, and I.
+
+=head1 SUPPORT
+
+Please contact the author directly via e-mail.
+
+=head1 AUTHOR
+
+Joshua Hoblitt <jhoblitt@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2006-2008  Joshua Hoblitt.  All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA  02111-1307, USA.
+
+The full text of the license can be found in the L<perlgpl> Pod as supplied
+with Perl 5.8.1 and later.
+
+=head1 SEE ALSO
+
+L<dsget>, L<dsleech>, L<dsrootls>, L<dsproductls>, L<dsfilesetls>, L<DataStore>
+
+=cut
Index: /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsproductls
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsproductls	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsproductls	(revision 22005)
@@ -0,0 +1,135 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006-2008  Joshua Hoblitt
+#
+# $Id: dsproductls,v 1.4 2008-05-12 22:04:53 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use vars qw( $VERSION );
+$VERSION = '0.02';
+
+use DataStore;
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+
+my ($uri, $last_fileset, $timeout);
+
+GetOptions(
+    'uri|u=s'           => \$uri,
+    'last_fileset|l=s'  => \$last_fileset,
+    'timeout|t'         => \$timeout,
+) or pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage(
+    -msg => "Required options: --uri",
+    -exitval => 3,
+) unless defined $uri;
+
+# default http request timeout is 30s
+$timeout ||= 30;
+
+my %p = (
+    uri     => $uri,
+);
+
+$p{last_fileset} = $last_fileset if defined $last_fileset; 
+
+my $response = DataStore::Product->new(%p)->request(
+        ua_args  => { timeout => $timeout },
+    );
+
+die "request failed" unless defined $response;
+die "request failed: ", $response->status_line unless $response->is_success;
+
+# file retreival succeed
+
+my $data = $response->data;
+
+unless ($data) {
+    warn "no filesets found";
+    exit(0);
+}
+
+print "# uri fileset datetime type\n";
+foreach my $fs (@$data) {
+    print $fs->uri, " ", $fs->fileset, " ", $fs->datetime, " ", $fs->type, "\n";
+}
+
+__END__
+
+=pod
+
+=head1 NAME
+
+dsproductls - list all the FileSets under a product from a DataStore server
+
+=head1 SYNOPSIS
+
+    dsproductls --uri <uri> [--last_fileset <filesetid>]
+
+=head1 DESCRIPTION
+
+=head1 OPTIONS
+
+=over 4
+
+=item * --uri|-u <uri>
+
+The URI of the file to be retrieved.
+
+=item * --lst_fileset|-l <filesetid>
+
+The FileSet ID of the last FileSet that you've seen.
+
+This flag is optional.
+
+=item * --timeout|-t
+
+The ammount of time (in seconds) to wait for a response from the DataStore
+after making an HTTP request.  The default is 30s.
+
+Optional.
+
+=back
+
+=head1 CREDITS
+
+Just me, myself, and I.
+
+=head1 SUPPORT
+
+Please contact the author directly via e-mail.
+
+=head1 AUTHOR
+
+Joshua Hoblitt <jhoblitt@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2006-2008  Joshua Hoblitt.  All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA  02111-1307, USA.
+
+The full text of the license can be found in the L<perlgpl> Pod as supplied
+with Perl 5.8.1 and later.
+
+=head1 SEE ALSO
+
+L<dsget>, L<dsleech>, L<dsrootls>, L<dsproductls>, L<dsfilesetls>, L<DataStore>
+
+=cut
Index: /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsrootls
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsrootls	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/scripts/dsrootls	(revision 22005)
@@ -0,0 +1,131 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006-2008  Joshua Hoblitt
+#
+# $Id: dsrootls,v 1.2 2008-05-12 22:04:53 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use vars qw( $VERSION );
+$VERSION = '0.01';
+
+use DataStore;
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+use Pod::Usage qw( pod2usage );
+
+my ($uri, $timeout);
+
+GetOptions(
+    'uri|u=s'       => \$uri,
+    'timeout|t'     => \$timeout,
+) or pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage(
+    -msg => "Required options: --uri",
+    -exitval => 3,
+) unless defined $uri;
+
+# default http request timeout is 30s
+$timeout ||= 30;
+
+my %p = (
+    uri     => $uri,
+);
+
+my $response = DataStore::Root->new(%p)->request(
+        ua_args  => { timeout => $timeout },
+    );
+
+die "request failed" unless defined $response;
+die "request failed: ", $response->status_line unless $response->is_success;
+
+# file retreival succeed
+
+my $data = $response->data;
+
+unless ($data) {
+    warn "no products found";
+    exit(0);
+}
+
+print "# uri product last time type desc\n";
+foreach my $prod (@$data) {
+    print $prod->uri, " ",
+          $prod->product, " ",
+          $prod->last_fileset, " ",
+          $prod->last_datetime, " ",
+          $prod->type, " ",
+          $prod->desc, "\n";
+}
+
+__END__
+
+=pod
+
+=head1 NAME
+
+dsrootls - list all the Product under the "root" of a DataStore server
+
+=head1 SYNOPSIS
+
+    dsrootls --uri <uri> 
+
+=head1 DESCRIPTION
+
+=head1 OPTIONS
+
+=over 4
+
+=item * --uri|-u <uri>
+
+The URI of the file to be retrieved.
+
+=item * --timeout|-t
+
+The ammount of time (in seconds) to wait for a response from the DataStore
+after making an HTTP request.  The default is 30s.
+
+Optional.
+
+=back
+
+=head1 CREDITS
+
+Just me, myself, and I.
+
+=head1 SUPPORT
+
+Please contact the author directly via e-mail.
+
+=head1 AUTHOR
+
+Joshua Hoblitt <jhoblitt@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2006-2008  Joshua Hoblitt.  All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA  02111-1307, USA.
+
+The full text of the license can be found in the L<perlgpl> Pod as supplied
+with Perl 5.8.1 and later.
+
+=head1 SEE ALSO
+
+L<dsget>, L<dsleech>, L<dsrootls>, L<dsproductls>, L<dsfilesetls>, L<DataStore>
+
+=cut
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/00_distribution.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/00_distribution.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/00_distribution.t	(revision 22005)
@@ -0,0 +1,25 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2005  Joshua Hoblitt
+#
+# $Id: 00_distribution.t,v 1.2 2006-03-16 22:04:38 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use lib qw( ./lib ./t );
+
+use Test::More;
+
+# example taken from Test::Distribution Pod
+
+BEGIN {
+    eval {
+        require Test::Distribution;
+    };
+    if($@) {
+        plan skip_all => 'Test::Distribution not installed';
+    } else {
+        import Test::Distribution; # not => qw( podcover );
+    }
+}
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/01_load.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/01_load.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/01_load.t	(revision 22005)
@@ -0,0 +1,19 @@
+# -*- perl -*-
+
+# t/001_load.t - check module loading and create testing directory
+
+use lib qw( ./lib ./t );
+
+use Test::More tests => 11;
+
+BEGIN { use_ok('DataStore'); }
+BEGIN { use_ok('DataStore::File'); }
+BEGIN { use_ok('DataStore::File::Parser'); }
+BEGIN { use_ok('DataStore::FileSet'); }
+BEGIN { use_ok('DataStore::FileSet::Parser'); }
+BEGIN { use_ok('DataStore::Product'); }
+BEGIN { use_ok('DataStore::Product::Parser'); }
+BEGIN { use_ok('DataStore::Root'); }
+BEGIN { use_ok('DataStore::Record'); }
+BEGIN { use_ok('DataStore::Response'); }
+BEGIN { use_ok('DataStore::Utils'); }
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/02_fileset_parse.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/02_fileset_parse.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/02_fileset_parse.t	(revision 22005)
@@ -0,0 +1,188 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: 02_fileset_parse.t,v 1.10 2007-09-25 23:50:34 jhoblitt Exp $
+
+use strict;
+use warnings;
+
+use lib qw( ./lib ./t );
+
+use Test::More tests => 43;
+use Test::Warn;
+
+=head1 NAME
+
+t/02_fileset_parse.t - tests DataStore::FileSet::Parser
+
+=head1 SYNOPSIS
+    
+    prove t/02_fileset_parse.t
+
+=cut
+
+use DataStore::FileSet::Parser;
+#use Test::Warn;
+
+can_ok('DataStore::FileSet::Parser', qw(
+    new
+    parse
+));
+
+# ->new()
+
+{
+    my $parser = DataStore::FileSet::Parser->new;
+
+    isa_ok($parser, 'DataStore::FileSet::Parser');
+}
+
+# ->parse()
+
+eval {
+    my $parser = DataStore::FileSet::Parser->new;
+
+    $parser->parse(undef);
+};
+like($@, qr/is not one of the allowed types/,
+    '->parse() fails when passed undef');
+
+eval {
+    my $parser = DataStore::FileSet::Parser->new;
+
+    $parser->parse('');
+};
+like($@, qr/ did not pass regex check/,
+    '->parse() fails when passed a zero length string');
+
+warning_like {
+    my $parser = DataStore::FileSet::Parser->new;
+
+    is($parser->parse('asdf|asdf'), undef,
+        '->parse() returns undef on failure');
+} qr/not enough fields/,
+    '->parse() fails when there are too few fields';
+
+warning_like {
+    my $parser = DataStore::FileSet::Parser->new;
+
+    is($parser->parse('|2006-01-01T00:03:04Z|OBJECT'), undef,
+        '->parse() returns undef on failure');
+} qr/does not conform /,
+    '->parse() fails when the fileset field is not in the proper format';
+
+warning_like {
+    my $parser = DataStore::FileSet::Parser->new;
+
+    is($parser->parse('foobar|2006-01-0100:03:04Z|OBJECT'), undef,
+        '->parse() returns undef on failure');
+} qr/does not conform /,
+    '->parse() fails when the datetime field is not in the proper format';
+
+warning_like {
+    my $parser = DataStore::FileSet::Parser->new;
+
+    is($parser->parse('foobar|2006-01-01T00:03:04Z| '), undef,
+        '->parse() returns undef on failure');
+} qr/does not conform /,
+    '->parse() fails when the type field is not in the proper format';
+
+warning_like {
+    my $parser = DataStore::FileSet::Parser->new;
+
+    is($parser->parse('foo#bonkbar|2006-01-01T00:03:04Z|baz'), undef,
+        '->parse() returns undef on failure');
+} qr/contains #/,
+    '->parse() fails when a field contains #';
+
+warning_like {
+    my $parser = DataStore::FileSet::Parser->new;
+
+    is($parser->parse('foobar|2006-01-01T00:03:04Z|baz # foo'), undef,
+        '->parse() returns undef on failure');
+} qr/contains #/,
+    '->parse() comments are not allowed after the last field';
+
+{
+    # multi-row example
+my $example1 =<<END;
+# filesetID|time registered    |type   |telescope pointing         |etime|f|airmass|
+otis0123456|2006-01-01T00:03:04Z|OBJECT|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
+otis0123456|2006-01-01T00:03:04Z|OBJECT|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
+otis0123456|2006-01-01T00:03:04Z|OBJECT|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
+otis0123456|2006-01-01T00:03:04Z|OBJECT|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
+END
+    my $parser  = DataStore::FileSet::Parser->new(
+        base_uri => 'http://foo.com/index.txt'
+    );
+    my @results = $parser->parse($example1);
+
+    is(scalar @results, 4, "correct number of item returned in list context");
+}
+
+{
+    # multi-row example
+my $example1 =<<END;
+# filesetID|time registered    |type   |telescope pointing         |etime|f|airmass|
+otis0123456|2006-01-01T00:03:04Z|OBJECT|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
+otis0123456|2006-01-01T00:03:04Z|OBJECT|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
+otis0123456|2006-01-01T00:03:04Z|OBJECT|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
+otis0123456|2006-01-01T00:03:04Z|OBJECT|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
+END
+    my $parser  = DataStore::FileSet::Parser->new(
+        base_uri => 'http://foo.com/index.txt'
+    );
+    my $results = $parser->parse($example1);
+
+    is(scalar @$results, 4,
+        "correct number of item returned in scalar context");
+
+    isa_ok(@$results[0], 'DataStore::FileSet');
+    is(@$results[0]->fileset, 'otis0123456', 'correct fileset');
+    is(@$results[0]->datetime, '2006-01-01T00:03:04Z', 'correct datetime');
+    is(@$results[0]->type, 'OBJECT', 'correct type');
+    is(@$results[0]->uri, 'http://foo.com/otis0123456/index.txt', 'correct uri');
+
+    isa_ok(@$results[1], 'DataStore::FileSet');
+    is(@$results[1]->fileset, 'otis0123456', 'correct fileset');
+    is(@$results[1]->datetime, '2006-01-01T00:03:04Z', 'correct datetime');
+    is(@$results[1]->type, 'OBJECT', 'correct type');
+    is(@$results[1]->uri, 'http://foo.com/otis0123456/index.txt', 'correct uri');
+
+    isa_ok(@$results[2], 'DataStore::FileSet');
+    is(@$results[2]->fileset, 'otis0123456', 'correct fileset');
+    is(@$results[2]->datetime, '2006-01-01T00:03:04Z', 'correct datetime');
+    is(@$results[2]->type, 'OBJECT', 'correct type');
+    is(@$results[2]->uri, 'http://foo.com/otis0123456/index.txt', 'correct uri');
+
+    isa_ok(@$results[3], 'DataStore::FileSet');
+    is(@$results[3]->fileset, 'otis0123456', 'correct fileset');
+    is(@$results[3]->datetime, '2006-01-01T00:03:04Z', 'correct datetime');
+    is(@$results[3]->type, 'OBJECT', 'correct type');
+    is(@$results[3]->uri, 'http://foo.com/otis0123456/index.txt', 'correct uri');
+}
+
+{
+    # example with blank lines & comments
+my $example1 =<<END;
+
+
+# filesetID|time registered    |type   |telescope pointing         |etime|f|airmass|
+
+                            # random comment
+otis0123456|2006-01-01T00:03:04Z|OBJECT|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
+
+                            # random comment
+
+# foo
+END
+    my $results = DataStore::FileSet::Parser->new->parse($example1);
+
+    is(scalar @$results, 1, "correct number of item returned");
+
+    isa_ok(@$results[0], 'DataStore::FileSet');
+    is(@$results[0]->fileset, 'otis0123456', 'correct fileset');
+    is(@$results[0]->datetime, '2006-01-01T00:03:04Z', 'correct datetime');
+    is(@$results[0]->type, 'OBJECT', 'correct type');
+}
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/03_file_parse.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/03_file_parse.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/03_file_parse.t	(revision 22005)
@@ -0,0 +1,200 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: 03_file_parse.t,v 1.5 2007-09-26 00:44:43 jhoblitt Exp $
+
+use strict;
+use warnings;
+
+use lib qw( ./lib ./t );
+
+use Test::More tests => 50;
+use Test::Warn;
+
+=head1 NAME
+
+t/03_file_parse.t - tests DataStore::File::Parser
+
+=head1 SYNOPSIS
+    
+    prove t/03_file_parse.t
+
+=cut
+
+use DataStore::File::Parser;
+#use Test::Warn;
+
+can_ok('DataStore::File::Parser', qw(
+    new
+    parse
+));
+
+# ->new()
+
+{
+    my $parser = DataStore::File::Parser->new;
+
+    isa_ok($parser, 'DataStore::File::Parser');
+}
+
+# ->parse()
+
+eval {
+    my $parser = DataStore::File::Parser->new;
+
+    $parser->parse(undef);
+};
+like($@, qr/is not one of the allowed types/,
+    '->parse() fails when passed undef');
+
+eval {
+    my $parser = DataStore::File::Parser->new;
+
+    $parser->parse('');
+};
+like($@, qr/ did not pass regex check/,
+    '->parse() fails when passed a zero length string');
+
+warning_like {
+    my $parser = DataStore::File::Parser->new;
+
+    is($parser->parse('asdf|asdf'), undef,
+        '->parse() returns undef on failure');
+} qr/not enough fields/,
+    '->parse() fails when there are too few fields';
+
+warning_like {
+    my $parser = DataStore::File::Parser->new;
+
+    is($parser->parse(
+    'foo+++bar|83002312|fe6a2b6564c0d4cfb3bbf1db813824ba|chip|'), undef,
+        '->parse() returns undef on failure');
+} qr/does not conform/,
+    '->parse() fails when the fileID field is not in the proper format';
+
+warning_like {
+    my $parser = DataStore::File::Parser->new;
+
+    is($parser->parse(
+    'otis0123456.01|a83002312|fe6a2b6564c0d4cfb3bbf1db813824ba|chip|'), undef,
+        '->parse() returns undef on failure');
+} qr/does not conform/,
+    '->parse() fails when the bytes field is not in the proper format';
+
+warning_like {
+    my $parser = DataStore::File::Parser->new;
+
+    is($parser->parse(
+    'otis0123456.01|83002312|zfe6a2b6564c0d4cfb3bbf1db813824ba|chip|'), undef,
+        '->parse() returns undef on failure');
+} qr/does not conform/,
+    '->parse() fails when the md5sum field is not in the proper format';
+
+warning_like {
+    my $parser = DataStore::File::Parser->new;
+
+    is($parser->parse(
+    'otis0123456.01|83002312|fe6a2b6564c0d4cfb3bbf1db813824ba|c+hip|'), undef,
+        '->parse() returns undef on failure');
+} qr/does not conform/,
+    '->parse() fails when the fileID field is not in the proper format';
+
+warning_like {
+    my $parser = DataStore::File::Parser->new;
+
+    is($parser->parse(
+    'otis012#3456.01|83002312|fe6a2b6564c0d4cfb3bbf1db813824ba|chip|'), undef,
+        '->parse() returns undef on failure');
+} qr/contains #/,
+    '->parse() fails when a field contains #';
+
+warning_like {
+    my $parser = DataStore::File::Parser->new;
+
+    is($parser->parse(
+    'otis0123456.01|83002312|fe6a2b6564c0d4cfb3bbf1db813824ba|chip| # foo'), undef,
+        '->parse() returns undef on failure');
+} qr/contains #/,
+    '->parse() comments are not allowed after the last field';
+
+{
+    # multi-row example
+my $example1 =<<END;
+# fileID      |bytes   |md5sum                          |type|chipname|
+otis0123456.01|83002312|fe6a2b6564c0d4cfb3bbf1db813824ba|chip|ota01   |
+otis0123456.02|83002312|a2b4a7d7b94dc6076c5f3f67239a48c6|chip|ota02   |
+otis0123456.03|83002312|a39b1510484c7833e27454b181f13981|chip|ota03   |
+otis0123456.04|83002312|7bb35e1e30f3f833c0416aea75f90304|chip|ota04   |
+END
+    my @results = DataStore::File::Parser->new->parse($example1);
+    is(scalar @results, 4, "correct number of item returned in list context");
+}
+
+{
+    # multi-row example
+my $example1 =<<END;
+# fileID      |bytes   |md5sum                          |type|chipname|
+otis0123456.01|83002312|fe6a2b6564c0d4cfb3bbf1db813824ba|chip|ota01   |
+otis0123456.02|83002312|a2b4a7d7b94dc6076c5f3f67239a48c6|chip|ota02   |
+otis0123456.03|83002312|a39b1510484c7833e27454b181f13981|chip|ota03   |
+otis0123456.04|83002312|7bb35e1e30f3f833c0416aea75f90304|chip|ota04   |
+END
+    my $results = DataStore::File::Parser->new->parse($example1);
+
+    is(scalar @$results, 4,
+        "correct number of item returned in scalar context");
+
+    isa_ok(@$results[0], 'DataStore::File');
+    is(@$results[0]->uri, 'http://example.org/otis0123456.01', 'correct uri');
+    is(@$results[0]->fileid, 'otis0123456.01', 'correct fileid');
+    is(@$results[0]->bytes, '83002312', 'correct datetime');
+    is(@$results[0]->md5sum, 'fe6a2b6564c0d4cfb3bbf1db813824ba', 'correct md5');
+    is(@$results[0]->type, 'chip', 'correct type');
+
+    isa_ok(@$results[1], 'DataStore::File');
+    is(@$results[1]->uri, 'http://example.org/otis0123456.02', 'correct uri');
+    is(@$results[1]->fileid, 'otis0123456.02', 'correct fileid');
+    is(@$results[1]->bytes, '83002312', 'correct datetime');
+    is(@$results[1]->md5sum, 'a2b4a7d7b94dc6076c5f3f67239a48c6', 'correct md5');
+    is(@$results[1]->type, 'chip', 'correct type');
+
+    isa_ok(@$results[2], 'DataStore::File');
+    is(@$results[2]->uri, 'http://example.org/otis0123456.03', 'correct uri');
+    is(@$results[2]->fileid, 'otis0123456.03', 'correct fileid');
+    is(@$results[2]->bytes, '83002312', 'correct datetime');
+    is(@$results[2]->md5sum, 'a39b1510484c7833e27454b181f13981', 'correct md5');
+    is(@$results[2]->type, 'chip', 'correct type');
+
+    isa_ok(@$results[3], 'DataStore::File');
+    is(@$results[3]->uri, 'http://example.org/otis0123456.04', 'correct uri');
+    is(@$results[3]->fileid, 'otis0123456.04', 'correct fileid');
+    is(@$results[3]->bytes, '83002312', 'correct datetime');
+    is(@$results[3]->md5sum, '7bb35e1e30f3f833c0416aea75f90304', 'correct md5');
+    is(@$results[3]->type, 'chip', 'correct type');
+}
+
+{
+    # example with blank lines & comments
+my $example1 =<<END;
+
+
+# fileID      |bytes   |md5sum                          |type|chipname|
+
+                            # random comment
+otis0123456.01|83002312|fe6a2b6564c0d4cfb3bbf1db813824ba|chip|ota01   |
+
+                            # random comment
+
+# foo
+END
+    my $results = DataStore::File::Parser->new->parse($example1);
+
+    is(scalar @$results, 1, "correct number of item returned");
+
+    isa_ok(@$results[0], 'DataStore::File');
+    is(@$results[0]->fileid, 'otis0123456.01', 'correct fileid');
+    is(@$results[0]->bytes, '83002312', 'correct datetime');
+    is(@$results[0]->md5sum, 'fe6a2b6564c0d4cfb3bbf1db813824ba', 'correct md5');
+    is(@$results[0]->type, 'chip', 'correct type');
+}
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/04_record.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/04_record.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/04_record.t	(revision 22005)
@@ -0,0 +1,81 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: 04_record.t,v 1.1 2006-02-28 03:56:46 jhoblitt Exp $
+
+use strict;
+use warnings;
+
+use lib qw( ./lib ./t );
+
+use Test::More tests => 7;
+use DataStore::Record;
+
+=head1 NAME
+
+t/04_record.t - tests DataStore::Record
+
+=head1 SYNOPSIS
+    
+    prove t/04_record.t
+
+=cut
+
+can_ok('DataStore::Record', qw(
+    new
+    uri
+    request
+));
+
+# ->new()
+
+{
+    my $rec = DataStore::Record->new;
+
+    isa_ok($rec, 'DataStore::Record');
+}
+
+{
+    # w/o trailing slash
+    my $rec = DataStore::Record->new(
+        uri => 'http://example.org/foo'
+    );
+
+    isa_ok($rec, 'DataStore::Record');
+}
+
+{
+    # w/ trailing slash
+    my $rec = DataStore::Record->new(
+        uri => 'http://example.org/foo/'
+    );
+
+    isa_ok($rec, 'DataStore::Record');
+}
+
+# ->uri()
+
+{
+    # default value
+    my $rec = DataStore::Record->new;
+    is($rec->uri, 'http://example.org/', '->uri() returned default uri');
+}
+
+{
+    # default value
+    my $rec = DataStore::Record->new(
+        uri => 'http://example.org/foo/'
+    );
+    is($rec->uri, 'http://example.org/foo/', '->uri() returned correct uri');
+}
+
+# ->request()
+
+eval {
+    my $rec = DataStore::Record->new;
+
+    $rec->request;
+};
+like($@, qr/must override the ->request\(\) method/,
+    '->request() dies when not overridden');
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/05_product.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/05_product.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/05_product.t	(revision 22005)
@@ -0,0 +1,181 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: 05_product.t,v 1.6 2007-09-25 23:37:44 jhoblitt Exp $
+
+use strict;
+use warnings;
+
+use lib qw( ./lib ./t );
+
+use Test::More tests => 23;
+
+=head1 NAME
+
+t/05_product.t - tests DataStore::Product
+
+=head1 SYNOPSIS
+    
+    prove t/05_product.t
+
+=cut
+
+use DataStore::Product;
+
+can_ok('DataStore::Product', qw(
+    new
+    request
+));
+
+# ->new()
+
+{
+    my $dsp = DataStore::Product->new( uri => 'http://example.org/index.txt' );
+
+    isa_ok($dsp, 'DataStore::Product');
+}
+
+{
+    my $dsp = DataStore::Product->new(
+        uri             => 'http://example.org/index.txt',
+        last_fileset    => '12buckelyourshoe',
+    );
+
+    isa_ok($dsp, 'DataStore::Product');
+}
+
+eval {
+    my $dsp = DataStore::Product->new( uri => 'http://example.org/index.txt', foo => 1 );
+};
+like($@, qr/not listed in the validation options/,
+    '->new() fails whe passed extra params');
+
+eval {
+    my $dsp = DataStore::Product->new(
+        uri             => 'http://example.org/index.txt',
+        last_fileset    => '12buckelyourshoe',
+        foo => 1,
+    );
+};
+like($@, qr/not listed in the validation options/,
+    '->new() fails whe passed extra params');
+
+eval {
+    my $dsp = DataStore::Product->new( uri => 'http://example.org' );
+};
+like($@, qr/uri ends with \/index.txt/,
+    '->new() fails when uri param does not end with /index.txt');
+
+eval {
+    my $dsp = DataStore::Product->new( uri => 'http://example.org/index.html' );
+};
+like($@, qr/uri ends with \/index.txt/,
+    '->new() fails when uri param does not end with /index.txt');
+
+eval {
+    my $dsp = DataStore::Product->new( uri => '://example.org/index.txt' );
+};
+like($@, qr/is valid http uri/,
+    '->new() fails when uri param is not http protocol');
+
+eval {
+    my $dsp = DataStore::Product->new(
+        uri             => 'http://example.org/index.txt',
+        last_fileset    => '++12buckelyourshoe',
+    );
+};
+like($@, qr/is valid fileset ID/,
+    '->new() fails when last_fileset param is not a valid fileset ID');
+
+eval {
+    my $dsp = DataStore::Product->new;
+};
+like($@, qr/Mandatory parameter 'uri'/,
+    '->new() fails when not passed a uri param');
+
+eval {
+    my $dsp = DataStore::Product->new(
+        last_fileset    => '12buckelyourshoe',
+    );
+};
+like($@, qr/Mandatory parameter 'uri'/,
+    '->new() fails when not passed a uri param');
+
+# ->request()
+
+use Net::HTTPServer;
+
+sub bar 
+{
+    my $req = shift;             # Net::HTTPServer::Request object
+    my $res = $req->Response();  # Net::HTTPServer::Response object
+
+    my $string = <<END;
+# filesetID|time registered    |type   |telescope pointing         |etime|f|airmass|
+otis0123456|2006-01-01T00:03:04Z|OBJECT|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
+otis0123456|2006-01-01T00:03:04Z|OBJECT|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
+otis0123456|2006-01-01T00:03:04Z|OBJECT|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
+otis0123456|2006-01-01T00:03:04Z|OBJECT|11:00:10.33 68:26:59.6 2000|30.0 |r|1.23   |
+END
+
+    $res->Print($string);
+
+    return $res;
+}
+
+$|++;
+
+$SIG{CHLD} = 'IGNORE';
+my $pid = open(my $child, "-|");
+
+unless ($pid) {
+    my $server = new Net::HTTPServer( port => 'scan', log => '/dev/null' );
+
+    # send port number to parent
+    print $server->Start(), "\n";
+
+    $server->RegisterURL('/index.txt', \&bar);
+    $server->Process();  # Run forever
+
+    exit -1;
+}
+
+my $port = <$child>;
+chomp $port;
+
+{
+    my $dsp = DataStore::Product->new( uri => "http://localhost:$port/index.txt" );
+
+    isa_ok($dsp->request, 'DataStore::Response');
+}
+
+{
+    my $dsp = DataStore::Product->new( uri => "http://localhost:$port/index.txt" );
+
+    my $dsr = $dsp->request;
+
+    ok($dsr->is_success, "response->is_success() is correct");
+    is($dsr->code, 200, "response->code() is correct");
+    is($dsr->status_line, "200 OK", "response->status_line() is correct");
+    is(ref $dsr->data, 'ARRAY', "response->data is arrayref is correct");
+    isa_ok($dsr->request, 'DataStore::Record');
+
+    my $data = $dsr->data;
+    is(scalar @$data, 4, "data has the correct number of rows");
+    isa_ok(@$data[0], 'DataStore::FileSet', "data has correct type of rows");
+    isa_ok(@$data[1], 'DataStore::FileSet', "data has correct type of rows");
+    isa_ok(@$data[2], 'DataStore::FileSet', "data has correct type of rows");
+    isa_ok(@$data[3], 'DataStore::FileSet', "data has correct type of rows");
+}
+
+# cleanup HTTP server
+kill 9, $pid;
+
+eval {
+    my $dsp = DataStore::Product->new( uri => 'http://example.org/index.txt' );
+
+    $dsp->request( foo => 1 );
+};
+like($@, qr/not listed in the validation options/,
+    '->request() fails whe passed extra params');
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/06_fileset.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/06_fileset.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/06_fileset.t	(revision 22005)
@@ -0,0 +1,172 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: 06_fileset.t,v 1.9 2007-09-25 23:50:34 jhoblitt Exp $
+
+use strict;
+use warnings;
+
+use lib qw( ./lib ./t );
+
+use Test::More tests => 19;
+
+=head1 NAME
+
+t/06_fileset.t - tests DataStore::FileSet
+
+=head1 SYNOPSIS
+    
+    prove t/06_fileset.t
+
+=cut
+
+use DataStore::FileSet;
+
+can_ok('DataStore::FileSet', qw(
+    new
+    request
+));
+
+# ->new()
+
+{
+    my $dsf = DataStore::FileSet->new(
+        uri         => 'http://example.org/index.txt',
+        fileset     => '12buckelyourshoe',
+        datetime    => '2042-01-01T00:00:00Z',
+        type        => 'OBJECT',
+    );
+
+    isa_ok($dsf, 'DataStore::FileSet');
+}
+
+eval {
+    my $dsf = DataStore::FileSet->new(
+        uri         => 'http://example.org/index.txt',
+        fileset     => '12buckelyourshoe',
+        datetime    => '2042-01-01T00:00:00Z',
+        type        => 'OBJECT',
+        foo         => 1,
+    );
+};
+like($@, qr/not listed in the validation options/,
+    '->new() fails whe passed extra params');
+
+eval {
+    my $dsf = DataStore::FileSet->new( uri => 'http://example.org' );
+};
+like($@, qr/uri ends with \/index.txt/,
+    '->new() fails when uri param does not end with /');
+
+eval {
+    my $dsf = DataStore::FileSet->new( uri => 'http://example.org/index.html' );
+};
+like($@, qr/uri ends with \/index.txt/,
+    '->new() fails when uri param does not end with /');
+
+eval {
+    my $dsf = DataStore::FileSet->new( uri => '://example.org/index.txt' );
+};
+like($@, qr/is valid http uri/,
+    '->new() fails when uri param is not http protocol');
+
+eval {
+    my $dsp = DataStore::FileSet->new;
+};
+like($@, qr/Mandatory parameter/,
+    '->new() fails when not passed all manadator params');
+
+# ->request()
+
+use Net::HTTPServer;
+
+sub bar 
+{
+    my $req = shift;             # Net::HTTPServer::Request object
+    my $res = $req->Response();  # Net::HTTPServer::Response object
+
+    my $string = <<END;
+# fileID      |bytes   |md5sum                          |type|chipname|
+otis0123456.01|83002312|fe6a2b6564c0d4cfb3bbf1db813824ba|chip|ota01   |
+otis0123456.02|83002312|a2b4a7d7b94dc6076c5f3f67239a48c6|chip|ota02   |
+otis0123456.03|83002312|a39b1510484c7833e27454b181f13981|chip|ota03   |
+otis0123456.04|83002312|7bb35e1e30f3f833c0416aea75f90304|chip|ota04   |
+END
+
+    $res->Print($string);
+
+    return $res;
+}
+
+$|++;
+
+$SIG{CHLD} = 'IGNORE';
+my $pid = open(my $child, "-|");
+
+unless ($pid) {
+    my $server = new Net::HTTPServer( port => 'scan', log => '/dev/null' );
+
+    # send port number to parent
+    print $server->Start(), "\n";
+
+    $server->RegisterURL('/index.txt', \&bar);
+    $server->Process();  # Run forever
+
+    exit -1;
+}
+
+my $port = <$child>;
+chomp $port;
+
+{
+    my $dsp = DataStore::FileSet->new(
+        uri         => "http://localhost:$port/index.txt",
+        fileset     => '12buckelyourshoe',
+        datetime    => '2042-01-01T00:00:00Z',
+        type        => 'OBJECT',
+    );
+
+    isa_ok($dsp->request, 'DataStore::Response');
+}
+
+{
+    my $dsp = DataStore::FileSet->new(
+        uri         => "http://localhost:$port/index.txt",
+        fileset     => '12buckelyourshoe',
+        datetime    => '2042-01-01T00:00:00Z',
+        type        => 'OBJECT',
+    );
+
+    my $dsr = $dsp->request;
+
+    ok($dsr->is_success, "response->is_success() is correct");
+    is($dsr->code, 200, "response->code() is correct");
+    is($dsr->status_line, "200 OK", "response->status_line() is correct");
+    is(ref $dsr->data, 'ARRAY', "response->data is arrayref is correct");
+    isa_ok($dsr->request, 'DataStore::Record');
+
+    my $data = $dsr->data;
+    is(scalar @$data, 4, "data has the correct number of rows");
+    isa_ok(@$data[0], 'DataStore::File', "data has correct type of rows");
+    isa_ok(@$data[1], 'DataStore::File', "data has correct type of rows");
+    isa_ok(@$data[2], 'DataStore::File', "data has correct type of rows");
+    isa_ok(@$data[3], 'DataStore::File', "data has correct type of rows");
+}
+
+# cleanup HTTP server
+kill 9, $pid;
+
+eval {
+    my $dsf = DataStore::FileSet->new(
+        uri         => 'http://example.org/index.txt',
+        fileset     => '12buckelyourshoe',
+        datetime    => '2042-01-01T00:00:00Z',
+        type        => 'OBJECT',
+    );
+
+    $dsf->request( foo => 1 );
+};
+like($@, qr/not listed in the validation options/,
+    '->request() fails whe passed extra params');
+
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/07_file.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/07_file.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/07_file.t	(revision 22005)
@@ -0,0 +1,180 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: 07_file.t,v 1.5 2006-03-17 23:54:35 jhoblitt Exp $
+
+use strict;
+use warnings;
+
+use lib qw( ./lib ./t );
+
+use Test::More tests => 14;
+
+=head1 NAME
+
+t/07_file.t - tests DataStore::File
+
+=head1 SYNOPSIS
+    
+    prove t/07_file.t
+
+=cut
+
+use DataStore::File;
+use File::Temp ();
+
+can_ok('DataStore::File', qw(
+    new
+    request
+));
+
+# ->new()
+
+{
+    my $dsf = DataStore::File->new(
+        uri         => 'http://example.org/foo',
+        fileid      => '12buckelyourshoe',
+        bytes       => 12345,
+        md5sum      => 'fe6a2b6564c0d4cfb3bbf1db813824ba',
+        type        => 'chip',
+    );
+
+    isa_ok($dsf, 'DataStore::File');
+}
+
+eval {
+    my $dsf = DataStore::File->new(
+        uri         => 'http://example.org/foo',
+        fileid      => '12buckelyourshoe',
+        bytes       => 12345,
+        md5sum      => 'fe6a2b6564c0d4cfb3bbf1db813824ba',
+        type        => 'chip',
+        foo         => 1,
+    );
+};
+like($@, qr/not listed in the validation options/,
+    '->new() fails whe passed extra params');
+
+eval {
+    my $dsf = DataStore::File->new( uri => 'http://example.org/' );
+};
+like($@, qr/is valid uri filename/,
+    '->new() fails when uri param does not end with /');
+
+eval {
+    my $dsf = DataStore::File->new( uri => '://example.org' );
+};
+like($@, qr/is valid http uri/,
+    '->new() fails when uri param is not http protocol');
+
+eval {
+    my $dsf = DataStore::File->new;
+};
+like($@, qr/Mandatory parameter/,
+    '->new() fails when not passed all manadator params');
+
+# ->request()
+
+use Net::HTTPServer;
+
+sub bar 
+{
+    my $req = shift;             # Net::HTTPServer::Request object
+    my $res = $req->Response();  # Net::HTTPServer::Response object
+
+    my $string = "foobarbaz"; 
+
+    $res->Print($string);
+
+    return $res;
+}
+
+$|++;
+
+$SIG{CHLD} = 'IGNORE';
+my $pid = open(my $child, "-|");
+
+unless ($pid) {
+    my $server = new Net::HTTPServer( port => 'scan', log => '/dev/null' );
+
+    # send port number to parent
+    print $server->Start(), "\n";
+
+    $server->RegisterURL('/somefile', \&bar);
+    $server->Process();  # Run forever
+
+    exit -1;
+}
+
+my $port = <$child>;
+chomp $port;
+
+{
+    my $dsf = DataStore::File->new(
+        uri         => "http://localhost:$port/somefile",
+        fileid      => '12buckelyourshoe',
+        bytes       => 9,
+        md5sum      => 'a0a6e1a375117c58d77221f10c5ce12e',
+        type        => 'chip',
+    );
+
+    my $fh = File::Temp->new( UNLINK => 1 );
+    $fh->autoflush(1);
+    isa_ok($dsf->request( filename => $fh->filename ), 'DataStore::Response');
+}
+
+{
+    my $dsf = DataStore::File->new(
+        uri         => "http://localhost:$port/somefile",
+        fileid      => '12buckelyourshoe',
+        bytes       => 9,
+        md5sum      => 'a0a6e1a375117c58d77221f10c5ce12e',
+        type        => 'chip',
+    );
+
+    my $fh = File::Temp->new( UNLINK => 1 );
+    $fh->autoflush(1);
+    my $dsr = $dsf->request( filename => $fh->filename );
+
+    ok($dsr->is_success, "response->is_success() is correct");
+    is($dsr->code, 200, "response->code() is correct");
+    is($dsr->status_line, "200 OK", "response->status_line() is correct");
+    is($dsr->data, $fh->filename, "response->data is arrayref is correct");
+    isa_ok($dsr->request, 'DataStore::Record');
+}
+
+# stop HTTP server
+kill 9, $pid;
+
+eval {
+    my $dsf = DataStore::File->new(
+        uri         => 'http://example.org/foo',
+        fileid      => '12buckelyourshoe',
+        bytes       => 12345,
+        md5sum      => 'fe6a2b6564c0d4cfb3bbf1db813824ba',
+        type        => 'chip',
+    );
+    
+    $dsf->request;
+};
+like($@, qr/Mandatory parameter/,
+    '->request() fails when passed no params');
+
+eval {
+    my $dsf = DataStore::File->new(
+        uri         => 'http://example.org/foo',
+        fileid      => '12buckelyourshoe',
+        bytes       => 12345,
+        md5sum      => 'fe6a2b6564c0d4cfb3bbf1db813824ba',
+        type        => 'chip',
+    );
+    
+    my $fh = File::Temp->new( UNLINK => 1 );
+    $dsf->request(
+        filename => $fh->filename,
+        foo => 1,
+    );
+};
+like($@, qr/not listed in the validation options/,
+    '->request() fails whe passed extra params');
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/08_response.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/08_response.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/08_response.t	(revision 22005)
@@ -0,0 +1,96 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: 08_response.t,v 1.3 2007-09-25 23:37:44 jhoblitt Exp $
+
+use strict;
+use warnings;
+
+use lib qw( ./lib ./t );
+
+use Test::More tests => 8;
+
+=head1 NAME
+
+t/08_response.t - tests DataStore::Response
+
+=head1 SYNOPSIS
+    
+    prove t/08_response.t
+
+=cut
+
+use CGI;
+use DataStore::Product;
+use DataStore::Response;
+
+can_ok('DataStore::Response', qw(
+    new
+    is_success
+    code
+    status_line
+    data
+    request
+));
+
+# ->new()
+
+{
+    my $dsr = DataStore::Response->new(
+        is_success  => undef,
+        code        => 500,
+        status_line => 'foo',
+        data        => 'bar',
+        request     => DataStore::Product->new( uri => 'http://example.org/index.txt' ),
+    );
+
+    isa_ok($dsr, 'DataStore::Response');
+}
+
+eval {
+    my $dsr = DataStore::Response->new(
+        is_success   => undef,
+        code        => 500,
+        status_line => 'foo',
+        data        => 'bar',
+        request     => DataStore::Product->new( uri => 'http://example.org/index.txt' ),
+        foo         => 1,
+    );
+};
+like($@, qr/not listed in the validation options/,
+    '->new() fails whe passed extra params');
+
+eval {
+    my $dsr = DataStore::Response->new( is_success => 2 );
+};
+like($@, qr/is 0, 1, or undef/,
+    '->new() fails when is_success is not valid');
+
+eval {
+    my $dsr = DataStore::Response->new( code => 5000 );
+};
+like($@, qr/did not pass regex check/,
+    '->new() fails when code is not valid');
+
+eval {
+    my $dsr = DataStore::Response->new( status_line => '' );
+};
+like($@, qr/did not pass regex check/,
+    '->new() fails when status_line is not valid');
+
+eval {
+    my $dsr = DataStore::Response->new(
+        request => CGI->new,
+    );
+};
+like($@, qr/was not a 'DataStore::Record' /,
+    '->new() fails when response is not valid');
+
+eval {
+    my $dsr = DataStore::Response->new;
+};
+like($@, qr/Mandatory parameters/,
+    '->new() fails when not passed all manadator params');
+
+# accessor tests unneeded as they are all generated by Class::Accessor::Fast
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/09_datastore.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/09_datastore.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/09_datastore.t	(revision 22005)
@@ -0,0 +1,33 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: 09_datastore.t,v 1.2 2006-03-16 01:23:10 jhoblitt Exp $
+
+use strict;
+use warnings;
+
+use lib qw( ./lib ./t );
+
+use Test::More tests => 7;
+
+=head1 NAME
+
+t/09_datastore.t - tests DataStore
+
+=head1 SYNOPSIS
+    
+    prove t/09_datastore.t
+
+=cut
+
+use DataStore;
+
+ok(%DataStore::, "DataStore is loaded");
+ok(%DataStore::File::Parser::, "DataStore::File::Parser is loaded");
+ok(%DataStore::File::, "DataStore::File is loaded");
+ok(%DataStore::FileSet::Parser::, "DataStore::FileSet::Parser is loaded");
+ok(%DataStore::FileSet::, "DataStore::Set is loaded");
+ok(%DataStore::Product::, "DataStore::Product is loaded");
+ok(%DataStore::Response::, "DataStore::Response is loaded");
+
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/10_dsget.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/10_dsget.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/10_dsget.t	(revision 22005)
@@ -0,0 +1,53 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: 10_dsget.t,v 1.2 2006-03-17 21:58:23 jhoblitt Exp $
+
+use strict;
+use warnings;
+
+use lib qw( ./lib ./t );
+
+use Test::Cmd;
+use Test::More tests => 7;
+
+=head1 NAME
+
+t/10_dsget.t - tests dsget
+
+=head1 SYNOPSIS
+    
+    prove t/10_dsget.t
+
+=cut
+
+# last ditch effort to make sure dsget is executable
+chmod 0755, 'scripts/dsget';
+
+my $test = Test::Cmd->new(prog => 'scripts/dsget', workdir => '');
+isa_ok($test, 'Test::Cmd');
+
+{
+    $test->run(args => '');
+    missing_args(3, "Required options: --uri --filename");
+}
+
+{
+    $test->run(args => '--uri http://example.org/foo');
+    missing_args(3, "Required options: --uri --filename");
+}
+
+{
+    $test->run(args => '--filename /foo/bar/baz');
+    missing_args(3, "Required options: --uri --filename");
+}
+
+sub missing_args
+{
+    my ($exit, $errstr) = @_;
+
+    is($? >> 8, $exit, "error code is: $exit");
+    like($test->stderr, qr/$errstr/, "error string is: $errstr");
+}
+
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/11_dsproductls.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/11_dsproductls.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/11_dsproductls.t	(revision 22005)
@@ -0,0 +1,48 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: 11_dsproductls.t,v 1.1 2006-03-18 04:02:35 jhoblitt Exp $
+
+use strict;
+use warnings;
+
+use lib qw( ./lib ./t );
+
+use Test::Cmd;
+use Test::More tests => 5;
+
+=head1 NAME
+
+t/11_dsproductls.t - tests dsproductls
+
+=head1 SYNOPSIS
+    
+    prove t/11_dsproductls.t
+
+=cut
+
+# last ditch effort to make sure dsproductls is executable
+chmod 0755, 'scripts/dsproductls';
+
+my $test = Test::Cmd->new(prog => 'scripts/dsproductls', workdir => '');
+isa_ok($test, 'Test::Cmd');
+
+{
+    $test->run(args => '');
+    missing_args(3, "Required options: --uri");
+}
+
+{
+    $test->run(args => '--last_fileset foobar');
+    missing_args(3, "Required options: --uri");
+}
+
+sub missing_args
+{
+    my ($exit, $errstr) = @_;
+
+    is($? >> 8, $exit, "error code is: $exit");
+    like($test->stderr, qr/$errstr/, "error string is: $errstr");
+}
+
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/12_dsfilesetls.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/12_dsfilesetls.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/12_dsfilesetls.t	(revision 22005)
@@ -0,0 +1,45 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: 12_dsfilesetls.t,v 1.1 2006-03-20 22:03:53 jhoblitt Exp $
+
+use strict;
+use warnings;
+
+use lib qw( ./lib ./t );
+
+use Test::Cmd;
+use Test::More tests => 3;
+
+=head1 NAME
+
+t/12_dsfilesetls.t - tests dsfilesetls
+
+=head1 SYNOPSIS
+    
+    prove t/12_dsfilesetls.t
+
+=cut
+
+my $prog = 'scripts/dsfilesetls';
+
+# last ditch effort to make sure dsproductls is executable
+chmod 0755, $prog;
+
+my $test = Test::Cmd->new( prog => $prog, workdir => '' );
+isa_ok($test, 'Test::Cmd');
+
+{
+    $test->run( args => '' );
+    missing_args(3, "Required options: --uri");
+}
+
+sub missing_args
+{
+    my ($exit, $errstr) = @_;
+
+    is($? >> 8, $exit, "error code is: $exit");
+    like($test->stderr, qr/$errstr/, "error string is: $errstr");
+}
+
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/13_dsrootls.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/13_dsrootls.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/13_dsrootls.t	(revision 22005)
@@ -0,0 +1,45 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006  Joshua Hoblitt
+#
+# $Id: 13_dsrootls.t,v 1.1 2007-09-25 22:10:45 jhoblitt Exp $
+
+use strict;
+use warnings;
+
+use lib qw( ./lib ./t );
+
+use Test::Cmd;
+use Test::More tests => 3;
+
+=head1 NAME
+
+t/12_dsfilesetls.t - tests dsfilesetls
+
+=head1 SYNOPSIS
+    
+    prove t/12_dsfilesetls.t
+
+=cut
+
+my $prog = 'scripts/dsrootls';
+
+# last ditch effort to make sure dsproductls is executable
+chmod 0755, $prog;
+
+my $test = Test::Cmd->new( prog => $prog, workdir => '' );
+isa_ok($test, 'Test::Cmd');
+
+{
+    $test->run( args => '' );
+    missing_args(3, "Required options: --uri");
+}
+
+sub missing_args
+{
+    my ($exit, $errstr) = @_;
+
+    is($? >> 8, $exit, "error code is: $exit");
+    like($test->stderr, qr/$errstr/, "error string is: $errstr");
+}
+
Index: /tags/ipp-1-X/rel-0_07/DataStore/t/14_root.t
===================================================================
--- /tags/ipp-1-X/rel-0_07/DataStore/t/14_root.t	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/DataStore/t/14_root.t	(revision 22005)
@@ -0,0 +1,166 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2006-2007  Joshua Hoblitt
+#
+# $Id: 14_root.t,v 1.1 2007-09-26 00:51:22 jhoblitt Exp $
+
+use strict;
+use warnings;
+
+use lib qw( ./lib ./t );
+
+use Test::More tests => 21;
+
+=head1 NAME
+
+t/14_root.t - tests DataStore::Root
+
+=head1 SYNOPSIS
+    
+    prove t/14_root.t
+
+=cut
+
+use DataStore::Root;
+
+can_ok('DataStore::Root', qw(
+    new
+    request
+));
+
+# ->new()
+
+{
+    my $dsp = DataStore::Root->new( uri => 'http://example.org/index.txt' );
+
+    isa_ok($dsp, 'DataStore::Root');
+}
+
+eval {
+    my $dsp = DataStore::Root->new(
+        uri => 'http://example.org/index.txt',
+        foo => 1
+    );
+};
+like($@, qr/not listed in the validation options/,
+    '->new() fails whe passed extra params');
+
+eval {
+    my $dsp = DataStore::Root->new(
+        uri             => 'http://example.org/index.txt',
+        last_fileset    => '12buckelyourshoe',
+        foo => 1,
+    );
+};
+like($@, qr/not listed in the validation options/,
+    '->new() fails whe passed extra params');
+
+eval {
+    my $dsp = DataStore::Root->new( uri => 'http://example.org' );
+};
+like($@, qr/uri ends with \/index.txt/,
+    '->new() fails when uri param does not end with /index.txt');
+
+eval {
+    my $dsp = DataStore::Root->new( uri => 'http://example.org/index.html' );
+};
+like($@, qr/uri ends with \/index.txt/,
+    '->new() fails when uri param does not end with /index.txt');
+
+eval {
+    my $dsp = DataStore::Root->new( uri => '://example.org/index.txt' );
+};
+like($@, qr/is valid http uri/,
+    '->new() fails when uri param is not http protocol');
+
+eval {
+    my $dsp = DataStore::Root->new;
+};
+like($@, qr/Mandatory parameter 'uri'/,
+    '->new() fails when not passed a uri param');
+
+eval {
+    my $dsp = DataStore::Root->new(
+        last_fileset    => '12buckelyourshoe',
+    );
+};
+like($@, qr/not listed in the validation options/,
+    '->new() fails when not passed a uri param');
+
+# ->request()
+
+use Net::HTTPServer;
+
+sub bar 
+{
+    my $req = shift;             # Net::HTTPServer::Request object
+    my $res = $req->Response();  # Net::HTTPServer::Response object
+
+    my $string = <<END;
+# productID | Most recent | Time              |type | Description       |
+gpc1|otis_test|2006-08-30T17:41:59Z|image|Gigapixel Camera 1|
+skyprobe|o4348i0010o05|2007-09-04T23:00:06Z|image|Skyprobe|
+ucam|video0102|2007-01-17T14:48:10Z|image|Microcam|
+allskycam|o4367a1075o01|2007-09-24T05:21:44Z|image|All Sky Camera|
+END
+
+    $res->Print($string);
+
+    return $res;
+}
+
+$|++;
+
+$SIG{CHLD} = 'IGNORE';
+my $pid = open(my $child, "-|");
+
+unless ($pid) {
+    my $server = new Net::HTTPServer( port => 'scan', log => '/dev/null' );
+
+    # send port number to parent
+    print $server->Start(), "\n";
+
+    $server->RegisterURL('/index.txt', \&bar);
+    $server->Process();  # Run forever
+
+    exit -1;
+}
+
+my $port = <$child>;
+chomp $port;
+
+{
+    my $dsp = DataStore::Root->new( uri => "http://localhost:$port/index.txt" );
+
+    isa_ok($dsp->request, 'DataStore::Response');
+}
+
+{
+    my $dsp = DataStore::Root->new( uri => "http://localhost:$port/index.txt" );
+
+    my $dsr = $dsp->request;
+
+    ok($dsr->is_success, "response->is_success() is correct");
+    is($dsr->code, 200, "response->code() is correct");
+    is($dsr->status_line, "200 OK", "response->status_line() is correct");
+    is(ref $dsr->data, 'ARRAY', "response->data is arrayref is correct");
+    isa_ok($dsr->request, 'DataStore::Record');
+
+    my $data = $dsr->data;
+    is(scalar @$data, 4, "data has the correct number of rows");
+    isa_ok(@$data[0], 'DataStore::Product', "data has correct type of rows");
+    isa_ok(@$data[1], 'DataStore::Product', "data has correct type of rows");
+    isa_ok(@$data[2], 'DataStore::Product', "data has correct type of rows");
+    isa_ok(@$data[3], 'DataStore::Product', "data has correct type of rows");
+}
+
+# cleanup HTTP server
+kill 9, $pid;
+
+eval {
+    my $dsp = DataStore::Root->new( uri => 'http://example.org/index.txt' );
+
+    $dsp->request( foo => 1 );
+};
+like($@, qr/not listed in the validation options/,
+    '->request() fails whe passed extra params');
Index: /tags/ipp-1-X/rel-0_07/glueforge/INSTALL
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/INSTALL	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/INSTALL	(revision 22005)
@@ -0,0 +1,95 @@
+# $Id: INSTALL,v 1.6 2006-01-11 02:12:34 jhoblitt Exp $
+
+Using the glueforge meta-database API generator
+--
+
+- Step 0
+
+Setup your shell's environment for Pan-STARRS CVS.  If you need help setting up
+CVS please see this article:
+
+    http://pan-starrs.ifa.hawaii.edu/project/resources/ps-cvs.html
+
+- Step 1
+
+Install the PS:IPP::Metadata::Config and Template modules.
+
+# PS:IPP::Metadata::Config
+$ cvs co PS-IPP-Metadata-Config
+$ cd PS-IPP-Metadata-Config
+$ perl Build.PL
+$ ./Build
+$ ./Build test
+# if you have sudo
+$ sudo ./Build install
+# if not
+$ su
+$ ./Build install
+
+# Template
+# if you have sudo
+$ sudo perl -MCPAN -e 'install Template'
+# if not
+$ su -
+$ perl -MCPAN -e 'install Template'
+
+If you have never used CPAN before you will be given a series of prompts to
+configure the module.
+
+- Step 2
+
+Checkout the glueforge module from Pan-STARRS CVS and build it.  If you need
+help setting up CVS please see this article:
+
+    http://pan-starrs.ifa.hawaii.edu/project/resources/ps-cvs.html
+
+$ cvs co glueforge
+$ cd glueforge
+$ ./autogen.sh
+$ make
+
+- Step 3
+
+Create a MetadataConfig file that describes the table you want to access.  The
+MetadataConfig file syntax is described in the pslib SDRS.  glueforge specific
+details are included in the "glueforge" man page. For reference, both a simple
+and complex config example is provided in the examples directory.
+
+$ perldoc glueforge
+
+or
+
+$ man glueforge
+
+$ cat examples/simple.md
+
+or
+
+$ cat examples/complex.md
+
+- Step 4
+
+Generate the database bindings with the "glueforge" executable.  The example
+simple.md file will generate code under the directory "foodb".
+
+$./glueforge -t templates/psdb -i examples/simple.md
+$ cd foodb
+
+- Step 5
+
+Package the software for distribution.  This is the same as for any 'standard'
+autotools package.  Please note that you must have pslib installed for the step
+to complete.  If you need help installing pslib please see this article:
+
+    http://pan-starrs.ifa.hawaii.edu/project/IPP/software/jhbuild/
+
+$ jhbuild shell
+$ ./autogen.sh && make dist
+
+This should generate two packages suitable for distribution.
+
+$ ls -la foodb-*
+-rw-r--r--  1 jhoblitt users 216367 Jul 28 17:54 foodb-0.0.1.tar.bz2
+-rw-r--r--  1 jhoblitt users 324926 Jul 28 17:54 foodb-0.0.1.tar.gz
+
+The End.
Index: /tags/ipp-1-X/rel-0_07/glueforge/Makefile.am
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/Makefile.am	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/Makefile.am	(revision 22005)
@@ -0,0 +1,35 @@
+SUBDIRS = templates/psdb
+
+bin_SCRIPTS = glueforge
+CLEANFILES = $(bin_SCRIPTS)
+
+do_subst = sed \
+	-e 's,[@]datadir[@],$(datadir),g' \
+	-e 's,[@]PACKAGE_NAME[@],$(PACKAGE_NAME),g' \
+	-e 's,[@]PACKAGE_VERSION[@],$(PACKAGE_VERSION),g'
+
+glueforge: glueforge.in
+	$(do_subst) < $(srcdir)/glueforge.in > glueforge
+	chmod +x glueforge
+
+example_files = \
+   examples/simple.md \
+   examples/complex.md
+
+glueforgedatadir = $(datadir)/@PACKAGE_NAME@
+exampledir = $(glueforgedatadir)/examples
+example_DATA = $(example_files)
+
+install-data-local:
+	chmod 0755 $(glueforgedatadir) $(exampledir)
+
+man_MANS = \
+    $(top_builddir)/@PACKAGE_NAME@.1
+
+@PACKAGE@.1: glueforge
+	$(POD2MAN) glueforge > @PACKAGE@.1
+
+clean-local:
+	-rm -rf docs @PACKAGE@.1
+
+EXTRA_DIST = autogen.sh glueforge.in $(example_files)
Index: /tags/ipp-1-X/rel-0_07/glueforge/autogen.sh
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/autogen.sh	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/autogen.sh	(revision 22005)
@@ -0,0 +1,103 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+PROJECT=glueforge
+TEST_TYPE=-f
+# change this to be a unique filename in the top level dir
+FILE=autogen.sh
+
+DIE=0
+
+LIBTOOLIZE=libtoolize
+ACLOCAL=aclocal
+AUTOHEADER=autoheader
+AUTOMAKE=automake
+AUTOCONF=autoconf
+
+#($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
+#        echo
+#        echo "You must have $LIBTOOlIZE installed to compile $PROJECT."
+#        echo "Download the appropriate package for your distribution,"
+#        echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/"
+#        DIE=1
+#}
+
+($ACLOCAL --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have $ACLOCAL installed to compile $PROJECT."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
+        DIE=1
+}
+
+#($AUTOHEADER --version) < /dev/null > /dev/null 2>&1 || {
+#        echo
+#        echo "You must have $AUTOHEADER installed to compile $PROJECT."
+#        echo "Download the appropriate package for your distribution,"
+#        echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
+#        DIE=1
+#}
+
+($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have $AUTOMAKE installed to compile $PROJECT."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
+        DIE=1
+}
+
+($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have $AUTOCONF installed to compile $PROJECT."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
+        DIE=1
+}
+
+if test "$DIE" -eq 1; then
+        exit 1
+fi
+
+test $TEST_TYPE $FILE || {
+        echo "You must run this script in the top-level $PROJECT directory"
+        exit 1
+}
+
+if test -z "$*"; then
+        echo "I am going to run ./configure with no arguments - if you wish "
+        echo "to pass any to it, please specify them on the $0 command line."
+fi
+
+#$LIBTOOLIZE --copy --force || echo "$LIBTOOlIZE failed"
+$ACLOCAL -I m4 || echo "$ACLOCAL failed"
+#$AUTOHEADER || echo "$AUTOHEADER failed"
+$AUTOMAKE --add-missing --force-missing --copy || echo "$AUTOMAKE failed"
+$AUTOCONF || echo "$AUTOCONF failed"
+
+cd $ORIGDIR
+
+run_configure=true
+for arg in $*; do
+    case $arg in
+        --no-configure)
+            run_configure=false
+            ;;
+        *)
+            ;;
+    esac
+done
+
+if $run_configure; then
+    $srcdir/configure --enable-maintainer-mode "$@"
+    echo
+    echo "Now type 'make' to compile $PROJECT."
+else
+    echo
+    echo "Now run 'configure' and 'make' to compile $PROJECT."
+fi
Index: /tags/ipp-1-X/rel-0_07/glueforge/configure.ac
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/configure.ac	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/configure.ac	(revision 22005)
@@ -0,0 +1,30 @@
+AC_PREREQ(2.59)
+
+AC_INIT([glueforge], [0.07], [jhoblitt@cpan.org])
+AC_CONFIG_SRCDIR([glueforge.in])
+
+AM_INIT_AUTOMAKE([1.6 foreign dist-bzip2])
+AM_MAINTAINER_MODE
+
+AC_PROG_INSTALL
+
+AC_PROG_PERL_MODULES(
+  [PS::IPP::Metadata::Config], ,
+  [AC_MSG_ERROR(perl module PS::IPP::Metadata::Config is required)]
+)
+
+AC_PROG_PERL_MODULES(
+  [Template], ,
+  [AC_MSG_ERROR(perl module Template is required)]
+)
+
+AC_PATH_PROG([POD2MAN], [pod2man], [missing])
+if test "$POD2MAN" = "missing" ; then
+  AC_MSG_ERROR([pod2man is required])
+fi
+
+AC_CONFIG_FILES([
+  Makefile
+  templates/psdb/Makefile
+])
+AC_OUTPUT
Index: /tags/ipp-1-X/rel-0_07/glueforge/examples/complex.md
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/examples/complex.md	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/examples/complex.md	(revision 22005)
@@ -0,0 +1,20 @@
+glueforge METADATA
+    pkg_name        STR  foodb 
+    pkg_namespace   STR  foo
+END
+
+foo METADATA
+    foo     STR     60      # Primary Key
+    bar     S32     0 
+    baz     F32     0.0
+    boing   F64     0.0
+    zot     BOOL    t       # Key
+END
+
+bar METADATA
+    zot     BOOL    t       # Key
+    boing   F64     0.0
+    baz     F32     0.0
+    bar     S32     0 
+    foo     STR     60      # Primary Key
+END
Index: /tags/ipp-1-X/rel-0_07/glueforge/examples/simple.md
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/examples/simple.md	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/examples/simple.md	(revision 22005)
@@ -0,0 +1,6 @@
+table   STR     foo
+foo     STR     60      # Primary Key
+bar     S32     0 
+baz     F32     0.0
+boing   F64     0.0
+zot     BOOL    t       # Key
Index: /tags/ipp-1-X/rel-0_07/glueforge/glueforge.in
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/glueforge.in	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/glueforge.in	(revision 22005)
@@ -0,0 +1,481 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2005-2006  Joshua Hoblitt
+#
+# $Id: glueforge.in,v 1.42 2006-01-11 02:39:16 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use vars qw( $VERSION );
+$VERSION = '@PACKAGE_VERSION@';
+
+use PS::IPP::Metadata::Config;
+use Template;
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version );
+use Pod::Usage qw( pod2usage );
+
+my ( $input, $output, $template );
+GetOptions(
+    'input=s'       => \$input,
+    'output=s'      => \$output,
+    'template=s'    => \$template,
+) || pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage( -msg => "Required option: --input|-i", -exitval => 2 ) unless $input;
+
+$template = "@datadir@/@PACKAGE_NAME@/templates/psdb" unless $template;
+
+die "file doesn't exist: $input" unless -e $input;
+die "file isn't readable: $input" unless -r $input;
+
+my $config = parse_config( $input );
+
+die "file doesn't not contain a valid config" unless defined $config->[0];
+
+# if the first hash has a class of "metadata" then this is a complex config.
+# Otherwise it is a simple config.
+my $complex = ($config->[0]->{class} eq "metadata") ? 1 : 0;
+
+my $data; # hashref
+if ($complex) {
+    $data = complex_config($config);
+} else {
+    $data = simple_config($config);
+}
+
+# determine output path
+$output = $data->{pkg_name} unless defined $output;
+
+my %tt = (
+    'autogen_sh.tt'         => "$output/autogen.sh",
+    'configure_ac.tt'       => "$output/configure.ac",
+    'pkgconfig_pc_in.tt'    => "$output/$data->{pkg_name}.pc.in",
+    'doxyfile_in.tt'        => "$output/Doxyfile.in",
+    'top_makefile_am.tt'    => "$output/Makefile.am",
+    'src_makefile_am.tt'    => "$output/src/Makefile.am",
+    'header.tt'             => "$output/src/$data->{pkg_name}.h",
+    'code.tt'               => "$output/src/$data->{pkg_name}.c",
+    'tests_makefile_am.tt'  => "$output/tests/Makefile.am",
+    'testsuite_at.tt'       => "$output/tests/testsuite.at",
+    'dbsetup_c.tt'          => "$output/tests/dbsetup.c",
+    'dbcleanup_c.tt'        => "$output/tests/dbcleanup.c",
+    'alloc_c.tt'            => "$output/tests/alloc.c",
+    'init_c.tt'             => "$output/tests/init.c",
+    'cleanup_c.tt'          => "$output/tests/cleanup.c",
+    'createtable_c.tt'      => "$output/tests/createtable.c",
+    'droptable_c.tt'        => "$output/tests/droptable.c",
+    'insert_c.tt'           => "$output/tests/insert.c",
+    'pop_c.tt'              => "$output/tests/pop.c",
+    'insertobject_c.tt'     => "$output/tests/insertobject.c",
+    'popobject_c.tt'        => "$output/tests/popobject.c",
+    'insertfits_c.tt'       => "$output/tests/insertfits.c",
+    'popfits_c.tt'          => "$output/tests/popfits.c",
+    'selectrowsfits_c.tt'   => "$output/tests/selectrowsfits.c",
+    'metadatafromobject_c.tt' => "$output/tests/metadatafromobject.c",
+    'objectfrommetadata_c.tt' => "$output/tests/objectfrommetadata.c",
+);
+
+my $mangler = Template->new({ INCLUDE_PATH => $template });
+
+foreach my $t ( keys %tt ) {
+    $mangler->process( $t, $data, $tt{$t})
+        or die $mangler->error;
+}
+
+# make autogen.sh executable
+# permissions are in octal
+chmod 0744, $tt{'autogen_sh.tt'}; 
+
+sub parse_config {
+    my $file = shift;
+
+    my $mdparser = PS::IPP::Metadata::Config->new;
+    $mdparser->overwrite( 1 );
+
+    open( my $data, $file ) or die "can't open file: $!";
+    my $example = do { local $/; <$data> };
+    close( $data ) or die "can't close file: $!";
+
+    my $config = $mdparser->parse( $example )
+        or die "error parsing file: $input";
+
+    return $config;
+}
+
+sub lookup_type {
+    my $type = shift;
+
+    my %primitives = map { $_ => 1 } qw( S8 S16 S32 S64 U8 U16 U32 U64 F32 F64 );
+    my %mtypes = map { $_ => "PS_DATA_$_" } keys %primitives;
+    my %ctypes = map { $_ => "ps$_" } keys %primitives;
+
+    my %ttypes = (
+        S8      => -8,
+        S16     => -16,
+        S32     => -32,
+        S64     => -64,
+        U8      => 8,
+        U16     => 16,
+        U32     => 32,
+        U64     => 64,
+        F32     => 32.32,
+        F64     => 64.64,
+    );
+
+    if ( $primitives{$type} ) {
+        return {
+            ctype   => $ctypes{$type},
+            mtype   => $mtypes{$type},
+            test    => $ttypes{$type},
+        };
+    } elsif ( $type =~ /STR|STRING/ ) {
+        return {
+            ctype   => "char*",
+            mtype   => 'PS_DATA_STR',
+            test    => '"a string"',
+        };
+    } elsif ( $type =~ /BOOL/ ) {
+        return {
+            ctype   => "bool",
+            mtype   => 'PS_DATA_BOOL',
+            test    => 'true',
+        };
+    } else {
+        return undef;
+    }
+}
+
+sub simple_config {
+    my $config = shift;
+
+    # find table name
+    my $table_name;
+    for (my $i = 0; $i < @{$config}; $i++) {
+        my $elem = $config->[$i];
+
+        if ( $elem->{name} eq "table" ) {
+            $table_name = $elem->{value};
+
+            # delete element from array
+            splice @$config, $i, 1;
+
+            last;
+        }
+    }
+
+    my %data;
+
+    # global data
+    $data{pkg_name}         = $table_name . "db";
+    $data{pkg_namespace}    = $table_name;
+
+    # per table data
+    my %table;
+    $table{name}        = $table_name;
+    $table{namespace}   = $table_name;
+    $table{object_name} = $table{namespace} . "Row";
+
+    my @items;
+
+    # setup items
+    for (my $i = 0; $i < @{$config}; $i++) {
+        my $elem = $config->[$i];
+
+        my $mdtypes = lookup_type( $elem->{type} );
+        next if ! defined $mdtypes;
+
+        push @items, {
+            name    => $elem->{name},
+            type    => $elem->{type},
+            ctype   => $mdtypes->{ctype},
+            mtype   => $mdtypes->{mtype},
+            test    => $mdtypes->{test},
+            comment => $elem->{comment},
+            value   => $elem->{value},
+        };
+    }
+
+    $table{columns} = \@items;
+    $data{tables} = [ \%table ];
+
+    return \%data;
+}
+
+sub complex_config {
+    my $config = shift;
+
+    # find the glueforge metadata
+    my $glueforge_meta;
+    for (my $i = 0; $i < @{$config}; $i++) {
+        my $elem = $config->[$i];
+
+        if ($elem->{name} eq "glueforge") {
+            $glueforge_meta = $elem;
+
+            # delete element from array
+            splice @$config, $i, 1;
+
+            last;
+        }
+    }
+
+    die "missing glueforge METADATA" unless defined $glueforge_meta;
+
+    # global data
+
+    # process glueforge metadata for global data
+    my ($pkg_name, $pkg_namespace);
+    foreach my $item (@{$glueforge_meta->{value}}) {
+        if ($item->{name} eq 'pkg_name') {
+            $pkg_name = $item->{value};
+        } elsif ($item->{name} eq 'pkg_namespace') {
+            $pkg_namespace = $item->{value};
+        } else {
+            die "invalid glueforge METADATA key: $item->{name}";
+        }
+    }
+
+    die "pkg_name is required in complex config" unless defined $pkg_name;
+    die "pkg_namespace is required in complex config" unless defined
+        $pkg_namespace;
+
+    my %data;
+    $data{pkg_name}         = $pkg_name;
+    $data{pkg_namespace}    = $pkg_namespace;
+
+    # setup one table per nested metadata
+    my @tables;
+    foreach my $meta (@{$config}) {
+        push @tables, tabledata_from_meta($meta);
+    }
+
+    $data{tables} = \@tables;
+
+    return \%data;
+}
+
+sub tabledata_from_meta {
+    my $meta = shift;   # hashref
+
+    die "not a valid metadata" unless $meta->{class} eq 'metadata';
+
+    my $table_name = $meta->{name};
+
+    my @fields;
+    foreach my $column (@{$meta->{value}}) {
+        my $mdtypes = lookup_type( $column->{type} );
+        next if not defined $mdtypes;
+
+        push @fields, {
+            name    => $column->{name},
+            type    => $column->{type},
+            ctype   => $mdtypes->{ctype},
+            mtype   => $mdtypes->{mtype},
+            test    => $mdtypes->{test},
+            comment => $column->{comment},
+            value   => $column->{value},
+        };
+    }
+
+    my %table = (
+        name        => $table_name,
+        namespace   => $table_name,
+        object_name => $table_name . "Row",
+        columns     => \@fields,
+    );
+
+    return \%table;
+}
+
+__END__
+
+=pod
+
+=head1 NAME
+
+@PACKAGE_NAME@ - auto-generate Pan-STARRS IPP 'meta' database bindings
+
+=head1 SYNOPSIS
+
+    @PACKAGE_NAME@ --input <filename> [--output <dirname>] [--template <dirname>]
+
+=head1 DESCRIPTION
+
+This program generates a set of database table format specific bindings in the
+ANSI C language.  The code generated is largely just wrapper functions around
+the C<pslib> C<psDB> API.  Table information is read in from a configuration
+file in the pslib C<MetadataConfig> format.  A complete autotools configured
+package that builds both static & shared libraries is generated.
+
+=head2 Features
+
+=over 4
+
+=item * Generates a complete autoconf/automake/libtool package.
+
+=item * Generated packages include an C<autogen.sh> script.
+
+=item * Installs a pkgconfig C<.pc> data file.
+
+=item * Includes a table format specific autotest test suite.
+
+=item * Builds both shared and static libraries by default.
+
+=item * Generates man pages and HTML documentation with Doxygen.
+
+=item * Header files should be C++ safe.
+
+=item * Functions to open and close database connections.
+
+=item * Functions to create and destroy a table of the appropriate format.
+
+=item * Functions to insert and pop a row.
+
+=item * Functions to insert and pop a simple object representing a row.
+
+=item * Functions to insert, select, and pop to/from FITS files.
+
+=item * Functions to convert between row structs and pslib C<psMetadata>s.
+
+=back
+
+=head1 TABLE DESCRIPTION FORMAT
+
+There are two slightly different configuration file forms.  A C<simple> format
+for describing a single table and a C<complex> format for describing more then
+one table and/or configuring specific details as to how the package is
+generated.  The syntax for both of these forms follows the C<Configuration
+files> format as described in C<PSDC-430-007>.
+
+=head2 Simple configuration
+
+A simple config file specifies the name of the table, the name and types of all
+columns, and can optionally specify which column(s) are to be used as indexes.
+
+=head2 Example simple configuration
+
+    table   STR     foo
+    foo     STR     60      # Primary Key
+    bar     S32     0
+    baz     F32     0.0
+    boing   F64     0.0
+    zot     BOOL    t       # Key
+
+The key name C<table> is reserved and specifies the name of the database table.
+It may appear any where in the file but it is most I<convenient> to have it as
+the first line of the table description.
+
+The value of a C<STR> column specifies the maximum number of characters that
+the database is required to store for that field.  The values for C<S32>,
+C<F32>, C<F64>, & C<BOOL> columns are ignored.
+
+Keys maybe specified as a C<Primary Key> or C<Key>.  Only one C<Primary Key>
+may be specified per table.
+
+The key name C<position> is also reserved as it is used internally by the
+database bindings.
+
+=head2 Complex configuration
+
+A complex config file consists of a series of C<METADATA> blocks.  One (and
+only one) of these blocks I<must> be named C<glueforge>. This block
+contains the global package configuration data.  Only the keys C<pkg_name> and
+C<pkg_namespace> are allowed in this block and they are both required.
+
+All other C<METADATA> blocks describe a single table with the name of the
+C<METATA> block being the tables name.  Otherwise, the format of items
+contained in a C<METADATA> block is the same as for the simple configuration.
+
+Note that nested C<METADATA> blocks are not allowed.
+
+=head2 Example complex configuration
+
+glueforge METADATA
+    pkg_name        STR  foodb 
+    pkg_namespace   STR  foo
+END
+
+foo METADATA
+    foo     STR     60      # Primary Key
+    bar     S32     0 
+    baz     F32     0.0
+    boing   F64     0.0
+    zot     BOOL    t       # Key
+END
+
+bar METADATA
+    zot     BOOL    t       # Key
+    boing   F64     0.0
+    baz     F32     0.0
+    bar     S32     0 
+    foo     STR     60      # Primary Key
+END
+
+=head1 OPTIONS
+
+=over 4
+
+=item * --input|-i <filename>
+
+File to read table description from.
+
+=item * --output|-o <dirname>
+
+Send the generate files to this directory name.
+
+Defaults to the name of the database table.
+
+=item * --template|-t <dirname>
+
+Directory to load template files from.
+
+Defaults to C<@datadir@/@PACKAGE_NAME@/templates/psdb>.
+
+=back
+
+=head1 BUGS
+
+The format of configuration files is not rigorously checked.  Improperly
+formatted files may not be caught and cause random (possibly silent) errors
+and/or improperly code generation.
+
+=head1 CREDITS
+
+Just me, myself, and I.
+
+=head1 SUPPORT
+
+Please contact the author directly via e-mail.
+
+=head1 AUTHOR
+
+Joshua Hoblitt <jhoblitt@cpan.org>
+
+=head1 COPYRIGHT
+
+Copyright (C) 2005-2006  Joshua Hoblitt.  All rights reserved.
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA  02111-1307, USA.
+
+The full text of the license can be found in the L<perlgpl> Pod as supplied
+with Perl 5.8.1 and later.
+
+=head1 SEE ALSO
+
+C<pslib>, C<PSDC-430-007>. L<PS:IPP::Metadata::Config>
+
+=cut
Index: /tags/ipp-1-X/rel-0_07/glueforge/m4/ac_prog_perl_modules.m4
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/m4/ac_prog_perl_modules.m4	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/m4/ac_prog_perl_modules.m4	(revision 22005)
@@ -0,0 +1,53 @@
+dnl @synopsis AC_PROG_PERL_MODULES([MODULES], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+dnl
+dnl Checks to see if the the given perl modules are available. If true
+dnl the shell commands in ACTION-IF-TRUE are executed. If not the shell
+dnl commands in ACTION-IF-FALSE are run. Note if $PERL is not set (for
+dnl example by calling AC_CHECK_PROG, or AC_PATH_PROG),
+dnl AC_CHECK_PROG(PERL, perl, perl) will be run.
+dnl
+dnl Example:
+dnl
+dnl   AC_CHECK_PERL_MODULES(Text::Wrap Net::LDAP, ,
+dnl                         AC_MSG_WARN(Need some Perl modules)
+dnl
+dnl @category InstalledPackages
+dnl @author Dean Povey <povey@wedgetail.com>
+dnl @version 2002-09-25
+dnl @license AllPermissive
+
+AC_DEFUN([AC_PROG_PERL_MODULES],[
+    ac_perl_modules="$1"
+    # Make sure we have perl
+    if test -z "$PERL"; then
+        AC_CHECK_PROG(PERL,perl,perl)
+    fi
+
+    if test "x$PERL" != x; then
+        ac_perl_modules_failed=0
+        for ac_perl_module in $ac_perl_modules; do
+            AC_MSG_CHECKING(for perl module $ac_perl_module)
+
+            # Would be nice to log result here, but can't rely on autoconf
+            # internals
+            $PERL "-M$ac_perl_module" -e exit > /dev/null 2>&1
+            if test $? -ne 0; then
+                AC_MSG_RESULT(no);
+                ac_perl_modules_failed=1
+            else
+                AC_MSG_RESULT(ok);
+            fi
+        done
+
+        # Run optional shell commands
+        if test "$ac_perl_modules_failed" = 0; then
+            :
+            $2
+        else
+            :
+            $3
+        fi
+    else
+        AC_MSG_WARN(could not find perl)
+    fi
+])
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/Makefile.am
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/Makefile.am	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/Makefile.am	(revision 22005)
@@ -0,0 +1,83 @@
+template_files = \
+    alloc.tt \
+    alloc_at.tt \
+    alloc_c.tt \
+    alloc_h.tt \
+    autogen_sh.tt \
+    bootstrap_sh.tt \
+    cleanup.tt \
+    cleanup_at.tt \
+    cleanup_c.tt \
+    cleanup_h.tt \
+    code.tt \
+    configure_ac.tt \
+    createtable.tt \
+    createtable_at.tt \
+    createtable_c.tt \
+    createtable_h.tt \
+    dbcleanup_c.tt \
+    dbsetup_c.tt \
+    doxyfile_in.tt \
+    droptable.tt \
+    droptable_at.tt \
+    droptable_c.tt \
+    droptable_h.tt \
+    header.tt \
+    init.tt \
+    init_at.tt \
+    init_c.tt \
+    init_h.tt \
+    insert.tt \
+    insert_at.tt \
+    insert_c.tt \
+    insert_h.tt \
+    insertfits.tt \
+    insertfits_at.tt \
+    insertfits_c.tt \
+    insertfits_h.tt \
+    insertobject.tt \
+    insertobject_at.tt \
+    insertobject_c.tt \
+    insertobject_h.tt \
+    makefile.tt \
+    metadatafromobject.tt \
+    metadatafromobject_at.tt \
+    metadatafromobject_c.tt \
+    metadatafromobject_h.tt \
+    object_h.tt \
+    objectfrommetadata.tt \
+    objectfrommetadata_at.tt \
+    objectfrommetadata_c.tt \
+    objectfrommetadata_h.tt \
+    pkgconfig_pc_in.tt \
+    pop.tt \
+    pop_at.tt \
+    pop_c.tt \
+    pop_h.tt \
+    popfits.tt \
+    popfits_at.tt \
+    popfits_c.tt \
+    popfits_h.tt \
+    popobject.tt \
+    popobject_at.tt \
+    popobject_c.tt \
+    popobject_h.tt \
+    selectrowobjects.tt \
+    selectrowobjects_h.tt \
+    selectrowsfits.tt \
+    selectrowsfits_at.tt \
+    selectrowsfits_c.tt \
+    selectrowsfits_h.tt \
+    src_makefile_am.tt \
+    tests_makefile_am.tt \
+    testsuite_at.tt \
+    top_makefile_am.tt
+
+templatedir = $(datadir)/@PACKAGE_NAME@/templates
+psdbtemplatedir = $(templatedir)/psdb
+psdbtemplate_DATA = $(template_files)
+
+install-data-hook:
+	chmod 0755 $(templatedir) $(psdbtemplatedir)
+
+EXTRA_DIST = $(template_files)
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/alloc.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/alloc.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/alloc.tt	(revision 22005)
@@ -0,0 +1,40 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+static void [% table.object_name %]Free([% table.object_name %] *object);
+
+[% table.object_name %] *[% table.object_name %]Alloc(
+[%- SET i = 0 -%]
+[% FOREACH item = table.columns -%]
+[% IF i == 0 %][% i = 1 %][% ELSE %], [% END -%]
+[% IF item.type == "STR" -%]
+const char *[% item.name %]
+[%- ELSE -%]
+[% item.ctype %] [% item.name %]
+[%- END -%]
+[% END -%]
+)
+{
+    [% indented(table.object_name, "*object") %];
+
+    object = psAlloc(sizeof([% table.object_name %]));
+    psMemSetDeallocator(object, (psFreeFunc)[% table.object_name %]Free);
+
+[% FOREACH item = table.columns -%]
+[% IF item.type == "STR" -%]
+    object->[% item.name %] = psStringCopy([% item.name %]);
+[% ELSE -%]
+    object->[% item.name %] = [% item.name %];
+[% END -%]
+[% END -%]
+
+    return object;
+}
+
+static void [% table.object_name %]Free([% table.object_name %] *object)
+{
+[% FOREACH item = table.columns -%]
+[% IF item.type == "STR" -%]
+    psFree(object->[% item.name %]);
+[% END -%]
+[% END -%]
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/alloc_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/alloc_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/alloc_at.tt	(revision 22005)
@@ -0,0 +1,6 @@
+AT_SETUP([[% table.object_name %]Alloc()])
+AT_KEYWORDS([[% table.object_name %]Alloc])
+
+AT_CHECK([alloc])
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/alloc_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/alloc_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/alloc_c.tt	(revision 22005)
@@ -0,0 +1,42 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+
+#define MAX_STRING_LENGTH 1024
+
+int main ()
+{
+[% FOREACH table = tables -%]
+    {
+        [% indented(table.object_name, "*object") %];
+
+        object = [% table.object_name %]Alloc(
+[%- SET i = 0 -%]
+[%- FOREACH item = table.columns -%]
+        [%- IF i == 0 -%][%- i = 1 -%][%- ELSE -%], [% END -%] [%- item.test -%]
+[%- END -%]
+    );
+
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+[% FOREACH item = table.columns -%]
+[% IF item.type == "S32" or item.type == "F32" or item.type == "F64" or item.type == "BOOL" -%]
+        if (!object->[% item.name %] == [% item.test %]) {
+[% ELSIF item.type == "STR" -%]
+        if (strncmp(object->[% item.name %], [% item.test %], MAX_STRING_LENGTH)) {
+[% END -%]
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+[% END -%]
+
+        psFree(object);
+    }
+
+[% END -%]
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/alloc_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/alloc_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/alloc_h.tt	(revision 22005)
@@ -0,0 +1,18 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+/** Creates a new [% table.object_name %] object
+ *
+ *  @return A new [% table.object_name %] object or NULL on failure.
+ */
+
+[% table.object_name %] *[% table.object_name %]Alloc(
+[%- SET i = 0 -%]
+[% FOREACH item = table.columns -%]
+[% IF i == 0 %][% i = 1 %][% ELSE %],[% END %]
+[% IF item.type == "STR" -%]
+    [% indented("const char", "*$item.name") %]
+[%- ELSE -%]
+    [% indented("$item.ctype", "$item.name") %]
+[%- END -%]
+[% END %]
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/autogen_sh.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/autogen_sh.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/autogen_sh.tt	(revision 22005)
@@ -0,0 +1,103 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+PROJECT=[% pkg_name %]
+TEST_TYPE=-f
+# change this to be a unique filename in the top level dir
+FILE=autogen.sh
+
+DIE=0
+
+LIBTOOLIZE=libtoolize
+ACLOCAL=aclocal
+AUTOHEADER=autoheader
+AUTOMAKE=automake
+AUTOCONF=autoconf
+
+($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have $LIBTOOlIZE installed to compile $PROJECT."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/"
+        DIE=1
+}
+
+($ACLOCAL --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have $ACLOCAL installed to compile $PROJECT."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
+        DIE=1
+}
+
+($AUTOHEADER --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have $AUTOHEADER installed to compile $PROJECT."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
+        DIE=1
+}
+
+($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have $AUTOMAKE installed to compile $PROJECT."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
+        DIE=1
+}
+
+($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have $AUTOCONF installed to compile $PROJECT."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
+        DIE=1
+}
+
+if test "$DIE" -eq 1; then
+        exit 1
+fi
+
+test $TEST_TYPE $FILE || {
+        echo "You must run this script in the top-level $PROJECT directory"
+        exit 1
+}
+
+if test -z "$*"; then
+        echo "I am going to run ./configure with no arguments - if you wish "
+        echo "to pass any to it, please specify them on the $0 command line."
+fi
+
+$LIBTOOLIZE --copy --force || echo "$LIBTOOlIZE failed"
+$ACLOCAL || echo "$ACLOCAL failed"
+$AUTOHEADER || echo "$AUTOHEADER failed"
+$AUTOMAKE --add-missing --force-missing --copy || echo "$AUTOMAKE failed"
+$AUTOCONF || echo "$AUTOCONF failed"
+
+cd $ORIGDIR
+
+run_configure=true
+for arg in $*; do
+    case $arg in
+        --no-configure)
+            run_configure=false
+            ;;
+        *)
+            ;;
+    esac
+done
+
+if $run_configure; then
+    $srcdir/configure --enable-maintainer-mode "$@"
+    echo
+    echo "Now type 'make' to compile $PROJECT."
+else
+    echo
+    echo "Now run 'configure' and 'make' to compile $PROJECT."
+fi
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/bootstrap_sh.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/bootstrap_sh.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/bootstrap_sh.tt	(revision 22005)
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+libtoolize --automake --copy \
+&& aclocal \
+&& autoheader \
+&& automake --foreign --add-missing --copy \
+&& autoconf
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/cleanup.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/cleanup.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/cleanup.tt	(revision 22005)
@@ -0,0 +1,4 @@
+void [% pkg_namespace %]Cleanup(psDB *dbh)
+{
+    psDBCleanup(dbh);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/cleanup_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/cleanup_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/cleanup_at.tt	(revision 22005)
@@ -0,0 +1,6 @@
+AT_SETUP([[% table.namespace %]Cleanup()])
+AT_KEYWORDS([[% table.namespace %]Cleanup])
+
+AT_CHECK([cleanup])
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/cleanup_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/cleanup_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/cleanup_c.tt	(revision 22005)
@@ -0,0 +1,17 @@
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+
+int main ()
+{
+    psDB            *dbh;
+
+    dbh = psDBInit("localhost", "test", NULL, "test");
+    if (!dbh) {
+        exit(EXIT_FAILURE);
+    }
+
+    [% pkg_namespace %]Cleanup(dbh);
+
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/cleanup_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/cleanup_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/cleanup_h.tt	(revision 22005)
@@ -0,0 +1,6 @@
+/** Closes a database connection
+ */
+
+void [% pkg_namespace %]Cleanup(
+    psDB            *dbh                ///< Database handle
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/code.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/code.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/code.tt	(revision 22005)
@@ -0,0 +1,25 @@
+#include "[% pkg_name %].h"
+
+[% FOREACH table = tables -%]
+#define [% table.namespace FILTER upper %]_TABLE_NAME "[% table.name %]"
+#define [% table.namespace FILTER upper %]_INDEX_NAME "position"
+[% END -%]
+#define MAX_STRING_LENGTH 1024
+
+[% INCLUDE init.tt %]
+[% INCLUDE cleanup.tt %]
+[% FOREACH table = tables -%]
+[% INCLUDE alloc.tt %]
+[% INCLUDE createtable.tt %]
+[% INCLUDE droptable.tt %]
+[% INCLUDE insert.tt %]
+[% INCLUDE pop.tt %]
+[% INCLUDE insertobject.tt %]
+[% INCLUDE popobject.tt %]
+[% INCLUDE insertfits.tt %]
+[% INCLUDE popfits.tt %]
+[% INCLUDE selectrowsfits.tt %]
+[% INCLUDE metadatafromobject.tt %]
+[% INCLUDE objectfrommetadata.tt -%]
+[% INCLUDE selectrowobjects.tt -%]
+[% END -%]
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/configure_ac.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/configure_ac.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/configure_ac.tt	(revision 22005)
@@ -0,0 +1,39 @@
+AC_PREREQ(2.59)
+
+AC_INIT([[% pkg_name %]], [0.0.1], [pan-starrs.ifa.hawaii.edu])
+AC_CONFIG_SRCDIR([[% pkg_name %].pc.in])
+
+AM_INIT_AUTOMAKE([1.6 foreign dist-bzip2])
+AM_CONFIG_HEADER([config.h])
+AM_MAINTAINER_MODE
+
+AC_CONFIG_TESTDIR([tests])
+AC_CONFIG_FILES([tests/Makefile])
+AM_MISSING_PROG([AUTOM4TE], [autom4te])
+
+AC_LANG(C)
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+
+PKG_CHECK_MODULES([PSLIB], [pslib >= 0.6.0]) 
+
+AC_PATH_PROG([PERL], [perl], [missing])
+if test "$PERL" = "missing" ; then
+  AC_MSG_ERROR([perl is required])
+fi
+
+AC_PATH_PROG([doxygen], [doxygen], [missing])
+AM_CONDITIONAL([DOXYGEN], test "x$doxygen" = "xmissing")
+
+dnl is this the best was to setup recursive CFLAGS?
+[% pkg_name %]_CFLAGS="-Wall -pedantic -std=c99 -fno-strict-aliasing"
+AC_SUBST([[% pkg_name %]_CFLAGS])
+
+AC_CONFIG_FILES([
+  Makefile
+  src/Makefile
+  [% pkg_name %].pc
+  Doxyfile
+])
+AC_OUTPUT
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/createtable.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/createtable.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/createtable.tt	(revision 22005)
@@ -0,0 +1,43 @@
+bool [% table.namespace %]CreateTable(psDB *dbh)
+{
+    psMetadata      *md;
+    bool            status;
+
+    md = psMetadataAlloc();
+    if (!psMetadataAdd(md, PS_LIST_TAIL, [% table.namespace FILTER upper %]_INDEX_NAME, PS_DATA_S32, "AUTO_INCREMENT", 0.0)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item %s", [% table.namespace FILTER upper %]_INDEX_NAME);
+        psFree(md);
+        return false;
+    }
+[% FOREACH item = table.columns -%]
+[% IF item.comment;
+    SET item.comment = "\"$item.comment\"";
+ELSE;
+    SET item.comment = 'NULL';
+END;
+-%]
+[% IF item.type == "S32" or item.type == "F32" or item.type == "F64" -%]
+    if (!psMetadataAdd[% item.type %](md, PS_LIST_TAIL, "[% item.name %]", 0, [% item.comment %], [% item.value %])) {
+[% ELSIF item.type == "STR" -%]
+    if (!psMetadataAddStr(md, PS_LIST_TAIL, "[% item.name %]", 0, [% item.comment %], "[% item.value %]")) {
+[% ELSIF item.type == "BOOL" -%]
+[% IF item.value == 1;
+    SET item.value = "true";
+ELSE;
+    SET item.value = "false";
+END;
+-%]
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "[% item.name %]", PS_DATA_BOOL, [% item.comment %], [% item.value %])) {
+[% END -%]
+        psError(PS_ERR_UNKNOWN, false, "failed to add item [% item.name %]");
+        psFree(md);
+        return false;
+    }
+[% END -%]
+
+    status = psDBCreateTable(dbh, [% table.namespace FILTER upper %]_TABLE_NAME, md);
+
+    psFree(md);
+
+    return status;
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/createtable_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/createtable_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/createtable_at.tt	(revision 22005)
@@ -0,0 +1,9 @@
+AT_SETUP([[% table.namespace %]CreateTable()])
+AT_KEYWORDS([[% table.namespace %]CreateTable])
+
+# make sure the table is not there.
+AT_CHECK([dbcleanup])
+AT_CHECK([createtable])
+AT_CHECK([dbcleanup])
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/createtable_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/createtable_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/createtable_c.tt	(revision 22005)
@@ -0,0 +1,25 @@
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+
+int main ()
+{
+[% FOREACH table = tables -%]
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if(![% table.namespace %]CreateTable(dbh)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+[% END -%]
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/createtable_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/createtable_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/createtable_h.tt	(revision 22005)
@@ -0,0 +1,8 @@
+/** Creates a new [% table.name %] table
+ *
+ * @return true on success
+ */
+
+bool [% table.namespace %]CreateTable(
+    psDB            *dbh                ///< Database handle
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/dbcleanup_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/dbcleanup_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/dbcleanup_c.tt	(revision 22005)
@@ -0,0 +1,20 @@
+#include <pslib.h>
+#include <stdlib.h>
+
+int main ()
+{
+    psDB            *dbh;
+
+    dbh = psDBInit("localhost", "test", NULL, "test");
+    if (!dbh) {
+        exit(EXIT_FAILURE);
+    }
+
+[% FOREACH table = tables -%]
+    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS [% table.name %]");
+[% END -%]
+
+    psDBCleanup(dbh);
+
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/dbsetup_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/dbsetup_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/dbsetup_c.tt	(revision 22005)
@@ -0,0 +1,23 @@
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+
+int main ()
+{
+    psDB            *dbh;
+
+    dbh = psDBInit("localhost", "test", NULL, "test");
+    if (!dbh) {
+        exit(EXIT_FAILURE);
+    }
+
+    // remove the table if it already exists
+[% FOREACH table = tables -%]
+    p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS [% table.name %]");
+    [% table.namespace %]CreateTable(dbh);
+
+[% END -%]
+    psDBCleanup(dbh);
+
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/doxyfile_in.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/doxyfile_in.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/doxyfile_in.tt	(revision 22005)
@@ -0,0 +1,1219 @@
+# Doxyfile 1.4.2
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = @PACKAGE_NAME@
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = @PACKAGE_VERSION@
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+# @top_builddir@ doesn't work for some reason
+OUTPUT_DIRECTORY       = @builddir@/docs
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, 
+# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, 
+# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, 
+# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, 
+# Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE        = English
+
+# This tag can be used to specify the encoding used in the generated output. 
+# The encoding is not always determined by the language that is chosen, 
+# but also whether or not the output is meant for Windows or non-Windows users. 
+# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES 
+# forces the Windows encoding (this is the default for the Windows binary), 
+# whereas setting the tag to NO uses a Unix-style encoding (the default for 
+# all platforms other than Windows).
+
+USE_WINDOWS_ENCODING   = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = 
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = 
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like the Qt-style comments (thus requiring an 
+# explicit @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member 
+# documentation.
+
+DETAILS_AT_TOP         = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources 
+# only. Doxygen will then generate output that is more tailored for Java. 
+# For instance, namespaces will be presented as packages, qualified scopes 
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation.
+
+SHOW_DIRECTORIES       = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from the 
+# version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the progam writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = @top_srcdir@/src
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
+
+FILE_PATTERNS          = *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories.
+
+EXCLUDE_PATTERNS       = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = 
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = YES
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = @PERL@
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will 
+# generate a call dependency graph for every global function or class method. 
+# Note that enabling this option will significantly increase the time of a run. 
+# So in most cases it will be better to enable call graphs for selected 
+# functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = 
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_WIDTH    = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that a graph may be further truncated if the graph's 
+# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH 
+# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), 
+# the graph is not depth-constrained.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, which results in a white background. 
+# Warning: Depending on the platform used, enabling this option may lead to 
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to 
+# read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/droptable.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/droptable.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/droptable.tt	(revision 22005)
@@ -0,0 +1,4 @@
+bool [% table.namespace %]DropTable(psDB *dbh)
+{
+    return psDBDropTable(dbh, [% table.namespace FILTER upper %]_TABLE_NAME);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/droptable_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/droptable_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/droptable_at.tt	(revision 22005)
@@ -0,0 +1,9 @@
+AT_SETUP([[% table.namespace %]DropTable()])
+AT_KEYWORDS([[% table.namespace %]DropTable])
+
+# make sure the table is not there.
+AT_CHECK([dbsetup])
+AT_CHECK([droptable])
+AT_CHECK([dbcleanup])
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/droptable_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/droptable_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/droptable_c.tt	(revision 22005)
@@ -0,0 +1,25 @@
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+
+int main ()
+{
+[% FOREACH table = tables -%]
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (![% table.namespace %]DropTable(dbh)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+[% END -%]
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/droptable_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/droptable_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/droptable_h.tt	(revision 22005)
@@ -0,0 +1,8 @@
+/** Deletes a [% table.name %] table
+ *
+ * @return true on success
+ */
+
+bool [% table.namespace %]DropTable(
+    psDB            *dbh                ///< Database handle
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/header.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/header.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/header.tt	(revision 22005)
@@ -0,0 +1,38 @@
+#ifndef [% pkg_name FILTER upper %]_H
+#define [% pkg_name FILTER upper %]_H 1
+
+#include <pslib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/// @addtogroup [% pkg_name %]
+/// @{
+
+[% INCLUDE init_h.tt %]
+[% INCLUDE cleanup_h.tt %]
+[% FOREACH table = tables -%]
+[% INCLUDE object_h.tt %]
+[% INCLUDE alloc_h.tt %]
+[% INCLUDE createtable_h.tt %]
+[% INCLUDE droptable_h.tt %]
+[% INCLUDE insert_h.tt %]
+[% INCLUDE pop_h.tt %]
+[% INCLUDE insertobject_h.tt %]
+[% INCLUDE popobject_h.tt %]
+[% INCLUDE insertfits_h.tt %]
+[% INCLUDE popfits_h.tt %]
+[% INCLUDE selectrowsfits_h.tt %]
+[% INCLUDE metadatafromobject_h.tt %]
+[% INCLUDE objectfrommetadata_h.tt -%]
+[% INCLUDE selectrowobjects_h.tt -%]
+[% END -%]
+
+/// @}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // [% table.namespace FILTER upper %]_DB_H
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/init.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/init.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/init.tt	(revision 22005)
@@ -0,0 +1,4 @@
+psDB *[% pkg_namespace %]Init(const char *host, const char *user, const char *passwd, const char *dbname)
+{
+    return psDBInit(host, user, passwd, dbname);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/init_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/init_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/init_at.tt	(revision 22005)
@@ -0,0 +1,6 @@
+AT_SETUP([[% table.namespace %]Init()])
+AT_KEYWORDS([[% table.namespace %]Init])
+
+AT_CHECK([init])
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/init_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/init_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/init_c.tt	(revision 22005)
@@ -0,0 +1,17 @@
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+
+int main ()
+{
+    psDB            *dbh;
+
+    dbh = [% pkg_namespace %]Init("localhost", "test", NULL, "test");
+    if (!dbh) {
+        exit(EXIT_FAILURE);
+    }
+
+    psDBCleanup(dbh);
+
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/init_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/init_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/init_h.tt	(revision 22005)
@@ -0,0 +1,12 @@
+/** Opens a new database connection
+ *
+ *  @return A new psDB object if the database connection is successful or NULL
+ *  on failure.
+ */
+
+psDB *[% pkg_namespace %]Init(
+    const char      *host,              ///< Database server hostname
+    const char      *user,              ///< Database username
+    const char      *passwd,            ///< Database password
+    const char      *dbname             ///< Database table.namespace
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insert.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insert.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insert.tt	(revision 22005)
@@ -0,0 +1,35 @@
+bool [% table.namespace %]Insert(psDB * dbh,
+[%- SET i = 0 -%]
+[% FOREACH item = table.columns -%]
+[% IF i == 0 %][% i = 1 %] [% ELSE %], [% END -%]
+[% IF item.type == "STR" -%]
+const char *[% item.name %]
+[%- ELSE -%]
+[% item.ctype %] [% item.name %]
+[%- END -%]
+[% END -%]
+)
+{
+    psMetadata      *md;
+    bool            status;
+
+    md = psMetadataAlloc();
+[% FOREACH item = table.columns -%]
+[% IF item.type == "S32" or item.type == "F32" or item.type == "F64" -%]
+    if (!psMetadataAdd[% item.type %](md, PS_LIST_TAIL, "[% item.name %]", 0, NULL, [% item.name %])) {
+[% ELSIF item.type == "STR" -%]
+    if (!psMetadataAddStr(md, PS_LIST_TAIL, "[% item.name %]", 0, NULL, psStringCopy([% item.name %]))) {
+[% ELSIF item.type == "BOOL" -%]
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "[% item.name %]", PS_DATA_BOOL, NULL, [% item.name %])) {
+[% END -%]
+        psError(PS_ERR_UNKNOWN, false, "failed to add item [% item.name %]");
+        psFree(md);
+        return false;
+    }
+[% END -%]
+
+    status = psDBInsertOneRow(dbh, [% table.namespace FILTER upper %]_TABLE_NAME, md);
+    psFree(md);
+
+    return status;
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insert_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insert_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insert_at.tt	(revision 22005)
@@ -0,0 +1,8 @@
+AT_SETUP([[% table.namespace %]Insert()])
+AT_KEYWORDS([[% table.namespace %]Insert])
+
+AT_CHECK([dbsetup])
+AT_CHECK([insert])
+AT_CHECK([dbcleanup])
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insert_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insert_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insert_c.tt	(revision 22005)
@@ -0,0 +1,32 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+
+int main ()
+{
+[% FOREACH table = tables -%]
+    {
+        psDB            *dbh;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (![% table.namespace %]Insert(dbh, 
+[%- SET i = 0 -%]
+[%- FOREACH item = table.columns -%]
+[%- IF i == 0 -%][%- i = 1 -%][%- ELSE -%], [% END -%] [%- item.test -%]
+[%- END -%]
+)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+[% END -%]
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insert_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insert_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insert_h.tt	(revision 22005)
@@ -0,0 +1,21 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+/** Insert a single row into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool [% table.namespace %]Insert(
+    psDB            *dbh,               ///< Database handle
+[%- SET i = 0 -%]
+[% FOREACH item = table.columns -%]
+[% IF i == 0 %][% i = 1 %][% ELSE %],[% END %]
+[% IF item.type == "STR" -%]
+    [% indented("const char", "*$item.name") -%]
+[% ELSE -%]
+    [% indented("$item.ctype", "$item.name") -%]
+[% END -%]
+[% END %]
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertfits.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertfits.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertfits.tt	(revision 22005)
@@ -0,0 +1,34 @@
+bool [% table.namespace %]InsertFits(psDB *dbh, const psFits *fits)
+{
+    psArray         *rowSet;
+
+    // move to (the first?) extension named  [% table.namespace FILTER upper %]_TABLE_NAME
+    if (!psFitsMoveExtName(fits, [% table.namespace FILTER upper %]_TABLE_NAME)) {
+        psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", [% table.namespace FILTER upper %]_TABLE_NAME);
+        return false;
+    }
+
+    // check HDU type
+    if (psFitsGetExtType(fits) != PS_FITS_TYPE_BINARY_TABLE)  {
+        psError(PS_ERR_UNKNOWN, true, "FITS HDU type is not PS_FITS_TYPE_BINARY_TABLE");
+        return false;
+    }
+
+    // read fits table
+    rowSet = psFitsReadTable(fits);
+    if (!rowSet) {
+        psError(PS_ERR_UNKNOWN, true, "FITS read error or FITS table is empty");
+        psFree(rowSet);
+        return false;
+    }
+
+    if (!psDBInsertRows(dbh, [% table.namespace FILTER upper %]_TABLE_NAME, rowSet)) {
+        psError(PS_ERR_UNKNOWN, false, "databse insert failed");
+        psFree(rowSet);
+        return false;
+    }
+
+    psFree(rowSet);
+
+    return true;
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertfits_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertfits_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertfits_at.tt	(revision 22005)
@@ -0,0 +1,15 @@
+AT_SETUP([[% table.namespace %]InsertFits()])
+AT_KEYWORDS([[% table.namespace %]InsertFits])
+
+AT_CHECK([dbsetup])
+# run insert so there is a row in the table
+AT_CHECK([insert])
+# run popfis so there is afits file to read
+AT_CHECK([popfits])
+AT_CHECK([insertfits])
+AT_CHECK([dbcleanup])
+if [ test -f "blargh" ] ; then
+    rm -f "blargh"
+fi
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertfits_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertfits_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertfits_c.tt	(revision 22005)
@@ -0,0 +1,40 @@
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#define TMP_FILENAME "./blargh"
+
+int main ()
+{
+[% FOREACH table = tables -%]
+    {
+        psDB            *dbh;
+        psFits          *fits;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        // open a temp
+        fits = psFitsOpen(TMP_FILENAME, "r");
+        if (!fits) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (![% table.namespace %]InsertFits(dbh, fits)) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!psFitsClose(fits)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+[% END -%]
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertfits_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertfits_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertfits_h.tt	(revision 22005)
@@ -0,0 +1,14 @@
+/** Insert data from a binary FITS table [% table.object_name %] into the database
+ *
+ * This function expects a psFits object with a FITS table as the first
+ * extension.  The table must have at least one row of data in it, that is of
+ * the appropriate format (number of columns and their type).  All other
+ * extensions are ignored.
+ *
+ * @return true on success
+ */
+
+bool [% table.namespace %]InsertFits(
+    psDB            *dbh,               ///< Database handle
+    const psFits    *fits               ///< psFits object
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertobject.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertobject.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertobject.tt	(revision 22005)
@@ -0,0 +1,10 @@
+bool [% table.namespace %]InsertObject(psDB *dbh, [% table.object_name %] *object)
+{
+    return [% table.namespace %]Insert(dbh,
+[%- SET i = 0 -%]
+[%- FOREACH item = table.columns -%]
+[%- IF i == 0 -%][%- i = 1 -%] [% ELSE %], [% END -%]
+object->[% item.name -%]
+[%- END -%]
+);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertobject_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertobject_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertobject_at.tt	(revision 22005)
@@ -0,0 +1,8 @@
+AT_SETUP([[% table.namespace %]InsertObject()])
+AT_KEYWORDS([[% table.namespace %]InsertObject])
+
+AT_CHECK([dbsetup])
+AT_CHECK([insertobject])
+AT_CHECK([dbcleanup])
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertobject_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertobject_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertobject_c.tt	(revision 22005)
@@ -0,0 +1,39 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+
+int main ()
+{
+[% FOREACH table = tables -%]
+    {
+        psDB            *dbh;
+        [% indented(table.object_name, "*object") %];
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        object = [% table.object_name %]Alloc(
+[%- SET i = 0 -%]
+[%- FOREACH item = table.columns -%]
+    [%- IF i == 0 -%][%- i = 1 -%][%- ELSE -%], [% END -%] [%- item.test -%]
+[%- END -%]
+);
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (![% table.namespace %]InsertObject(dbh, object)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+        psDBCleanup(dbh);
+    }
+
+[% END -%]
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertobject_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertobject_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/insertobject_h.tt	(revision 22005)
@@ -0,0 +1,13 @@
+[% USE format -%]
+[% indented = format('%-15s %-20s') -%]
+/** Insert a single [% table.object_name %] object into a table
+ *
+ * This function constructs and inserts a single row based on it's parameters.
+ *
+ * @return true on success
+ */
+
+bool [% table.namespace %]InsertObject(
+    psDB            *dbh,               ///< Database handle
+    [% indented(table.object_name, "*object") %]///< [% table.object_name %] object
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/makefile.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/makefile.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/makefile.tt	(revision 22005)
@@ -0,0 +1,19 @@
+SHELL   = /bin/sh
+CFLAGS  = -g -O0 -pipe -fpic -Wall -pedantic -std=c99
+LIBS    = -lpslib
+CFLAGS += `mysql_config --cflags`
+LIBS   += `mysql_config --libs`
+
+
+objects=[% table.namespace %]db.o
+
+all: lib[% table.namespace %]db.so
+
+lib[% table.namespace %]db.so: $(objects)
+	$(CC) $(CFLAGS) -shared -o lib[% table.namespace %]db.so $(objects) $(LIBS)
+
+$(objects): %.o : %.c
+	$(CC) $(CFLAGS) -o $@ -c $<
+
+clean:
+	$(RM) *.so *.o core test
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/metadatafromobject.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/metadatafromobject.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/metadatafromobject.tt	(revision 22005)
@@ -0,0 +1,21 @@
+psMetadata *[% table.namespace %]MetadataFromObject(const [% table.object_name %] *object)
+{
+    psMetadata      *md;
+
+    md = psMetadataAlloc();
+[% FOREACH item = table.columns -%]
+[% IF item.type == "S32" or item.type == "F32" or item.type == "F64" -%]
+    if (!psMetadataAdd[% item.type %](md, PS_LIST_TAIL, "[% item.name %]", 0, NULL, object->[% item.name %])) {
+[% ELSIF item.type == "STR" -%]
+    if (!psMetadataAddStr(md, PS_LIST_TAIL, "[% item.name %]", 0, NULL, psStringCopy(object->[% item.name %]))) {
+[% ELSIF item.type == "BOOL" -%]
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "[% item.name %]", PS_DATA_BOOL, NULL, object->[% item.name %])) {
+[% END -%]
+        psError(PS_ERR_UNKNOWN, false, "failed to add item [% item.name %]");
+        psFree(md);
+        return NULL;
+    }
+[% END -%]
+
+    return md;
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/metadatafromobject_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/metadatafromobject_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/metadatafromobject_at.tt	(revision 22005)
@@ -0,0 +1,6 @@
+AT_SETUP([[% table.namespace %]MetadataFromObject()])
+AT_KEYWORDS([[% table.namespace %]MetadataFromObject])
+
+AT_CHECK([metadatafromobject])
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/metadatafromobject_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/metadatafromobject_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/metadatafromobject_c.tt	(revision 22005)
@@ -0,0 +1,53 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+#include <string.h>
+
+#define MAX_STRING_LENGTH 1024
+
+int main ()
+{
+[% FOREACH table = tables -%]
+    {
+        psMetadata      *md;
+        [% indented(table.object_name, "*object") %];
+        bool            status;
+
+        object = [% table.object_name %]Alloc(
+[%- SET i = 0 -%]
+[%- FOREACH item = table.columns -%]
+    [%- IF i == 0 -%][%- i = 1 -%][%- ELSE -%], [% END -%] [%- item.test -%]
+[%- END -%]
+);
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        md = [% table.namespace %]MetadataFromObject(object);
+        if (!md) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+
+[% FOREACH item = table.columns -%]
+[% IF item.type == "S32" or item.type == "F32" or item.type == "F64" -%]
+        if (!psMetadataLookup[% item.type %](&status, md, "[% item.name %]") == [% item.test %]) {
+[% ELSIF item.type == "STR" -%]
+        if (strncmp(psMetadataLookupPtr(&status, md, "[% item.name %]"), [% item.test %], MAX_STRING_LENGTH)) {
+[% ELSIF item.type == "BOOL" -%]
+        if (!psMetadataLookupBool(&status, md, "[% item.name %]") == [% item.test %]) {
+[% END -%]
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+[% END -%]
+
+        psFree(md);
+    }
+
+[% END -%]
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/metadatafromobject_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/metadatafromobject_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/metadatafromobject_h.tt	(revision 22005)
@@ -0,0 +1,10 @@
+[% USE format -%]
+[% indented = format('%-15s %-20s') -%]
+/** Convert a [% table.object_name %] into an equivalent psMetadata
+ *
+ * @return A psMetadata pointer or NULL on error
+ */
+
+psMetadata *[% table.namespace %]MetadataFromObject(
+    [% indented("const $table.object_name", "*object") %]///< fooRow to convert into a psMetadata
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/object_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/object_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/object_h.tt	(revision 22005)
@@ -0,0 +1,17 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+/** [% table.object_name %] data structure
+ *
+ * Structure for representing a single row of [% table.name %] table data.
+ */
+
+typedef struct {
+[% SET i = 0 -%]
+[% FOREACH item = table.columns -%]
+[% IF item.type == "STR" -%]
+    [% indented("char", "*$item.name") %];
+[% ELSE -%]
+    [% indented("$item.ctype", "$item.name") %];
+[% END -%]
+[% END -%]
+} [% table.object_name %];
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/objectfrommetadata.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/objectfrommetadata.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/objectfrommetadata.tt	(revision 22005)
@@ -0,0 +1,34 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+[% table.object_name %] *[% table.namespace %]ObjectFromMetadata(psMetadata *md)
+{
+    bool            status;
+[% FOREACH item = table.columns -%]
+[% IF item.type == "STR" -%]
+    [% indented("char", "*$item.name") %];
+[% ELSE-%]
+    [% indented("$item.ctype", "$item.name") %];
+[% END -%]
+[% END -%]
+
+[% FOREACH item = table.columns -%]
+[% IF item.type == "S32" or item.type == "F32" or item.type == "F64" -%]
+    [% item.name %] = psMetadataLookup[% item.type %](&status, md, "[% item.name %]");
+[% ELSIF item.type == "STR" -%]
+    [% item.name %] = psMetadataLookupPtr(&status, md, "[% item.name %]");
+[% ELSIF item.type == "BOOL" -%]
+    [% item.name %] = psMetadataLookupBool(&status, md, "[% item.name %]");
+[% END -%]
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item [% item.name %]");
+        return false;
+    }
+[% END -%]
+
+    return [% table.object_name %]Alloc(
+[%- SET i = 0 -%]
+[% FOREACH item = table.columns -%]
+[% IF i == 0 -%][%- i = 1 -%][% ELSE %], [% END -%]
+[% item.name %]
+[%- END -%]);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/objectfrommetadata_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/objectfrommetadata_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/objectfrommetadata_at.tt	(revision 22005)
@@ -0,0 +1,6 @@
+AT_SETUP([[% table.namespace %]ObjectFromMetadata()])
+AT_KEYWORDS([[% table.namespace %]ObjectFromMetadata])
+
+AT_CHECK([objectfrommetadata])
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/objectfrommetadata_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/objectfrommetadata_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/objectfrommetadata_c.tt	(revision 22005)
@@ -0,0 +1,55 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+#include <string.h>
+
+#define MAX_STRING_LENGTH 1024
+
+int main ()
+{
+[% FOREACH table = tables -%]
+    {
+        psMetadata      *md;
+        [% indented(table.object_name, "*object") %];
+
+        md = psMetadataAlloc();
+[% FOREACH item = table.columns -%]
+[% IF item.type == "S32" or item.type == "F32" or item.type == "F64" -%]
+        if (!psMetadataAdd[% item.type %](md, PS_LIST_TAIL, "[% item.name %]", 0, NULL, [% item.test %])) {
+[% ELSIF item.type == "STR" -%]
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "[% item.name %]", 0, NULL, [% item.test %])) {
+[% ELSIF item.type == "BOOL" -%]
+        if (!psMetadataAdd(md, PS_LIST_TAIL, "[% item.name %]", PS_DATA_BOOL, NULL, [% item.test %])) {
+[% END -%]
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+[% END -%]
+
+        object = [% table.namespace %]ObjectFromMetadata(md);
+        if (!object) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(md);
+
+[% FOREACH item = table.columns -%]
+[% IF item.type == "S32" or item.type == "F32" or item.type == "F64" or item.type == "BOOL" -%]
+        if (!object->[% item.name %] == [% item.test %]) {
+[% ELSIF item.type == "STR" -%]
+        if (strncmp(object->[% item.name %], [% item.test %], MAX_STRING_LENGTH)) {
+[% END -%]
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+[% END -%]
+
+        psFree(object);
+    }
+
+[% END -%]
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/objectfrommetadata_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/objectfrommetadata_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/objectfrommetadata_h.tt	(revision 22005)
@@ -0,0 +1,8 @@
+/** Convert a psMetadata into an equivalent fooRow
+ *
+ * @return A [% table.object_name %] pointer or NULL on error
+ */
+
+[% table.object_name %] *[% table.namespace %]ObjectFromMetadata(
+    psMetadata      *md                 ///< psMetadata to convert into a fooRow
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pkgconfig_pc_in.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pkgconfig_pc_in.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pkgconfig_pc_in.tt	(revision 22005)
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: @PACKAGE@
+Description: some library
+Version: @VERSION@
+Requires: pslib
+Libs: -L${libdir} -l@PACKAGE@
+Cflags: -I${includedir}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pop.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pop.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pop.tt	(revision 22005)
@@ -0,0 +1,75 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+bool [% table.namespace %]Pop(psDB *dbh, 
+[%- SET i = 0 -%]
+[% FOREACH item = table.columns -%]
+[% IF i == 0 %][% i = 1 %][% ELSE %], [% END -%]
+[% IF item.type == "STR" -%]
+char **[% item.name -%]
+[% ELSE -%]
+[% item.ctype %] *[% item.name -%]
+[% END -%]
+[% END %])
+{
+    psArray         *rowSet;
+    psMetadata      *row;
+    psMetadata      *popped;
+    long            deleted;
+    bool            status;
+    int             rowID;
+
+    rowSet = psDBSelectRows(dbh, [% table.namespace FILTER upper %]_TABLE_NAME, NULL, 1);
+    if (!rowSet) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item %s", [% table.namespace FILTER upper %]_INDEX_NAME);
+        psFree(rowSet);
+        return NULL;
+    }
+
+    row = psArrayGet(rowSet, 0);
+    // FIXME: psArrayGet should increment the ref count
+    psMemIncrRefCounter(row);
+    if (!row) {
+        psError(PS_ERR_UNKNOWN, true, "database error or table is empty");
+        return NULL;
+    }
+    psFree(rowSet);
+
+    rowID = psMetadataLookupS32(&status, row, [% table.namespace FILTER upper %]_INDEX_NAME);
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item %s", [% table.namespace FILTER upper %]_INDEX_NAME);
+        psFree(row);
+        return NULL;
+    }
+
+    popped = psMetadataAlloc();
+    psMetadataAddS32(popped, PS_LIST_TAIL, [% table.namespace FILTER upper %]_INDEX_NAME, 0, NULL, rowID);
+
+    deleted = psDBDeleteRows(dbh, [% table.namespace FILTER upper %]_TABLE_NAME, popped, 0);
+    if (deleted != 1) {
+        psError(PS_ERR_UNKNOWN, false, "database failed to delete row");
+        psFree(popped);
+        psFree(row);
+        return NULL;
+    }
+
+    psFree(popped);
+
+[% FOREACH item = table.columns -%]
+[% IF item.type == "S32" or item.type == "F32" or item.type == "F64" -%]
+    *[% item.name %] = psMetadataLookup[% item.type %](&status, row, "[% item.name %]");
+[% ELSIF item.type == "STR" -%]
+    *[% item.name %] = psMetadataLookupPtr(&status, row, "[% item.name %]");
+[% ELSIF item.type == "BOOL" -%]
+    *[% item.name %] = psMetadataLookupBool(&status, row, "[% item.name %]");
+[% END -%]
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item [% item.name %]");
+        psFree(row);
+        return false;
+    }
+[% END -%]
+
+    psFree(row);
+
+    return true;
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pop_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pop_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pop_at.tt	(revision 22005)
@@ -0,0 +1,10 @@
+AT_SETUP([[% table.namespace %]Pop()])
+AT_KEYWORDS([[% table.namespace %]Pop])
+
+AT_CHECK([dbsetup])
+# run insert so there is a row in the table
+AT_CHECK([insert])
+AT_CHECK([pop])
+AT_CHECK([dbcleanup])
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pop_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pop_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pop_c.tt	(revision 22005)
@@ -0,0 +1,43 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+
+int main ()
+{
+[% FOREACH table = tables -%]
+    {
+        psDB            *dbh;
+[% FOREACH item = table.columns -%]
+[% IF item.type == "STR" -%]
+        [% indented("char", "$item.name[256]") %];
+[% ELSE-%]
+        [% indented("$item.ctype", "$item.name") %];
+[% END -%]
+[% END -%]
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (![% table.namespace %]Pop(dbh, 
+[%- SET i = 0 -%]
+[% FOREACH item = table.columns -%]
+[% IF i == 0 %][% i = 1 %][% ELSE %], [% END -%]
+[% IF item.type == "STR" -%]
+(char **)&[% item.name -%]
+[% ELSE-%]
+&[% item.name -%]
+[% END -%]
+[% END %])) { 
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+[% END -%]
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pop_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pop_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/pop_h.tt	(revision 22005)
@@ -0,0 +1,19 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+/** Removes the last row from the database and returns it
+ *
+ * @return true on success
+ */
+
+bool [% table.namespace %]Pop(
+    psDB            *dbh,               ///< Database handle
+[%- SET i = 0 -%]
+[% FOREACH item = table.columns -%]
+[% IF i == 0 %][% i = 1 %][% ELSE %],[% END %]
+[% IF item.type == "STR" -%]
+    [% indented("char", "**$item.name") -%]
+[% ELSE -%]
+    [% indented("$item.ctype", "*$item.name") -%]
+[% END -%]
+[% END %]
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popfits.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popfits.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popfits.tt	(revision 22005)
@@ -0,0 +1,24 @@
+bool [% table.namespace %]PopFits(psDB *dbh, psFits *fits, unsigned long long limit)
+{
+    char            query[MAX_STRING_LENGTH];
+
+    if (![% table.namespace %]SelectRowsFits(dbh, fits, NULL, limit)) {
+        psError(PS_ERR_UNKNOWN, true, "database error or table is empty");
+        return false;
+    }
+
+    // remove limit rows from the end of the database
+    if (snprintf(query, MAX_STRING_LENGTH,
+                "DELETE FROM %s ORDER BY %s DESC LIMIT %lld",
+                [% table.namespace FILTER upper %]_TABLE_NAME, [% table.namespace FILTER upper %]_INDEX_NAME, limit) < 0) {
+        psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %s bytes", MAX_STRING_LENGTH);
+        return false;
+    }
+            
+    if (!p_psDBRunQuery(dbh, query)) {
+        psError(PS_ERR_UNKNOWN, false, "database query failed");
+        return false;
+    }
+
+    return true;
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popfits_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popfits_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popfits_at.tt	(revision 22005)
@@ -0,0 +1,13 @@
+AT_SETUP([[% table.namespace %]PopFits()])
+AT_KEYWORDS([[% table.namespace %]PopFits])
+
+AT_CHECK([dbsetup])
+# run insert so there is a row in the table
+AT_CHECK([insert])
+AT_CHECK([popfits])
+AT_CHECK([dbcleanup])
+if [ test -f "blargh" ] ; then
+    rm -f "blargh"
+fi
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popfits_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popfits_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popfits_c.tt	(revision 22005)
@@ -0,0 +1,40 @@
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#define TMP_FILENAME "./blargh"
+
+int main ()
+{
+[% FOREACH table = tables -%]
+    {
+        psDB            *dbh;
+        psFits          *fits;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        // allocate a temp
+        fits = psFitsOpen(TMP_FILENAME, "w");
+        if (!fits) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (![% table.namespace %]PopFits(dbh, fits, 1)) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (!psFitsClose(fits)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psDBCleanup(dbh);
+    }
+
+[% END -%]
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popfits_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popfits_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popfits_h.tt	(revision 22005)
@@ -0,0 +1,13 @@
+/** Removes the last limit row from the database and returns them in a binary FITS table.
+ *
+ * This function assumes an empty psFits object and will create a FITS table as
+ * the first extension. 
+ *
+ * @return true on success
+ */
+
+bool [% table.namespace %]PopFits(
+    psDB            *dbh,               ///< Database handle
+    psFits          *fits,              ///< psFits object
+    unsigned long long limit            ///< Maximum number of elements to return
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popobject.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popobject.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popobject.tt	(revision 22005)
@@ -0,0 +1,33 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+[% table.object_name %] *[% table.namespace %]PopObject(psDB *dbh)
+{
+[% FOREACH item = table.columns -%]
+[% IF item.type == "STR" -%]
+    [% indented("char", "$item.name[256]") %];
+[% ELSE-%]
+    [% indented("$item.ctype", "$item.name") %];
+[% END -%]
+[% END -%]
+
+    if (![% table.namespace %]Pop(dbh, 
+[%- SET i = 0 -%]
+[% FOREACH item = table.columns -%]
+[% IF i == 0 %][% i = 1 %][% ELSE %], [% END -%]
+[% IF item.type == "STR" -%]
+(char **)&[% item.name -%]
+[% ELSE-%]
+&[% item.name -%]
+[% END -%]
+[% END %])) {
+        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
+        return NULL;
+    }
+
+    return [% table.object_name %]Alloc(
+[%- SET i = 0 -%]
+[% FOREACH item = table.columns -%]
+[% IF i == 0 -%][%- i = 1 -%][% ELSE %], [% END -%]
+[% item.name %]
+[%- END -%]);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popobject_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popobject_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popobject_at.tt	(revision 22005)
@@ -0,0 +1,10 @@
+AT_SETUP([[% table.namespace %]PopObject()])
+AT_KEYWORDS([[% table.namespace %]PopObject])
+
+AT_CHECK([dbsetup])
+# run insert so there is a row in the table
+AT_CHECK([insert])
+AT_CHECK([popobject])
+AT_CHECK([dbcleanup])
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popobject_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popobject_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popobject_c.tt	(revision 22005)
@@ -0,0 +1,30 @@
+[% USE format -%]
+[% indented = format('%-15s %s') -%]
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+
+int main ()
+{
+[% FOREACH table = tables -%]
+    {
+        psDB            *dbh;
+        [% indented(table.object_name, "*object") %];
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        object = [% table.namespace %]PopObject(dbh);
+        if (!object) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(object);
+        psDBCleanup(dbh);
+    }
+
+[% END -%]
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popobject_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popobject_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/popobject_h.tt	(revision 22005)
@@ -0,0 +1,8 @@
+/** Removes the last row from the database and returns it
+ *
+ * @return A new [% table.object_name %] on success or NULL on failure.
+ */
+
+[% table.object_name %] *[% table.namespace %]PopObject(
+    psDB            *dbh                ///< Database handle
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowobjects.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowobjects.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowobjects.tt	(revision 22005)
@@ -0,0 +1,33 @@
+psArray *[% table.namespace %]SelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
+{
+    psArray         *rowSet;
+    psArray         *returnSet;
+    psU64           i;
+
+    rowSet = psDBSelectRows(dbh, [% table.namespace FILTER upper %]_TABLE_NAME, where, limit);
+    if (!rowSet) {
+        return false;
+    }
+
+    // strip index column
+    for (i = 0; i < rowSet->n; i++) {
+        if (!psMetadataRemove((psMetadata *)(rowSet->data[i]), 0, [% table.namespace FILTER upper %]_INDEX_NAME)) {
+            psError(PS_ERR_UNKNOWN, true, "failed to remove item %s", [% table.namespace FILTER upper %]_INDEX_NAME);
+            psFree(rowSet);
+            return false;
+        }
+    }
+
+    // convert psMetadata rows to row objects
+
+    returnSet = psArrayAlloc(rowSet->n);
+    returnSet->n = 0;
+
+    for (i = 0; i < rowSet->n; i++) {
+        psArrayAdd(returnSet, 0, [% table.namespace %]ObjectFromMetadata(rowSet->data[i]));
+    }
+
+    psFree(rowSet);
+
+    return returnSet;
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowobjects_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowobjects_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowobjects_h.tt	(revision 22005)
@@ -0,0 +1,12 @@
+/** Selects up to limit rows from the database and returns as [% table.object_name %] objects in a psArray
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return A psArray pointer or NULL on error
+ */
+
+psArray *[% table.namespace %]SelectRowObjects(
+    psDB            *dbh,               ///< Database handle
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to return
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowsfits.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowsfits.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowsfits.tt	(revision 22005)
@@ -0,0 +1,37 @@
+bool [% table.namespace %]SelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)
+{
+    psArray         *rowSet;
+    psU64           i;
+
+    rowSet = psDBSelectRows(dbh, [% table.namespace FILTER upper %]_TABLE_NAME, where, limit);
+    if (!rowSet) {
+        return false;
+    }
+
+    // strip index column
+    for (i = 0; i < rowSet->n; i++) {
+        if (!psMetadataRemove((psMetadata *)rowSet->data[i], 0, [% table.namespace FILTER upper %]_INDEX_NAME)) {
+            psError(PS_ERR_UNKNOWN, true, "failed to remove item %s", [% table.namespace FILTER upper %]_INDEX_NAME);
+            psFree(rowSet);
+            return false;
+        }
+    }
+
+    // output to fits
+    if (!psFitsWriteTable(fits, NULL, rowSet)) {
+        psError(PS_ERR_UNKNOWN, false, "FITS table write failed");
+        psFree(rowSet);
+        return false;
+    }
+
+    // FIXME: needs to be after a new ext is written?
+    if (!psFitsSetExtName(fits, [% table.namespace FILTER upper %]_TABLE_NAME)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to set FITS HDU extension name");
+        psFree(rowSet);
+        return false;
+    }
+
+    psFree(rowSet);
+
+    return true;
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowsfits_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowsfits_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowsfits_at.tt	(revision 22005)
@@ -0,0 +1,13 @@
+AT_SETUP([[% table.namespace %]SelectRowsFits()])
+AT_KEYWORDS([[% table.namespace %]SelectRowsFits])
+
+AT_CHECK([dbsetup])
+# run insert so there is a row in the table
+AT_CHECK([insert])
+AT_CHECK([selectrowsfits])
+AT_CHECK([dbcleanup])
+if [ test -f "blargh" ] ; then
+    rm -f "blargh"
+fi
+
+AT_CLEANUP
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowsfits_c.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowsfits_c.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowsfits_c.tt	(revision 22005)
@@ -0,0 +1,34 @@
+#include <pslib.h>
+#include <[% pkg_name %].h>
+#include <stdlib.h>
+
+#define TMP_FILENAME "./blargh"
+
+int main ()
+{
+[% FOREACH table = tables -%]
+    {
+        psDB            *dbh;
+        psFits          *fits;
+
+        dbh = psDBInit("localhost", "test", NULL, "test");
+        if (!dbh) {
+            exit(EXIT_FAILURE);
+        }
+
+        fits = psFitsOpen(TMP_FILENAME, "w");
+        if (!fits) {
+            exit(EXIT_FAILURE);
+        }
+
+        if (![% table.namespace %]SelectRowsFits(dbh, fits, NULL, 1)) {
+            exit(EXIT_FAILURE);
+        }
+
+        psFree(fits);
+        psDBCleanup(dbh);
+    }
+
+[% END -%]
+    exit(EXIT_SUCCESS);
+}
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowsfits_h.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowsfits_h.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/selectrowsfits_h.tt	(revision 22005)
@@ -0,0 +1,16 @@
+/** Selects up to limit from the database and returns them in a binary FITS table
+ *
+ * This function assumes an empty psFits object and will create a FITS table
+ * as the first extension.
+ *
+ *  See psDBSelectRows() for documentation on the format of where.
+ *
+ * @return true on success
+ */
+
+bool [% table.namespace %]SelectRowsFits(
+    psDB            *dbh,               ///< Database handle
+    psFits          *fits,              ///< psFits object
+    const psMetadata *where,            ///< Row match criteria
+    unsigned long long limit            ///< Maximum number of elements to return
+);
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/src_makefile_am.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/src_makefile_am.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/src_makefile_am.tt	(revision 22005)
@@ -0,0 +1,10 @@
+AM_CFLAGS = @[% pkg_name %]_CFLAGS@
+
+include_HEADERS = [% pkg_name %].h
+lib_LTLIBRARIES = lib[% pkg_name %].la
+lib[% pkg_name %]_la_CFLAGS  = $(PSLIB_CFLAGS) $(AM_CFLAGS)
+lib[% pkg_name %]_la_LIBS    = $(PSLIB_LIBS) $(AM_LIBS)
+lib[% pkg_name %]_la_LDFLAGS = -release $(PACKAGE_VERSION)
+lib[% pkg_name %]_la_SOURCES = \
+    [% pkg_name %].h \
+    [% pkg_name %].c
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/tests_makefile_am.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/tests_makefile_am.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/tests_makefile_am.tt	(revision 22005)
@@ -0,0 +1,67 @@
+# copied from bison-1.875d
+
+EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4
+
+DISTCLEANFILES       = atconfig $(check_SCRIPTS)
+MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
+
+## ------------ ##
+## package.m4.  ##
+## ------------ ##
+
+$(srcdir)/package.m4: $(top_srcdir)/configure.ac
+	{					\
+	  echo '# Signature of the current package.'; \
+	  echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])'; \
+	  echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])'; \
+	  echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])'; \
+	  echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])'; \
+	  echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+	} >$(srcdir)/package.m4
+
+## ------------ ##
+## Test suite.  ##
+## ------------ ##
+
+TESTSUITE = $(srcdir)/testsuite
+
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(TESTSUITE): package.m4 $(TESTSUITE_AT)
+	$(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
+	mv $@.tmp $@
+
+atconfig: $(top_builddir)/config.status
+	cd $(top_builddir) && ./config.status tests/$@
+
+clean-local:
+	test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
+
+check-local: atconfig $(TESTSUITE)
+	$(SHELL) $(TESTSUITE)
+
+#
+# END BISON
+#
+
+UNITS = \
+	alloc \
+	init \
+	cleanup \
+	createtable \
+    droptable \
+    insert \
+    pop \
+    insertobject \
+    popobject \
+    insertfits \
+    popfits \
+    selectrowsfits \
+    metadatafromobject \
+    objectfrommetadata
+
+AM_CPPFLAGS = -I$(top_srcdir)/src$
+AM_CFLAGS   = @[% pkg_name %]_CFLAGS@ $(PSLIB_CFLAGS)$
+AM_LDFLAGS  = $(PSLIB_LIBS)$
+LDADD       = $(top_builddir)/src/lib[% pkg_name %].la$
+
+check_PROGRAMS = dbsetup dbcleanup $(UNITS)
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/testsuite_at.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/testsuite_at.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/testsuite_at.tt	(revision 22005)
@@ -0,0 +1,33 @@
+m4_version_prereq([2.59])
+
+AT_INIT
+
+###
+[% INCLUDE alloc_at.tt %]
+###
+[% INCLUDE init_at.tt %]
+###
+[% INCLUDE cleanup_at.tt %]
+###
+[% INCLUDE createtable_at.tt %]
+###
+[% INCLUDE droptable_at.tt %]
+###
+[% INCLUDE insert_at.tt %]
+###
+[% INCLUDE pop_at.tt %]
+###
+[% INCLUDE insertobject_at.tt %]
+###
+[% INCLUDE popobject_at.tt %]
+###
+[% INCLUDE insertfits_at.tt %]
+###
+[% INCLUDE popfits_at.tt %]
+###
+[% INCLUDE selectrowsfits_at.tt %]
+###
+[% INCLUDE metadatafromobject_at.tt %]
+###
+[% INCLUDE objectfrommetadata_at.tt %]
+###
Index: /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/top_makefile_am.tt
===================================================================
--- /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/top_makefile_am.tt	(revision 22005)
+++ /tags/ipp-1-X/rel-0_07/glueforge/templates/psdb/top_makefile_am.tt	(revision 22005)
@@ -0,0 +1,30 @@
+SUBDIRS = src tests
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA= [% pkg_name %].pc
+
+EXTRA_DIST = [% pkg_name %].pc.in Doxyfile.in
+
+if DOXYGEN
+
+man_MANS = \
+    $(top_builddir)/docs/man/man3/[% pkg_name %].3 \
+[%- FOREACH table = tables %]
+[% IF NOT loop.last -%]
+    $(top_builddir)/docs/man/man3/[% table.object_name %].3 \
+[%- ELSE -%]
+    $(top_builddir)/docs/man/man3/[% table.object_name %].3 
+[% END -%]
+[% END %]
+
+docs/man/man3/[% pkg_name %].3
+[%- FOREACH table = tables -%]
+ docs/man/man3/[% table.object_name %].3
+[%- IF loop.last %]:[% END -%]
+[%- END %]
+	$(DOXYGEN)
+
+endif
+
+clean-local:
+	-rm -rf docs
