Package org.jclouds.compute

Examples of org.jclouds.compute.ComputeServiceContext


      client = view.getComputeService();
   }

   @Test(enabled = true, expectedExceptions = AuthorizationException.class)
   public void testCorrectAuthException() throws Exception {
      ComputeServiceContext context = null;
      try {
         Properties overrides = setupProperties();
         overrides.setProperty(provider + ".identity", "MOMMA");
         overrides.setProperty(provider + ".credential", "MIA");
         context = newBuilder()
               .modules(ImmutableSet.of(getLoggingModule(), credentialStoreModule))
               .overrides(overrides).build(ComputeServiceContext.class);
         context.getComputeService().listNodes();
      } catch (AuthorizationException e) {
         throw e;
      } catch (RuntimeException e) {
         e.printStackTrace();
         throw e;
      } finally {
         if (context != null)
            context.close();
      }
   }
View Full Code Here


 
  @Override
  public HadoopCluster launchCluster(ClusterSpec clusterSpec) throws IOException {
    LOG.info("Launching " + clusterSpec.getClusterName() + " cluster");
   
    ComputeServiceContext computeServiceContext =
      ComputeServiceContextBuilder.build(clusterSpec);
    ComputeService computeService = computeServiceContext.getComputeService();
   
    // Launch Hadoop "master" (NN and JT)
    // deal with user packages and autoshutdown with extra runurls
    String hadoopInstallRunUrl = clusterSpec.getConfiguration().getString(
        "whirr.hadoop-install-runurl", "apache/hadoop/install");
View Full Code Here

      client = view.getComputeService();
   }

   @Test(enabled = true, expectedExceptions = AuthorizationException.class)
   public void testCorrectAuthException() throws Exception {
      ComputeServiceContext context = null;
      try {
         Properties overrides = setupProperties();
         overrides.setProperty(provider + ".identity", "MOMMA");
         overrides.setProperty(provider + ".credential", "MIA");
         context = newBuilder()
               .modules(ImmutableSet.of(getLoggingModule(), credentialStoreModule))
               .overrides(overrides).build(ComputeServiceContext.class);
         context.getComputeService().listNodes();
      } catch (AuthorizationException e) {
         throw e;
      } catch (RuntimeException e) {
         e.printStackTrace();
         throw e;
      } finally {
         if (context != null)
            context.close();
      }
   }
View Full Code Here

    return "zookeeper";
  }
 
  @Override
  public ZooKeeperCluster launchCluster(ClusterSpec clusterSpec) throws IOException {
    ComputeServiceContext computeServiceContext =
      ComputeServiceContextBuilder.build(clusterSpec);
    ComputeService computeService = computeServiceContext.getComputeService();

    byte[] bootScript = RunUrlBuilder.runUrls(
      "sun/java/install",
      "apache/zookeeper/install");
   
View Full Code Here

    return "cassandra";
  }

  @Override
  public Cluster launchCluster(ClusterSpec clusterSpec) throws IOException {
    ComputeServiceContext computeServiceContext =
        ComputeServiceContextBuilder.build(clusterSpec);
    ComputeService computeService = computeServiceContext.getComputeService();

    byte[] bootScript = RunUrlBuilder.runUrls("sun/java/install",
        "apache/cassandra/install");

    TemplateBuilder templateBuilder = computeService.templateBuilder()
View Full Code Here

    return "hadoop";
  }
 
  @Override
  public HadoopCluster launchCluster(ClusterSpec clusterSpec) throws IOException {
    ComputeServiceContext computeServiceContext =
      ComputeServiceContextBuilder.build(clusterSpec);
    ComputeService computeService = computeServiceContext.getComputeService();
   
    // Launch Hadoop "master" (NN and JT)
    // deal with user packages and autoshutdown with extra runurls
    String hadoopInstallRunUrl = clusterSpec.getConfiguration().getString(
        "whirr.hadoop-install-runurl", "apache/hadoop/install");
View Full Code Here

      client = view.getComputeService();
   }

   @Test(enabled = true, expectedExceptions = AuthorizationException.class)
   public void testCorrectAuthException() throws Exception {
      ComputeServiceContext context = null;
      try {
         Properties overrides = setupProperties();
         overrides.setProperty(provider + ".identity", "MOMMA");
         overrides.setProperty(provider + ".credential", "MIA");
         context = newBuilder()
               .modules(ImmutableSet.of(getLoggingModule(), credentialStoreModule))
               .overrides(overrides).build(ComputeServiceContext.class);
         context.getComputeService().listNodes();
      } catch (AuthorizationException e) {
         throw e;
      } catch (RuntimeException e) {
         e.printStackTrace();
         throw e;
      } finally {
         if (context != null)
            context.close();
      }
   }
View Full Code Here

        LOG.warn("No blob store location found with this ID '{}'. " +
          "Using default location.", spec.getBlobStoreLocationId());
      }
    } else if (spec.getTemplate().getLocationId() != null) {
      /* find the closest location to the compute nodes */
      ComputeServiceContext compute = getCompute.apply(spec);

      Set<String> computeIsoCodes = null;
      for(Location loc : compute.getComputeService().listAssignableLocations()) {
        if (loc.getId().equals(spec.getTemplate().getLocationId())) {
          computeIsoCodes = loc.getIso3166Codes();
          break;
        }
      }
View Full Code Here

      options = options.overrideLoginCredentials(credentials);
    }
    condition = Predicates
      .and(runningInGroup(spec.getClusterName()), condition);

    ComputeServiceContext context = getCompute().apply(spec);
    return context.getComputeService().runScriptOnNodesMatching(condition,
      statement, options);
  }
View Full Code Here

  }
 
  public Map<? extends NodeMetadata, ExecResponse> runScriptOnNodesMatching(final ClusterSpec spec,
      Predicate<NodeMetadata> condition, final Statement statement) throws IOException, RunScriptOnNodesException {
   
    ComputeServiceContext computeServiceContext = getCompute().apply(spec);
    ComputeService computeService = computeServiceContext.getComputeService();
    Cluster cluster = getClusterStateStore(spec).load();

    RunScriptOptions options = RunScriptOptions.Builder.runAsRoot(false).wrapInInitScript(false);
    return computeService.runScriptOnNodesMatching(Predicates.<NodeMetadata>and(condition, runningIn(cluster)), statement, options);
  }
View Full Code Here

TOP

Related Classes of org.jclouds.compute.ComputeServiceContext

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.