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

COVERAGE SUMMARY FOR SOURCE FILE [CreateOptions.java]

nameclass, %method, %block, %line, %
CreateOptions.java100% (2/2)80%  (4/5)95%  (61/64)95%  (9.5/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CreateOptions$Builder100% (1/1)50%  (1/2)73%  (8/11)67%  (2/3)
CreateOptions$Builder (): void 0%   (0/1)0%   (0/3)0%   (0/1)
withMetadata (Multimap): CreateOptions 100% (1/1)100% (8/8)100% (2/2)
     
class CreateOptions100% (1/1)100% (3/3)100% (53/53)100% (8/8)
<static initializer> 100% (1/1)100% (5/5)100% (1/1)
CreateOptions (): void 100% (1/1)100% (3/3)100% (2/2)
withMetadata (Multimap): CreateOptions 100% (1/1)100% (45/45)100% (5/5)

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.azure.storage.options;
20 
21import java.util.Map.Entry;
22 
23import org.jclouds.azure.storage.reference.AzureStorageHeaders;
24import org.jclouds.http.options.BaseHttpRequestOptions;
25 
26import com.google.common.collect.Multimap;
27 
28/**
29 * Contains common options supported in the REST API for the Create operation. <h2>
30 * Usage</h2> The recommended way to instantiate a CreateOptions object is to statically import
31 * CreateOptions.* and invoke a static creation method followed by an instance mutator (if
32 * needed):
33 * <p/>
34 * <code>
35 * import static org.jclouds.azure.storage.options.CreateOptions.Builder.*
36 * import org.jclouds.azure.storage.queue.AzureQueueClient;
37 * <p/>
38 * AzureQueueClient connection = // get connection
39 * Multimap<String,String> metadata = // ...
40 * boolean createdWithPublicAcl = connection.createQueue("containerName", withMetdata(metadata));
41 * <code> *
42 * 
43 * @see <a href="http://msdn.microsoft.com/en-us/library/dd179466.aspx" />
44 * @author Adrian Cole
45 */
46public class CreateOptions extends BaseHttpRequestOptions {
47   public static final CreateOptions NONE = new CreateOptions();
48 
49   /**
50    * A name-value pair to associate with the container as metadata.
51    * 
52    * Note that these are stored at the server under the prefix: x-ms-meta-
53    */
54   public CreateOptions withMetadata(Multimap<String, String> metadata) {
55      for (Entry<String, String> entry : metadata.entries()) {
56         if (entry.getKey().startsWith(AzureStorageHeaders.USER_METADATA_PREFIX))
57            headers.put(entry.getKey(), entry.getValue());
58         else
59            headers
60                     .put(AzureStorageHeaders.USER_METADATA_PREFIX + entry.getKey(), entry
61                              .getValue());
62      }
63      return this;
64   }
65 
66   public static class Builder {
67 
68      /**
69       * @see CreateOptions#withMetadata(Multimap<String, String>)
70       */
71      public static CreateOptions withMetadata(Multimap<String, String> metadata) {
72         CreateOptions options = new CreateOptions();
73         return options.withMetadata(metadata);
74      }
75 
76   }
77}

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