View Javadoc

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   */
19  package org.jclouds.aws.s3;
20  
21  import static org.jclouds.Constants.PROPERTY_ENDPOINT;
22  import static org.jclouds.aws.domain.Region.AP_NORTHEAST_1;
23  import static org.jclouds.aws.domain.Region.AP_SOUTHEAST_1;
24  import static org.jclouds.aws.domain.Region.US_STANDARD;
25  import static org.jclouds.aws.domain.Region.US_WEST_1;
26  import static org.jclouds.location.reference.LocationConstants.ENDPOINT;
27  import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGION;
28  
29  import java.util.Properties;
30  
31  import org.jclouds.aws.domain.Region;
32  
33  /**
34   * Builds properties used in S3 Clients
35   * 
36   * @author Adrian Cole
37   */
38  public class AWSS3PropertiesBuilder extends org.jclouds.s3.S3PropertiesBuilder {
39  
40     @Override
41     protected Properties defaultProperties() {
42        Properties properties = super.defaultProperties();
43        properties.putAll(Region.regionPropertiesS3());
44        properties.setProperty(PROPERTY_ENDPOINT, "https://s3.amazonaws.com");
45        properties.setProperty(PROPERTY_REGION + "." + US_STANDARD + "." + ENDPOINT, "https://s3.amazonaws.com");
46        properties.setProperty(PROPERTY_REGION + "." + US_WEST_1 + "." + ENDPOINT, "https://s3-us-west-1.amazonaws.com");
47        properties.setProperty(PROPERTY_REGION + "." + "EU" + "." + ENDPOINT, "https://s3-eu-west-1.amazonaws.com");
48        properties.setProperty(PROPERTY_REGION + "." + AP_SOUTHEAST_1 + "." + ENDPOINT,
49              "https://s3-ap-southeast-1.amazonaws.com");
50        properties.setProperty(PROPERTY_REGION + "." + AP_NORTHEAST_1 + "." + ENDPOINT,
51              "https://s3-ap-northeast-1.amazonaws.com");
52        return properties;
53     }
54  
55     public AWSS3PropertiesBuilder() {
56        super();
57     }
58  
59     public AWSS3PropertiesBuilder(Properties properties) {
60        super(properties);
61     }
62  
63  }