Changeset 17738 for gsdl


Ignore:
Timestamp:
2008-11-06T13:50:44+13:00 (15 years ago)
Author:
kjdon
Message:

AbstractPLugin has been removedd, so these now inherit from PrintInfo, and code from AbstractPlugin has been added to these two classes

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

Legend:

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

    r16392 r17738  
    2424###########################################################################
    2525
    26 # plugin which recurses through an archives.inf file
     26# plugin which reads through an archives.inf file
    2727# (i.e. the file generated in the archives directory
    2828# when an import is done), processing each file it finds
    2929
    30 # 12-05-02 Added usage datastructure - John Thompson
    31 
    3230package ArchivesInfPlugin;
    3331
    3432use util;
    35 use AbstractPlugin;
     33use PrintInfo;
    3634use plugin;
    3735use arcinfo;
     
    4240
    4341BEGIN {
    44     @ArchivesInfPlugin::ISA = ('AbstractPlugin');
     42    @ArchivesInfPlugin::ISA = ('PrintInfo');
    4543}
    4644
     
    6664    push(@{$hashArgOptLists->{"OptList"}},$options);
    6765
    68     my $self = new AbstractPlugin($pluginlist, $inputargs, $hashArgOptLists);
     66    my $self = new PrintInfo($pluginlist, $inputargs, $hashArgOptLists);
    6967
    7068    return bless $self, $class;
     69}
     70
     71# called once, at the start of processing
     72sub init {
     73    my $self = shift (@_);
     74    my ($verbosity, $outhandle, $failhandle) = @_;
     75
     76    # verbosity is passed through from the processor
     77    $self->{'verbosity'} = $verbosity;
     78
     79    # as are the outhandle and failhandle
     80    $self->{'outhandle'} = $outhandle if defined $outhandle;
     81    $self->{'failhandle'} = $failhandle;
     82
    7183}
    7284
     
    94106}
    95107
     108# called at the beginning of each plugin pass (import has one, buildin has many)
     109sub begin {
     110    my $self = shift (@_);
     111    my ($pluginfo, $base_dir, $processor, $maxdocs) = @_;
     112
     113}
     114
     115# called at the end of each plugin pass
     116sub end {
     117    my ($self) = shift (@_);
     118
     119}
     120
     121# called if we are doing incremental building
     122sub set_incremental {
     123    my $self = shift(@_);
     124    my ($incremental) = @_;
     125
     126    $self->{'incremental'} = $incremental;
     127}
     128
    96129# return 1 if this class might recurse using $pluginfo
    97130sub is_recursive {
     
    102135
    103136
     137sub compile_stats {
     138    my $self = shift(@_);
     139    my ($stats) = @_;
     140}
     141
     142# We don't do metadata_read
     143sub metadata_read {
     144    my $self = shift (@_);
     145    my ($pluginfo, $base_dir, $file, $block_hash, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
     146
     147    return undef;
     148}
     149
     150# we don't do any file blocking
     151sub file_block_read {
     152
     153    my $self = shift (@_); 
     154    my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $gli) = @_;
     155
     156    return undef;
     157}
    104158
    105159
  • gsdl/trunk/perllib/plugins/DirectoryPlugin.pm

    r17543 r17738  
    3030package DirectoryPlugin;
    3131
    32 use AbstractPlugin;
     32use PrintInfo;
    3333use plugin;
    3434use util;
     
    4343
    4444BEGIN {
    45     @DirectoryPlugin::ISA = ('AbstractPlugin');
     45    @DirectoryPlugin::ISA = ('PrintInfo');
    4646}
    4747
     
    7777    push(@{$hashArgOptLists->{"OptList"}},$options);
    7878
    79     my $self = new AbstractPlugin($pluginlist, $inputargs, $hashArgOptLists);
     79    my $self = new PrintInfo($pluginlist, $inputargs, $hashArgOptLists);
    8080   
    8181    if ($self->{'info_only'}) {
     
    8989    }
    9090   
     91    $self->{'num_processed'} = 0;
     92    $self->{'num_not_processed'} = 0;
     93    $self->{'num_blocked'} = 0;
     94    $self->{'num_archives'} = 0;
     95
    9196    $self->{'subdir_extrametakeys'} = {};
    9297
     
    9499}
    95100
     101# called once, at the start of processing
     102sub init {
     103    my $self = shift (@_);
     104    my ($verbosity, $outhandle, $failhandle) = @_;
     105
     106    # verbosity is passed through from the processor
     107    $self->{'verbosity'} = $verbosity;
     108
     109    # as are the outhandle and failhandle
     110    $self->{'outhandle'} = $outhandle if defined $outhandle;
     111    $self->{'failhandle'} = $failhandle;
     112
     113}
     114
     115# called once, after all passes have finished
     116sub deinit {
     117    my ($self) = @_;
     118
     119}
     120
     121# called at the beginning of each plugin pass (import has one, building has many)
    96122sub begin {
    97123    my $self = shift (@_);
     
    111137    }
    112138    }
    113 
    114     #$self->SUPER::begin($pluginfo, $base_dir, $processor, $maxdocs);
    115 }
    116 
     139}
     140
     141# called at the end of each plugin pass
    117142sub end {
    118 
    119 }
    120 
    121 sub deinit {
    122 
    123 }
     143    my ($self) = shift (@_);
     144
     145}
     146
     147
     148# called if we are doing incremental building
     149sub set_incremental {
     150    my $self = shift(@_);
     151    my ($incremental) = @_;
     152
     153    $self->{'incremental'} = $incremental;
     154}
     155
    124156# return 1 if this class might recurse using $pluginfo
    125157sub is_recursive {
     
    284316   
    285317}
     318
     319# We don't do metadata_read
     320sub metadata_read {
     321    my $self = shift (@_);
     322    my ($pluginfo, $base_dir, $file, $block_hash, $extrametakeys, $extrametadata, $processor, $maxdocs, $gli) = @_;
     323
     324    return undef;
     325}
     326
     327
    286328# return number of files processed, undef if can't process
    287329# Note that $base_dir might be "" and that $file might
     
    551593}
    552594
     595sub compile_stats {
     596    my $self = shift(@_);
     597    my ($stats) = @_;
     598}
     599
    5536001;
Note: See TracChangeset for help on using the changeset viewer.