Index: /gsdl/trunk/perllib/basebuilder.pm
===================================================================
--- /gsdl/trunk/perllib/basebuilder.pm	(revision 14198)
+++ /gsdl/trunk/perllib/basebuilder.pm	(revision 14199)
@@ -26,7 +26,4 @@
 package basebuilder;
 
-use strict;
-no strict 'refs'; # allow filehandles to be variables and viceversa
-
 use classify;
 use cfgread;
@@ -57,9 +54,9 @@
 	$maxdocs, $debug, $keepold, $incremental, $incremental_dlc,
 	$remove_empty_classifications, 
-	$outhandle, $no_text, $failhandle, $gli) = @_;
-
-    $outhandle = *STDERR unless defined $outhandle;
+	$outhandle, $no_text, $failhandle, $gli, $disable_OAI) = @_;
+
+    $outhandle = STDERR unless defined $outhandle;
     $no_text = 0 unless defined $no_text;
-    $failhandle = *STDERR unless defined $failhandle;
+    $failhandle = STDERR unless defined $failhandle;
 
     # create a builder object
@@ -78,16 +75,28 @@
 		      'failhandle'=>$failhandle,
 		      'notbuilt'=>{},    # indexes not built
-		      'gli'=>$gli
+		      'gli'=>$gli,
+		      'disable_OAI'=>$disable_OAI
 		      }, $class;
 
     $self->{'gli'} = 0 unless defined $self->{'gli'};
-
-    # Read in the collection configuration file.
-    my ($colcfgname);
-    ($colcfgname, $gs_mode) = &colcfg::get_collect_cfg_name($outhandle);
-    if ($gs_mode eq "gs2") {
-        $self->{'collect_cfg'} = &colcfg::read_collect_cfg ($colcfgname);
-    } elsif ($gs_mode eq "gs3") {
-	$self->{'collect_cfg'} = &colcfg::read_collection_cfg_xml ($colcfgname);
+    $self->{'disable_OAI'} = 0 unless defined $self->{'disable_OAI'};
+    
+    # read in the collection configuration file
+    my $colcfgname = "$ENV{'GSDLCOLLECTDIR'}/etc/collect.cfg";
+    if (-e $colcfgname) {
+      ##$self->{'collect_cfg'} = &colcfg::read_collection_cfg_xml ($colcfgname);
+      $self->{'collect_cfg'} = &colcfg::read_collect_cfg ($colcfgname);
+      $gs_mode = "gs2";
+    }
+    else {
+      my $colcfgname = "$ENV{'GSDLCOLLECTDIR'}/etc/collectionConfig.xml";
+      if (!-e $colcfgname) {
+	die "mgbuilder::new - couldn't find collectionConfig.xml for collection $collection\n";
+      }
+      else {
+	#$self->{'collect_cfg'} = &colcfg::read_collect_cfg ($colcfgname);
+        $self->{'collect_cfg'} = &colcfg::read_collection_cfg_xml ($colcfgname);
+	$gs_mode = "gs3";
+      }
     }
     
@@ -187,11 +196,5 @@
     my ($buildprocdir, $buildproctype);
     my $collection = $self->{'collection'};
-    if (-e "$ENV{'GSDLCOLLECTDIR'}/custom/${collection}/perllib/custombuildproc.pm") {
-	$buildprocdir = "$ENV{'GSDLCOLLECTDIR'}/custom/${collection}/perllib";
-	$buildproctype = "custombuildproc";
-    } elsif (-e "$ENV{'GSDLCOLLECTDIR'}/perllib/custombuildproc.pm") {
-	$buildprocdir = "$ENV{'GSDLCOLLECTDIR'}/perllib";
-	$buildproctype = "custombuildproc";
-    } elsif (-e "$ENV{'GSDLCOLLECTDIR'}/perllib/${collection}buildproc.pm") {
+    if (-e "$ENV{'GSDLCOLLECTDIR'}/perllib/${collection}buildproc.pm") {
 	$buildprocdir = "$ENV{'GSDLCOLLECTDIR'}/perllib";
 	$buildproctype = "${collection}buildproc";
@@ -237,4 +240,11 @@
     $self->{'maxnumeric'} = $maxnumeric;
 }
+# It seems we don't need this sub
+#sub set_disable_OAI {
+#    my $disable_OAI = shift (@_);
+#    my ($disable_OAI = @_;
+#
+#    $self->{'disable_OAI'} = $disable_OAI;
+#}
 sub set_strip_html {
     my $self = shift (@_);
@@ -269,5 +279,7 @@
     # and their directory names (includes subcolls and langs)
     $self->{'index_mapping'} = $self->create_index_mapping ($indexes);
-   
+
+    my $indexmap = $self->{'index_mapping'}->{'indexmap'};
+
     # build each of the indexes
     foreach my $index (@$indexes) {
@@ -339,5 +351,5 @@
     my ($handle);
     if ($self->{'debug'}) {
-	$handle = *STDOUT;
+	$handle = STDOUT;
     } else {
 	if (!-e "$txt2db_exe" || !open (PIPEOUT, "| txt2db$exe \"$fulldbname\"")) {
@@ -345,5 +357,5 @@
 	    die "builder::make_infodatabase - couldn't run $txt2db_exe\n";
 	}
-	$handle = *PIPEOUT;
+	$handle = basebuilder::PIPEOUT;
     }
     
@@ -427,5 +439,8 @@
     $build_cfg->{'numsections'} = $self->{'buildproc'}->get_num_sections();
     $build_cfg->{'numbytes'} = $self->{'buildproc'}->get_num_bytes();
-    
+
+    # store whether to disable OAI service
+    $build_cfg->{'disable_OAI'} = $self->{'disable_OAI'};
+        
     # store the mapping between the index names and the directory names
     # the index map is used to determine what indexes there are, so any that are not built should not be put into the map.
@@ -463,7 +478,9 @@
 
     if ($gs_mode eq "gs2") {
-      &colcfg::write_build_cfg("$self->{'build_dir'}/build.cfg", $build_cfg);
+      &colcfg::write_build_cfg_xml("$self->{'build_dir'}/buildConfig.xml", $build_cfg, $self->{'collect_cfg'});
+      ##&colcfg::write_build_cfg("$self->{'build_dir'}/build.cfg", $build_cfg);
     }
     if ($gs_mode eq "gs3") {
+      ##&colcfg::write_build_cfg("$self->{'build_dir'}/build.cfg", $build_cfg);
       &colcfg::write_build_cfg_xml("$self->{'build_dir'}/buildConfig.xml", $build_cfg, $self->{'collect_cfg'});
     }    
