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

COVERAGE SUMMARY FOR SOURCE FILE [ListContainerOptions.java]

nameclass, %method, %block, %line, %
ListContainerOptions.java100% (3/3)71%  (22/31)69%  (140/203)76%  (35.9/47)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ListContainerOptions$ImmutableListContainerOptions100% (1/1)58%  (7/12)60%  (30/50)64%  (9/14)
afterMarker (String): ListContainerOptions 0%   (0/1)0%   (0/4)0%   (0/1)
inDirectory (String): ListContainerOptions 0%   (0/1)0%   (0/4)0%   (0/1)
maxResults (int): ListContainerOptions 0%   (0/1)0%   (0/4)0%   (0/1)
recursive (): ListContainerOptions 0%   (0/1)0%   (0/4)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/4)0%   (0/1)
ListContainerOptions$ImmutableListContainerOptions (ListContainerOptions): void 100% (1/1)100% (6/6)100% (3/3)
clone (): ListContainerOptions 100% (1/1)100% (4/4)100% (1/1)
getDir (): String 100% (1/1)100% (4/4)100% (1/1)
getMarker (): String 100% (1/1)100% (4/4)100% (1/1)
getMaxResults (): Integer 100% (1/1)100% (4/4)100% (1/1)
isDetailed (): boolean 100% (1/1)100% (4/4)100% (1/1)
isRecursive (): boolean 100% (1/1)100% (4/4)100% (1/1)
     
class ListContainerOptions100% (1/1)85%  (11/13)71%  (79/112)86%  (18.9/22)
toString (): String 0%   (0/1)0%   (0/27)0%   (0/1)
withDetails (): ListContainerOptions 0%   (0/1)0%   (0/5)0%   (0/2)
inDirectory (String): ListContainerOptions 100% (1/1)94%  (16/17)98%  (2.9/3)
<static initializer> 100% (1/1)100% (8/8)100% (1/1)
ListContainerOptions (): void 100% (1/1)100% (3/3)100% (2/2)
ListContainerOptions (Integer, String, String, boolean, boolean): void 100% (1/1)100% (14/14)100% (5/5)
afterMarker (String): ListContainerOptions 100% (1/1)100% (5/5)100% (1/1)
clone (): ListContainerOptions 100% (1/1)100% (14/14)100% (1/1)
getDir (): String 100% (1/1)100% (3/3)100% (1/1)
isDetailed (): boolean 100% (1/1)100% (3/3)100% (1/1)
isRecursive (): boolean 100% (1/1)100% (3/3)100% (1/1)
maxResults (int): ListContainerOptions 100% (1/1)100% (5/5)100% (1/1)
recursive (): ListContainerOptions 100% (1/1)100% (5/5)100% (2/2)
     
class ListContainerOptions$Builder100% (1/1)67%  (4/6)76%  (31/41)73%  (8/11)
ListContainerOptions$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
withDetails (): ListContainerOptions 0%   (0/1)0%   (0/7)0%   (0/2)
afterMarker (String): ListContainerOptions 100% (1/1)100% (8/8)100% (2/2)
inDirectory (String): ListContainerOptions 100% (1/1)100% (8/8)100% (2/2)
maxResults (int): ListContainerOptions 100% (1/1)100% (8/8)100% (2/2)
recursive (): ListContainerOptions 100% (1/1)100% (7/7)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.blobstore.options;
20 
21import static com.google.common.base.Preconditions.checkArgument;
22import static com.google.common.base.Preconditions.checkNotNull;
23 
24/**
25 * Contains options supported in the list container operation. <h2>
26 * Usage</h2> The recommended way to instantiate a ListOptions object is to statically import
27 * ListContainerOptions.* and invoke a static creation method followed by an instance mutator (if
28 * needed):
29 * <p/>
30 * <code>
31 * import static org.jclouds.blobstore.options.ListContainerOptions.Builder.*
32 * <p/>
33 * BlobStore connection = // get connection
34 * Future<ListResponse<ResourceMetadata>> list = connection.list("container",inDirectory("home/users").maxResults(1000));
35 * <code>
36 * 
37 * @author Adrian Cole
38 */
39public class ListContainerOptions extends ListOptions implements Cloneable {
40 
41   public static final ImmutableListContainerOptions NONE = new ImmutableListContainerOptions(
42            new ListContainerOptions());
43 
44   private String dir;
45   private boolean recursive;
46   private boolean detailed;
47 
48   public ListContainerOptions() {
49   }
50 
51   ListContainerOptions(Integer maxKeys, String marker, String dir, boolean recursive,
52            boolean detailed) {
53      super(maxKeys, marker);
54      this.dir = dir;
55      this.recursive = recursive;
56      this.detailed = detailed;
57   }
58 
59   public static class ImmutableListContainerOptions extends ListContainerOptions {
60      private final ListContainerOptions delegate;
61 
62      @Override
63      public ListContainerOptions afterMarker(String marker) {
64         throw new UnsupportedOperationException();
65      }
66 
67      public ImmutableListContainerOptions(ListContainerOptions delegate) {
68         this.delegate = delegate;
69      }
70 
71      @Override
72      public String getDir() {
73         return delegate.getDir();
74      }
75 
76      @Override
77      public ListContainerOptions inDirectory(String dir) {
78         throw new UnsupportedOperationException();
79      }
80 
81      @Override
82      public boolean isDetailed() {
83         return delegate.isDetailed();
84      }
85 
86      @Override
87      public boolean isRecursive() {
88         return delegate.isRecursive();
89      }
90 
91      @Override
92      public ListContainerOptions maxResults(int maxKeys) {
93         throw new UnsupportedOperationException();
94      }
95 
96      @Override
97      public ListContainerOptions recursive() {
98         throw new UnsupportedOperationException();
99 
100      }
101 
102      @Override
103      public String getMarker() {
104         return delegate.getMarker();
105      }
106 
107      @Override
108      public Integer getMaxResults() {
109         return delegate.getMaxResults();
110      }
111 
112      @Override
113      public ListContainerOptions clone() {
114         return delegate.clone();
115      }
116 
117      @Override
118      public String toString() {
119         return delegate.toString();
120      }
121 
122   }
123 
124   public String getDir() {
125      return dir;
126   }
127 
128   public boolean isRecursive() {
129      return recursive;
130   }
131 
132   public boolean isDetailed() {
133      return detailed;
134   }
135 
136   /**
137    * This will list the contents of a virtual or real directory path.
138    * 
139    */
140   public ListContainerOptions inDirectory(String dir) {
141      this.dir = checkNotNull(dir, "dir");
142      checkArgument(!dir.equals("/"), "dir must not be a slash");
143      return this;
144   }
145 
146   /**
147    * {@inheritDoc}
148    */
149   public ListContainerOptions afterMarker(String marker) {
150      return (ListContainerOptions) super.afterMarker(marker);
151   }
152 
153   /**
154    * {@inheritDoc}
155    */
156   public ListContainerOptions maxResults(int maxKeys) {
157      return (ListContainerOptions) super.maxResults(maxKeys);
158   }
159 
160   /**
161    * return a listing of all objects inside the store, recursively.
162    */
163   public ListContainerOptions recursive() {
164      // checkArgument(path == null, "path and recursive combination currently not supported");
165      this.recursive = true;
166      return this;
167   }
168 
169   /**
170    * populate each result with detailed such as metadata even if it incurs extra requests to the
171    * service.
172    */
173   public ListContainerOptions withDetails() {
174      this.detailed = true;
175      return this;
176   }
177 
178   public static class Builder {
179 
180      /**
181       * @see ListContainerOptions#inDirectory(String)
182       */
183      public static ListContainerOptions inDirectory(String directory) {
184         ListContainerOptions options = new ListContainerOptions();
185         return options.inDirectory(directory);
186      }
187 
188      /**
189       * @see ListContainerOptions#afterMarker(String)
190       */
191      public static ListContainerOptions afterMarker(String marker) {
192         ListContainerOptions options = new ListContainerOptions();
193         return options.afterMarker(marker);
194      }
195 
196      /**
197       * @see ListContainerOptions#maxResults(int)
198       */
199      public static ListContainerOptions maxResults(int maxKeys) {
200         ListContainerOptions options = new ListContainerOptions();
201         return options.maxResults(maxKeys);
202      }
203 
204      /**
205       * @see ListContainerOptions#recursive()
206       */
207      public static ListContainerOptions recursive() {
208         ListContainerOptions options = new ListContainerOptions();
209         return options.recursive();
210      }
211 
212      /**
213       * @see ListContainerOptions#withDetails()
214       */
215      public static ListContainerOptions withDetails() {
216         ListContainerOptions options = new ListContainerOptions();
217         return options.withDetails();
218      }
219   }
220 
221   @Override
222   public ListContainerOptions clone() {
223      return new ListContainerOptions(getMaxResults(), getMarker(), dir, recursive, detailed);
224   }
225 
226   @Override
227   public String toString() {
228      return "[dir=" + dir + ", recursive=" + recursive + ", detailed=" + detailed
229               + ", maxResults=" + getMaxResults() + "]";
230   }
231}

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