Package org.sonar.process

Examples of org.sonar.process.MessageException


    this.props = props;
    masterHosts.addAll(Arrays.asList(StringUtils.split(props.value(ProcessConstants.CLUSTER_MASTER_HOST, ""), ",")));
    clusterName = props.value(ProcessConstants.CLUSTER_NAME);
    Integer port = props.valueAsInt(ProcessConstants.SEARCH_PORT);
    if (port == null) {
      throw new MessageException("Property is not set: " + ProcessConstants.SEARCH_PORT);
    }
    tcpPort = port.intValue();
  }
View Full Code Here


        builder.put("node.master", false);

        // Enforce a N/2+1 number of masters in cluster
        builder.put("discovery.zen.minimum_master_nodes", 1);
      } else {
        throw new MessageException(String.format("Not an Elasticsearch master nor slave. Please check properties %s and %s",
          ProcessConstants.CLUSTER_MASTER, ProcessConstants.CLUSTER_MASTER_HOST));
      }
    }
    builder.put("index.number_of_replicas", replicationFactor);
    builder.put("cluster.name", clusterName);
View Full Code Here

    if (dirPath == null) {
      return null;
    }
    File dir = new File(homeDir, dirPath);
    if (!dir.exists()) {
      throw new MessageException("Directory does not exist: " + dirPath);
    }
    List<File> files = new ArrayList<File>(FileUtils.listFiles(dir, new String[] {"jar"}, false));
    if (files.isEmpty()) {
      throw new MessageException("Directory does not contain JDBC driver: " + dirPath);
    }
    if (files.size() > 1) {
      throw new MessageException("Directory must contain only one JAR file: " + dirPath);
    }
    return files.get(0).getAbsolutePath();
  }
View Full Code Here

  Provider driverProvider(String url) {
    Pattern pattern = Pattern.compile("jdbc:(\\w+):.+");
    Matcher matcher = pattern.matcher(url);
    if (!matcher.find()) {
      throw new MessageException(String.format("Bad format of JDBC URL: " + url));
    }
    String key = matcher.group(1);
    try {
      return Provider.valueOf(StringUtils.upperCase(key));
    } catch (IllegalArgumentException e) {
      throw new MessageException(String.format(String.format("Unsupported JDBC driver provider: %s", key)));
    }
  }
View Full Code Here

    }
  }

  private void checkRequiredParameter(String url, String val) {
    if (!url.contains(val)) {
      throw new MessageException(String.format("JDBC URL must have the property '%s'", val));
    }
  }
View Full Code Here

        .prepareGetSettings().get().getIndexToSettings().values()) {
        Settings settings = settingCursor.value;
        String clusterReplicationFactor = settings.get("index.number_of_replicas", "-1");
        if (Integer.parseInt(clusterReplicationFactor) <= 0) {
          node.stop();
          throw new MessageException("Invalid number of Elasticsearch replicas: " + clusterReplicationFactor);
        }
      }
    }
  }
View Full Code Here

  void waitForReady() {
    boolean ready = false;
    while (!ready) {
      if (isStopped()) {
        throw new MessageException(String.format("%s failed to start", this));
      }
      ready = commands.isReady();
      try {
        Thread.sleep(200L);
      } catch (InterruptedException e) {
View Full Code Here

TOP

Related Classes of org.sonar.process.MessageException

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.