Package ucar.unidata.idv
Class ArgsManager
java.lang.Object
ucar.unidata.ui.WindowHolder
ucar.unidata.idv.IdvManager
ucar.unidata.idv.ArgsManager
- All Implemented Interfaces:
ActionListener,EventListener,IdvConstants
This manages the parsing and processing of the command line
arguments to the IDV. If an IDV application needs to add
custom command line arguments then you need to do:
- Overwrite the factory method,
IdvBase.doMakeArgsManager(String[]), in your derivedIntegratedDataViewerclass. - This new method should return your own subclass of ArgsManager.
- This subclass should overwrite the
parseArg(String,String[],int)method.
- Author:
- IDV development team
-
Field Summary
FieldsModifier and TypeFieldDescriptionA list of the base 64 encoded in line display xml filesA list (String) of the bundle sources (files and/or urls) passed in on the command line.A list of the base 64 encoded in line bundles.protected ListHolds the set files argumentsprotected ListHolds the set files argumentsprotected ListHolds the list of display names.protected ListHolds the list of parameter names.List of pluginsprotected HashtableHolds the optional arguments of ISL fileprotected StringJython code that should be evaluated at startup timeprotected booleanShould we list out the resources for debuggingprotected booleanShould any guis be shownprotected ListThis holds the command line arguments that should be written out in saved jnlp files (e.g., .properties)List of pluginsprotected booleanShuold the embedded bundles in jnlp files be printed outstatic final intHow many times to try to run the initial runnablesList of isl filesThe name of the test archive when we are in test archive writing modeThe name of the test directory when we are in test archive writing modebooleanCreated when we see the -testeval command line argument.booleanCreated when we see the -test command line argument.static final Stringusage messageFields inherited from class ucar.unidata.ui.WindowHolder
contents, dialog, frame, windowFields 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_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_APPEARANCEMODE, 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_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_DASH, PROP_SHOWCLOCK_VIEW, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, PROP_USE_DISPLAYAREA, 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
ConstructorsConstructorDescriptionArgsManager(IntegratedDataViewer idv, String[] args) Create the manager with the given idv and command line arguments. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanA utility method for checking the argument array.Return a list of file filters that match on all of the types of bundlesGet the host name for the collab serverintPort for collab serverbooleanShould we start up a collab serverthe fixed time index stringMethod to return the initial catalogsbooleanIs isl interactive modebooleanrunning in offscreen modebooleangetNoGui()Should we create any GUIsGet the very original command line arguments.String[]Get the very original command line arguments.protected StringReturn the command line usage message.Get the file filter to be used for a regular xidv bundle fileGet the file filter that matches both xidv and zidv filesGet the file filter to be used for a zidv bundle fileprotected voidinitDone()Called by the IDV when its initialization is complete.booleanisBundleFile(String name) Is the given file a bindlestatic booleanisDisplayXmlFile(String name) Helper method to determine if the given filename is a display xml filebooleanHelper method to determine if the given filename is an isl filebooleanisJnlpFile(String name) Helper method to determine if the given filename is a jnlp filebooleanHelper method to determine if the given filename is a resource bundle fileboolean_more_booleanisXidvFile(String name) Helper method to determine if the given filename is a xidv bundle filebooleanisZidvFile(String name) is file a zidv fileprotected StringUtility to format the usage message lineprotected intCheck the argument given by the arg parameter.voidParse the command line arguments.protected voidParse the given argument array.protected String[]preprocessArgs(String[] args) Check for any .jnlp files in the command line.protected voidGets called by the IDV to process the set of initial files, e.g., default bundles, command line bundles, jnlp files, etc.voidprocessInstanceArgs(String[] args) Process the command line argument we got passed form another instance of the idvvoidsetIsOffScreen(boolean v) set running in offscreen modevoidPrint out the command line usage message and exitMethods 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, waitUntilDisplaysAreDoneMethods 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
-
Field Details
-
USAGE_MESSAGE
usage message- See Also:
-
RUNNABLE_MAX_TRIES
public static final int RUNNABLE_MAX_TRIESHow many times to try to run the initial runnables- See Also:
-
listResources
protected boolean listResourcesShould we list out the resources for debugging -
persistentCommandLineArgs
This holds the command line arguments that should be written out in saved jnlp files (e.g., .properties) -
testMode
public boolean testModeCreated when we see the -test command line argument. Turns on testings. -
testEval
public boolean testEvalCreated when we see the -testeval command line argument. -
testArchive
The name of the test archive when we are in test archive writing mode -
testDir
The name of the test directory when we are in test archive writing mode -
noGui
protected boolean noGuiShould any guis be shown -
jythonCode
Jython code that should be evaluated at startup time -
argXidvFiles
A list (String) of the bundle sources (files and/or urls) passed in on the command line. -
argDisplayB64Xml
A list of the base 64 encoded in line display xml files -
b64Bundles
A list of the base 64 encoded in line bundles. This argument is mostly used for the jnlp files that hold a bundle From the IdvConstants.ARG_B64BUNDLE argument. -
plugins
List of plugins -
installPlugins
List of plugins -
printJnlpBundles
protected boolean printJnlpBundlesShuold the embedded bundles in jnlp files be printed out -
scriptingFiles
List of isl files -
initParams
Holds the list of parameter names.You can specify a set of initial parameter/display pairs that will automatically be created with every data source that gets loaded. This are defined with the
IdvConstants.ARG_DISPLAY -
initDisplays
Holds the list of display names.You can specify a set of initial parameter/display pairs that will automatically be created with every data source that gets loaded. This are defined with the
IdvConstants.ARG_DISPLAY -
fileMappingIds
Holds the set files arguments -
fileMappingFiles
Holds the set files arguments -
islOptionalArgs
Holds the optional arguments of ISL file
-
-
Constructor Details
-
ArgsManager
Create the manager with the given idv and command line arguments. This just sets some state, it does not yet parse the arguments. The IDV needs to callparseArgs()- Parameters:
idv- The IDVargs- Command line arguments
-
-
Method Details
-
getOptionalArgs
Get the very original command line arguments. The ones before we pre-process them.- Returns:
- The command line args
-
getOriginalArgs
Get the very original command line arguments. The ones before we pre-process them.- Returns:
- The command line args
-
getInitCatalogs
Method to return the initial catalogs- Returns:
- List of urls for the catalogs to show at start up time
-
initDone
protected void initDone()Called by the IDV when its initialization is complete. This method will popup the chooser manager if needed, run any initRunnables, and run any event capture files. -
isDisplayXmlFile
Helper method to determine if the given filename is a display xml file- Parameters:
name- The file name- Returns:
- Is the file a display xml file
-
getBundleFileFilters
Return a list of file filters that match on all of the types of bundles- Returns:
- list of bundle file filters
-
getXidvFileFilter
Get the file filter to be used for a regular xidv bundle file- Returns:
- bundle file filter
-
getZidvFileFilter
Get the file filter to be used for a zidv bundle file- Returns:
- bundle file filter
-
getXidvZidvFileFilter
Get the file filter that matches both xidv and zidv files- Returns:
- file filter
-
isXidvFile
Helper method to determine if the given filename is a xidv bundle file- Parameters:
name- The file name- Returns:
- Is the file a bundle file
-
isBundleFile
Is the given file a bindle- Parameters:
name- the file to check- Returns:
- is a bundle or not
-
isIslFile
Helper method to determine if the given filename is an isl file- Parameters:
name- The file name- Returns:
- Is the file a bundle file
-
isZidvFile
is file a zidv file- Parameters:
name- file- Returns:
- is zidv
-
isRbiFile
Helper method to determine if the given filename is a resource bundle file- Parameters:
name- The file name- Returns:
- Is the file a resource bundle file
-
isJnlpFile
Helper method to determine if the given filename is a jnlp file- Parameters:
name- The file name- Returns:
- Is the file a jnlp file
-
getNoGui
public boolean getNoGui()Should we create any GUIs- Returns:
- The no gui flag
-
usage
Print out the command line usage message and exit- Parameters:
err- The usage message
-
msg
Utility to format the usage message line- Parameters:
arg- argdesc- desc- Returns:
- Formatted message
-
getIslInteractive
public boolean getIslInteractive()Is isl interactive mode- Returns:
- isl interactive
-
getUsageMessage
Return the command line usage message. Can be overwritten by derived classes to add in their own usage message.- Returns:
- The usage message
-
preprocessArgs
Check for any .jnlp files in the command line. If there are any then recurse and process the command line arguments in the jnlp file.- Parameters:
args- The incoming argument array- Returns:
- The preprocessed argument array
-
parseArgs
Parse the command line arguments.- Throws:
Exception- When something untoward happens
-
parseArgs
Parse the given argument array. If there are any errors then call usage (which will exit).- Parameters:
args- The command line arguments- Throws:
Exception- When something untoward happens
-
checkArg
A utility method for checking the argument array. If arg not equal to lookingFor then simply return false. Else make sure that the given args array has at least howManyMore entries ahead of the given idx. If not then fail by calling usage.- Parameters:
arg- The current value in the args arraylookingFor- The flag we are looking forargs- The full args arrayidx- The index of the current arghowManyMore- If arg==lookingFor then this is how many more values the lookingFor flag requires. If there are not that many left in the args array then call usage and exit- Returns:
- Does the given arg match the given lookingFor value
-
parseArg
Check the argument given by the arg parameter. The idx parameter points to the next unprocessed entry in the args array. If the argument requires one or more values in the args array then increment idx accordingly. Return idx.- Parameters:
arg- The current argument we are looking atargs- The full args arrayidx- The index into args that we are looking at- 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- When something untoward happens
-
processInitialBundles
Gets called by the IDV to process the set of initial files, e.g., default bundles, command line bundles, jnlp files, etc.- Throws:
VisADException- When something untoward happensRemoteException- When something untoward happens
-
processInstanceArgs
Process the command line argument we got passed form another instance of the idv- Parameters:
args- command line args
-
getCollabHostName
Get the host name for the collab server- Returns:
- collab server name
-
getDoCollabServer
public boolean getDoCollabServer()Should we start up a collab server- Returns:
- start up a collab server
-
getCollabPort
public int getCollabPort()Port for collab server- Returns:
- collab server port
-
getFixedTimeString
the fixed time index string- Returns:
- fixed time string - for later
-
getIsOffScreen
public boolean getIsOffScreen()running in offscreen mode- Returns:
- is offscreen
-
setIsOffScreen
public void setIsOffScreen(boolean v) set running in offscreen mode- Parameters:
v- offscreen
-
isScriptingMode
public boolean isScriptingMode()_more_- Returns:
- _more_
-