Ignore:
Timestamp:
2008-06-05T09:29:32+12:00 (16 years ago)
Author:
kjdon
Message:

plugin overhaul: plugins renamed to xxPlugin, and in some cases the names are made more sensible. They now use the new base plugins. Hopefully we have better code reuse. Some of the plugins still need work done as I didn't want to spend another month doing this before committing it. Alos, I haven't really tested anything yet...

File:
1 edited

Legend:

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

    r15865 r15872  
    11###########################################################################
    22#
    3 # LOMPlug.pm -- plugin for import the collection from LOM
     3# LOMPlugin.pm -- plugin for import the collection from LOM
    44#
    55# A component of the Greenstone digital library software
     
    2727### Note this plugin currently can't download source documents from outside if you are behind a firewall.
    2828
    29 package LOMPlug;
    30 
    31 use BasPlug;
     29package LOMPlugin;
     30
     31use ReadTextFile;
    3232use MetadataPass;
    3333use XMLParser;
     
    3535
    3636sub BEGIN {
    37     @ISA = ('BasPlug', 'MetadataPass');
     37    @ISA = ('ReadTextFile', 'MetadataPass');
    3838}
    3939
     
    4444my $arguments =
    4545    [ { 'name' => "process_exp",
    46     'desc' => "{BasPlug.process_exp}",
     46    'desc' => "{ReadTextFile.process_exp}",
    4747    'type' => "string",
    4848    'deft' => &get_default_process_exp(),
    4949    'reqd' => "no" },
    5050      { 'name' => "root_tag",
    51     'desc' => "{LOMPlug.root_tag}",
     51    'desc' => "{LOMPlugin.root_tag}",
    5252    'type' => "regexp",
    5353    'deft' => q/^(?i)lom$/,
    5454    'reqd' => "no" },
    5555      { 'name' => "check_timestamp",
    56     'desc' => "{LOMPlug.check_timestamp}",
     56    'desc' => "{LOMPlugin.check_timestamp}",
    5757    'type' => "flag" },
    5858      { 'name' => "download_srcdocs",
    59     'desc' => "{LOMPlug.download_srcdocs}",
     59    'desc' => "{LOMPlugin.download_srcdocs}",
    6060    'type' => "regexp",
    6161    'deft' => "",
    6262    'reqd' => "no" }];
    6363
    64 my $options = { 'name'     => "LOMPlug",
    65         'desc'     => "{LOMPlug.desc}",
     64my $options = { 'name'     => "LOMPlugin",
     65        'desc'     => "{LOMPlugin.desc}",
    6666        'inherits' => "yes",
    6767        'args'     => $arguments };
     
    7575    push(@$pluginlist, $class);
    7676   
    77     if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
    78     if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     77    push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
     78    push(@{$hashArgOptLists->{"OptList"}},$options);
    7979   
    80     $self = new BasPlug($pluginlist, $inputargs, $hashArgOptLists);
     80    $self = new ReadTextFile($pluginlist, $inputargs, $hashArgOptLists);
     81
     82    if ($self->{'info_only'}) {
     83    # don't worry about creating the XML parser as all we want is the
     84    # list of plugin options
     85    return bless $self, $class;
     86    }
    8187
    8288    #create XML::Parser object for parsing dublin_core.xml files
     
    120126    $file =~ s/^[\/\\]+//; # $file often begins with / so we'll tidy it up
    121127   
    122     print $outhandle "LOMPlug: extracting metadata from $file\n"
     128    print $outhandle "LOMPlugin: extracting metadata from $file\n"
    123129    if $self->{'verbosity'} > 1;
    124130
     
    131137   
    132138    if ($@) {
    133     print $outhandle "LOMPlug: skipping $filename as not conformant to LOM syntax\n" if ($self->{'verbosity'} > 1);
     139    print $outhandle "LOMPlugin: skipping $filename as not conformant to LOM syntax\n" if ($self->{'verbosity'} > 1);
    134140    print $outhandle "\n Perl Error:\n $@\n" if ($self->{'verbosity'}>2);
    135141    return 0;
     
    262268    my $outhandle = $self->{'outhandle'};
    263269
    264     print STDERR "<Processing n='$file' p='LOMPlug'>\n" if ($gli);
     270    print STDERR "<Processing n='$file' p='LOMPlugin'>\n" if ($gli);
    265271
    266272    print $outhandle "LOMPLug: processing $file\n";
Note: See TracChangeset for help on using the changeset viewer.