edu.wisc.ssec.mcidasv
Class ArgumentManager

java.lang.Object
  extended by ucar.unidata.ui.WindowHolder
      extended by ucar.unidata.idv.IdvManager
          extended by ucar.unidata.idv.ArgsManager
              extended by edu.wisc.ssec.mcidasv.ArgumentManager
All Implemented Interfaces:
ActionListener, EventListener, IdvConstants

public class ArgumentManager
extends ArgsManager

McIDAS-V needs to handle a few command line flags/options that the IDV does not. Only the ability to force the Aqua look and feel currently exists.

Author:
McIDAS-V Developers

Field Summary
static String ARG_JYTHONARGS
          McIDAS-V flag that signifies everything that follows is a Jython argument.
(package private)  String defaultUserDirectory
          Given by the "-user" argument.
private  List<String> jythonArguments
          Jython arguments, if any.
private  String jythonScript
          Jython script to execute, or "<none>" if one was not given.
static String USAGE_MESSAGE
          usage message
 
Fields inherited from class ucar.unidata.idv.ArgsManager
argDisplayB64Xml, argXidvFiles, b64Bundles, fileMappingFiles, fileMappingIds, installPlugins, jythonCode, listResources, noGui, persistentCommandLineArgs, plugins, printJnlpBundles, RUNNABLE_MAX_TRIES, scriptingFiles, testArchive, testDir, testEval, testMode
 
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
ArgumentManager(IntegratedDataViewer idv, String[] args)
          Just bubblin' on up the inheritance hierarchy.
 
Method Summary
private static List<String> extractJythonArgs(int index, String[] args)
           
 List<PatternFileFilter> getBundleFileFilters()
           
 List<PatternFileFilter> getBundleFilters(boolean fromOpen)
          Returns a list of PatternFileFilters that can be used to determine if a file is a bundle.
 List<String> getJythonArguments()
          Returns Jython arguments.
 String getJythonScript()
          Returns the name of the Jython script the user has provided.
protected  String getUsageMessage()
          Append some McIDAS-V specific command line options to the default IDV usage message.
 PatternFileFilter getXidvFileFilter()
           
 PatternFileFilter getXidvZidvFileFilter()
           
 PatternFileFilter getZidvFileFilter()
           
 boolean hasJythonArguments()
          Determine whether or not the user has provided any arguments for a Jython script.
static boolean isBundle(String name)
          Tests name to see if it has a known bundle extension.
 boolean isXidvFile(String name)
           
static boolean isXmlBundle(String name)
          Tests to see if name has a known XML bundle extension.
 boolean isZidvFile(String name)
           
static boolean isZippedBundle(String name)
          Tests to see if name has a known zipped bundle extension.
protected  int parseArg(String arg, String[] args, int idx)
          Currently we're only handling the -forceaqua flag so we can mitigate some overlay issues we've been seeing on OS X Leopard.
protected  void processInitialBundles()
          Gets called by the IDV to process the set of initial files, e.g., default bundles, command line bundles, jnlp files, etc.
 void usage(String err)
          Print out the command line usage message and exit
 
Methods inherited from class ucar.unidata.idv.ArgsManager
checkArg, getCollabHostName, getCollabPort, getDoCollabServer, getFixedTimeString, getInitCatalogs, getIslInteractive, getIsOffScreen, getNoGui, getOriginalArgs, initDone, isBundleFile, isDisplayXmlFile, isIslFile, isJnlpFile, isRbiFile, isScriptingMode, msg, parseArgs, parseArgs, preprocessArgs, processInstanceArgs, setIsOffScreen
 
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

ARG_JYTHONARGS

public static final String ARG_JYTHONARGS
McIDAS-V flag that signifies everything that follows is a Jython argument.

See Also:
Constant Field Values

USAGE_MESSAGE

public static final String USAGE_MESSAGE
usage message

See Also:
Constant Field Values

jythonArguments

private List<String> jythonArguments
Jython arguments, if any.


jythonScript

private String jythonScript
Jython script to execute, or "<none>" if one was not given.


defaultUserDirectory

String defaultUserDirectory
Given by the "-user" argument. Alternative user path for bundles, resources, etc.

Constructor Detail

ArgumentManager

public ArgumentManager(IntegratedDataViewer idv,
                       String[] args)
Just bubblin' on up the inheritance hierarchy.

Parameters:
idv - The IDV instance.
args - The command line arguments that were given.
Method Detail

extractJythonArgs

private static List<String> extractJythonArgs(int index,
                                              String[] args)

parseArg

protected int parseArg(String arg,
                       String[] args,
                       int idx)
                throws Exception
Currently we're only handling the -forceaqua flag so we can mitigate some overlay issues we've been seeing on OS X Leopard.

Overrides:
parseArg in class ArgsManager
Parameters:
arg - The current argument we're examining.
args - The actual array of arguments.
idx - The index of arg within args.
Returns:
The idx of the last value in the args array we look at. i.e., if the flag arg does not require any further values in the args array then don't increment idx. If arg requires one more value then increment idx by one. etc.
Throws:
Exception - Throw bad things off to something that can handle 'em!

usage

public void usage(String err)
Print out the command line usage message and exit

Overrides:
usage in class ArgsManager
Parameters:
err - The usage message

getUsageMessage

protected String getUsageMessage()
Append some McIDAS-V specific command line options to the default IDV usage message.

Overrides:
getUsageMessage in class ArgsManager
Returns:
Usage message.

hasJythonArguments

public boolean hasJythonArguments()
Determine whether or not the user has provided any arguments for a Jython script.

Returns:
true if the user has provided Jython arguments, false otherwise.

getJythonArguments

public List<String> getJythonArguments()
Returns Jython arguments. Note: this does not include the Jython script that will be executed.

Returns:
Either a List of Strings containing the arguments or an empty List if there were no arguments given.

getJythonScript

public String getJythonScript()
Returns the name of the Jython script the user has provided.

Returns:
Either the path to a Jython file or "<none>" if the user did not provide a script.

processInitialBundles

protected void processInitialBundles()
                              throws VisADException,
                                     RemoteException
Gets called by the IDV to process the set of initial files, e.g., default bundles, command line bundles, jnlp files, etc.

Overridden by McIDAS-V to remove bundle file paths that are zero characters long. This was happening because runMcV.bat was always passing '-bundle ""' on the command line (for Windows).

Overrides:
processInitialBundles in class ArgsManager
Throws:
VisADException - When something untoward happens
RemoteException - When something untoward happens

getBundleFileFilters

public List<PatternFileFilter> getBundleFileFilters()
Overrides:
getBundleFileFilters in class ArgsManager
See Also:
ArgsManager.getBundleFileFilters()

getBundleFilters

public List<PatternFileFilter> getBundleFilters(boolean fromOpen)
Returns a list of PatternFileFilters that can be used to determine if a file is a bundle.

If fromOpen is true, the returned list will contain PatternFileFilters for bundles as well as JNLP and ISL files. If false, the returned list will only contain filters for XML and zipped bundles.

Parameters:
fromOpen - Whether or not this has been called from an "open file" dialog.
Returns:
Filters for bundles.

getXidvFileFilter

public PatternFileFilter getXidvFileFilter()
Overrides:
getXidvFileFilter in class ArgsManager
See Also:
ArgsManager.getXidvFileFilter()

getZidvFileFilter

public PatternFileFilter getZidvFileFilter()
Overrides:
getZidvFileFilter in class ArgsManager
See Also:
ArgsManager.getZidvFileFilter()

getXidvZidvFileFilter

public PatternFileFilter getXidvZidvFileFilter()
Overrides:
getXidvZidvFileFilter in class ArgsManager
See Also:
ArgsManager.getXidvZidvFileFilter()

isZidvFile

public boolean isZidvFile(String name)
Overrides:
isZidvFile in class ArgsManager

isXidvFile

public boolean isXidvFile(String name)
Overrides:
isXidvFile in class ArgsManager

isXmlBundle

public static boolean isXmlBundle(String name)
Tests to see if name has a known XML bundle extension.

Parameters:
name - Name of the bundle.
Returns:
Whether or not name has an XML bundle suffix.

isZippedBundle

public static boolean isZippedBundle(String name)
Tests to see if name has a known zipped bundle extension.

Parameters:
name - Name of the bundle.
Returns:
Whether or not name has zipped bundle suffix.

isBundle

public static boolean isBundle(String name)
Tests name to see if it has a known bundle extension.

Parameters:
name - Name of the bundle.
Returns:
Whether or not name has a bundle suffix.