Ignore:
Timestamp:
2008-09-04T14:27:27+12:00 (16 years ago)
Author:
kjdon
Message:

tidied up import and export scripts a little. Reordered code to make them more similar in preparation for merging the scripts later. import only supports GA and GreenstoneMETS, export only supports Greenstone/FedoraMETS, DSpace, MARCXML. export.pl now only exports one collection at a time. And I have removed some options that didn't make sense - sortmeta, groupsize.

File:
1 edited

Legend:

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

    r17038 r17142  
    253253    'modegli' => "4" },
    254254      { 'name' => "gli",
    255     'desc' => "",
     255    'desc' => "{scripts.gli}",
    256256    'type' => "flag",
    257257    'reqd' => "no",
     
    273273    # params
    274274    my ($language, $verbosity, $debug,
    275     $importdir, $site, $manifest, $incremental, $keepold,
    276     $removeold, $saveas,
     275    $collectdir, $importdir, $archivedir, $site, $manifest,
     276    $incremental, $keepold, $removeold,
     277    $saveas,
    277278    $OIDtype, $OIDmetadata,
    278279    $maxdocs, $statsfile,
    279     $out, $faillog, $collectdir, $gli,
    280 
    281     $archivedir,
     280    $out, $faillog, $gli,
    282281    $gzip, $groupsize,
    283     $sortmeta, $reversesort, $removeprefix, $removesuffix,
     282    $sortmeta, $reversesort, $removeprefix, $removesuffix
    284283    );
    285284
     
    287286
    288287    # other vars
    289     my ($configfilename, $collectcfg, $collection,
     288    my ($configfilename, $collection, $collectcfg,
    290289    $archive_info_filename, $archive_info,
    291290    $gs_mode,
     
    331330    if ($intArgLeftinAfterParsing != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/))
    332331    {
    333     &PrintUsage::print_txt_usage($options, "{buildcol.params}");
     332    &PrintUsage::print_txt_usage($options, "{import.params}");
    334333    die "\n";
    335334    }
     
    432431    }
    433432
    434     if ($OIDtype !~ /^(hash|incremental|assigned|dirname)$/) {
     433    if (!defined $OIDtype || ($OIDtype !~ /^(hash|incremental|assigned|dirname)$/ )) {
    435434    if (defined $collectcfg->{'OIDtype'} && $collectcfg->{'OIDtype'} =~ /^(hash|incremental|assigned|dirname)$/) {
    436435        $OIDtype = $collectcfg->{'OIDtype'};
    437436    } else {
    438437        $OIDtype = "hash"; # the default
    439     }
    440     }
    441 
    442     my ($plugout);
    443     if (defined $collectcfg->{'plugout'}) {
    444     $plugout = $collectcfg->{'plugout'};
    445     }
    446     else{
    447     if ($saveas !~ /^(GA|.*METS|DSpace|MARCXML)$/) {
    448         push @$plugout,"GAPlugout";
    449     }
    450     else{
    451         push @$plugout,$saveas."Plugout";
    452438    }
    453439    }
     
    484470    $gli = 1;
    485471    }
    486    
    487    
    488     # global plugin stuff
    489     if (defined $collectcfg->{'separate_cjk'} && $collectcfg->{'separate_cjk'} =~ /^true$/i) {
    490     push @global_opts, "-separate_cjk";
    491     }
    492    
     472    $gli = 0 unless defined $gli;
     473       
    493474    # check keepold and removeold
    494475    ($removeold, $keepold, $incremental) = &scriptutil::check_removeold_and_keepold($removeold, $keepold, $incremental, "archives", $collectcfg);
    495476 
    496     $gli = 0 unless defined $gli;
    497477
    498478    print STDERR "<Import>\n" if $gli;
     
    538518
    539519    # read the archive information file
    540 
    541     # If saveas=DSpace, a "contents" file will be created, otherwise "archives.inf"
    542    
    543     # the plugouts should be doing this!!
    544     if ($saveas eq "DSpace"){
    545     $archive_info_filename = &util::filename_cat ($archivedir, "contents");
    546     } elsif ($saveas =~ m/^.*METS$/ || $saveas eq "GA" || $saveas eq "MARC" ) {
    547     $archive_info_filename = &util::filename_cat ($archivedir, "archives.inf");
    548     }
    549 
     520    $archive_info_filename = &util::filename_cat ($archivedir, "archives.inf");
     521   
    550522    $archive_info = new arcinfo ();
    551523    $archive_info->load_info ($archive_info_filename);
     
    555527
    556528    ####Use Plugout####
     529    my ($plugout);
     530    if (defined $collectcfg->{'plugout'} && $collectcfg->{'plugout'} =~ /^(GA|GreenstoneMETS)Plugout/) {
     531    $plugout = $collectcfg->{'plugout'};
     532    }
     533    else{
     534    if ($saveas !~ /^(GA|GreenstoneMETS)$/) {
     535        push @$plugout,"GAPlugout";
     536    }
     537    else{
     538        push @$plugout,$saveas."Plugout";
     539    }
     540    }
     541
    557542    push @$plugout,("-output_info",$archive_info) if (defined $archive_info);
    558543    push @$plugout,("-verbosity",$verbosity) if (defined $verbosity);
     
    590575    }
    591576    }
    592 
    593     if ($saveas eq "FedoraMETS")
    594     {
    595     # This would be better (should?!) be done in Plugout!!
    596 
    597     # create collection "doc obj" for Fedora that contains
    598     # collection-level metadata
    599    
    600     my $doc_obj = new doc($configfilename,"nonindexed_doc");
    601     $doc_obj->set_OID("collection");
    602    
    603     my $col_name = undef;
    604     my $col_meta = $collectcfg->{'collectionmeta'};
    605     if (defined $col_meta)
    606     {
    607         store_collectionmeta($col_meta,"collectionname",$doc_obj);
    608         store_collectionmeta($col_meta,"collectioextra",$doc_obj);
    609        
    610     }
    611    
    612     $processor->process($doc_obj);
    613     }
    614 
    615577
    616578    &plugin::end($pluginfo, $processor);
Note: See TracChangeset for help on using the changeset viewer.