Index: /gs2-extensions/parallel-building/trunk/src/perllib/dbutil/gdbml.pm
===================================================================
--- /gs2-extensions/parallel-building/trunk/src/perllib/dbutil/gdbml.pm	(revision 27370)
+++ /gs2-extensions/parallel-building/trunk/src/perllib/dbutil/gdbml.pm	(revision 27371)
@@ -1,7 +1,7 @@
 ###########################################################################
 #
-# dbutil::gdbml -- utility functions for writing to gdbm databases
-#
-# Adding file locking to allow for multiple readers/writers (albeit slow)
+# dbutil::gdbml -- extends the dbutil::gdbm class by adding simple file
+# locking so as to allow for multiple readers/writers (albeit slow and not
+# supported over network filesystems)
 #
 # A component of the Greenstone digital library software
@@ -9,5 +9,5 @@
 # University of Waikato, New Zealand.
 #
-# Copyright (C) 2009
+# Copyright (C) 2013
 #
 # This program is free software; you can redistribute it and/or modify
@@ -31,5 +31,10 @@
 use strict;
 
-use dbutil::gdbmtxtgz;
+use dbutil::gdbm;
+
+BEGIN
+{
+  @dbutil::gdbml::ISA = ('dbutil::gdbm');
+}
 
 # -----------------------------------------------------------------------------
@@ -45,5 +50,4 @@
   # also, we assume the path is correct to find the executable [jmt12]
   my $txt2db_exe = "txt2dbl" . &util::get_os_exe();
-  #my $txt2db_exe = "txt2db" . &util::get_os_exe();
   my $infodb_file_handle = undef;
   my $cmd = "\"$txt2db_exe\"";
@@ -52,11 +56,4 @@
   }
   $cmd .= " \"$infodb_file_path\"";
-
-  # Why? Why do you hate me? [jmt12]
-#  if (!-e "$txt2db_exe")
-#  {
-#      print STDERR "Error: Unable to find $txt2db_exe\n";
-#      return undef;
-#  }
 
   if(!open($infodb_file_handle, "| $cmd"))
@@ -74,23 +71,4 @@
 
 
-
-sub close_infodb_write_handle
-{
-  my $infodb_handle = shift(@_);
-  close($infodb_handle);
-}
-
-
-sub get_infodb_file_path
-{
-  my $collection_name = shift(@_);
-  my $infodb_directory_path = shift(@_);
-
-  my $infodb_file_extension = ".gdb";
-  my $infodb_file_name = &util::get_dirsep_tail($collection_name) . $infodb_file_extension;
-  return &util::filename_cat($infodb_directory_path, $infodb_file_name);
-}
-
-
 sub read_infodb_file
 {
@@ -99,6 +77,5 @@
 
   # note the use of locking enabled db2txt [jmt12]
-  open (PIPEIN, "db2txtl \"$infodb_file_path\" |") 
-      || die "couldn't open pipe from db2txt \$infodb_file_path\"\n";
+  open (PIPEIN, "db2txtl \"$infodb_file_path\" |") || die "couldn't open pipe from db2txt \$infodb_file_path\"\n";
 
   binmode(PIPEIN,":utf8");
@@ -130,79 +107,6 @@
 sub read_infodb_keys
 {
-  my $infodb_file_path = shift(@_);
-  my $infodb_map = shift(@_);
-
   die("[gdbmkeys] not implemented for parallel building");
-
-  open (PIPEIN, "gdbmkeys \"$infodb_file_path\" |") 
-      || die "couldn't open pipe from gdbmkeys \$infodb_file_path\"\n";
-
-  binmode(PIPEIN,":utf8");
-
-  my $infodb_line = "";
-  my $infodb_key = "";
-  my $infodb_value = "";
-  while (defined ($infodb_line = <PIPEIN>))
-  {
-      chomp $infodb_line; # remove end of line 
-
-      $infodb_map->{$infodb_line} = 1;
-  }
-
-  close (PIPEIN);
 }
-
-sub write_infodb_entry
-{
-  # With infodb_handle already set up, works the same as _gdbm_txtgz version
-  &dbutil::gdbmtxtgz::write_infodb_entry(@_);
-}
-
-sub write_infodb_rawentry
-{
-  # With infodb_handle already set up, works the same as _gdbm_txtgz version
-  &dbutil::gdbmtxtgz::write_infodb_rawentry(@_);
-}
-
-
-sub set_infodb_entry_OLD
-{
-    my $infodb_file_path = shift(@_);
-    my $infodb_key = shift(@_);
-    my $infodb_map = shift(@_);
-  
-    # Protect metadata values that go inside quotes for gdbmset
-    foreach my $k (keys %$infodb_map) {
-	  my @escaped_v = ();
-	  foreach my $v (@{$infodb_map->{$k}}) {
-	    if ($k eq "contains") {
-		  # protect quotes in ".2;".3 etc
-		  $v =~ s/\"/\\\"/g;
-		  push(@escaped_v, $v);
-	    }
-	    else {
-		  my $ev = &ghtml::unescape_html($v);
-		  $ev =~ s/\"/\\\"/g;
-		  push(@escaped_v, $ev);
-	    }
-	  }
-	  $infodb_map->{$k} = \@escaped_v;
-	}
-	
-    # Generate the record string
-    my $serialized_infodb_map = &dbutil::convert_infodb_hash_to_string($infodb_map);
-##    print STDERR "**** ser dr\n$serialized_infodb_map\n\n\n";
-
-    die("[gdbmset] not implemented for parallel building");
-
-    # Store it into GDBM
-    my $cmd = "gdbmset \"$infodb_file_path\" \"$infodb_key\" \"$serialized_infodb_map\"";
-    my $status = system($cmd);
-
-    return $status;
-  
-}
-
-
 
 sub set_infodb_entry
@@ -233,5 +137,4 @@
     # Store it into GDBM using 'txt2db -append' which despite its name
     # actually replaces the record if it already exists
-
     # note the use of locking enabled txt2db [jmt12]
     my $cmd = "txt2dbl -append \"$infodb_file_path\"";
@@ -257,12 +160,3 @@
 }
 
-
-sub delete_infodb_entry
-{
-  # With infodb_handle already set up, works the same as _gdbm_txtgz version
-  &dbutil::gdbmtxtgz::delete_infodb_entry(@_);
-}
-
-
-
 1;
