EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.ec2.options]

COVERAGE SUMMARY FOR SOURCE FILE [BundleInstanceS3StorageOptions.java]

nameclass, %method, %block, %line, %
BundleInstanceS3StorageOptions.java100% (2/2)83%  (5/6)94%  (44/47)95%  (10.5/11)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BundleInstanceS3StorageOptions$Builder100% (1/1)50%  (1/2)73%  (8/11)67%  (2/3)
BundleInstanceS3StorageOptions$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
bucketOwnedBy (String): BundleInstanceS3StorageOptions 100% (1/1)100% (8/8)100% (2/2)
     
class BundleInstanceS3StorageOptions100% (1/1)100% (4/4)100% (36/36)100% (9/9)
BundleInstanceS3StorageOptions (): void 100% (1/1)100% (3/3)100% (2/2)
bucketOwnedBy (String): BundleInstanceS3StorageOptions 100% (1/1)100% (10/10)100% (2/2)
buildFormParameters (): Multimap 100% (1/1)100% (19/19)100% (4/4)
getAwsAccessKeyId (): String 100% (1/1)100% (4/4)100% (1/1)

1/**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  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,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.jclouds.ec2.options;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22import static com.google.common.base.Preconditions.checkState;
23import static org.jclouds.Constants.PROPERTY_IDENTITY;
24 
25import javax.inject.Named;
26 
27import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
28 
29import com.google.common.collect.Multimap;
30import com.google.inject.Inject;
31 
32/**
33 * Contains options supported in the Form API for the RegisterImage operation.
34 * <h2>
35 * Usage</h2> The recommended way to instantiate a
36 * BundleInstanceS3StorageOptions object is to statically import
37 * BundleInstanceS3StorageOptions.Builder.* and invoke a static creation method
38 * followed by an instance mutator (if needed):
39 * <p/>
40 * <code>
41 * import static org.jclouds.ec2.options.BundleInstanceS3StorageOptions.Builder.*
42 * <p/>
43 * EC2Client connection = // get connection
44 * String imageId = connection.getWindowsServices().bundleInstanceInRegion(...bucketOwnedBy(anotherAccessKey));
45 * <code>
46 * 
47 * @author Adrian Cole
48 * @see <a
49 *      href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-BundleInstance.html"
50 *      />
51 */
52public class BundleInstanceS3StorageOptions extends BaseEC2RequestOptions {
53 
54   @Inject(optional = true)
55   @Named(PROPERTY_IDENTITY)
56   String currentAwsAccessKeyId;
57 
58   @Override
59   public Multimap<String, String> buildFormParameters() {
60      if (getAwsAccessKeyId() == null) {
61         checkState(currentAwsAccessKeyId != null, "currentAwsAccessKeyId should have been injected");
62         bucketOwnedBy(currentAwsAccessKeyId);
63      }
64      return super.buildFormParameters();
65   }
66 
67   /**
68    * 
69    * @param ccessKeyId
70    *           The Access Key ID of the owner of the Amazon S3 bucket.
71    */
72   public BundleInstanceS3StorageOptions bucketOwnedBy(String ccessKeyId) {
73      formParameters.put("Storage.S3.AWSAccessKeyId", checkNotNull(ccessKeyId, "ccessKeyId"));
74      return this;
75   }
76 
77   /**
78    * 
79    * @return The Access Key ID of the owner of the Amazon S3 bucket.
80    */
81   public String getAwsAccessKeyId() {
82      return getFirstFormOrNull("Storage.S3.AWSAccessKeyId");
83   }
84 
85   public static class Builder {
86      /**
87       * @see BundleInstanceS3StorageOptions#bucketOwnedBy(ccessKeyId)
88       */
89      public static BundleInstanceS3StorageOptions bucketOwnedBy(String ccessKeyId) {
90         BundleInstanceS3StorageOptions options = new BundleInstanceS3StorageOptions();
91         return options.bucketOwnedBy(ccessKeyId);
92      }
93 
94   }
95}

[all classes][org.jclouds.ec2.options]
EMMA 2.0.5312 (C) Vladimir Roubtsov