Index: /gs2-extensions/parallel-building/trunk/src/perllib/plugouts/BasePlugout.pm
===================================================================
--- /gs2-extensions/parallel-building/trunk/src/perllib/plugouts/BasePlugout.pm	(revision 26963)
+++ /gs2-extensions/parallel-building/trunk/src/perllib/plugouts/BasePlugout.pm	(revision 26964)
@@ -508,5 +508,5 @@
             # only if opening new file
 	    my $output_dir = $self->get_output_dir();
-	    &util::mk_all_dir ($output_dir) unless -e $output_dir;
+	    &util::mk_all_dir ($output_dir) unless &util::dir_exists($output_dir);
 	    my $doc_file = &util::filename_cat ($output_dir, $doc_dir, "doc.xml");
 	    my $short_doc_file = &util::filename_cat ($doc_dir, "doc.xml");
@@ -614,19 +614,18 @@
    do {
        $doc_dir .= "/" if $doc_dir_num > 0;
-#       if ($doc_dir_rest =~ s/^(.{1,8})//) {
-       if ($doc_dir_rest =~ s/^(.{1,4})//) {
+#       if ($doc_dir_rest =~ s/^((HASH)?.{1,3})//i) {
+       if ($doc_dir_rest =~ s/^(.{1,3})//) {
 	   $doc_dir .= $1;
 	   $doc_dir_num++;
        }
-   } while ($doc_dir_rest ne "" && 
-	    ((-d &util::filename_cat ($working_dir, "$doc_dir.dir")) || 
-	     ($working_info->size() >= 1024 && $doc_dir_num < 2)));
+   } while ($doc_dir_rest ne "" && ((&util::dir_exists(&util::filename_cat($working_dir, "$doc_dir.dir"))) || ($working_info->size() >= 1024 && $doc_dir_num < 2)));
    my $i = 1;
    my $doc_dir_base = $doc_dir;
-   while (-d &util::filename_cat ($working_dir, "$doc_dir.dir")) {
+   #rint "!! - ensure path is unique by adding numeric suffix if necessary\n";
+   while (&util::dir_exists(&util::filename_cat($working_dir, "$doc_dir.dir"))) {
        $doc_dir = "$doc_dir_base-$i";
        $i++;
    }
-          
+
    return "$doc_dir.dir";
 }
@@ -641,8 +640,8 @@
     return if (!defined $output_dir);
 
-    &util::mk_all_dir ($output_dir) unless -e $output_dir;
+    &util::mk_all_dir ($output_dir) unless &util::dir_exists($output_dir);
       
     my $working_dir = &util::filename_cat($output_dir, $doc_dir);
-    &util::mk_all_dir ($working_dir) unless -e $working_dir;
+    &util::mk_all_dir ($working_dir) unless &util::dir_exists($working_dir);
 
     my @assoc_files = ();
@@ -685,5 +684,5 @@
 	$real_filename = &util::downgrade_if_dos_filename($real_filename);
 
-	if (-e $real_filename) {
+	if (&util::file_exists($real_filename)) {
 
 	    $filename = &util::filename_cat($working_dir, $afile);
@@ -732,9 +731,9 @@
 	my $raw_filename = &util::downgrade_if_dos_filename($real_filename);
 
-	if (-e $raw_filename) {
+	if (&util::file_exists($raw_filename)) {
 
 #	    if (defined $collect_dir) {
 #		my $collect_dir_re_safe = $collect_dir;
-#		$collect_dir_re_safe =~ s/\\/\\\\/g;
+#		$collect_dir_re_safe =~ s/\\/\\\\/g; # use &util::filename_to_regex()
 #		$collect_dir_re_safe =~ s/\./\\./g;##
 
@@ -805,4 +804,34 @@
 
     ##print STDERR "*** To set in db: \n\t$doc_db\n\t$oid\n\t$doc_db_text\n";
+    if (($oid_files->{'index-status'} eq "I") || ($oid_files->{'index-status'} eq "R"))
+    {
+      my $top_section = $doc_obj->get_top_section();
+      my $dc_titles = $doc_obj->get_metadata($top_section, 'dls.Title');
+      my $dc_title = join("; ", @$dc_titles);
+      # if we still don't have a title, use a feature I added into a doc_obj ages
+      # ago to find *any* title (regardless of namespace) [jmt12]
+      if ($dc_title eq '')
+      {
+        $dc_title = $doc_obj->get_metadata_element($top_section, 'Title', 1);
+      }
+      if ($oid_files->{'index-status'} eq "R")
+      {
+        $dc_title .= " (Updated)";
+      }
+      my $rss_filename = &util::filename_cat($output_dir,"rss-items.rdf");
+      if (open(RSSOUT, &util::file_openfdcommand($rss_filename, '>>')))
+      {
+        print RSSOUT "<item>\n";
+        print RSSOUT "   <title>" . $dc_title . "</title>\n";
+        print RSSOUT "   <link>_httpdomain__httpcollection_/document/" . $doc_obj->get_OID() . "</link>\n";
+        print RSSOUT "</item>\n";
+        close(RSSOUT);
+      }
+      else
+      {
+        print STDERR "**** Failed to open " . $rss_filename . "\n";
+        print STDERR $! . "\n";
+      }
+    }
 
     $oid_files->{'doc-file'} = [ $oid_files->{'doc-file'} ];
@@ -828,4 +857,13 @@
 }
 
+# /** @function append_to_rss_file()
+#  */
+sub append_to_rss_file
+{
+  my $self = shift(@_);
+  my ($doc_obj, $index_status, $output_dir) = @_;
+
+}
+# /** append_to_rss_file() **/
 
 sub set_sortmeta {
@@ -849,5 +887,5 @@
     my ($output_file_name, $xslt_file)=@_;
 
-    return unless defined $xslt_file and $xslt_file ne "" and -e $xslt_file;
+    return unless defined $xslt_file and $xslt_file ne "" and &util::file_exists($xslt_file);
     
     my $java_class_path =  &util::filename_cat ($ENV{'GSDLHOME'},"bin","java","ApplyXSLT.jar");
@@ -923,5 +961,5 @@
 	$doc_file .= ".gz";
 	$short_doc_file .= ".gz";
-	if (!-e $doc_file) {
+	if (!&util::file_exists($doc_file)) {
 	     my $outhandle = $self->{'output_handle'};
 	    print $outhandle "error while gzipping: $doc_file doesn't exist\n";
