Changeset 15873

Show
Ignore:
Timestamp:
05.06.2008 09:35:29 (11 years ago)
Author:
kjdon
Message:

plugin overhaul: all the plugins have new names. Have added a mapping between old names and new names so that if we are building an old collection that specifies xxPlug then we will load up the appropriate new ones

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugin.pm

    r14933 r15873  
    3232require util; 
    3333use gsprintf 'gsprintf'; 
     34 
     35# mapping from old plugin names to new ones for backwards compatibility 
     36# can remove at sometime in future when we no longer want to support old xxPlug plugins 
     37my $plugin_name_map = { 
     38    'ArcPlug' => 'ArchivesInfPlugin', 
     39    'RecPlug' => 'DirectoryPlugin', 
     40    'TEXTPlug' => 'TextPlugin', 
     41    'EMAILPlug' => 'EmailPlugin', 
     42    'SRCPlug' => 'SourceCodePlugin', 
     43    'NULPlug' => 'NulPlugin', 
     44    'W3ImgPlug' => 'W3ImagePlugin', 
     45    'PagedImgPlug' => 'PagedImagePlugin' 
     46    }; 
    3447 
    3548# global variables 
     
    4457my ($verbosity, $outhandle, $failhandle, $globaloptions); 
    4558 
    46  
     59sub get_valid_pluginname { 
     60    my ($pluginname) = @_; 
     61    my $valid_name = $pluginname; 
     62    if (defined $plugin_name_map->{$pluginname}) { 
     63    $valid_name = $plugin_name_map->{$pluginname}; 
     64    } elsif ($pluginname =~ /Plug$/) { 
     65    $valid_name =~ s/Plug/Plugin/; 
     66     
     67    } 
     68    return $valid_name; 
     69} 
    4770sub load_plugin_require 
    4871{ 
     
    102125sub load_plugin_for_info { 
    103126    my ($pluginname) = shift @_; 
    104  
     127    $pluginname = &get_valid_pluginname($pluginname); 
    105128    load_plugin_require($pluginname); 
    106129 
     
    134157    my $pluginname = shift @$pluginoptions; 
    135158    next unless defined $pluginname; 
    136  
     159    $pluginname = &get_valid_pluginname($pluginname); 
    137160    load_plugin_require($pluginname); 
    138161