ucar.unidata.idv
Class PluginManager

java.lang.Object
  extended by ucar.unidata.ui.WindowHolder
      extended by ucar.unidata.idv.IdvManager
          extended by ucar.unidata.idv.PluginManager
All Implemented Interfaces:
ActionListener, EventListener, IdvConstants

public class PluginManager
extends IdvManager


Field Summary
static String ATTR_CATEGORY
          Xml attr
static String ATTR_DESC
          Xml attr name
static String ATTR_NAME
          Xml attr
static String ATTR_SIZE
          Xml attr
static String ATTR_URL
          Xml attr name
static String ATTR_VERSION
          Xml attr
static String PLUGIN_PROTOCOL
          for url plugins
static String TAG_PLUGIN
          xml tag
 
Fields inherited from class ucar.unidata.ui.WindowHolder
contents, dialog, frame, window
 
Fields inherited from interface ucar.unidata.idv.IdvConstants
ARG_B64BUNDLE, ARG_B64ISL, ARG_BUNDLE, ARG_CATALOG, ARG_CHOOSER, ARG_CLEARDEFAULT, ARG_CODE, ARG_CONNECT, ARG_CURRENTTIME, ARG_DATA, ARG_DEBUG, ARG_DEFAULT, ARG_DISPLAY, ARG_DXML, ARG_FIXEDTIME, ARG_HELP, ARG_IMAGE, ARG_IMAGESERVER, ARG_INSTALLPLUGIN, ARG_ISLFILE, ARG_ISLINTERACTIVE, ARG_LISTRESOURCES, ARG_MAINCLASS, ARG_MOVIE, ARG_MSG_DEBUG, ARG_MSG_RECORD, ARG_NODEFAULT, ARG_NOERRORSINGUI, ARG_NOGUI, ARG_NOONEINSTANCE, ARG_NOPLUGINS, ARG_NOPREF, ARG_ONEINSTANCEPORT, ARG_PLUGIN, ARG_PORT, ARG_PRINTJNLP, ARG_PROPERTIES, ARG_SCRIPT, ARG_SERVER, ARG_SETFILES, ARG_SITEPATH, ARG_TEMPLATE, ARG_TEST, ARG_TESTEVAL, ARG_TRACE, ARG_TRACEONLY, ARG_USERPATH, DEFAULT_DATE_FORMAT, DEFAULT_DOCPATH, DEFAULT_MAX_PERMGENSIZE, DEFAULT_TIMEZONE, FILTER_CPT, FILTER_ISL, FILTER_JNLP, FILTER_XIDV, FILTER_XIDVZIDV, FILTER_XML, FILTER_ZIDV, ID_COMMANDSTORUN, ID_DATASOURCES, ID_DISPLAYCONTROLS, ID_IDV, ID_JYTHON, ID_MESSAGE, ID_MISCHASHTABLE, ID_NCIDV_VERSION, ID_VERSION, ID_VIEWMANAGERS, ID_WINDOWS, INITIAL_PROBE_EARTHLOCATION, NULL_DATA_SELECTION, NULL_STRING, PREF_ARCHIVEDIR, PREF_ARCHIVENAME, PREF_AUTODISPLAYS_ENABLE, PREF_AUTODISPLAYS_SHOWGUI, PREF_AUTOSELECTDATA, PREF_CACHESIZE, PREF_CONTROLSINTABS, PREF_DATAPREFIX, PREF_DATE_FORMAT, PREF_DISTANCEUNIT, PREF_DOCACHE, PREF_EMBEDDATACHOOSERINDASHBOARD, PREF_EMBEDFIELDSELECTORINDASHBOARD, PREF_EMBEDLEGENDINDASHBOARD, PREF_EMBEDQUICKLINKSINDASHBOARD, PREF_EVENT_KEYBOARDMAP, PREF_EVENT_MOUSEMAP, PREF_EVENT_WHEELMAP, PREF_FAST_RENDER, PREF_FIELD_CACHETHRESHOLD, PREF_FILEREADDIR, PREF_FILEWRITEDIR, PREF_GEOMETRY_BY_REF, PREF_HISTORY, PREF_IMAGE_BY_REF, PREF_LARGE_REMOTE_DATA_WARN, PREF_LASTVERSION, PREF_LATLON_FORMAT, PREF_LEGEND_SHOWICONS, PREF_LOCALE, PREF_LOOKANDFEEL, PREF_MAX_PERMGENSIZE, PREF_MAXIMAGESIZE, PREF_MEMORY, PREF_NPOT_IMAGE, PREF_OPEN_ASK, PREF_OPEN_MERGE, PREF_OPEN_REMOVE, PREF_PROJ_LIST, PREF_SAMPLINGMODE, PREF_SHOWCONTROLWINDOW, PREF_SHOWDASHBOARD, PREF_SHOWDECODEDIALOG, PREF_SHOWHIDDENFILES, PREF_SHOWQUITCONFIRM, PREF_SITEPATH, PREF_THREADS_DATA, PREF_THREADS_RENDER, PREF_TIMEZONE, PREF_VERTICALCS, PREF_VERTICALUNIT, PREF_WINDOW_SHOWTOOLBAR, PREF_ZIDV_ASK, PREF_ZIDV_DIRECTORY, PREF_ZIDV_SAVETOTMP, PROP_3DMODE, PROP_ABOUTTEXT, PROP_APPRESOURCEPATH, PROP_CHOOSERS, PROP_CHOOSERS_ALL, PROP_CONTROLDESCRIPTORS, PROP_CONTROLDESCRIPTORS_ALL, PROP_DATAHOLDERBOUNDS, PROP_DEFAULTLOCATIONS, PROP_DISPLAYLIST_GROUP, PROP_FIXFILELOCKUP, PROP_JNLPCODEBASE, PROP_JNLPTEMPLATE, PROP_JNLPTITLE, PROP_LOADINGXML, PROP_MAP_GLOBE_LEVEL, PROP_MAP_MAP_LEVEL, PROP_MINIMUMFRAMECYCLETIME, PROP_MONITORPORT, PROP_OLDCONTROLDESCRIPTORS, PROP_ONEINSTANCEPORT, PROP_PREFERENCES, PROP_PROJ_NAME, PROP_RESOURCEFILES, PROP_SHOWCLOCK, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, PROP_USE_TIMEDRIVER, PROP_VERSIONFILE, PROP_WINDOW_SCREENSIZEOFFSET, PROP_WINDOW_SIZEHEIGHT, PROP_WINDOW_SIZEWIDTH, PROP_WINDOW_USESCREENSIZE, SUFFIX_BAT, SUFFIX_CPT, SUFFIX_ISL, SUFFIX_JNLP, SUFFIX_RBI, SUFFIX_SH, SUFFIX_XIDV, SUFFIX_XML, SUFFIX_ZIDV
 
Constructor Summary
PluginManager(IntegratedDataViewer idv)
          ctor
 
Method Summary
 void addCreateFile()
          Let user select a file to put into the plugin
 void addCreateFile(String file)
          Add the file to the list of plugin files
protected  void addError(String message, Throwable exc)
          add an error
 void addObject(Object obj)
          Add some object to the list
 void addObjects(List objects)
          Add the list of objects
 void addPreferences()
          Add main.xml
 void addText(String text, String filename)
          Add the given text with the given filename.
 void applyPreferences()
          Apply preferences
 void closeCreatePlugin()
          Close the dialog
 void closePluginDialog()
          close dialog
protected  void closeResources()
          This gets called on System.exit and closes any open plugin jar files
 void createPlugin()
          Write the plugin
static String decode(File f)
          Decode the name of the file.
static String decode(String filename)
          Decode the name of the file.
static String encode(String filename)
          Encode the filename
 String getPluginHtml()
          Show a dialog that lists the loaded plugins
 void handlePlugin(String path)
          Handle the extension file.
 void importPlugin()
          import plugin from file
 void importPlugin(String filename)
          import plugin from file
 void importPlugin(String filename, boolean merge)
          import plugin from file
 void initializeColorTableMenu(JMenu menu)
          Add entries to menu
 void initializeFavoritesMenu(JMenu menu)
          Add entries to menu
 void initializeFormulasMenu(JMenu menu)
          Add entries to menu
 void initializeMenu(JMenu menu, List list, String name)
          Add entries to menu
 void initializeParamDefaultsMenu(JMenu menu)
          Add entries to menu
 void initializeProjectionsMenu(JMenu menu)
          Add entries to menu
 void initializeStationModelsMenu(JMenu menu)
          Add entries to menu
 void installPlugin(String plugin)
          install the plugin
 void installPluginFromFile()
          Prompt for a plugin filename and install it.
 void installPluginFromFile(String filename)
          Install a plugin from a file
 void installPluginFromUrl()
          Prompt for a plugin url and install it.
 void installPluginInThread(String plugin)
          install the plugin
 void listPlugin(String file)
          List the contents of the plugin file
 void loadBundlesFromDisk()
          Load bundles from disk
protected  void loadJar(String jarFilePath)
          Load the jar file
protected  void loadPlugin(String filename, boolean topLevel)
          Try to process the given file.
protected  void loadPlugin(String filename, String prefix, boolean topLevel)
          Try to process the given file.
protected  void loadPlugin(String filename, String prefix, boolean topLevel, String label)
          load plugin
protected  void loadPlugins()
          Load in any plugins
static void main(String[] args)
          test
protected  void notifyUser()
          Notify the users to restart the IDV
 void removeCreateFile()
          Remove the selected entry(ies) in the list of resources
 void removePlugin(File file)
          remove plugin
 void removePlugin(String file)
          remove plugin
 String selectJarFile()
          Ask the user to seelct a jar file.
 void showCreatePlugin()
          Show the create dialog
 void showCreatorHelp()
          Show help
 void showManagerHelp()
          Show help
 void showPluginList()
          show dialog
 void toggleCategory(String category)
          Show or hide the category
 void updatePlugins()
          Show a dialog that lists the loaded plugins
 void updatePlugins(boolean doLoaded)
          Show a dialog that lists the loaded plugins
 void viewPluginFile(Object[] args)
          View the plugin file.
 
Methods inherited from class ucar.unidata.idv.IdvManager
getArgsManager, getCollabManager, getColorTableManager, getDataManager, getIdv, getIdvChooserManager, getIdvClass, getIdvProjectionManager, getIdvUIManager, getImageGenerator, getInstallManager, getJythonManager, getPersistenceManager, getPreferenceManager, getProperty, getProperty, getProperty, getPublishManager, getResourceManager, getStateManager, getStationModelManager, getStore, getVMManager, logException, showNormalCursor, showWaitCursor, waitUntilDisplaysAreDone, waitUntilDisplaysAreDone
 
Methods inherited from class ucar.unidata.ui.WindowHolder
actionPerformed, close, doMakeContents, getContents, getDialog, getFrame, getWindow, getWindowTitle, isShowing, removeAll, setMenuBar, setWindowTitle, shouldMakeDialog, show, show, showModal, toFront, windowIsClosing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLUGIN_PROTOCOL

public static final String PLUGIN_PROTOCOL
for url plugins

See Also:
Constant Field Values

TAG_PLUGIN

public static final String TAG_PLUGIN
xml tag

See Also:
Constant Field Values

ATTR_NAME

public static final String ATTR_NAME
Xml attr

See Also:
Constant Field Values

ATTR_SIZE

public static final String ATTR_SIZE
Xml attr

See Also:
Constant Field Values

ATTR_VERSION

public static final String ATTR_VERSION
Xml attr

See Also:
Constant Field Values

ATTR_CATEGORY

public static final String ATTR_CATEGORY
Xml attr

See Also:
Constant Field Values

ATTR_DESC

public static final String ATTR_DESC
Xml attr name

See Also:
Constant Field Values

ATTR_URL

public static final String ATTR_URL
Xml attr name

See Also:
Constant Field Values
Constructor Detail

PluginManager

public PluginManager(IntegratedDataViewer idv)
ctor

Parameters:
idv - the idv
Method Detail

viewPluginFile

public void viewPluginFile(Object[] args)
View the plugin file. The jar file is args[0]. The jarEntry is args[1]

Parameters:
args - The args

listPlugin

public void listPlugin(String file)
List the contents of the plugin file

Parameters:
file - The plugin file

selectJarFile

public String selectJarFile()
Ask the user to seelct a jar file. Set the jarFileFld textfield

Returns:
The jar file selected

addText

public void addText(String text,
                    String filename)
Add the given text with the given filename. Write out the file to a tmp directory.

Parameters:
text - Text to write
filename - Filename to use

addObjects

public void addObjects(List objects)
Add the list of objects

Parameters:
objects - Objects

addObject

public void addObject(Object obj)
Add some object to the list

Parameters:
obj - The object to add

createPlugin

public void createPlugin()
Write the plugin


closeCreatePlugin

public void closeCreatePlugin()
Close the dialog


applyPreferences

public void applyPreferences()
Apply preferences


addCreateFile

public void addCreateFile()
Let user select a file to put into the plugin


addCreateFile

public void addCreateFile(String file)
Add the file to the list of plugin files

Parameters:
file - The file

removeCreateFile

public void removeCreateFile()
Remove the selected entry(ies) in the list of resources


initializeColorTableMenu

public void initializeColorTableMenu(JMenu menu)
Add entries to menu

Parameters:
menu - the menu

initializeStationModelsMenu

public void initializeStationModelsMenu(JMenu menu)
Add entries to menu

Parameters:
menu - the menu

initializeFavoritesMenu

public void initializeFavoritesMenu(JMenu menu)
Add entries to menu

Parameters:
menu - the menu

initializeFormulasMenu

public void initializeFormulasMenu(JMenu menu)
Add entries to menu

Parameters:
menu - the menu

loadBundlesFromDisk

public void loadBundlesFromDisk()
Load bundles from disk


initializeParamDefaultsMenu

public void initializeParamDefaultsMenu(JMenu menu)
Add entries to menu

Parameters:
menu - the menu

initializeProjectionsMenu

public void initializeProjectionsMenu(JMenu menu)
Add entries to menu

Parameters:
menu - the menu

initializeMenu

public void initializeMenu(JMenu menu,
                           List list,
                           String name)
Add entries to menu

Parameters:
menu - the menu
list - List of entries
name - name of the sub menu

addPreferences

public void addPreferences()
Add main.xml


showCreatePlugin

public void showCreatePlugin()
Show the create dialog


showCreatorHelp

public void showCreatorHelp()
Show help


showManagerHelp

public void showManagerHelp()
Show help


showPluginList

public void showPluginList()
show dialog


closeResources

protected void closeResources()
This gets called on System.exit and closes any open plugin jar files


loadPlugins

protected void loadPlugins()
                    throws Exception
Load in any plugins

Throws:
Exception - On badness_

addError

protected void addError(String message,
                        Throwable exc)
add an error

Parameters:
message - msg
exc - exception

handlePlugin

public void handlePlugin(String path)
                  throws Exception
Handle the extension file. It may be a jar, index or resource file

Parameters:
path - file path or url
Throws:
Exception - On badness

loadPlugin

protected void loadPlugin(String filename,
                          boolean topLevel)
                   throws Exception
Try to process the given file. This deals with rbis, properties and files with the default name of resources

Parameters:
filename - The file
topLevel - Flag that designates that this plugin is one of the main files in the plugins directory.
Throws:
Exception - On badness

removePlugin

public void removePlugin(String file)
remove plugin

Parameters:
file - file

removePlugin

public void removePlugin(File file)
remove plugin

Parameters:
file - file

loadPlugin

protected void loadPlugin(String filename,
                          String prefix,
                          boolean topLevel)
                   throws Exception
Try to process the given file. This deals with rbis, properties and files with the default name of resources

Parameters:
filename - The file
prefix - Prefix to prepend on the filename for jar based entries
topLevel - Flag that designates that this plugin is one of the main files in the plugins directory.
Throws:
Exception - On badness

loadPlugin

protected void loadPlugin(String filename,
                          String prefix,
                          boolean topLevel,
                          String label)
                   throws Exception
load plugin

Parameters:
filename - plugin file
prefix - prefix
topLevel - top level
label - label
Throws:
Exception - on badness

loadJar

protected void loadJar(String jarFilePath)
Load the jar file

Parameters:
jarFilePath - Load the jar

getPluginHtml

public String getPluginHtml()
Show a dialog that lists the loaded plugins

Returns:
the plugin html listing to include in support requests

importPlugin

public void importPlugin()
import plugin from file


importPlugin

public void importPlugin(String filename)
import plugin from file

Parameters:
filename - filename

importPlugin

public void importPlugin(String filename,
                         boolean merge)
import plugin from file

Parameters:
filename - filename
merge - merge

installPluginFromFile

public void installPluginFromFile()
Prompt for a plugin filename and install it.


installPluginFromFile

public void installPluginFromFile(String filename)
Install a plugin from a file

Parameters:
filename - file name

notifyUser

protected void notifyUser()
Notify the users to restart the IDV


installPluginFromUrl

public void installPluginFromUrl()
Prompt for a plugin url and install it.


installPlugin

public void installPlugin(String plugin)
install the plugin

Parameters:
plugin - url or file name of the plugin

installPluginInThread

public void installPluginInThread(String plugin)
install the plugin

Parameters:
plugin - url or file name of the plugin

closePluginDialog

public void closePluginDialog()
close dialog


decode

public static String decode(File f)
Decode the name of the file. This is the full url or original file path

Parameters:
f - file
Returns:
decoded name

decode

public static String decode(String filename)
Decode the name of the file. This is the full url or original file path

Parameters:
filename - filen
Returns:
decoded name

encode

public static String encode(String filename)
Encode the filename

Parameters:
filename - file or url
Returns:
encoded version

toggleCategory

public void toggleCategory(String category)
Show or hide the category

Parameters:
category - category to show or hide

updatePlugins

public void updatePlugins()
Show a dialog that lists the loaded plugins


updatePlugins

public void updatePlugins(boolean doLoaded)
Show a dialog that lists the loaded plugins

Parameters:
doLoaded - Update the loaded list as well

main

public static void main(String[] args)
                 throws IOException
test

Parameters:
args - args
Throws:
IOException - on badness