View Javadoc

1   /**
2    *
3    * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4    *
5    * ====================================================================
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   * ====================================================================
18   */
19  package org.jclouds.aws.ec2.compute.suppliers;
20  
21  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.c1_medium;
22  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.c1_xlarge;
23  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.cc1_4xlarge;
24  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_large;
25  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_small32;
26  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_xlarge;
27  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_2xlarge;
28  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_4xlarge;
29  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_xlarge;
30  import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.t1_micro;
31  
32  import java.util.Set;
33  
34  import javax.inject.Inject;
35  import javax.inject.Singleton;
36  
37  import org.jclouds.aws.ec2.compute.config.ClusterCompute;
38  import org.jclouds.compute.domain.Hardware;
39  import org.jclouds.ec2.compute.suppliers.EC2HardwareSupplier;
40  
41  import com.google.common.collect.ImmutableSet;
42  import com.google.common.collect.ImmutableSet.Builder;
43  
44  /**
45   * 
46   * @author Adrian Cole
47   */
48  @Singleton
49  public class AWSEC2HardwareSupplier extends EC2HardwareSupplier {
50  
51     private final Set<String> ccAmis;
52  
53     @Inject
54     public AWSEC2HardwareSupplier(@ClusterCompute Set<String> ccAmis) {
55        this.ccAmis = ccAmis;
56     }
57  
58     @Override
59     public Set<? extends Hardware> get() {
60        Builder<Hardware> sizes = ImmutableSet.builder();
61        sizes.add(cc1_4xlarge().supportsImageIds(ccAmis).build());
62        sizes.addAll(ImmutableSet.<Hardware> of(t1_micro().build(), c1_medium().build(), c1_xlarge().build(), m1_large()
63                 .build(), m1_small32().build(), m1_xlarge().build(), m2_xlarge().build(), m2_2xlarge().build(),
64                 m2_4xlarge().build()));
65        return sizes.build();
66     }
67  }