Class LoaderOptions


public class LoaderOptions extends Options
This class derives from the Options class to implement a command line syntax and set of options that apply to all of the "pin loader" programs. The syntax is: optional flag options followed by the name of the configuration file to load into Portal.

[-option] ... file_name

The options defined by this class are:

-vIf this option is present then the command line program will display comprehensive feedback as it executes.
-dIf this flag is present then comprehensive debug information will be logged to the appropriate log file.

Some examples (that include the program to run):

load_device_map -d device_service_map
load_business_params -d -v business_params

If you have additional options that are unique to your program then you will need to extend this class to support those options. The bulk of the extension can be achieved by adding option definitions for your new options in the constructor of your derived class. See the Options class for an example on how to do this.

  • Field Details

    • VERBOSE

      public static final String VERBOSE
      The verbose option. If this option is present on the command line then the program will display comprehensive progress feedback.
      See Also:
    • DEBUG

      public static final String DEBUG
      The debug option. If this option is present on the command line then the program will display comprehensive diagnostic information.
      See Also:
  • Constructor Details

    • LoaderOptions

      protected LoaderOptions(String[] args) throws CommandLineParser.InvalidOptionsException
      You cannot all this constructor directly because you must derive from this class. In the constructor of your derived class you must call the CommandLineParse.parse method after your constructor has finished all initialization. This is because the CommandLineParser.parse method calls the methods overriden in the Options class which depend on the option definitions defined in the constructor of your derived class. All constructor initialization must be complete for the CommandLineParser.parse method to work correctly.

      Parameters:
      args - The array of command line arguments passed to the program.
      Throws:
      CommandLineParser.InvalidOptionsException - An error was encountered when parsing the command line arguments. See the Options constructor for details on the possible various errors encountered.
  • Method Details

    • createLoaderOptions

      public static LoaderOptions createLoaderOptions(String[] args) throws CommandLineParser.InvalidOptionsException
      Factory method used to create a LoaderOptions. Call this method to construct a LoaderOptions.

      Parameters:
      args - The array of command line arguments passed to the program.
      Returns:
      An instance of a LoaderOptions.
      Throws:
      CommandLineParser.InvalidOptionsException - An error was encountered when parsing the command line arguments. See the Options constructor for details on the possible various errors encountered.
    • createLoaderOptionsAndExitOnErrorOrHelp

      public static LoaderOptions createLoaderOptionsAndExitOnErrorOrHelp(String[] args)
      Factory method used to create a LoaderOptions. Call this method to construct a LoaderOptions and exit if an error is encountered in the options or if a request has been made to display help (display then help and then exit).

      Parameters:
      args - The array of command line arguments passed to the program.
      Returns:
      An instance of a LoaderOptions.
    • isDebug

      public boolean isDebug()
      Convienence method to return the state of the debug option. You could acheive the same result by calling containsOption(mDebug).

      Returns:
      true if your program needs to log comprehensive debug information while it executes, otherwise return false.
    • isVerbose

      public boolean isVerbose()
      Convienence method to return the state of the verbose option. You could acheive the same result by calling containsOption(mVerbose).

      Returns:
      true if your program needs to display comprehensive feedback while it executes, otherwise return false.
    • getFileName

      public String getFileName()
      Convienence method to return the name of the file to load configuration information into Portal.

      Returns:
      the name of the file to load into Portal.
    • getSyntaxHelp

      protected String getSyntaxHelp()
      Get the help string that describes the syntax required by your options class.

      Specified by:
      getSyntaxHelp in class Options
      Returns:
      The appropriate help string.
    • postParse

      protected void postParse() throws CommandLineParser.InvalidOptionsException
      This method is called by the CommandLineParser.parse method after it has successfully parsed the command line. Typically, this is the place where you extract option values into local member variables.

      Overrides:
      postParse in class CommandLineParser
      Throws:
      CommandLineParser.InvalidOptionsException - An error was detected when extracting option values into local member variables.