Exemple #1
0
  public static void main(String[] args) {
    try {
      CodeServer codeServer = new CodeServer();
      ConsoleParametersProcessor parametersProcessor = codeServer.createParametersProcessor();
      Map<String, ConsoleParameter> parameters = parametersProcessor.processConsoleParameters(args);

      if (parameters.containsKey("-help") || parameters.containsKey("-h")) {
        parametersProcessor.showsUsageScreen();
      } else {
        codeServer.processParameters(parameters.values());
        codeServer.runGWTCodeServer(codeServer.getServerParameters());

        if (parameters.containsKey("-startJetty")) {
          JettyDevServer.main(args);
        }
      }
    } catch (ConsoleParametersProcessingException e) {
      logger.error(
          "Error processing program parameters: " + e.getLocalizedMessage() + ". Program aborted.",
          e);
    } catch (Exception e) {
      logger.error(
          "Error running code server: " + e.getLocalizedMessage() + ". Program aborted.", e);
    }
  }
Exemple #2
0
  protected ConsoleParametersProcessor createParametersProcessor() {
    ConsoleParameter parameter;
    ConsoleParametersProcessor parametersProcessor = new ConsoleParametersProcessor("CodeServer");

    parameter =
        new ConsoleParameter("-moduleName", "The name of the module to be compiled.", false, true);
    parameter.addParameterOption(new ConsoleParameterOption("name", "Module name"));
    parametersProcessor.addSupportedParameter(parameter);

    parameter = new ConsoleParameter("-sourceDir", "The application source folder.", false, true);
    parameter.addParameterOption(new ConsoleParameterOption("dir", "Source dir"));
    parametersProcessor.addSupportedParameter(parameter);

    parameter =
        new ConsoleParameter(
            "-bindAddress",
            "The ip address of the code server. Defaults to 127.0.0.1.",
            false,
            true);
    parameter.addParameterOption(new ConsoleParameterOption("ip", "Ip address"));
    parametersProcessor.addSupportedParameter(parameter);

    parametersProcessor.addSupportedParameter(
        new ConsoleParameter(
            "-noprecompile",
            "If informed, code server will not pre compile the source.",
            false,
            true));

    parametersProcessor.addSupportedParameter(
        new ConsoleParameter(
            "-startJetty",
            "If informed, starts the default application server (Jetty).",
            false,
            true));

    parameter =
        new ConsoleParameter(
            "-locale",
            "The locale used by hotdeployment scanner to recompile the project.",
            false,
            true);
    parameter.addParameterOption(new ConsoleParameterOption("locale", "locale"));
    parametersProcessor.addSupportedParameter(parameter);

    parameter =
        new ConsoleParameter("-port", "The port where the code server will run.", false, true);
    parameter.addParameterOption(new ConsoleParameterOption("port", "Port"));
    parametersProcessor.addSupportedParameter(parameter);

    parameter =
        new ConsoleParameter(
            "-workDir",
            "The root of the directory tree where the code server will write compiler output. If not supplied, a temporary directory will be used.",
            false,
            true);
    parameter.addParameterOption(new ConsoleParameterOption("dir", "Work dir"));
    parametersProcessor.addSupportedParameter(parameter);

    parameter =
        new ConsoleParameter(
            "-webDir",
            "The directory to be updated by code server compiler. If provided, after each code server compilation, this folder will be updated.",
            false,
            true);
    parameter.addParameterOption(new ConsoleParameterOption("dir", "Web dir"));
    parametersProcessor.addSupportedParameter(parameter);

    parametersProcessor.addSupportedParameter(
        new ConsoleParameter("-help", "Display the usage screen.", false, true));
    parametersProcessor.addSupportedParameter(
        new ConsoleParameter("-h", "Display the usage screen.", false, true));
    return parametersProcessor;
  }