EMMA Coverage Report (generated Fri Apr 27 15:03:37 EDT 2012)
[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;
23 
24import org.jclouds.ec2.options.internal.BaseEC2RequestOptions;
25import org.jclouds.rest.annotations.Identity;
26 
27import com.google.common.collect.Multimap;
28import com.google.inject.Inject;
29 
30/**
31 * Contains options supported in the Form API for the RegisterImage operation.
32 * <h2>
33 * Usage</h2> The recommended way to instantiate a
34 * BundleInstanceS3StorageOptions object is to statically import
35 * BundleInstanceS3StorageOptions.Builder.* and invoke a static creation method
36 * followed by an instance mutator (if needed):
37 * <p/>
38 * <code>
39 * import static org.jclouds.ec2.options.BundleInstanceS3StorageOptions.Builder.*
40 * <p/>
41 * EC2Client connection = // get connection
42 * String imageId = connection.getWindowsServices().bundleInstanceInRegion(...bucketOwnedBy(anotherAccessKey));
43 * <code>
44 * 
45 * @author Adrian Cole
46 * @see <a
47 *      href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-BundleInstance.html"
48 *      />
49 */
50public class BundleInstanceS3StorageOptions extends BaseEC2RequestOptions {
51 
52   @Inject(optional = true)
53   @Identity
54   String currentAwsAccessKeyId;
55 
56   @Override
57   public Multimap<String, String> buildFormParameters() {
58      if (getAwsAccessKeyId() == null) {
59         checkState(currentAwsAccessKeyId != null, "currentAwsAccessKeyId should have been injected");
60         bucketOwnedBy(currentAwsAccessKeyId);
61      }
62      return super.buildFormParameters();
63   }
64 
65   /**
66    * 
67    * @param ccessKeyId
68    *           The Access Key ID of the owner of the Amazon S3 bucket.
69    */
70   public BundleInstanceS3StorageOptions bucketOwnedBy(String ccessKeyId) {
71      formParameters.put("Storage.S3.AWSAccessKeyId", checkNotNull(ccessKeyId, "ccessKeyId"));
72      return this;
73   }
74 
75   /**
76    * 
77    * @return The Access Key ID of the owner of the Amazon S3 bucket.
78    */
79   public String getAwsAccessKeyId() {
80      return getFirstFormOrNull("Storage.S3.AWSAccessKeyId");
81   }
82 
83   public static class Builder {
84      /**
85       * @see BundleInstanceS3StorageOptions#bucketOwnedBy(ccessKeyId)
86       */
87      public static BundleInstanceS3StorageOptions bucketOwnedBy(String ccessKeyId) {
88         BundleInstanceS3StorageOptions options = new BundleInstanceS3StorageOptions();
89         return options.bucketOwnedBy(ccessKeyId);
90      }
91 
92   }
93}

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