Changeset 20446

Show
Ignore:
Timestamp:
31.08.2009 14:38:34 (10 years ago)
Author:
kjdon
Message:

moved code to do with converting from old plugin names to new ones into Utility

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/util/Utility.java

    r14052 r20446  
    429429    } 
    430430 
    431  
     431  static private HashMap plugin_map = null; 
     432   
     433  static private void setUpPluginNameMap() { 
     434    plugin_map = new HashMap(); 
     435    plugin_map.put("GAPlug", "GreenstoneXMLPlugin"); 
     436    plugin_map.put("RecPlug", "DirectoryPlugin"); 
     437    plugin_map.put("ArcPlug","ArchivesInfPlugin"); 
     438    plugin_map.put("TEXTPlug","TextPlugin"); 
     439    plugin_map.put("XMLPlug","ReadXMLFile"); 
     440    plugin_map.put("EMAILPlug","EmailPlugin"); 
     441    plugin_map.put("SRCPlug","SourceCodePlugin"); 
     442    plugin_map.put("NULPlug","NulPlugin"); 
     443    plugin_map.put("W3ImgPlug","HTMLImagePlugin"); 
     444    plugin_map.put("PagedImgPlug","PagedImagePlugin"); 
     445    plugin_map.put("METSPlug", "GreenstoneMETSPlugin"); 
     446    plugin_map.put("DBPlug", "DatabasePlugin"); 
     447    plugin_map.put("PPTPlug", "PowerPointPlugin"); 
     448    plugin_map.put("PSPlug", "PostScriptPlugin"); 
     449  } 
     450 
     451  static public String ensureNewPluginName(String plugin) { 
     452    if (plugin.endsWith("Plugin")) return plugin; 
     453    if (plugin_map == null) { 
     454      setUpPluginNameMap(); 
     455    } 
     456    String new_name = (String)plugin_map.get(plugin); 
     457    if (new_name != null) return new_name; 
     458    new_name = plugin.replaceAll("Plug", "Plugin"); 
     459    return new_name; 
     460  } 
     461    
    432462}