All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jclouds.compute.RunNodesException Maven / Gradle / Ivy

The newest version!
/**
 * Licensed to jclouds, Inc. (jclouds) under one or more
 * contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  jclouds licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.jclouds.compute;

import static org.jclouds.compute.util.ComputeServiceUtils.createExecutionErrorMessage;
import static org.jclouds.compute.util.ComputeServiceUtils.createNodeErrorMessage;

import java.util.Map;
import java.util.Set;

import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Template;

/**
 * 
 * @author Adrian Cole
 */
public class RunNodesException extends Exception {

   private final String group;
   private final int count;
   private final Template template;
   private final Set successfulNodes;
   private final Map failedNodes;
   private final Map executionExceptions;

   public RunNodesException(String group, int count, Template template,
            Set successfulNodes, Map executionExceptions,
            Map failedNodes) {
      super(
               String
                        .format(
                                 "error running %d node%s group(%s) location(%s) image(%s) size(%s) options(%s)%n%s%n%s",
                                 count, count > 1 ? "s" : "", group, template.getLocation().getId(),
                                 template.getImage().getProviderId(), template.getHardware()
                                          .getProviderId(), template.getOptions(),
                                 createExecutionErrorMessage(executionExceptions),
                                 createNodeErrorMessage(failedNodes)));
      this.group = group;
      this.count = count;
      this.template = template;
      this.successfulNodes = successfulNodes;
      this.failedNodes = failedNodes;
      this.executionExceptions = executionExceptions;
   }

   /**
    * 
    * @return Nodes that performed startup without error
    */
   public Set getSuccessfulNodes() {
      return successfulNodes;
   }

   /**
    * 
    * @return Nodes that performed startup without error, but incurred problems applying options
    */
   public Map getExecutionErrors() {
      return executionExceptions;
   }

   /**
    * 
    * @return Nodes that performed startup without error, but incurred problems applying options
    */
   public Map getNodeErrors() {
      return failedNodes;
   }

   public String getGroup() {
      return group;
   }

   public int getCount() {
      return count;
   }

   public Template getTemplate() {
      return template;
   }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy