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

COVERAGE SUMMARY FOR SOURCE FILE [S3PropertiesBuilder.java]

nameclass, %method, %block, %line, %
S3PropertiesBuilder.java100% (1/1)67%  (4/6)87%  (71/82)80%  (16/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class S3PropertiesBuilder100% (1/1)67%  (4/6)87%  (71/82)80%  (16/20)
S3PropertiesBuilder (): void 0%   (0/1)0%   (0/3)0%   (0/2)
withMetaPrefix (String): S3PropertiesBuilder 0%   (0/1)0%   (0/8)0%   (0/2)
S3PropertiesBuilder (Properties): void 100% (1/1)100% (4/4)100% (2/2)
build (): Properties 100% (1/1)100% (5/5)100% (2/2)
defaultProperties (): Properties 100% (1/1)100% (40/40)100% (9/9)
setMetaPrefix (): void 100% (1/1)100% (22/22)100% (3/3)

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;
20 
21import static org.jclouds.Constants.PROPERTY_API_VERSION;
22import static org.jclouds.Constants.PROPERTY_RELAX_HOSTNAME;
23import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG;
24import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG;
25import static org.jclouds.blobstore.reference.BlobStoreConstants.DIRECTORY_SUFFIX_FOLDER;
26import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_BLOBSTORE_DIRECTORY_SUFFIX;
27import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX;
28import static org.jclouds.s3.reference.S3Constants.PROPERTY_S3_SERVICE_PATH;
29import static org.jclouds.s3.reference.S3Constants.PROPERTY_S3_VIRTUAL_HOST_BUCKETS;
30 
31import java.util.Properties;
32 
33import org.jclouds.PropertiesBuilder;
34import org.jclouds.s3.reference.S3Headers;
35 
36/**
37 * Builds properties used in S3 Connections
38 * 
39 * @author Adrian Cole
40 */
41public class S3PropertiesBuilder extends PropertiesBuilder {
42   @Override
43   protected Properties defaultProperties() {
44      Properties properties = super.defaultProperties();
45      properties.setProperty(PROPERTY_API_VERSION, S3AsyncClient.VERSION);
46      properties.setProperty(PROPERTY_AUTH_TAG, "AWS");
47      properties.setProperty(PROPERTY_HEADER_TAG, S3Headers.DEFAULT_AMAZON_HEADERTAG);
48      properties.setProperty(PROPERTY_S3_SERVICE_PATH, "/");
49      properties.setProperty(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, "true");
50      properties.setProperty(PROPERTY_RELAX_HOSTNAME, "true");
51      properties.setProperty(PROPERTY_BLOBSTORE_DIRECTORY_SUFFIX, DIRECTORY_SUFFIX_FOLDER);
52      return properties;
53   }
54 
55   public S3PropertiesBuilder(Properties properties) {
56      super(properties);
57   }
58 
59   public S3PropertiesBuilder() {
60      super();
61   }
62 
63   protected S3PropertiesBuilder withMetaPrefix(String prefix) {
64      properties.setProperty(PROPERTY_USER_METADATA_PREFIX, prefix);
65      return this;
66   }
67 
68   protected void setMetaPrefix() {
69      if (properties.getProperty(PROPERTY_USER_METADATA_PREFIX) == null) {
70         properties.setProperty(PROPERTY_USER_METADATA_PREFIX, String.format("x-%s-meta-", properties
71                  .getProperty(PROPERTY_HEADER_TAG)));
72      }
73   }
74 
75   @Override
76   public Properties build() {
77      setMetaPrefix();
78      return super.build();
79   }
80}

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