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

COVERAGE SUMMARY FOR SOURCE FILE [ObjectMetadataBuilder.java]

nameclass, %method, %block, %line, %
ObjectMetadataBuilder.java100% (1/1)61%  (11/18)72%  (113/156)72%  (34/47)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ObjectMetadataBuilder100% (1/1)61%  (11/18)72%  (113/156)72%  (34/47)
cacheControl (String): ObjectMetadataBuilder 0%   (0/1)0%   (0/5)0%   (0/2)
contentDisposition (String): ObjectMetadataBuilder 0%   (0/1)0%   (0/7)0%   (0/2)
contentEncoding (String): ObjectMetadataBuilder 0%   (0/1)0%   (0/7)0%   (0/2)
contentLanguage (String): ObjectMetadataBuilder 0%   (0/1)0%   (0/7)0%   (0/2)
contentType (String): ObjectMetadataBuilder 0%   (0/1)0%   (0/7)0%   (0/2)
create (): ObjectMetadataBuilder 0%   (0/1)0%   (0/4)0%   (0/1)
userMetadata (Map): ObjectMetadataBuilder 0%   (0/1)0%   (0/6)0%   (0/2)
ObjectMetadataBuilder (): void 100% (1/1)100% (16/16)100% (4/4)
bucket (String): ObjectMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
build (): ObjectMetadata 100% (1/1)100% (48/48)100% (12/12)
contentLength (Long): ObjectMetadataBuilder 100% (1/1)100% (7/7)100% (2/2)
contentMD5 (byte []): ObjectMetadataBuilder 100% (1/1)100% (7/7)100% (2/2)
eTag (String): ObjectMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
key (String): ObjectMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
lastModified (Date): ObjectMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
owner (CanonicalUser): ObjectMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
storageClass (ObjectMetadata$StorageClass): ObjectMetadataBuilder 100% (1/1)100% (5/5)100% (2/2)
uri (URI): ObjectMetadataBuilder 100% (1/1)100% (5/5)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.s3.domain;
20 
21import java.net.URI;
22import java.util.Date;
23import java.util.Map;
24 
25import org.jclouds.io.ContentMetadataBuilder;
26import org.jclouds.io.payloads.BaseMutableContentMetadata;
27import org.jclouds.s3.domain.ObjectMetadata.StorageClass;
28import org.jclouds.s3.domain.internal.MutableObjectMetadataImpl;
29 
30import com.google.common.collect.ImmutableMap;
31 
32/**
33 * Allows you to create {@link ObjectMetadata} objects.
34 * 
35 * @author Adrian Cole
36 */
37public class ObjectMetadataBuilder {
38   public static ObjectMetadataBuilder create() {
39      return new ObjectMetadataBuilder();
40   }
41 
42   private final ContentMetadataBuilder contentMetadataBuilder = new ContentMetadataBuilder()
43            .contentType("binary/octet-stream");
44 
45   private String key;
46   private String bucket;
47   private URI uri;
48   private StorageClass storageClass = StorageClass.STANDARD;
49   private String cacheControl;
50   private Date lastModified;
51   private String eTag;
52   private CanonicalUser owner;
53   private Map<String, String> userMetadata = ImmutableMap.of();
54 
55   public ObjectMetadataBuilder key(String key) {
56      this.key = key;
57      return this;
58   }
59 
60   public ObjectMetadataBuilder bucket(String bucket) {
61      this.bucket = bucket;
62      return this;
63   }
64 
65   public ObjectMetadataBuilder owner(CanonicalUser owner) {
66      this.owner = owner;
67      return this;
68   }
69 
70   public ObjectMetadataBuilder eTag(String eTag) {
71      this.eTag = eTag;
72      return this;
73   }
74 
75   public ObjectMetadataBuilder uri(URI uri) {
76      this.uri = uri;
77      return this;
78   }
79 
80   public ObjectMetadataBuilder lastModified(Date lastModified) {
81      this.lastModified = lastModified;
82      return this;
83   }
84 
85   public ObjectMetadataBuilder storageClass(StorageClass storageClass) {
86      this.storageClass = storageClass;
87      return this;
88   }
89 
90   public ObjectMetadataBuilder cacheControl(String cacheControl) {
91      this.cacheControl = cacheControl;
92      return this;
93   }
94 
95   public ObjectMetadataBuilder userMetadata(Map<String, String> userMetadata) {
96      this.userMetadata = ImmutableMap.copyOf(userMetadata);
97      return this;
98   }
99 
100   public ObjectMetadataBuilder contentDisposition(String contentDisposition) {
101      contentMetadataBuilder.contentDisposition(contentDisposition);
102      return this;
103   }
104 
105   public ObjectMetadataBuilder contentEncoding(String contentEncoding) {
106      contentMetadataBuilder.contentEncoding(contentEncoding);
107      return this;
108 
109   }
110 
111   public ObjectMetadataBuilder contentLanguage(String contentLanguage) {
112      contentMetadataBuilder.contentLanguage(contentLanguage);
113      return this;
114 
115   }
116 
117   public ObjectMetadataBuilder contentLength(Long contentLength) {
118      contentMetadataBuilder.contentLength(contentLength);
119      return this;
120 
121   }
122 
123   public ObjectMetadataBuilder contentMD5(byte[] md5) {
124      contentMetadataBuilder.contentMD5(md5);
125      return this;
126 
127   }
128 
129   public ObjectMetadataBuilder contentType(String contentType) {
130      contentMetadataBuilder.contentType(contentType);
131      return this;
132   }
133 
134   public ObjectMetadata build() {
135      MutableObjectMetadataImpl toReturn = new MutableObjectMetadataImpl();
136      toReturn.setContentMetadata(BaseMutableContentMetadata.fromContentMetadata(contentMetadataBuilder.build()));
137      toReturn.setCacheControl(cacheControl);
138      toReturn.setKey(key);
139      toReturn.setBucket(bucket);
140      toReturn.setUri(uri);
141      toReturn.setETag(eTag);
142      toReturn.setOwner(owner);
143      toReturn.setStorageClass(storageClass);
144      toReturn.setUserMetadata(userMetadata);
145      toReturn.setLastModified(lastModified);
146      return toReturn;
147   }
148 
149}

[all classes][org.jclouds.s3.domain]
EMMA 2.0.5312 (C) Vladimir Roubtsov