| 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.openstack.swift.blobstore.config; |
| 20 | |
| 21 | import org.jclouds.blobstore.AsyncBlobStore; |
| 22 | import org.jclouds.blobstore.BlobRequestSigner; |
| 23 | import org.jclouds.blobstore.BlobStore; |
| 24 | import org.jclouds.blobstore.BlobStoreContext; |
| 25 | import org.jclouds.blobstore.attr.ConsistencyModel; |
| 26 | import org.jclouds.blobstore.config.BlobStoreMapModule; |
| 27 | import org.jclouds.blobstore.internal.BlobStoreContextImpl; |
| 28 | import org.jclouds.location.config.JustProviderLocationModule; |
| 29 | import org.jclouds.openstack.swift.CommonSwiftAsyncClient; |
| 30 | import org.jclouds.openstack.swift.CommonSwiftClient; |
| 31 | import org.jclouds.openstack.swift.blobstore.SwiftAsyncBlobStore; |
| 32 | import org.jclouds.openstack.swift.blobstore.SwiftBlobRequestSigner; |
| 33 | import org.jclouds.openstack.swift.blobstore.SwiftBlobStore; |
| 34 | |
| 35 | import com.google.inject.AbstractModule; |
| 36 | import com.google.inject.Scopes; |
| 37 | import com.google.inject.TypeLiteral; |
| 38 | |
| 39 | /** |
| 40 | * Configures the {@link CloudFilesBlobStoreContext}; requires {@link SwiftAsyncBlobStore} |
| 41 | * bound. |
| 42 | * |
| 43 | * @author Adrian Cole |
| 44 | */ |
| 45 | public class SwiftBlobStoreContextModule extends AbstractModule { |
| 46 | |
| 47 | @Override |
| 48 | protected void configure() { |
| 49 | install(new BlobStoreMapModule()); |
| 50 | install(new JustProviderLocationModule()); |
| 51 | bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT); |
| 52 | bind(AsyncBlobStore.class).to(SwiftAsyncBlobStore.class).in(Scopes.SINGLETON); |
| 53 | bind(BlobStore.class).to(SwiftBlobStore.class).in(Scopes.SINGLETON); |
| 54 | bind(BlobStoreContext.class).to(new TypeLiteral<BlobStoreContextImpl<CommonSwiftClient, CommonSwiftAsyncClient>>() { |
| 55 | }).in(Scopes.SINGLETON); |
| 56 | bind(BlobRequestSigner.class).to(SwiftBlobRequestSigner.class); |
| 57 | } |
| 58 | |
| 59 | |
| 60 | } |