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

global block pass: read_block is no more, use can_process_this_file to see whether a file is for us or not. extra arg (block_hash) to read, read_into_doc_obj, metadata_read etc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/ReadXMLFile.pm

    r15971 r16392  
    157157    return $transformed_xml;
    158158
     159}
     160
     161sub can_process_this_file {
     162    my $self = shift(@_);
     163    my ($filename) = @_;
     164
     165    if ($self->SUPER::can_process_this_file($filename) && $self->check_doctype($filename)) {
     166    return 1; # its a file for us
     167    }
     168    return 0;
    159169}
    160170
     
    188198}
    189199
    190 # because we are not just using process_exp to determine whether to process or not, we need to implement this too, so that a file can be passed down if we are not actually processing it
    191 sub metadata_read {
    192     my $self = shift (@_);
    193    
    194     my ($pluginfo, $base_dir, $file, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
    195  
    196     my $result = $self->SUPER::metadata_read($pluginfo, $base_dir, $file, $metadata, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli);
    197 
    198     if (defined $result) {
    199     # we think we are processing this, but check that we actually are
    200     my ($filename_full_path, $filename_no_path) = $self->get_full_filenames($base_dir, $file);
    201 
    202     if ($self->check_doctype($filename_full_path)) {
    203         return $result;
    204     }
    205     }
    206     return undef;
    207 }
    208200
    209201# we need to implement read cos we are not just using process_exp to determine
     
    212204    my $self = shift (@_); 
    213205 
    214     my ($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
    215 
    216     # Make sure we're processing the correct file, do blocking etc
    217     my ($block_status,$filename_full_path) = $self->read_block(@_);   
    218     return $block_status if ((!defined $block_status) || ($block_status==0));
    219 
    220     ## check the doctype to see whether we really want to process the file
    221     if (!$self->check_doctype($filename_full_path)) {
    222     # this file is not for us
    223     return undef;
    224     }
    225 
     206    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_;
     207
     208    # can we process this file??
     209    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
     210    return undef unless $self->can_process_this_file($filename_full_path);
     211   
    226212    $file =~ s/^[\/\\]+//; # $file often begins with / so we'll tidy it up
    227213    $self->{'base_dir'} = $base_dir;
Note: See TracChangeset for help on using the changeset viewer.