- Timestamp:
- 2013-05-21T14:46:55+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/parallel-building/trunk/src/perllib/plugouts/BasePlugout.pm
r26964 r27377 3 3 # BasePlugout.pm -- base class for all the plugout modules 4 4 # A component of the Greenstone digital library software 5 # from the New Zealand Digital Library Project at the 5 # from the New Zealand Digital Library Project at the 6 6 # University of Waikato, New Zealand. 7 7 # … … 36 36 use printusage; 37 37 use parse2; 38 use util; 39 use FileUtils; 38 40 39 41 … … 349 351 350 352 my ($output_file_name) = @_; 351 352 open(*OUTPUT, ">$output_file_name") or die "Can not open a file handler for $output_file_name\n"; 353 354 return *OUTPUT; 353 my $fh; 354 &FileUtils::openFileHandle($output_file_name, '>', \$fh) or die "Can not open a file handler for $output_file_name\n"; 355 return $fh; 355 356 } 356 357 … … 508 509 # only if opening new file 509 510 my $output_dir = $self->get_output_dir(); 510 & util::mk_all_dir ($output_dir) unless &util::dir_exists($output_dir);511 my $doc_file = & util::filename_cat($output_dir, $doc_dir, "doc.xml");512 my $short_doc_file = & util::filename_cat($doc_dir, "doc.xml");511 &FileUtils::makeAllDirectories ($output_dir) unless &FileUtils::directoryExists($output_dir); 512 my $doc_file = &FileUtils::filenameConcatenate ($output_dir, $doc_dir, "doc.xml"); 513 my $short_doc_file = &FileUtils::filenameConcatenate ($doc_dir, "doc.xml"); 513 514 514 515 if ($gs_count>0) … … 590 591 591 592 if (!defined $self->{'group'} || !$self->{'group'}){ 592 & util::mk_all_dir (&util::filename_cat($working_dir, $doc_dir));593 &FileUtils::makeAllDirectories(&FileUtils::filenameConcatenate($working_dir, $doc_dir)); 593 594 } 594 595 … … 619 620 $doc_dir_num++; 620 621 } 621 } while ($doc_dir_rest ne "" && ((& util::dir_exists(&util::filename_cat($working_dir, "$doc_dir.dir"))) || ($working_info->size() >= 1024 && $doc_dir_num < 2)));622 } while ($doc_dir_rest ne "" && ((&FileUtils::directoryExists(&FileUtils::filenameConcatenate($working_dir, "$doc_dir.dir"))) || ($working_info->size() >= 1024 && $doc_dir_num < 2))); 622 623 my $i = 1; 623 624 my $doc_dir_base = $doc_dir; 624 625 #rint "!! - ensure path is unique by adding numeric suffix if necessary\n"; 625 while (& util::dir_exists(&util::filename_cat($working_dir, "$doc_dir.dir"))) {626 while (&FileUtils::directoryExists(&FileUtils::filenameConcatenate($working_dir, "$doc_dir.dir"))) { 626 627 $doc_dir = "$doc_dir_base-$i"; 627 628 $i++; … … 640 641 return if (!defined $output_dir); 641 642 642 & util::mk_all_dir ($output_dir) unless &util::dir_exists($output_dir);643 &FileUtils::makeAllDirectories($output_dir) unless &FileUtils::directoryExists($output_dir); 643 644 644 my $working_dir = & util::filename_cat($output_dir, $doc_dir);645 & util::mk_all_dir ($working_dir) unless &util::dir_exists($working_dir);645 my $working_dir = &FileUtils::filenameConcatenate($output_dir, $doc_dir); 646 &FileUtils::makeAllDirectories($working_dir) unless &FileUtils::directoryExists($working_dir); 646 647 647 648 my @assoc_files = (); … … 662 663 663 664 if ($source_filename !~ /^$dirsep_regexp/) { 664 $source_filename = & util::filename_cat($collect_dir, $source_filename);665 $source_filename = &FileUtils::filenameConcatenate($collect_dir, $source_filename); 665 666 } 666 667 } … … 684 685 $real_filename = &util::downgrade_if_dos_filename($real_filename); 685 686 686 if (& util::file_exists($real_filename)) {687 688 $filename = & util::filename_cat($working_dir, $afile);689 690 & util::hard_link($real_filename, $filename, $self->{'verbosity'});687 if (&FileUtils::fileExists($real_filename)) { 688 689 $filename = &FileUtils::filenameConcatenate($working_dir, $afile); 690 691 &FileUtils::hardLink($real_filename, $filename, $self->{'verbosity'}); 691 692 692 693 $doc_obj->add_utf8_metadata ($doc_obj->get_top_section(), … … 731 732 my $raw_filename = &util::downgrade_if_dos_filename($real_filename); 732 733 733 if (& util::file_exists($raw_filename)) {734 if (&FileUtils::fileExists($raw_filename)) { 734 735 735 736 # if (defined $collect_dir) { … … 819 820 $dc_title .= " (Updated)"; 820 821 } 821 my $rss_filename = &util::filename_cat($output_dir,"rss-items.rdf"); 822 if (open(RSSOUT, &util::file_openfdcommand($rss_filename, '>>'))) 822 my $rss_filename = &FileUtils::filenameConcatenate($output_dir,"rss-items.rdf"); 823 my $rssout_fh; 824 825 if (&FileUtils::openFileHandle($rss_filename, '>>', \$rssout_fh)) 823 826 { 824 print RSSOUT"<item>\n";825 print RSSOUT" <title>" . $dc_title . "</title>\n";826 print RSSOUT" <link>_httpdomain__httpcollection_/document/" . $doc_obj->get_OID() . "</link>\n";827 print RSSOUT"</item>\n";828 close(RSSOUT);827 print $rssout_fh "<item>\n"; 828 print $rssout_fh " <title>" . $dc_title . "</title>\n"; 829 print $rssout_fh " <link>_httpdomain__httpcollection_/document/" . $doc_obj->get_OID() . "</link>\n"; 830 print $rssout_fh "</item>\n"; 831 &FileUtils::closeFileHandle($rss_filename, $rssout_fh); 829 832 } 830 833 else … … 887 890 my ($output_file_name, $xslt_file)=@_; 888 891 889 return unless defined $xslt_file and $xslt_file ne "" and & util::file_exists($xslt_file);890 891 my $java_class_path = & util::filename_cat($ENV{'GSDLHOME'},"bin","java","ApplyXSLT.jar");892 return unless defined $xslt_file and $xslt_file ne "" and &FileUtils::fileExists($xslt_file); 893 894 my $java_class_path = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"bin","java","ApplyXSLT.jar"); 892 895 893 896 my $mapping_file_path = ""; 894 897 895 898 if ($ENV{'GSDLOS'} eq "windows"){ 896 $java_class_path .=";".& util::filename_cat($ENV{'GSDLHOME'},"bin","java","xalan.jar");899 $java_class_path .=";".&FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"bin","java","xalan.jar"); 897 900 # this file:/// bit didn't work for me on windows XP 898 901 #$xslt_file = "\"file:///".$xslt_file."\""; … … 900 903 } 901 904 else{ 902 $java_class_path .=":".& util::filename_cat($ENV{'GSDLHOME'},"bin","java","xalan.jar");905 $java_class_path .=":".&FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"bin","java","xalan.jar"); 903 906 } 904 907 … … 961 964 $doc_file .= ".gz"; 962 965 $short_doc_file .= ".gz"; 963 if (!& util::file_exists($doc_file)) {966 if (!&FileUtils::fileExists($doc_file)) { 964 967 my $outhandle = $self->{'output_handle'}; 965 968 print $outhandle "error while gzipping: $doc_file doesn't exist\n";
Note:
See TracChangeset
for help on using the changeset viewer.