Package org.apache.whirr

Examples of org.apache.whirr.ClusterSpec


    addStatement(event, call(getStartFunction(conf), "resourcemanager"));
  }
 
  @Override
  protected void afterConfigure(ClusterActionEvent event) throws IOException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();
    Instance resourceManager = cluster.getInstanceMatching(role(ROLE));
    LOG.info("Resource manager web UI available at http://{}:{}",
      resourceManager.getPublicHostName(), RESOURCE_MANAGER_WEB_UI_PORT);
   
View Full Code Here


  @Override
  protected Object doExecute() throws Exception {
    validateInput();
    DestroyClusterCommand command = new DestroyClusterCommand(clusterControllerFactory);
    ClusterSpec clusterSpec = getClusterSpec();
    if (clusterSpec != null) {
      command.run(System.in, System.out, System.err, clusterSpec);
    }
    return null;
  }
View Full Code Here

  @Override
  protected Object doExecute() throws Exception {
    validateInput();
    ListClusterCommand command = new ListClusterCommand(clusterControllerFactory);
    ClusterSpec clusterSpec = getClusterSpec();
    if (clusterSpec != null) {
      command.run(System.in, System.out, System.err, clusterSpec);
    }
    return null;
  }
View Full Code Here

  /**
   * Apply the firewall rules specified via configuration.
   */
  protected void eventSpecificActions(InstanceTemplate instanceTemplate, ClusterActionEvent event)
      throws IOException {
    ClusterSpec clusterSpec = event.getClusterSpec();
   
    Map<String, List<String>> firewallRules = clusterSpec.getFirewallRules();
    for (String role: firewallRules.keySet()) {
      if (!roleIsInTarget(role)) {
        continue;   // skip execution for this role
      }
      Rule rule = Rule.create();
View Full Code Here

   *
   * @return
   * @throws Exception
   */
  protected ClusterSpec getClusterSpec() throws Exception {
    ClusterSpec clusterSpec = null;
    if (pid != null || fileName != null) {
      PropertiesConfiguration properties = getConfiguration(pid, fileName);
      clusterSpec = new ClusterSpec(properties);
    } else {
      clusterSpec = new ClusterSpec();
    }

    if (name != null) {
      clusterSpec.setContextName(name);
    }

    if (provider != null) {
      clusterSpec.setProvider(provider);
    }

    if (endpoint != null) {
      clusterSpec.setEndpoint(endpoint);
    }

    if (templates != null) {
      clusterSpec.setInstanceTemplates(getTemplate(templates, imageId, hardwareId));
    }


    if (privateKey != null) {
      clusterSpec.setPrivateKey(privateKey);
    }
    if (clusterName != null) {
      clusterSpec.setClusterName(clusterName);
    }

    return clusterSpec;
  }
View Full Code Here

    return ROLE;
  }

  @Override
  protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
    ClusterSpec spec = event.getClusterSpec();
    Configuration config = spec.getConfiguration();

    addStatement(event, call("retry_helpers"));
    addStatement(event, call("install_tarball"));

    addStatement(event, call(getInstallFunction(config, "java", "install_openjdk")));
View Full Code Here

    addStatement(event, call("install_elasticsearch", tarurl));
  }

  @Override
  protected void beforeConfigure(ClusterActionEvent event) throws IOException {
    ClusterSpec spec = event.getClusterSpec();
    Cluster cluster = event.getCluster();

    event.getFirewallManager().addRule(
      Rule.create()
        .destination(cluster.getInstancesMatching(role(ROLE)))
View Full Code Here

   
  /**
   * Handles firewall rules for a given event.
   */
  public static void handleFirewallRules(ClusterActionEvent event) {
    ClusterSpec clusterSpec = event.getClusterSpec();
   
    for (Statement statement : event.getFirewallManager().getRulesAsStatements()) {
      addStatement(event, statement);
    }

View Full Code Here

    return CASSANDRA_ROLE;
  }

  @Override
  protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Configuration conf = clusterSpec.getConfiguration();

    addStatement(event, call("retry_helpers"));
    addStatement(event, call("install_tarball"));
    addStatement(event, call("install_service"));

    addStatement(event, call(getInstallFunction(conf, "java", "install_openjdk")));

    Configuration config = clusterSpec.getConfiguration();

    String tarball = prepareRemoteFileUrl(event, config.getString(BIN_TARBALL, null));
    String major = config.getString(MAJOR_VERSION, null);

    if (tarball != null && major != null) {
View Full Code Here

  }

  @Override
  protected void beforeConfigure(ClusterActionEvent event) throws IOException,
      InterruptedException {
    ClusterSpec clusterSpec = event.getClusterSpec();
    Cluster cluster = event.getCluster();

    Instance instance = cluster
        .getInstanceMatching(role(HamaMasterClusterActionHandler.ROLE));
    InetAddress masterPublicAddress = instance.getPublicAddress();
View Full Code Here

TOP

Related Classes of org.apache.whirr.ClusterSpec

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.