MAEPlugin.popup
Class PluginLoader

java.lang.Object
  |
  +--MAEPlugin.MAEPlugin
        |
        +--MAEPlugin.MenuPlugin
              |
              +--MAEPlugin.popup.PopupPlugin
                    |
                    +--MAEPlugin.popup.PluginLoader
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, java.io.FilenameFilter, PluginStub

public final class PluginLoader
extends PopupPlugin
implements java.io.FilenameFilter

This class contains the dynamic MAEplugin loader. It will load either .jar or .class files (the latter is useful for debugging since no jar packaging is required).

This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The MAExplorer Mozilla and Legal files are available on http://maexplorer.sourceforge.net/.

Version:
$Date: 2003/03/03 16:21:35 $ / $Revision: 1.4 $
Author:
Jai Evans (DECA/CIT), C. Santos (DECA/CIT), P. Lemkin (NCI-FCRDC)
See Also:
MAExplorer Home

Field Summary
(package private)  java.awt.FileDialog fileDialog
          Reference to the Dialog that will load files
(package private) static int MAX_PLUGINS
          Maximum number of MAEPlugins that may be loaded at one time
(package private) static int nPluginPathsList
          Size of list of unique loaded plugins full path for ensuring uniqueness
(package private)  java.lang.String pluginClassName
          Reference to the plain name of the class to load
(package private)  MAEPlugin pluginObject
          Reference to the Object itself
(package private) static java.lang.String[] pluginPathsList
          List of unique loaded plugins full path for ensuring uniqueness
 
Fields inherited from class MAEPlugin.MAEPlugin
DBUG_MAEP, jarResources, maestub, menuFlag, menuHook, menuInsertionPointName, menuItem, plugInFileName, plugInName, propertySupport, registry, registryMaxSize
 
Fields inherited from interface MAEPlugin.PluginStub
PLUGIN_VERSION
 
Constructor Summary
PluginLoader(MAEStub stub)
          PluginLoader() - Creates new LoadPlugins.
PluginLoader(MAEStub stub, java.lang.String pluginJarPath)
          PluginLoader() - Creates new LoadPlugin but do it siliently.
 
Method Summary
(package private) static void ()
           
 boolean accept(java.io.File dir, java.lang.String name)
          accept() - implentation of FilenameFilter.
 java.lang.String getPluginDescription()
          getPluginDescription() - This returns a human readable description of the Plugin
private  boolean loadPlugin(java.lang.String path)
          loadPlugin() - tests and loads good MAPlugin from the path.
private  boolean loadPlugin(java.lang.String dir, java.lang.String fileName)
          loadPlugin() - tests and loads good MAEplugin.
 boolean loadPluginSilently(java.lang.String path)
          loadPluginSilently() - silently tests and loads good MAPlugin from the path.
private  boolean mountPlugin()
          mountPlugin() - loads the plugin into the MAE application.
 void pluginMain()
          pluginMain() - Is the method end-users implement to use the API.
 void updateCurGene(int mid)
          updateCurGene() - update any data since current gene has changed.
 void updateFilter()
          updateFilter() - update any dependent data since Filter has changed.
 void updateLabels()
          updateLabels() - update any dependent data since global labels have changed.
 void updateSlider()
          updateSlider() - update any dependent data sincea threshold slider has changed.
 
Methods inherited from class MAEPlugin.MenuPlugin
actionPerformed
 
Methods inherited from class MAEPlugin.MAEPlugin
getFlag, getInstance, getMAEStub, getMenuHook, getMenuInsertionPointName, getMenuItem, getNumberPlugins, getPluginFileName, getPluginName, getPlugins, menuActivated, pluginHalt, pluginInit, removePlugin, setFlag, setJarResources, setMAEStub, setMenuHook, setMenuInsertionPointName, setMenuItem, setMenuLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

MAX_PLUGINS

static final int MAX_PLUGINS
Maximum number of MAEPlugins that may be loaded at one time

pluginPathsList

static java.lang.String[] pluginPathsList
List of unique loaded plugins full path for ensuring uniqueness

nPluginPathsList

static int nPluginPathsList
Size of list of unique loaded plugins full path for ensuring uniqueness

fileDialog

java.awt.FileDialog fileDialog
Reference to the Dialog that will load files

pluginClassName

java.lang.String pluginClassName
Reference to the plain name of the class to load

pluginObject

MAEPlugin pluginObject
Reference to the Object itself
Constructor Detail

PluginLoader

public PluginLoader(MAEStub stub)
             throws PluginException
PluginLoader() - Creates new LoadPlugins.
Parameters:
stub - is the plugin stub
Throws:
PluginException -  

PluginLoader

public PluginLoader(MAEStub stub,
                    java.lang.String pluginJarPath)
             throws PluginException
PluginLoader() - Creates new LoadPlugin but do it siliently.
Parameters:
stub - is the plugin stub
Throws:
PluginException -  
Method Detail

static void ()

mountPlugin

private final boolean mountPlugin()
mountPlugin() - loads the plugin into the MAE application. These must be instances of class MAEplugin.
Returns:
false if plugin mount fails

loadPlugin

private final boolean loadPlugin(java.lang.String dir,
                                 java.lang.String fileName)
loadPlugin() - tests and loads good MAEplugin. Called in pluginMain() for GUI or in loadPlugin().
Parameters:
dir - the path to the plugin file
fileName - the name of the plugin .jar or .class file
Returns:
false if plugin load fails

loadPluginSilently

public final boolean loadPluginSilently(java.lang.String path)
loadPluginSilently() - silently tests and loads good MAPlugin from the path.
Parameters:
path - to search for plugin
Returns:
true if successfuly loaded the plugin

loadPlugin

private final boolean loadPlugin(java.lang.String path)
loadPlugin() - tests and loads good MAPlugin from the path.
Parameters:
path - to search for plugin
Returns:
true if successfuly loaded the plugin

accept

public boolean accept(java.io.File dir,
                      java.lang.String name)
accept() - implentation of FilenameFilter. Does not work and is never called in 1.1.2 and as as far as I can tell in 1.3 [see "Class Libraries" p. 603]
Specified by:
accept in interface java.io.FilenameFilter
Parameters:
dir - is the diredtory to browse
name - is the file to test for extensions
Returns:
true if accept the file.

pluginMain

public void pluginMain()
pluginMain() - Is the method end-users implement to use the API.
Overrides:
pluginMain in class MenuPlugin

getPluginDescription

public java.lang.String getPluginDescription()
getPluginDescription() - This returns a human readable description of the Plugin
Overrides:
getPluginDescription in class MAEPlugin
Returns:
plugin description if any.

updateCurGene

public void updateCurGene(int mid)
updateCurGene() - update any data since current gene has changed. This is invoked from the PopupRegistry
Overrides:
updateCurGene in class PopupPlugin
Parameters:
ml - is the gene list to update now that filter has changed.

updateFilter

public void updateFilter()
updateFilter() - update any dependent data since Filter has changed. This is invoked from the PopupRegistry
Overrides:
updateFilter in class PopupPlugin

updateSlider

public void updateSlider()
updateSlider() - update any dependent data sincea threshold slider has changed. This is invoked from the PopupRegistry.
Overrides:
updateSlider in class PopupPlugin

updateLabels

public void updateLabels()
updateLabels() - update any dependent data since global labels have changed. This is invoked from the PopupRegistry.
Overrides:
updateLabels in class PopupPlugin