Changeset 20577


Ignore:
Timestamp:
2009-09-10T10:50:05+12:00 (15 years ago)
Author:
davidb
Message:

Changes to support new incremental_mode variable, and to track metadata.xml files more closely so incremental building works when a document is first build without any metadata attached, then then in a subsequent build has metadata from such a source as metadata.xml added.

Location:
gsdl/trunk/perllib/plugins
Files:
5 edited

Legend:

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

    r19759 r20577  
    146146}
    147147
    148 # called if we are doing incremental building
    149 sub set_incremental {
    150     my $self = shift(@_);
    151     my ($incremental) = @_;
    152 
    153     $self->{'incremental'} = $incremental;
    154 }
    155148
    156149# return 1 if this class might recurse using $pluginfo
  • gsdl/trunk/perllib/plugins/BasePlugin.pm

    r20451 r20577  
    337337}
    338338
    339 sub set_incremental {
    340     my $self = shift(@_);
    341     my ($incremental) = @_;
    342 
    343     $self->{'incremental'} = $incremental;
    344 }
    345339
    346340# this function should be overridden to return 1
     
    941935    # can we process this file??
    942936    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
     937
    943938    return undef unless $self->can_process_this_file($filename_full_path);
    944939   
  • gsdl/trunk/perllib/plugins/DirectoryPlugin.pm

    r19623 r20577  
    148148
    149149
    150 # called if we are doing incremental building
    151 sub set_incremental {
    152     my $self = shift(@_);
    153     my ($incremental) = @_;
    154 
    155     $self->{'incremental'} = $incremental;
    156 }
    157150
    158151# return 1 if this class might recurse using $pluginfo
     
    283276
    284277    $block_hash->{'all_files'} = {} unless defined $block_hash->{'all_files'};
     278    $block_hash->{'metadata_files'} = {} unless defined $block_hash->{'metadata_files'};
    285279
    286280    $block_hash->{'file_blocks'} = {} unless defined $block_hash->{'file_blocks'};
     
    597591    }
    598592
    599 
    600593    if (defined $self->{'inf_timestamp'}) {
    601594        # Look to see if it's a completely new file
     
    608601        if (! -d $full_filename) {
    609602            if (!$block_hash->{'reindex_files'}->{$full_filename}) {
    610             # filename has been around for longer than inf
     603            # filename has been around for longer than inf_timestamp
    611604            print $outhandle "**** Skipping $subfile\n" if ($verbosity >3);
    612605            next;
  • gsdl/trunk/perllib/plugins/MetadataXMLPlugin.pm

    r19493 r20577  
    164164
    165165
     166sub file_block_read {
     167    my $self = shift (@_);
     168    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $gli) = @_;
     169
     170    my $filename = &util::filename_cat($base_dir, $file);
     171    if ($filename !~ /metadata\.xml$/ || !-f $filename) {
     172        return undef;
     173    }
     174
     175    $block_hash->{'metadata_files'}->{$filename} = 1;
     176
     177    return 1;
     178}
     179
    166180sub metadata_read
    167181{
     
    179193    $self->{'metadata-filename'} = $filename;
    180194
     195
    181196    my $outhandle = $self->{'outhandle'};
    182197   
     
    185200    # add the file to the block list so that it won't be processed in read, as we will do all we can with it here
    186201    $block_hash->{'file_blocks'}->{$filename} = 1;
     202
    187203    $self->{'metadataref'} = $extrametadata;
    188204    $self->{'metafileref'} = $extrametafile;
  • gsdl/trunk/perllib/plugins/PrintInfo.pm

    r16639 r20577  
    106106#sub init {
    107107#}
     108
     109
     110sub set_incremental {
     111    my $self = shift(@_);
     112    my ($incremental_mode) = @_;
     113
     114    if (!defined $incremental_mode) {
     115    $self->{'incremental'} = 0;
     116    $self->{'incremental_mode'} = "none";
     117    }
     118    elsif ($incremental_mode eq "none") {
     119    $self->{'incremental'} = 0;
     120    $self->{'incremental_mode'} = "none";
     121    }
     122    else {
     123    $self->{'incremental'} = 1;
     124    $self->{'incremental_mode'} = $incremental_mode;
     125    }   
     126}
    108127
    109128sub get_arguments
Note: See TracChangeset for help on using the changeset viewer.