| 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 | */ |
| 19 | package org.jclouds.aws.s3.blobstore.config; |
| 20 | |
| 21 | import org.jclouds.aws.s3.AWSS3AsyncClient; |
| 22 | import org.jclouds.aws.s3.AWSS3Client; |
| 23 | import org.jclouds.aws.s3.blobstore.AWSS3AsyncBlobStore; |
| 24 | import org.jclouds.aws.s3.blobstore.AWSS3BlobStore; |
| 25 | import org.jclouds.aws.s3.blobstore.strategy.AsyncMultipartUploadStrategy; |
| 26 | import org.jclouds.aws.s3.blobstore.strategy.MultipartUploadStrategy; |
| 27 | import org.jclouds.aws.s3.blobstore.strategy.internal.ParallelMultipartUploadStrategy; |
| 28 | import org.jclouds.aws.s3.blobstore.strategy.internal.SequentialMultipartUploadStrategy; |
| 29 | import org.jclouds.blobstore.BlobStoreContext; |
| 30 | import org.jclouds.blobstore.internal.BlobStoreContextImpl; |
| 31 | import org.jclouds.s3.blobstore.S3AsyncBlobStore; |
| 32 | import org.jclouds.s3.blobstore.S3BlobStore; |
| 33 | import org.jclouds.s3.blobstore.config.S3BlobStoreContextModule; |
| 34 | |
| 35 | import com.google.inject.Scopes; |
| 36 | import com.google.inject.TypeLiteral; |
| 37 | |
| 38 | /** |
| 39 | * |
| 40 | * |
| 41 | * @author Tibor Kiss |
| 42 | */ |
| 43 | public class AWSS3BlobStoreContextModule extends S3BlobStoreContextModule { |
| 44 | |
| 45 | @Override |
| 46 | protected void configure() { |
| 47 | super.configure(); |
| 48 | bind(S3AsyncBlobStore.class).to(AWSS3AsyncBlobStore.class).in(Scopes.SINGLETON); |
| 49 | bind(S3BlobStore.class).to(AWSS3BlobStore.class).in(Scopes.SINGLETON); |
| 50 | bind(MultipartUploadStrategy.class).to(SequentialMultipartUploadStrategy.class); |
| 51 | bind(AsyncMultipartUploadStrategy.class).to(ParallelMultipartUploadStrategy.class); |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | protected void bindContext() { |
| 56 | bind(BlobStoreContext.class).to(new TypeLiteral<BlobStoreContextImpl<AWSS3Client, AWSS3AsyncClient>>() { |
| 57 | }).in(Scopes.SINGLETON); |
| 58 | } |
| 59 | |
| 60 | } |