Package org.wymiwyg.commons.util.arguments

Examples of org.wymiwyg.commons.util.arguments.ArgumentHandler


   *
   * @param invocationString invoation of the command as present in help-texts
   * @param args
   */
  public void execute(String invocationString, String[] args){
    ArgumentHandler argumentHandler = new ArgumentHandler(args);
    final T arguments;
    try {
      arguments = AnnotatedInterfaceArguments.getInstance(
          getArgumentsClass(), argumentHandler).getValueObject();
    } catch (InvalidArgumentsException e) {
      System.err.println(e.getMessage());
      showHelp(invocationString);
      return;
    }
    final List<String> unusedArguments = new ArrayList<String>();
    try {
      argumentHandler.processArguments(new ArgumentProcessor() {
        public void process(List<String> argumentList) throws InvalidArgumentsException {
          unusedArguments.addAll(argumentList);
         
        }
      });
View Full Code Here


public class SchemaGen {

  public static void main(String... args) throws Exception {
    SchemaGenArguments arguments;
    try {
      arguments = new ArgumentHandler(args).getInstance(SchemaGenArguments.class);
    } catch (InvalidArgumentsException e) {
      System.out.println(e.getMessage());
      System.out.print("Usage: SchemaGen ");
      System.out.println(AnnotatedInterfaceArguments.getArgumentsSyntax(SchemaGenArguments.class));
      PrintWriter out = new PrintWriter(System.out, true);
View Full Code Here

   * @param args  Command line arguments.
   */
  public void start(String... args) throws Throwable {
    LauncherArguments arguments;
    try {
      final ArgumentHandler argumentHandler = new ArgumentHandler(args);
      arguments = argumentHandler.getInstance(LauncherArguments.class);
      argumentHandler.processArguments(new ArgumentProcessor() {

        @Override
        public void process(List<String> remaining) throws InvalidArgumentsException {
          if (remaining.size() > 0) {
            throw new InvalidArgumentsException("The following arguments could not be understood: " + remaining);
View Full Code Here

   * @throws IOException
   */
  public static void main(String[] args) throws IOException {
    final LauncherArgs launcherArgs;
    try {
      launcherArgs = new ArgumentHandler(args)
          .getInstance(LauncherArgs.class);
    } catch (InvalidArgumentsException e) {
      showHelp();
      return;
    }
View Full Code Here

  /**
   * @param args
   * @throws InvalidArgumentsException
   */
  public static void main(String[] args) throws InvalidArgumentsException {
    ArgumentHandler argumentHandler = new ArgumentHandler(args);
    main("java -jar rdf-Leanify.jar", argumentHandler);
  }
View Full Code Here

  /**
   * @param args
   * @throws InvalidArgumentsException
   */
  public static void main(String[] args) throws InvalidArgumentsException {
    ArgumentHandler argumentHandler = new ArgumentHandler(args);
    main("java -jar rdf-diff.jar", argumentHandler);
  }
View Full Code Here

      showHelp();
      return;
    }
    String[] firstArg = new String[1];
    firstArg[0] = args[0];
    ArgumentHandler argumentHandler = new ArgumentHandler(firstArg);
    HelpArguments helpArguments;
    try {
      helpArguments = argumentHandler.getInstance(HelpArguments.class);
    } catch (InvalidArgumentsException e) {
      System.err.println(e.getMessage());
      showHelp();
      return;
    }
    if (helpArguments.getShowHelp()) {
      showHelp();
      return;
    }
    argumentHandler.processArguments(new ArgumentProcessor() {
      /**
       * @see org.wymiwyg.commons.util.arguments.ArgumentProcessor#process(java.util.List)
       */
      public void process(List<String> argumentList) {
        if (argumentList.size() > 0) {
          command = (String) argumentList.get(0);
          if (command.equals("diff") || command.equals("leanify") || command.equals("patch")) {
            argumentList.remove(0);
          }
        } else {
          showHelp();
          return;
        }
      }
    });
    if (command == null) {
      System.err.println("must specify a command");
      showHelp();
      return;
    }
    String[] restArgs = new String[args.length -1];
    System.arraycopy(args, 1,restArgs, 0, restArgs.length);
    if ("diff".equals(command)) {
      DiffMain.main("java -jar rdf-utils.jar diff", new ArgumentHandler(restArgs));
      return;
    }
    if ("leanify".equals(command)) {
      LeanifyMain.main("java -jar rdf-utils.jar leanify", new ArgumentHandler(restArgs));
      return;
    }
    if ("patch".equals(command)) {
      PatchMain.main("java -jar rdf-utils.jar patch", new ArgumentHandler(restArgs));
      return;
    }
    showHelp();

  }
View Full Code Here

  /**
   * @param args
   * @throws InvalidArgumentsException
   */
  public static void main(String[] args) throws InvalidArgumentsException {
    ArgumentHandler argumentHandler = new ArgumentHandler(args);
    main("java -jar rdf-diff.jar", argumentHandler);
  }
View Full Code Here

TOP

Related Classes of org.wymiwyg.commons.util.arguments.ArgumentHandler

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.