Examples of StringArgument


Examples of org.nasutekds.server.util.args.StringArgument

  public static void main(String[] args)
  {
    // Define the command-line arguments that may be used with this program.
    BooleanArgument displayUsage = null;
    BooleanArgument useGUI       = null;
    StringArgument  fileNames    = null;


    // Create the command-line argument parser for use with this program.
    Message toolDescription = INFO_PROFILEVIEWER_TOOL_DESCRIPTION.get();
    ArgumentParser argParser =
         new ArgumentParser("org.nasutekds.server.plugins.profiler.ProfileViewer",
                            toolDescription, false);


    // Initialize all the command-line argument types and register them with the
    // parser.
    try
    {
      fileNames =
        new StringArgument("filenames", 'f', "fileName", true, true, true,
                           INFO_FILE_PLACEHOLDER.get(), null, null,
                           INFO_PROFILEVIEWER_DESCRIPTION_FILENAMES.get());
      argParser.addArgument(fileNames);

      useGUI = new BooleanArgument(
              "usegui", 'g', "useGUI",
              INFO_PROFILEVIEWER_DESCRIPTION_USE_GUI.get());
      argParser.addArgument(useGUI);

      displayUsage = new BooleanArgument(
              "help", 'H', "help",
              INFO_PROFILEVIEWER_DESCRIPTION_USAGE.get());
      argParser.addArgument(displayUsage);
      argParser.setUsageArgument(displayUsage);
    }
    catch (ArgumentException ae)
    {
      Message message =
              ERR_PROFILEVIEWER_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());

      System.err.println(message);
      System.exit(1);
    }


    // Parse the command-line arguments provided to this program.
    try
    {
      argParser.parseArguments(args);
    }
    catch (ArgumentException ae)
    {
      Message message =
              ERR_PROFILEVIEWER_ERROR_PARSING_ARGS.get(ae.getMessage());

      System.err.println(message);
      System.err.println(argParser.getUsage());
      System.exit(1);
    }


    // If we should just display usage or versionn information,
    // then print it and exit.
    if (argParser.usageOrVersionDisplayed())
    {
      System.exit(0);
    }


    // Create the profile viewer and read in the data files.
    ProfileViewer viewer = new ProfileViewer();
    for (String filename : fileNames.getValues())
    {
      try
      {
        viewer.processDataFile(filename);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.