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

COVERAGE SUMMARY FOR SOURCE FILE [AWSDescribeImagesOptions.java]

nameclass, %method, %block, %line, %
AWSDescribeImagesOptions.java100% (2/2)86%  (12/14)94%  (132/141)91%  (26.5/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AWSDescribeImagesOptions$Builder100% (1/1)83%  (5/6)93%  (40/43)91%  (10/11)
AWSDescribeImagesOptions$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
executableBy (String): AWSDescribeImagesOptions 100% (1/1)100% (8/8)100% (2/2)
filters (Map): AWSDescribeImagesOptions 100% (1/1)100% (8/8)100% (2/2)
filters (Multimap): AWSDescribeImagesOptions 100% (1/1)100% (8/8)100% (2/2)
imageIds (String []): AWSDescribeImagesOptions 100% (1/1)100% (8/8)100% (2/2)
ownedBy (String []): AWSDescribeImagesOptions 100% (1/1)100% (8/8)100% (2/2)
     
class AWSDescribeImagesOptions100% (1/1)88%  (7/8)94%  (92/98)89%  (17/19)
imageIds (Iterable): AWSDescribeImagesOptions 0%   (0/1)0%   (0/6)0%   (0/2)
<static initializer> 100% (1/1)100% (5/5)100% (1/1)
AWSDescribeImagesOptions (): void 100% (1/1)100% (3/3)100% (2/2)
executableBy (String): AWSDescribeImagesOptions 100% (1/1)100% (6/6)100% (2/2)
filters (Map): AWSDescribeImagesOptions 100% (1/1)100% (8/8)100% (1/1)
filters (Multimap): AWSDescribeImagesOptions 100% (1/1)100% (58/58)100% (7/7)
imageIds (String []): AWSDescribeImagesOptions 100% (1/1)100% (6/6)100% (2/2)
ownedBy (String []): AWSDescribeImagesOptions 100% (1/1)100% (6/6)100% (2/2)

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.aws.ec2.options;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.util.Collection;
24import java.util.Map;
25import java.util.Map.Entry;
26 
27import org.jclouds.ec2.options.DescribeImagesOptions;
28 
29import com.google.common.collect.Multimap;
30import com.google.common.collect.Multimaps;
31 
32/**
33 * Extra options only available in Amazon's implementation
34 * 
35 * @see DescribeImagesOptions
36 * @author Adrian Cole
37 */
38public class AWSDescribeImagesOptions extends DescribeImagesOptions {
39   public static final AWSDescribeImagesOptions NONE = new AWSDescribeImagesOptions();
40 
41   /**
42    * {@inheritDoc}
43    */
44   @Override
45   public AWSDescribeImagesOptions executableBy(String identityId) {
46      super.executableBy(identityId);
47      return this;
48   }
49 
50   /**
51    * {@inheritDoc}
52    */
53   @Override
54   public AWSDescribeImagesOptions imageIds(String... imageIds) {
55      super.imageIds(imageIds);
56      return this;
57   }
58 
59   /**
60    * {@inheritDoc}
61    */
62   @Override
63   public AWSDescribeImagesOptions imageIds(Iterable<String> imageIds) {
64      super.imageIds(imageIds);
65      return this;
66   }
67 
68   /**
69    * {@inheritDoc}
70    */
71   @Override
72   public AWSDescribeImagesOptions ownedBy(String... owners) {
73      super.ownedBy(owners);
74      return this;
75   }
76 
77   /**
78    * You can filter the results to return information only about images that match criteria you
79    * specify. For example, you could get information only about images that use a certain kernel.
80    * You can specify multiple values for a filter (e.g., the image uses either kernel aki-1a2b3c4d
81    * or kernel aki-9b8c7d6f). An image must match at least one of the specified values for it to be
82    * included in the results.
83    * <p/>
84    * You can specify multiple filters (e.g., the image uses a certain kernel, and uses an Amazon
85    * EBS volume as the root device). The result includes information for a particular image only if
86    * it matches all your filters. If there's no match, no special message is returned; the response
87    * is simply empty.
88    * <p/>
89    * You can use wildcards with the filter values: * matches zero or more characters, and ? matches
90    * exactly one character. You can escape special characters using a backslash before the
91    * character. For example, a value of \*amazon\?\\ searches for the literal string *amazon?\.
92    * 
93    */
94   public AWSDescribeImagesOptions filters(Multimap<String, String> filters) {
95      int i = 0;
96      for (Entry<String, Collection<String>> filter : checkNotNull(filters, "filters").asMap().entrySet()) {
97         String filterPrefix = String.format("Filter.%s.", ++i);
98         formParameters.put(filterPrefix + "Name", filter.getKey());
99         indexFormValuesWithPrefix(filterPrefix + "Value", filter.getValue());
100      }
101      return this;
102   }
103 
104   /**
105    * @see #filters(Multimap)
106    */
107   public AWSDescribeImagesOptions filters(Map<String, String> filters) {
108      return filters(Multimaps.forMap(checkNotNull(filters, "filters")));
109   }
110 
111   public static class Builder extends DescribeImagesOptions.Builder {
112 
113      /**
114       * @see AWSDescribeImagesOptions#executableBy
115       */
116      public static AWSDescribeImagesOptions executableBy(String identityId) {
117         AWSDescribeImagesOptions options = new AWSDescribeImagesOptions();
118         return options.executableBy(identityId);
119      }
120 
121      /**
122       * @see AWSDescribeImagesOptions#imageIds
123       */
124      public static AWSDescribeImagesOptions imageIds(String... imageIds) {
125         AWSDescribeImagesOptions options = new AWSDescribeImagesOptions();
126         return options.imageIds(imageIds);
127      }
128 
129      /**
130       * @see AWSDescribeImagesOptions#filters(Multimap)
131       */
132      public static AWSDescribeImagesOptions filters(Multimap<String, String> filters) {
133         AWSDescribeImagesOptions options = new AWSDescribeImagesOptions();
134         return options.filters(filters);
135      }
136 
137      /**
138       * @see AWSDescribeImagesOptions#filters(Map)
139       */
140      public static AWSDescribeImagesOptions filters(Map<String, String> filters) {
141         AWSDescribeImagesOptions options = new AWSDescribeImagesOptions();
142         return options.filters(filters);
143      }
144 
145      /**
146       * @see AWSDescribeImagesOptions#ownedBy
147       */
148      public static AWSDescribeImagesOptions ownedBy(String... owners) {
149         AWSDescribeImagesOptions options = new AWSDescribeImagesOptions();
150         return options.ownedBy(owners);
151      }
152 
153   }
154}

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