Ignore:
Timestamp:
2006-10-27T13:31:13+13:00 (18 years ago)
Author:
kjdon
Message:

debug mode now passes debug flag to plugout rather than using docprint, which is no longer a docproc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/export.pl

    r12965 r13169  
    5050use plugin;
    5151use plugout;
    52 use docprint;
    5352use util;
    5453use scriptutil;
     
    459458       
    460459        # read the export information file
    461         if (!$debug) {
    462         # Export to DSpace Archive format or METs format
    463         # If saveas=DSpace, a "contents" file will be created, otherwise "export.inf"
     460       
     461        # Export to DSpace Archive format or METs format
     462        # If saveas=DSpace, a "contents" file will be created, otherwise "export.inf"
    464463       
    465         if ($saveas eq "DSpace"){
    466             $export_info_filename = &util::filename_cat ($exportdir, "contents");
    467         } elsif ($saveas eq "METS" || $saveas eq "GA" || $saveas eq "MARC" ) {
    468             $export_info_filename = &util::filename_cat ($exportdir, "export.inf");
    469         }
    470        
    471         $export_info = new arcinfo();
    472         $export_info -> load_info ($export_info_filename); 
    473                    
    474                 if ($saveas !~ /^(GA|METS|DSpace|MARCXML)$/) {
    475             if (defined $collectcfg->{'plugout'} && $collectcfg->{'plugout'}[0] =~ /^(GAPlugout|METSPlugout)$/) {
    476             $saveas = $collectcfg->{'plugout'}[0];
    477             } else {
    478             $saveas ="GAPlugout";
    479             }
    480         }
    481 
    482                    
    483             ####Use Plugout####
    484         my ($plugout_name);
    485         if ($saveas !~ /^(GA|METS|DSpace|MARCXML)Plugout$/  ){     
    486             $plugout_name = $saveas."Plugout";
    487         }
    488         else{
    489             $plugout_name = $saveas;
    490         }
    491        
    492         my $opts=[];
    493        
    494        
    495         push @$opts,("-output_info",$export_info) if (defined $export_info);
    496 
    497             push @$opts,("-verbosity",$verbosity) if (defined $verbosity);
    498        
    499         push @$opts,("-gzip_output",$gzip) if (defined $gzip);
    500         push @$opts,("-group_size",$groupsize) if (defined $groupsize);
    501         push @$opts,("-output_handle",$out) if (defined $out);
    502                 push @$opts,("-xslt_file",$xsltfile) if (defined $xsltfile);
    503                 push @$opts,("-group") if ($group_marc && $plugout_name =~ /^MARCXMLPlugout$/);
    504         push @$opts,("-mapping_file",$mapping_file) if (defined $mapping_file && $plugout_name =~ /^MARCXMLPlugout$/);
    505         push @$opts,("-saveas_version",$saveas_version) if (defined $saveas_version && $plugout_name =~ /^METSPlugout$/);
    506                 push @$opts,("-xslt_mets",$xslt_mets) if (defined $xslt_mets && $plugout_name =~ /^METSPlugout$/);
    507                 push @$opts,("-xslt_txt",$xslt_txt) if (defined $xslt_txt && $plugout_name =~ /^METSPlugout$/);
    508             $processor = &plugout::load_plugout($plugout_name,$opts);   
    509 
    510         $processor->setoutputdir ($exportdir);
    511        
    512         $processor->set_sortmeta ($sortmeta) if defined $sortmeta;
    513         $processor->set_OIDtype ($OIDtype, $OIDmetadata);
    514    
    515         } else {
    516         $processor = new docprint ();
    517         }
     464        # the plugouts should be doing this!!
     465        if ($saveas eq "DSpace"){
     466        $export_info_filename = &util::filename_cat ($exportdir, "contents");
     467        } elsif ($saveas eq "METS" || $saveas eq "GA" || $saveas eq "MARC" ) {
     468        $export_info_filename = &util::filename_cat ($exportdir, "export.inf");
     469        }
     470       
     471        $export_info = new arcinfo();
     472        $export_info -> load_info ($export_info_filename); 
     473       
     474        if ($saveas !~ /^(GA|METS|DSpace|MARCXML)$/) {
     475        if (defined $collectcfg->{'plugout'} && $collectcfg->{'plugout'}[0] =~ /^(GAPlugout|METSPlugout)$/) {
     476            $saveas = $collectcfg->{'plugout'}[0];
     477        } else {
     478            $saveas ="GAPlugout";
     479        }
     480        }
     481       
     482       
     483        ####Use Plugout####
     484        my ($plugout_name);
     485        if ($saveas !~ /^(GA|METS|DSpace|MARCXML)Plugout$/  ){     
     486        $plugout_name = $saveas."Plugout";
     487        }
     488        else {
     489        $plugout_name = $saveas;
     490        }
     491       
     492        my $opts=[];
     493       
     494        push @$opts,("-output_info",$export_info) if (defined $export_info);
     495        push @$opts,("-verbosity",$verbosity) if (defined $verbosity);
     496        push @$opts,("-debug") if ($debug);
     497        push @$opts,("-gzip_output",$gzip) if (defined $gzip);
     498        push @$opts,("-group_size",$groupsize) if (defined $groupsize);
     499        push @$opts,("-output_handle",$out) if (defined $out);
     500        push @$opts,("-xslt_file",$xsltfile) if (defined $xsltfile);
     501        push @$opts,("-group") if ($group_marc && $plugout_name =~ /^MARCXMLPlugout$/);
     502        push @$opts,("-mapping_file",$mapping_file) if (defined $mapping_file && $plugout_name =~ /^MARCXMLPlugout$/);
     503        push @$opts,("-saveas_version",$saveas_version) if (defined $saveas_version && $plugout_name =~ /^METSPlugout$/);
     504        push @$opts,("-xslt_mets",$xslt_mets) if (defined $xslt_mets && $plugout_name =~ /^METSPlugout$/);
     505        push @$opts,("-xslt_txt",$xslt_txt) if (defined $xslt_txt && $plugout_name =~ /^METSPlugout$/);
     506        $processor = &plugout::load_plugout($plugout_name,$opts);   
     507       
     508        $processor->setoutputdir ($exportdir);
     509       
     510        $processor->set_sortmeta ($sortmeta) if defined $sortmeta;
     511        $processor->set_OIDtype ($OIDtype, $OIDmetadata);
    518512       
    519513        &plugin::begin($pluginfo, $importdir, $processor, $maxdocs);
     
    527521       
    528522        # write out the export information file
    529         if (!$debug) {
    530         $processor->close_file_output() if $groupsize > 1;
    531                 $processor->close_group_output() if $processor->is_group();
    532         if ($saveas eq "METS") {
    533             $export_info->save_info($export_info_filename);
    534         }
     523        $processor->close_file_output() if $groupsize > 1;
     524        $processor->close_group_output() if $processor->is_group();
     525        if ($saveas eq "METS") {
     526        $export_info->save_info($export_info_filename);
    535527        }
    536528       
Note: See TracChangeset for help on using the changeset viewer.