diff --git a/core/src/main/resources/rest.properties b/core/src/main/resources/rest.properties index eb210a198e..d4d3cbdc7a 100644 --- a/core/src/main/resources/rest.properties +++ b/core/src/main/resources/rest.properties @@ -44,7 +44,7 @@ aws-elb.propertiesbuilder=org.jclouds.aws.elb.AWSELBPropertiesBuilder cloudwatch.contextbuilder=org.jclouds.cloudwatch.CloudWatchContextBuilder cloudwatch.propertiesbuilder=org.jclouds.cloudwatch.CloudWatchPropertiesBuilder -aws-s3.contextbuilder=org.jclouds.s3.S3ContextBuilder +aws-s3.contextbuilder=org.jclouds.aws.s3.AWSS3ContextBuilder aws-s3.propertiesbuilder=org.jclouds.aws.s3.AWSS3PropertiesBuilder aws-ec2.contextbuilder=org.jclouds.aws.ec2.AWSEC2ContextBuilder diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3AsyncClient.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3AsyncClient.java new file mode 100644 index 0000000000..5513f295eb --- /dev/null +++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3AsyncClient.java @@ -0,0 +1,57 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +package org.jclouds.aws.s3; +/** + * + * + * ==================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +import static org.jclouds.blobstore.attr.BlobScopes.CONTAINER; + +import org.jclouds.blobstore.attr.BlobScope; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.SkipEncoding; +import org.jclouds.s3.S3AsyncClient; +import org.jclouds.s3.filters.RequestAuthorizeSignature; + +/** + * Provides access to amazon-specific S3 features + * + * @author Adrian Cole + */ +@SkipEncoding('/') +@RequestFilters(RequestAuthorizeSignature.class) +@BlobScope(CONTAINER) +public interface AWSS3AsyncClient extends S3AsyncClient { + +} diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3Client.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3Client.java new file mode 100644 index 0000000000..b464041786 --- /dev/null +++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3Client.java @@ -0,0 +1,36 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +package org.jclouds.aws.s3; + +import java.util.concurrent.TimeUnit; + +import org.jclouds.concurrent.Timeout; +import org.jclouds.s3.S3Client; + +/** + * Provides access to amazon-specific S3 features + * + * @author Adrian Cole + * @see AWSS3AsyncClient + */ +@Timeout(duration = 90, timeUnit = TimeUnit.SECONDS) +public interface AWSS3Client extends S3Client { + +} diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3ContextBuilder.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3ContextBuilder.java new file mode 100644 index 0000000000..2a717f8eaf --- /dev/null +++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/AWSS3ContextBuilder.java @@ -0,0 +1,45 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +package org.jclouds.aws.s3; + +import java.util.List; +import java.util.Properties; + +import org.jclouds.aws.s3.config.AWSS3RestClientModule; +import org.jclouds.s3.S3ContextBuilder; + +import com.google.inject.Module; + +/** + * + * @author Adrian Cole + */ +public class AWSS3ContextBuilder extends S3ContextBuilder { + + public AWSS3ContextBuilder(Properties props) { + super(props); + } + + @Override + protected void addClientModule(List modules) { + modules.add(new AWSS3RestClientModule()); + } + +} diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3RestClientModule.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3RestClientModule.java new file mode 100644 index 0000000000..7dc6e9236d --- /dev/null +++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/config/AWSS3RestClientModule.java @@ -0,0 +1,59 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +package org.jclouds.aws.s3.config; + +import javax.inject.Singleton; + +import org.jclouds.aws.s3.AWSS3AsyncClient; +import org.jclouds.aws.s3.AWSS3Client; +import org.jclouds.http.RequiresHttp; +import org.jclouds.rest.ConfiguresRestClient; +import org.jclouds.s3.S3AsyncClient; +import org.jclouds.s3.S3Client; +import org.jclouds.s3.config.S3RestClientModule; + +import com.google.inject.Provides; + +/** + * Configures the S3 connection. + * + * @author Adrian Cole + */ +@RequiresHttp +@ConfiguresRestClient +public class AWSS3RestClientModule extends S3RestClientModule { + + public AWSS3RestClientModule() { + super(AWSS3Client.class, AWSS3AsyncClient.class); + } + + @Singleton + @Provides + S3Client provide(AWSS3Client in) { + return in; + } + + @Singleton + @Provides + S3AsyncClient provide(AWSS3AsyncClient in) { + return in; + } + +}