Class ArgsManager

All Implemented Interfaces:
ActionListener, EventListener, IdvConstants

public class ArgsManager extends IdvManager
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:
Author:
IDV development team
  • Field Details

    • USAGE_MESSAGE

      public static final String USAGE_MESSAGE
      usage message
      See Also:
    • RUNNABLE_MAX_TRIES

      public static final int RUNNABLE_MAX_TRIES
      How many times to try to run the initial runnables
      See Also:
    • listResources

      protected boolean listResources
      Should we list out the resources for debugging
    • persistentCommandLineArgs

      protected List persistentCommandLineArgs
      This holds the command line arguments that should be written out in saved jnlp files (e.g., .properties)
    • testMode

      public boolean testMode
      Created when we see the -test command line argument. Turns on testings.
    • testEval

      public boolean testEval
      Created when we see the -testeval command line argument.
    • testArchive

      public String testArchive
      The name of the test archive when we are in test archive writing mode
    • testDir

      public String testDir
      The name of the test directory when we are in test archive writing mode
    • noGui

      protected boolean noGui
      Should any guis be shown
    • jythonCode

      protected String jythonCode
      Jython code that should be evaluated at startup time
    • argXidvFiles

      public List argXidvFiles
      A list (String) of the bundle sources (files and/or urls) passed in on the command line.
    • argDisplayB64Xml

      public List argDisplayB64Xml
      A list of the base 64 encoded in line display xml files
    • b64Bundles

      public List 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

      public List plugins
      List of plugins
    • installPlugins

      public List installPlugins
      List of plugins
    • printJnlpBundles

      protected boolean printJnlpBundles
      Shuold the embedded bundles in jnlp files be printed out
    • scriptingFiles

      public List scriptingFiles
      List of isl files
    • initParams

      protected List 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

      protected List 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

      protected List fileMappingIds
      Holds the set files arguments
    • fileMappingFiles

      protected List fileMappingFiles
      Holds the set files arguments
    • islOptionalArgs

      protected Hashtable islOptionalArgs
      Holds the optional arguments of ISL file
  • Constructor Details

    • ArgsManager

      public ArgsManager(IntegratedDataViewer idv, String[] args)
      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 call parseArgs()
      Parameters:
      idv - The IDV
      args - Command line arguments
  • Method Details

    • getOptionalArgs

      public Hashtable getOptionalArgs()
      Get the very original command line arguments. The ones before we pre-process them.
      Returns:
      The command line args
    • getOriginalArgs

      public String[] getOriginalArgs()
      Get the very original command line arguments. The ones before we pre-process them.
      Returns:
      The command line args
    • getInitCatalogs

      public List 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

      public static boolean isDisplayXmlFile(String name)
      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

      public List<PatternFileFilter> getBundleFileFilters()
      Return a list of file filters that match on all of the types of bundles
      Returns:
      list of bundle file filters
    • getXidvFileFilter

      public PatternFileFilter getXidvFileFilter()
      Get the file filter to be used for a regular xidv bundle file
      Returns:
      bundle file filter
    • getZidvFileFilter

      public PatternFileFilter getZidvFileFilter()
      Get the file filter to be used for a zidv bundle file
      Returns:
      bundle file filter
    • getXidvZidvFileFilter

      public PatternFileFilter getXidvZidvFileFilter()
      Get the file filter that matches both xidv and zidv files
      Returns:
      file filter
    • isXidvFile

      public boolean isXidvFile(String name)
      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

      public boolean isBundleFile(String name)
      Is the given file a bindle
      Parameters:
      name - the file to check
      Returns:
      is a bundle or not
    • isIslFile

      public boolean isIslFile(String name)
      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

      public boolean isZidvFile(String name)
      is file a zidv file
      Parameters:
      name - file
      Returns:
      is zidv
    • isRbiFile

      public boolean isRbiFile(String name)
      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

      public boolean isJnlpFile(String name)
      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

      public void usage(String err)
      Print out the command line usage message and exit
      Parameters:
      err - The usage message
    • msg

      protected String msg(String arg, String desc)
      Utility to format the usage message line
      Parameters:
      arg - arg
      desc - desc
      Returns:
      Formatted message
    • getIslInteractive

      public boolean getIslInteractive()
      Is isl interactive mode
      Returns:
      isl interactive
    • getUsageMessage

      protected String 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

      protected String[] preprocessArgs(String[] args)
      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

      public void parseArgs() throws Exception
      Parse the command line arguments.
      Throws:
      Exception - When something untoward happens
    • parseArgs

      protected void parseArgs(String[] args) throws Exception
      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

      protected boolean checkArg(String arg, String lookingFor, String[] args, int idx, int howManyMore)
      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 array
      lookingFor - The flag we are looking for
      args - The full args array
      idx - The index of the current arg
      howManyMore - 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

      protected int parseArg(String arg, String[] args, int idx) throws Exception
      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 at
      args - The full args array
      idx - 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

      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.
      Throws:
      VisADException - When something untoward happens
      RemoteException - When something untoward happens
    • processInstanceArgs

      public void processInstanceArgs(String[] args)
      Process the command line argument we got passed form another instance of the idv
      Parameters:
      args - command line args
    • getCollabHostName

      public String 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

      public String 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_