Index: main/trunk/greenstone2/perllib/FileUtils.pm
===================================================================
--- main/trunk/greenstone2/perllib/FileUtils.pm	(revision 37194)
+++ main/trunk/greenstone2/perllib/FileUtils.pm	(revision 37200)
@@ -244,64 +244,4 @@
 }
 
-sub copyFilesDEPRECATED
-{
-  my $dest = pop (@_);
-  my (@srcfiles) = @_;
-
-  # remove trailing slashes from source and destination files
-  $dest =~ s/[\\\/]+$//;
-  map {$_ =~ s/[\\\/]+$//;} @srcfiles;
-
-  # a few sanity checks
-  if (scalar (@srcfiles) == 0)
-  {
-    print STDERR "FileUtils::copyFiles() no destination directory given\n";
-    return 0;
-  }
-  elsif ((scalar(@srcfiles) > 1) && (!-d $dest))
-  {
-    print STDERR "FileUtils::copyFiles() if multiple source files are given the destination must be a directory\n";
-    return 0;
-  }
-
-  my $had_an_error = 0;
-  
-  # copy the files
-  foreach my $file (@srcfiles)
-  {
-    my $tempdest = $dest;
-    if (-d $tempdest)
-    {
-      my ($filename) = $file =~ /([^\\\/]+)$/;
-      $tempdest .= "/$filename";
-    }
-    if (!-e $file)
-    {
-	print STDERR "FileUtils::copyFiles() $file does not exist\n";
-	$had_an_error = 1;
-    }
-    elsif (!-f $file)
-    {
-	print STDERR "FileUtils::copyFiles() $file is not a regular file\n";
-	$had_an_error = 1;
-    }
-    else
-    {
-	my $success = &File::Copy::copy ($file, $tempdest);
-	if (!$success) {
-	    $had_an_error = 1;
-	}
-    }
-  }
-
-  if ($had_an_error) {
-      return 0;
-  }
-  else {
-      # true => everything OK
-      return 1;
-  }
-
-}
 ## copyFiles()
 
@@ -391,47 +331,4 @@
     return ($ret_val_success,$fullpath_files_and_dirs);
 }
-
-sub readdirFullpathDEPRECATED
-{
-    my ($src_dir_fullpath,$options) = @_;
-    
-    my $ret_val_success = 1; # default (true) is to assume things will work out!
-    
-    my $fullpath_files_and_dirs = [];
-
-    my $exclude_filter_re = undef;
-    my $include_filter_re = undef;
-    if (defined $options) {
-	$exclude_filter_re = $options->{'exclude_filter_re'};
-	$include_filter_re = $options->{'include_filter_re'};
-    }
-    
-    # get the contents of this directory
-    if (!opendir(INDIR, $src_dir_fullpath))
-    {
-	print STDERR "FileUtils::readdirFullpath() could not open directory $src_dir_fullpath\n";
-	$ret_val_success = 0;	
-    }
-    else
-    {
-	my @next_files_and_dirs = readdir(INDIR);
-	closedir (INDIR);
-
-	foreach my $f_or_d (@next_files_and_dirs)
-	{
-	    next if $f_or_d =~ /^\.\.?$/;
-	    next if (defined $exclude_filter_re && ($f_or_d =~ m/$exclude_filter_re/));
-	    
-	    if ((!defined $include_filter_re) || ($f_or_d =~ m/$include_filter_re/)) {
-		my $ff_or_dd = &filenameConcatenate($src_dir_fullpath, $f_or_d);
-		push(@$fullpath_files_and_dirs,$ff_or_dd);
-	    }
-	}
-
-    }
-
-    return ($ret_val_success,$fullpath_files_and_dirs);
-}
-
 
 		    
@@ -646,71 +543,4 @@
 }
 
-sub copyFilesRecursiveDEPRECATED
-{
-  my $dest = pop (@_);
-  my (@srcfiles) = @_;
-
-  # a few sanity checks
-  if (scalar (@srcfiles) == 0)
-  {
-    print STDERR "FileUtils::copyFilesRecursive() no destination directory given\n";
-    return;
-  }
-  elsif (-f $dest)
-  {
-    print STDERR "FileUtils::copyFilesRecursive() destination must be a directory\n";
-    return;
-  }
-
-  # create destination directory if it doesn't exist already
-  if (! -d $dest)
-  {
-    my $store_umask = umask(0002);
-    mkdir ($dest, 0777);
-    umask($store_umask);
-  }
-
-  # copy the files
-  foreach my $file (@srcfiles)
-  {
-
-    if (!-e $file)
-    {
-      print STDERR "FileUtils::copyFilesRecursive() $file does not exist\n";
-    }
-    elsif (-d $file)
-    {
-      # make the new directory
-      my ($filename) = $file =~ /([^\\\/]*)$/;
-      $dest = &filenameConcatenate($dest, $filename);
-      my $store_umask = umask(0002);
-      mkdir ($dest, 0777);
-      umask($store_umask);
-
-      # get the contents of this directory
-      if (!opendir (INDIR, $file))
-      {
-        print STDERR "FileUtils::copyFilesRecursive() could not open directory $file\n";
-      }
-      else
-      {
-        my @filedir = readdir (INDIR);
-        closedir (INDIR);
-        foreach my $f (@filedir)
-        {
-          next if $f =~ /^\.\.?$/;
-          # copy all the files in this directory
-          my $ff = &filenameConcatenate($file, $f);
-          &copyFilesRecursiveDEPRECATED($ff ,$dest);
-        }
-      }
-
-    }
-    else
-    {
-      &copyFiles($file, $dest);
-    }
-  }
-}
 ## copyFilesRecursive()
 
@@ -733,158 +563,21 @@
 }
 
-sub copyFilesRecursiveNoSVNDEPRECATED
+## copyFilesRecursiveNoSVN()
+
+
+## @function copyFilesRecursiveTopLevel()
+#
+# copies a directory and its contents, excluding subdirectories, into a new directory
+#
+# another candidate for merging in with copyFilesRecursive() - jmt12
+#
+sub copyFilesRecursiveTopLevel
 {
   my $dest = pop (@_);
   my (@srcfiles) = @_;
 
-  # a few sanity checks
-  if (scalar (@srcfiles) == 0)
-  {
-    print STDERR "FileUtils::copyFilesRecursiveNoSVN() no destination directory given\n";
-    return;
-  }
-  elsif (-f $dest)
-  {
-    print STDERR "FileUtils::copyFilesRecursiveNoSVN() destination must be a directory\n";
-    return;
-  }
-
-  # create destination directory if it doesn't exist already
-  if (! -d $dest)
-  {
-    my $store_umask = umask(0002);
-    mkdir ($dest, 0777);
-    umask($store_umask);
-  }
-
-  # copy the files
-  foreach my $file (@srcfiles)
-  {
-    if (!-e $file)
-    {
-      print STDERR "copyFilesRecursiveNoSVN() $file does not exist\n";
-    }
-    elsif (-d $file)
-    {
-      # make the new directory
-      my ($filename) = $file =~ /([^\\\/]*)$/;
-      $dest = &filenameConcatenate($dest, $filename);
-      my $store_umask = umask(0002);
-      mkdir ($dest, 0777);
-      umask($store_umask);
-
-      # get the contents of this directory
-      if (!opendir (INDIR, $file))
-      {
-        print STDERR "copyFilesRecursiveNoSVN() could not open directory $file\n";
-      }
-      else
-      {
-        my @filedir = readdir (INDIR);
-        closedir (INDIR);
-        foreach my $f (@filedir)
-        {
-          next if $f =~ /^\.\.?$/;
-          next if $f =~ /^\.svn$/;
-          # copy all the files in this directory
-          my $ff = &filenameConcatenate($file, $f);
-          # util.pm version incorrectly called cp_r here - jmt12
-          &copyFilesRecursiveNoSVNDEPRECATED($ff ,$dest);
-        }
-      }
-    }
-    else
-    {
-      &copyFiles($file, $dest);
-    }
-  }
-}
-## copyFilesRecursiveNoSVN()
-
-
-## @function copyFilesRecursiveTopLevel()
-#
-# copies a directory and its contents, excluding subdirectories, into a new directory
-#
-# another candidate for merging in with copyFilesRecursive() - jmt12
-#
-sub copyFilesRecursiveTopLevel
-{
-  my $dest = pop (@_);
-  my (@srcfiles) = @_;
-
   return _copyFilesRecursiveGeneral(\@srcfiles,$dest, 0, { 'copytype' => "toplevel" } );
 }
 
-sub copyFilesRecursiveTopLevelDEPRECATED
-{
-  my $dest = pop (@_);
-  my (@srcfiles) = @_;
-
-  # a few sanity checks
-  if (scalar (@srcfiles) == 0)
-  {
-    print STDERR "FileUtils::copyFilesRecursiveTopLevel() no destination directory given\n";
-    return;
-  }
-  elsif (-f $dest)
-  {
-    print STDERR "FileUtils::copyFilesRecursiveTopLevel() destination must be a directory\n";
-    return;
-  }
-
-  # create destination directory if it doesn't exist already
-  if (! -d $dest)
-  {
-    my $store_umask = umask(0002);
-    mkdir ($dest, 0777);
-    umask($store_umask);
-  }
-
-  # copy the files
-  foreach my $file (@srcfiles)
-  {
-    if (!-e $file)
-    {
-      print STDERR "FileUtils::copyFilesRecursiveTopLevel() $file does not exist\n";
-    }
-    elsif (-d $file)
-    {
-      # make the new directory
-      my ($filename) = $file =~ /([^\\\/]*)$/;
-      $dest = &filenameConcatenate($dest, $filename);
-      my $store_umask = umask(0002);
-      mkdir ($dest, 0777);
-      umask($store_umask);
-
-      # get the contents of this directory
-      if (!opendir (INDIR, $file))
-      {
-        print STDERR "FileUtils::copyFilesRecursiveTopLevel() could not open directory $file\n";
-      }
-      else
-      {
-        my @filedir = readdir (INDIR);
-        closedir (INDIR);
-        foreach my $f (@filedir)
-        {
-          next if $f =~ /^\.\.?$/;
-
-          # copy all the files in this directory, but not directories
-          my $ff = &filenameConcatenate($file, $f);
-          if (-f $ff)
-          {
-            &copyFiles($ff, $dest);
-            #&cp_r ($ff, $dest);
-          }
-        }
-      }
-    }
-    else
-    {
-      &copyFiles($file, $dest);
-    }
-  }
-}
 ## copyFilesRecursiveTopLevel()
 
@@ -1599,21 +1292,4 @@
     return $files_and_dirs;
 }
-
-
-sub readDirectoryDEPRECATED
-{
-  my $path = shift(@_);
-  my @files;
-  if (opendir(DH, $path))
-  {
-    @files = readdir(DH);
-    close(DH);
-  }
-  else
-  {
-    die("Error! Failed to open directory list files: " . $path . "\n");
-  }
-  return \@files;
-}
 ## readDirectory()
 
Index: main/trunk/greenstone2/perllib/inexport.pm
===================================================================
--- main/trunk/greenstone2/perllib/inexport.pm	(revision 37194)
+++ main/trunk/greenstone2/perllib/inexport.pm	(revision 37200)
@@ -134,4 +134,12 @@
        'reqd' => "no",
        'hiddengli' => "yes" },
+     { 'name' => 'assocfile_copymode',
+       'desc' => "{import.assocfile_copymode}",
+       'type' => 'enum',
+       'list' => [ { 'name' => "copy",      'desc' => "{import.assocfile_copymode_copy}"     },
+		    { 'name' => "hardlink",  'desc' => "{import.assocfile_copymode_hardlink}" } ],
+       'deft' => 'copy',
+       'reqd' => 'yes',
+       'hiddengli' => 'no'},     
      { 'name' => "language",
        'desc' => "{scripts.language}",
@@ -787,5 +795,5 @@
 	if (defined $collectcfg->{'plugout'} && $collectcfg->{'plugout'} =~ /^(GreenstoneXML|.*METS|DSpace|MARCXML)Plugout/) {
 	    $plugout = $collectcfg->{'plugout'};
-	    print STDERR "Using plugout specified in collect.cfg: $collectcfg->{'plugout'}\n";
+	    print STDERR "Using plugout specified in collect.cfg/collectionConfig.xml: $collectcfg->{'plugout'}\n";
 	}
 	else {
@@ -805,8 +813,10 @@
     push @$plugout,("-gzip_output")                if ($gzip);
     push @$plugout,("-output_handle",$out)         if (defined $out);
-    push @$plugout,("-site",$self->{'site'})  if (defined $self->{'site'});
-
+    push @$plugout,("-site",$self->{'site'})       if (defined $self->{'site'});
     push @$plugout,("-xslt_file",$xsltfile)        if (defined $xsltfile && $xsltfile ne "");
+
+    push @$plugout,("-assocfile_copymode",$self->{'assocfile_copymode'})  if (defined $self->{'assocfile_copymode'});
     push @$plugout, ("-no_auxiliary_databases") if ($generate_auxiliary_files == 0);
+    
     if ($inexport_mode eq "import") {
 	if ($plugout_name =~ m/^GreenstoneXMLPlugout$/) {
Index: main/trunk/greenstone2/perllib/plugouts/BasePlugout.pm
===================================================================
--- main/trunk/greenstone2/perllib/plugouts/BasePlugout.pm	(revision 37194)
+++ main/trunk/greenstone2/perllib/plugouts/BasePlugout.pm	(revision 37200)
@@ -45,27 +45,27 @@
 
 my $arguments = [
-        { 'name' => "site",
-	  'desc' => "{BasPlugout.site}",
-	  'type' => "string",
-	  'reqd' => "no",
-	  'hiddengli' => "yes" },
+       { 'name' => "site",
+	'desc' => "{BasPlugout.site}",
+	'type' => "string",
+	'reqd' => "no",
+	'hiddengli' => "yes" },
        { 'name' => "xslt_file", 
 	'desc' => "{BasPlugout.xslt_file}",
 	'type' => "string",
 	'reqd' => "no",
-	 'deft' => "",
+	'deft' => "",
 	'hiddengli' => "no"},
        { 'name' => "subdir_split_length",
-	 'desc' => "{BasPlugout.subdir_split_length}",
-	 'type' => "int",
-	 'reqd' => "no",
-         'deft' => "8",
-	 'hiddengli' => "no"},
+	'desc' => "{BasPlugout.subdir_split_length}",
+	'type' => "int",
+	'reqd' => "no",
+        'deft' => "8",
+	'hiddengli' => "no"},
        { 'name' => "subdir_hash_prefix",
-	 'desc' => "{BasPlugout.subdir_hash_prefix}",
-	 'type' => "flag",
-	 'reqd' => "no",
-         'deft' => "0",
-	 'hiddengli' => "no"},
+	'desc' => "{BasPlugout.subdir_hash_prefix}",
+	'type' => "flag",
+	'reqd' => "no",
+        'deft' => "0",
+	'hiddengli' => "no"},
        { 'name' => "gzip_output", 
 	'desc' => "{BasPlugout.gzip_output}",
@@ -73,5 +73,5 @@
 	'reqd' => "no",  
      	'hiddengli' => "no"},
-        { 'name' => "verbosity", 
+       { 'name' => "verbosity", 
 	'desc' => "{BasPlugout.verbosity}",
 	'type' => "int",
@@ -79,5 +79,5 @@
 	'reqd' => "no",  
      	'hiddengli' => "no"},
-      { 'name' => "output_info", 
+       { 'name' => "output_info", 
 	'desc' => "{BasPlugout.output_info}",
 	'type' => "string",   
@@ -91,24 +91,32 @@
 	'hiddengli' => "yes"},
        { 'name' => "debug",
-	 'desc' => "{BasPlugout.debug}",
-	 'type' => "flag",
-	 'reqd' => "no",
-	 'hiddengli' => "yes"},
+	'desc' => "{BasPlugout.debug}",
+	'type' => "flag",
+	'reqd' => "no",
+	'hiddengli' => "yes"},
        { 'name' => 'no_rss',
-         'desc' => "{BasPlugout.no_rss}",
-         'type' => 'flag',
-         'reqd' => 'no',
-         'hiddengli' => 'yes'},
+        'desc' => "{BasPlugout.no_rss}",
+        'type' => 'flag',
+        'reqd' => 'no',
+        'hiddengli' => 'yes'},
        { 'name' => 'rss_title',
-         'desc' => "{BasPlugout.rss_title}",
-         'type' => 'string',
-	 'deft' => 'dc.Title',
-         'reqd' => 'no',
-         'hiddengli' => 'yes'},
-    { 'name' => "no_auxiliary_databases",
-      'desc' => "{BasPlugout.no_auxiliary_databases}",
-      'type' => "flag",
-      'reqd' => "no",
-      'hiddengli' => "yes"}
+        'desc' => "{BasPlugout.rss_title}",
+        'type' => 'string',
+	'deft' => 'dc.Title',
+        'reqd' => 'no',
+        'hiddengli' => 'yes'},
+       { 'name' => 'assocfile_copymode',
+        'desc' => "{import.assocfile_copymode}",
+	'type' => 'enum',
+	'list' => [ { 'name' => "copy",      'desc' => "{import.assocfile_copymode_copy}"     },
+		    { 'name' => "hardlink",  'desc' => "{import.assocfile_copymode_hardlink}" } ],
+	'deft' => 'copy',
+        'reqd' => 'yes',
+        'hiddengli' => 'no'},
+       { 'name' => "no_auxiliary_databases",
+	'desc' => "{BasPlugout.no_auxiliary_databases}",
+        'type' => "flag",
+        'reqd' => "no",
+        'hiddengli' => "yes"}
 
 ];
@@ -169,5 +177,5 @@
     }
 
- 
+    
     if(defined $self->{'xslt_file'} &&  $self->{'xslt_file'} ne "")
     {
@@ -812,5 +820,10 @@
 	    $filename = &FileUtils::filenameConcatenate($working_dir, $afile);
 
-            &FileUtils::hardLink($real_filename, $filename, $self->{'verbosity'});
+	    if ($self->{'assocfile_copymode'} eq "hardlink") {
+		&FileUtils::hardLink($real_filename, $filename, $self->{'verbosity'}); # Consider adding in 'strict' option??
+	    }
+	    else {
+		&FileUtils::copyFilesGeneral([$real_filename], $filename); # Consider adding in 'strict' option??
+	    }
 
 	    $doc_obj->add_utf8_metadata ($doc_obj->get_top_section(),
Index: main/trunk/greenstone2/perllib/plugouts/DSpacePlugout.pm
===================================================================
--- main/trunk/greenstone2/perllib/plugouts/DSpacePlugout.pm	(revision 37194)
+++ main/trunk/greenstone2/perllib/plugouts/DSpacePlugout.pm	(revision 37200)
@@ -290,5 +290,10 @@
     
     $filename = &FileUtils::filenameConcatenate($working_dir, $tail_filename);
-    &FileUtils::hardLink ($source_filename, $filename, $self->{'verbosity'});
+    if ($self->{'assocfile_copymode'} eq "hardlink") {
+	&FileUtils::hardLink ($source_filename, $filename, $self->{'verbosity'}); # Consider adding in 'strict' option??
+    }
+    else {
+	&FileUtils::copyFilesGeneral([$source_filename], $filename); # Consider adding in 'strict' option??
+    }
              
     # set the assocfile path (even if we have no assoc files - need this for lucene)
@@ -326,8 +331,13 @@
 	    
 		if ($afile ne "cover.jpg") {
-			&FileUtils::hardLink ($real_filename, $filename, $self->{'verbosity'});
-	        $doc_obj->add_utf8_metadata ($doc_obj->get_top_section(),
-				 "gsdlassocfile",
-				 "$afile:$assoc_file_rec->[2]:$dir");
+		    if ($self->{'assocfile_copymode'} eq "hardlink") {
+			&FileUtils::hardLink($real_filename, $filename, $self->{'verbosity'}); # Consider adding in 'strict' option??
+		    }
+		    else {
+			&FileUtils::copyFilesGeneral([$real_filename], $filename); # Consider adding in 'strict' option??
+		    }
+		    $doc_obj->add_utf8_metadata ($doc_obj->get_top_section(),
+						 "gsdlassocfile",
+						 "$afile:$assoc_file_rec->[2]:$dir");
 		}
 	} elsif ($self->{'verbosity'} > 2) {
