EMMA Coverage Report (generated Tue Jun 21 05:51:52 EDT 2011)
[all classes][org.jclouds.openstack.swift.options]

COVERAGE SUMMARY FOR SOURCE FILE [ListContainerOptions.java]

nameclass, %method, %block, %line, %
ListContainerOptions.java100% (2/2)73%  (11/15)82%  (101/123)85%  (22/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ListContainerOptions100% (1/1)70%  (7/10)78%  (69/88)81%  (14.5/18)
getMarker (): String 0%   (0/1)0%   (0/4)0%   (0/1)
getPath (): String 0%   (0/1)0%   (0/4)0%   (0/1)
getPrefix (): String 0%   (0/1)0%   (0/4)0%   (0/1)
getMaxResults (): int 100% (1/1)57%  (8/14)78%  (1.6/2)
maxResults (int): ListContainerOptions 100% (1/1)96%  (23/24)98%  (3.9/4)
<static initializer> 100% (1/1)100% (5/5)100% (1/1)
ListContainerOptions (): void 100% (1/1)100% (3/3)100% (2/2)
afterMarker (String): ListContainerOptions 100% (1/1)100% (10/10)100% (2/2)
underPath (String): ListContainerOptions 100% (1/1)100% (10/10)100% (2/2)
withPrefix (String): ListContainerOptions 100% (1/1)100% (10/10)100% (2/2)
     
class ListContainerOptions$Builder100% (1/1)80%  (4/5)91%  (32/35)89%  (8/9)
ListContainerOptions$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
afterMarker (String): ListContainerOptions 100% (1/1)100% (8/8)100% (2/2)
maxResults (int): ListContainerOptions 100% (1/1)100% (8/8)100% (2/2)
underPath (String): ListContainerOptions 100% (1/1)100% (8/8)100% (2/2)
withPrefix (String): ListContainerOptions 100% (1/1)100% (8/8)100% (2/2)

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 */
19package org.jclouds.openstack.swift.options;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22import static com.google.common.base.Preconditions.checkState;
23 
24import org.jclouds.http.options.BaseHttpRequestOptions;
25 
26/**
27 * Contains options supported in the REST API for the GET container operation. <h2>
28 */
29public class ListContainerOptions extends BaseHttpRequestOptions {
30   public static final ListContainerOptions NONE = new ListContainerOptions();
31 
32   /**
33    * Indicates where to begin listing the account's containers. The list will only include
34    * containers whose names occur lexicographically after the marker. This is convenient for
35    * pagination: To get the next page of results use the last container name of the current page as
36    * the marker.
37    */
38   public ListContainerOptions afterMarker(String marker) {
39      queryParameters.put("marker", checkNotNull(marker, "marker"));
40      return this;
41   }
42 
43   public String getMarker() {
44      return getFirstQueryOrNull("marker");
45   }
46 
47   /**
48    * The maximum number of containers that will be included in the response body. The server might
49    * return fewer than this many containers, but will not return more.
50    */
51   public ListContainerOptions maxResults(int limit) {
52      checkState(limit >= 0, "limit must be >= 0");
53      checkState(limit <= 10000, "limit must be <= 10000");
54      queryParameters.put("limit", Integer.toString(limit));
55      return this;
56   }
57 
58   public int getMaxResults() {
59      String val = getFirstQueryOrNull("limit");
60      return val != null ? new Integer(val) : 10000;
61   }
62 
63   /**
64    * For a string value X, causes the results to be limited to Object names beginning with the
65    * substring X.
66    * 
67    */
68   public ListContainerOptions withPrefix(String prefix) {
69      queryParameters.put("prefix", checkNotNull(prefix, "prefix"));
70      return this;
71   }
72 
73   public String getPrefix() {
74      return getFirstQueryOrNull("prefix");
75   }
76 
77   /**
78    * For a string value X, return the Object names nested in the pseudo path.
79    * <p/>
80    * Users will be able to simulate a hierarchical structure in Cloud Files by following a few
81    * guidelines. Object names must contain the forward slash character / as a path element
82    * separator and also create directory marker Objects, then they will be able to traverse this
83    * nested structure with the new path query parameter.
84    * <p/>
85    * To take advantage of this feature, the directory marker Objects must also be created to
86    * represent the appropriate directories. The following additional Objects need to be created. A
87    * good convention would be to create these as zero or one byte files with a Content-Type of
88    * application/directory
89    */
90   public ListContainerOptions underPath(String path) {
91      queryParameters.put("path", checkNotNull(path, "path"));
92      return this;
93   }
94 
95   public String getPath() {
96      return getFirstQueryOrNull("path");
97   }
98 
99   public static class Builder {
100 
101      /**
102       * @see ListContainerOptions#afterMarker(String)
103       */
104      public static ListContainerOptions afterMarker(String marker) {
105         ListContainerOptions options = new ListContainerOptions();
106         return options.afterMarker(marker);
107      }
108 
109      /**
110       * @see ListContainerOptions#limit(int)
111       */
112      public static ListContainerOptions maxResults(int limit) {
113         ListContainerOptions options = new ListContainerOptions();
114         return options.maxResults(limit);
115      }
116 
117      /**
118       * @see ListContainerOptions#withPrefix(String)
119       */
120      public static ListContainerOptions withPrefix(String prefix) {
121         ListContainerOptions options = new ListContainerOptions();
122         return options.withPrefix(prefix);
123      }
124 
125      /**
126       * @see ListContainerOptions#withPath(String)
127       */
128      public static ListContainerOptions underPath(String path) {
129         ListContainerOptions options = new ListContainerOptions();
130         return options.underPath(path);
131      }
132 
133   }
134}

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