Changeset 16381


Ignore:
Timestamp:
2008-07-14T14:37:01+12:00 (16 years ago)
Author:
kjdon
Message:

global block pass: added in plugin:file_block_read, which is the global blocking pass. read and metadata_read modified to take an exta argument, block_hash which contains blocking info - this is really only usesd by DirectoryPlugin which does the actual blocking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugin.pm

    r15873 r16381  
    195195}
    196196
     197sub file_block_read {
     198    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $gli) = @_;
     199
     200
     201    $gli = 0 unless defined $gli;
     202
     203    my $rv = 0;
     204    my $glifile = $file;
     205   
     206    $glifile =~ s/^[\/\\]+//; # file sometimes starts with a / so get rid of it
     207   
     208    # Announce to GLI that we are handling a file
     209    print STDERR "<File n='$glifile'>\n" if $gli;
     210   
     211    # the .kill file is a handy (if not very elegant) way of aborting
     212    # an import.pl or buildcol.pl process
     213    if (-e &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, ".kill")) {
     214    gsprintf($outhandle, "{plugin.kill_file}\n");
     215    die "\n";
     216    }
     217   
     218    foreach my $plugobj (@$pluginfo) {
     219
     220        $rv = $plugobj->file_block_read($pluginfo, $base_dir, $file, $block_hash, $metadata, $gli);
     221    #last if (defined $rv && $rv==1); # stop this file once we have found something to 'process' it
     222    }
     223   
     224}
     225
    197226
    198227sub metadata_read {
    199     my ($pluginfo, $base_dir, $file, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli, $aux) = @_;
     228    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli, $aux) = @_;
    200229
    201230    $maxdocs = -1 unless defined $maxdocs && $maxdocs =~ /\d/;
     
    228257    foreach my $plugobj (@$pluginfo) {
    229258
    230     $rv = $plugobj->metadata_read($pluginfo, $base_dir, $file,
     259    $rv = $plugobj->metadata_read($pluginfo, $base_dir, $file, $block_hash,
    231260                 $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli, $aux);
    232261
     
    246275
    247276sub read {
    248     my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli, $aux) = @_;
     277    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli, $aux) = @_;
    249278
    250279    $maxdocs = -1 unless defined $maxdocs && $maxdocs =~ /\d/;
     
    266295    die "\n";
    267296    }
    268 
     297   
    269298    my $had_error = 0;
    270299    # pass this file by each of the plugins in turn until one
     
    279308
    280309        $rv = $plugobj->read($pluginfo, $base_dir, $file,
    281                  $metadata, $processor, $maxdocs, $total_count, $gli, $aux);
     310                 $block_hash, $metadata, $processor, $maxdocs,
     311                 $total_count, $gli, $aux);
    282312
    283313    if (defined $rv) {
Note: See TracChangeset for help on using the changeset viewer.