Changeset 24547

Show
Ignore:
Timestamp:
02.09.2011 16:28:57 (8 years ago)
Author:
ak19
Message:

Added new abstract plugin MetadataRead? that defines can_process_this_file_for_metadata that MetadataPlugin? subclasses can inherit (if MetadataRead? is listed first in the ISA inheritance list) and which will then override the one defined in BasePlugin?. For now committing MARC, ISIS and OAIPlugins which now additionally inherit from MetadataRead?. Other metadataPlugins also need to be committed.

Location:
main/trunk/greenstone2/perllib/plugins
Files:
1 added
5 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/ISISPlugin.pm

    r23564 r24547  
    3030use multiread; 
    3131use SplitTextFile; 
     32use MetadataRead; 
    3233 
    3334use strict; 
     
    3536 
    3637# ISISPlugin is a sub-class of SplitTextFile. 
     38# methods with identical signatures take precedence in the order given in the ISA list. 
    3739sub BEGIN { 
    38     @ISISPlugin::ISA = ('SplitTextFile'); 
     40    @ISISPlugin::ISA = ('MetadataRead', 'SplitTextFile'); 
    3941} 
    4042 
  • main/trunk/greenstone2/perllib/plugins/MARCPlugin.pm

    r18563 r24547  
    2828 
    2929use SplitTextFile; 
     30use MetadataRead; 
    3031 
    3132use unicode; 
     
    3637no strict 'refs'; # allow filehandles to be variables and viceversa 
    3738 
     39# methods defined in superclasses that have the same signature take 
     40# precedence in the order given in the ISA list. We want MetaPlugins to 
     41# call MetadataRead's can_process_this_file_for_metadata(), rather than 
     42# calling BasePlugin's version of the same method, so list inherited  
     43# superclasses in this order. 
    3844sub BEGIN { 
    39     @MARCPlugin::ISA = ('SplitTextFile'); 
     45    @MARCPlugin::ISA = ('MetadataRead', 'SplitTextFile');  
    4046    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan"); 
    4147} 
     
    8490    push(@{$hashArgOptLists->{"ArgList"}},@{$arguments}); 
    8591    push(@{$hashArgOptLists->{"OptList"}},$options); 
    86  
     92  
     93    # this does nothing yet, but if member vars are ever added 
     94    # to MetadataRead, will need to do this anyway: 
     95    #new MetadataRead($pluginlist, $inputargs, $hashArgOptLists); 
    8796    my $self = new SplitTextFile($pluginlist, $inputargs, $hashArgOptLists); 
    8897 
  • main/trunk/greenstone2/perllib/plugins/MARCXMLPlugin.pm

    r23352 r24547  
    3232use ReadXMLFile; 
    3333use ReadTextFile; 
     34use MetadataRead; 
    3435use marcmapping; 
    3536 
     
    3738no strict 'refs'; # allow filehandles to be variables and viceversa 
    3839 
     40# methods with identical signatures take precedence in the order given in the ISA list. 
    3941sub BEGIN { 
    40     @MARCXMLPlugin::ISA = ('ReadXMLFile', 'ReadTextFile'); 
     42    @MARCXMLPlugin::ISA = ('MetadataRead', 'ReadXMLFile', 'ReadTextFile'); 
    4143} 
    4244 
  • main/trunk/greenstone2/perllib/plugins/MetadataCSVPlugin.pm

    r23561 r24547  
    2929 
    3030use BasePlugin; 
     31use MetadataRead; 
     32 
    3133use strict; 
    3234no strict 'refs'; 
     
    3436 
    3537 
     38# methods with identical signatures take precedence in the order given in the ISA list. 
    3639sub BEGIN { 
    37     @MetadataCSVPlugin::ISA = ('BasePlugin'); 
     40    @MetadataCSVPlugin::ISA = ('MetadataRead', 'BasePlugin'); 
    3841} 
    3942 
  • main/trunk/greenstone2/perllib/plugins/OAIPlugin.pm

    r24404 r24547  
    3636use ReadTextFile; # needed for subroutine textcat_get_language_encoding 
    3737use metadatautil; 
    38  
     38use MetadataRead; 
     39 
     40# methods with identical signatures take precedence in the order given in the ISA list. 
    3941sub BEGIN { 
    40     @OAIPlugin::ISA = ('ReadXMLFile', 'ReadTextFile'); 
     42    @OAIPlugin::ISA = ('MetadataRead', 'ReadXMLFile', 'ReadTextFile'); 
    4143} 
    4244 
     
    183185    $self->{'metadata_xml'} .= $_; 
    184186    } 
    185 } 
    186  
    187 sub can_process_this_file_for_metadata { 
    188     my $self = shift(@_); 
    189  
    190     return $self->can_process_this_file(@_); 
    191187} 
    192188