Package org.apache.uima.internal.util

Examples of org.apache.uima.internal.util.CommandLineParser


  private static final String MAIN_COMPONENT_DIR_PARAM = "-mainCompDir";

  private static final String TARGET_DIR_PARAM = "-targetDir";

  private static final CommandLineParser createCmdLineParser() {
    CommandLineParser parser = new CommandLineParser();
    parser.addParameter(INSTALL_ACTION_PARAM, false);
    parser.addParameter(PACKAGE_ACTION_PARAM, false);
    parser.addParameter(COMPONENT_ID_PARAM, true);
    parser.addParameter(MAIN_COMPONENT_DESC_PARAM, true);
    parser.addParameter(CLASSPATH_PARAM, true);
    parser.addParameter(DATAPATH_PARAM, true);
    parser.addParameter(ENV_VAR_PARAM, true);
    parser.addParameter(MAIN_COMPONENT_DIR_PARAM, true);
    parser.addParameter(TARGET_DIR_PARAM, true);
    return parser;
  }
View Full Code Here


    }
    return frame;
  }

  private static final CommandLineParser createCmdLineParser() {
    CommandLineParser parser = new CommandLineParser();
    parser.addParameter(TEXT_FILE_PARAM, true);
    parser.addParameter(DESC_FILE_PARAM, true);
    parser.addParameter(DATA_PATH_PARAM, true);
    parser.addParameter(LOOK_AND_FEEL_PARAM, true);
    parser.addParameter(EXECUTE_SWITCH);
    parser.addParameter(XMI_FILE_PARAM, true);
    parser.addParameter(INI_FILE_PARAM, true);
    return parser;
  }
View Full Code Here

    return true;
  }

  public static void main(String[] args) {
    try {
      CommandLineParser clp = createCmdLineParser();
      clp.parseCmdLine(args);
      if (!checkCmdLineSyntax(clp)) {
        printUsage();
        System.exit(2);
      }
      String lookAndFeel = null;
      if (clp.isInArgsList(LOOK_AND_FEEL_PARAM)) {
        lookAndFeel = clp.getParamArgument(LOOK_AND_FEEL_PARAM);
        try {
          UIManager.setLookAndFeel(lookAndFeel);
        } catch (UnsupportedLookAndFeelException e) {
          System.err.println(e.getMessage());
        }
      }
      File iniFile = null;
      if (clp.isInArgsList(INI_FILE_PARAM)) {
        String iniFileName = clp.getParamArgument(INI_FILE_PARAM);
        iniFile = new File(iniFileName);
      }
      MainFrame frame = createMainFrame(iniFile);
      if (clp.isInArgsList(TEXT_FILE_PARAM)) {
        frame.loadTextFile(new File(clp.getParamArgument(TEXT_FILE_PARAM)));
      }
      if (clp.isInArgsList(DATA_PATH_PARAM)) {
        frame.setDataPath(clp.getParamArgument(DATA_PATH_PARAM));
      } else {
        String dataProp = System.getProperty(RelativePathResolver.UIMA_DATAPATH_PROP);
        if (dataProp != null) {
          frame.setDataPath(dataProp);
        }
      }
      if (clp.isInArgsList(DESC_FILE_PARAM)) {
        frame.loadAEDescriptor(new File(clp.getParamArgument(DESC_FILE_PARAM)));
      }
      if (clp.isInArgsList(TEXT_FILE_PARAM)) {
  frame.loadTextFile(new File(clp.getParamArgument(TEXT_FILE_PARAM)));
      } else if (clp.isInArgsList(XMI_FILE_PARAM)) {
  frame.loadXmiFile(new File(clp.getParamArgument(XMI_FILE_PARAM)));
      }
      if (clp.isInArgsList(EXECUTE_SWITCH)) {
        frame.runAE(true);
      }
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(1);
View Full Code Here

    String installDesc = null;
    String pearFile = null;
   
    try {
      // create command line parser
      CommandLineParser clp = createCmdLineParser();

      // parse command line parameters and check syntax
      clp.parseCmdLine(args);
      if (!checkCmdLineSyntax(clp)) {
        printUsage();
        System.exit(2);
      }

      // check what we have to do
      boolean doInstallAction = false;
      boolean doPackageAction = false;

      // if install action is set, we have to create the installation descriptor
      if (clp.isInArgsList(INSTALL_ACTION_PARAM)) {
        doInstallAction = true;
      }
      // if package action is set, we have to create the pear package
      if (clp.isInArgsList(PACKAGE_ACTION_PARAM)) {
        doPackageAction = true;
      }
      // if both actions are not set, we have to create the installation descriptor and the pear
      // package
      if ((!clp.isInArgsList(INSTALL_ACTION_PARAM)) && (!clp.isInArgsList(PACKAGE_ACTION_PARAM))) {
        doInstallAction = true;
        doPackageAction = true;
      }

      // do install action
      if (doInstallAction) {

        // check envVars properties file
        String filename = null;
        Properties properties = null;
        if ((filename = clp.getParamArgument(ENV_VAR_PARAM)) != null) {
          properties = new Properties();
          properties.load(new FileInputStream(filename));
        }

        // create installation descriptor
        installDesc = PackageCreator.createInstallDescriptor(clp
                .getParamArgument(COMPONENT_ID_PARAM), clp
                .getParamArgument(MAIN_COMPONENT_DESC_PARAM),
                clp.getParamArgument(CLASSPATH_PARAM), clp.getParamArgument(DATAPATH_PARAM), clp
                        .getParamArgument(MAIN_COMPONENT_DIR_PARAM), properties);

      }

      // do package action
      if (doPackageAction) {
        pearFile = PackageCreator
                .createPearPackage(clp.getParamArgument(COMPONENT_ID_PARAM), clp
                        .getParamArgument(MAIN_COMPONENT_DIR_PARAM), clp
                        .getParamArgument(TARGET_DIR_PARAM));
      }

    } catch (Exception ex) {
      ex.printStackTrace();
View Full Code Here

    * line.
    *
    * @return returns the CommandLineParser for the DictionaryCreator
    */
   private static final CommandLineParser createCmdLineParser() {
      CommandLineParser parser = new CommandLineParser();
      parser.addParameter(INPUT_FILE_PARAM, true);
      parser.addParameter(INPUT_FILE_LANGUAGE_PARAM, true);
      parser.addParameter(OUTPUT_FILE_PARAM, true);
      parser.addParameter(INPUT_FILE_ENCODING_PARAM, true);
      parser.addParameter(TOKENIZER_PARAM, true);
      parser.addParameter(TOKEN_TYPE_PARAM, true);
      parser.addParameter(SEPARATOR_CHAR_PARAM, true);
      return parser;
   }
View Full Code Here

    *           command line arguments
    */
   public static void main(String[] args) {

      // create command line parser
      CommandLineParser clp = createCmdLineParser();
      try {
         // parse command line
         clp.parseCmdLine(args);
         // check command line syntax
         if (!checkCmdLineSyntax(clp)) {
            printUsage();
            System.exit(-1);
         }
      } catch (Exception e) {
         System.err.println("Error parsing command line: " + e.getMessage());
      }

      // get command line arguments
      String inputFile = clp.getParamArgument(INPUT_FILE_PARAM);
      String language = clp.getParamArgument(INPUT_FILE_LANGUAGE_PARAM);
      String encoding = clp.getParamArgument(INPUT_FILE_ENCODING_PARAM);
      String outputFile = clp.getParamArgument(OUTPUT_FILE_PARAM);
      String tokenizerFile = clp.getParamArgument(TOKENIZER_PARAM);
      String tokenTypeStr = clp.getParamArgument(TOKEN_TYPE_PARAM);
      String separatorChar = clp.getParamArgument(SEPARATOR_CHAR_PARAM);

      // create dictionary
      try {
         DictionaryCreator.createDictionary(inputFile, encoding, outputFile,
               language, tokenizerFile, tokenTypeStr, separatorChar);
View Full Code Here

    * line.
    *
    * @return returns the CommandLineParser for the DictionaryCreator
    */
   private static final CommandLineParser createCmdLineParser() {
      CommandLineParser parser = new CommandLineParser();
      parser.addParameter(INPUT_FILE_PARAM, true);
      parser.addParameter(INPUT_FILE_LANGUAGE_PARAM, true);
      parser.addParameter(OUTPUT_FILE_PARAM, true);
      parser.addParameter(INPUT_FILE_ENCODING_PARAM, true);
      parser.addParameter(TOKENIZER_PARAM, true);
      parser.addParameter(TOKEN_TYPE_PARAM, true);
      parser.addParameter(SEPARATOR_CHAR_PARAM, true);
      return parser;
   }
View Full Code Here

    *           command line arguments
    */
   public static void main(String[] args) {

      // create command line parser
      CommandLineParser clp = createCmdLineParser();
      try {
         // parse command line
         clp.parseCmdLine(args);
         // check command line syntax
         if (!checkCmdLineSyntax(clp)) {
            printUsage();
            System.exit(-1);
         }
      } catch (Exception e) {
         System.err.println("Error parsing command line: " + e.getMessage());
      }

      // get command line arguments
      String inputFile = clp.getParamArgument(INPUT_FILE_PARAM);
      String language = clp.getParamArgument(INPUT_FILE_LANGUAGE_PARAM);
      String encoding = clp.getParamArgument(INPUT_FILE_ENCODING_PARAM);
      String outputFile = clp.getParamArgument(OUTPUT_FILE_PARAM);
      String tokenizerFile = clp.getParamArgument(TOKENIZER_PARAM);
      String tokenTypeStr = clp.getParamArgument(TOKEN_TYPE_PARAM);
      String separatorChar = clp.getParamArgument(SEPARATOR_CHAR_PARAM);

      // create dictionary
      try {
         DictionaryCreator.createDictionary(inputFile, encoding, outputFile,
               language, tokenizerFile, tokenTypeStr, separatorChar);
View Full Code Here

    });
    return frame;
  }

  private static final CommandLineParser createCmdLineParser() {
    CommandLineParser parser = new CommandLineParser();
    parser.addParameter(TEXT_FILE_PARAM, true);
    parser.addParameter(DESC_FILE_PARAM, true);
    parser.addParameter(DATA_PATH_PARAM, true);
    parser.addParameter(LOOK_AND_FEEL_PARAM, true);
    parser.addParameter(EXECUTE_SWITCH);
    return parser;
  }
View Full Code Here

    return true;
  }

  public static void main(String[] args) {
    try {
      CommandLineParser clp = createCmdLineParser();
      clp.parseCmdLine(args);
      if (!checkCmdLineSyntax(clp)) {
        printUsage();
        System.exit(2);
      }
      String lookAndFeel = null;
      if (clp.isInArgsList(LOOK_AND_FEEL_PARAM)) {
  lookAndFeel = clp.getParamArgument(LOOK_AND_FEEL_PARAM);
  try {
    UIManager.setLookAndFeel(lookAndFeel);
  } catch (UnsupportedLookAndFeelException e) {
    System.err.println(e.getMessage());
  }
      }
      MainFrame frame = createMainFrame();
      if (clp.isInArgsList(TEXT_FILE_PARAM)) {
        frame.loadTextFile(new File(clp.getParamArgument(TEXT_FILE_PARAM)));
      }
      if (clp.isInArgsList(DATA_PATH_PARAM)) {
        frame.setDataPath(clp.getParamArgument(DATA_PATH_PARAM));
      } else {
        String dataProp = System.getProperty(RelativePathResolver.UIMA_DATAPATH_PROP);
        if (dataProp != null) {
          frame.setDataPath(dataProp);
        }
      }
      if (clp.isInArgsList(DESC_FILE_PARAM)) {
        frame.loadAEDescriptor(new File(clp.getParamArgument(DESC_FILE_PARAM)));
      }
      if (clp.isInArgsList(EXECUTE_SWITCH)) {
        frame.runAE(true);
      }
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(1);
View Full Code Here

TOP

Related Classes of org.apache.uima.internal.util.CommandLineParser

Copyright © 2018 www.massapicom. 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.