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.blobstore;
20  
21  import org.jclouds.blobstore.attr.ConsistencyModel;
22  import org.jclouds.blobstore.internal.BlobStoreContextImpl;
23  import org.jclouds.blobstore.options.ListContainerOptions;
24  import org.jclouds.rest.RestContext;
25  import org.jclouds.rest.Utils;
26  
27  import com.google.inject.ImplementedBy;
28  
29  /**
30   * Represents a cloud that has key-value storage functionality. This object is scoped to a service
31   * and an identity.
32   * 
33   * @author Adrian Cole
34   * 
35   */
36  @ImplementedBy(BlobStoreContextImpl.class)
37  public interface BlobStoreContext {
38     /**
39      * 
40      * Generates signed requests for blobs. useful in other tools such as backup utilities.
41      * 
42      */
43     BlobRequestSigner getSigner();
44  
45     /**
46      * Creates a <code>Map<String,InputStream></code> view of the specified container. Use this for
47      * simplest access to blobstore, knowing that MD5s will be calculated for every object.
48      * 
49      * @param container
50      *           existing container you wish to read or modify
51      * @param options
52      *           allow you to specify a directory within the container, or whether to list
53      *           recursively.
54      */
55     InputStreamMap createInputStreamMap(String container, ListContainerOptions options);
56  
57     /**
58      * Creates a <code>Map<String,InputStream></code> view of the specified container. Use this for
59      * simplest access to blobstore, knowing that MD5s will be calculated for every object.
60      * 
61      * Only root-level blobs will be visible.
62      * 
63      * @param container
64      *           existing container you wish to read or modify
65      */
66     InputStreamMap createInputStreamMap(String container);
67  
68     /**
69      * Creates a <code>Map<String,Blob></code> view of the specified container. Use this when you wan
70      * to control the content type, or manually specify length or size of blobs.
71      * 
72      * @param container
73      *           existing container you wish to read or modify
74      * @param options
75      *           allow you to specify a directory within the container, or whether to list
76      *           recursively.
77      */
78     BlobMap createBlobMap(String container, ListContainerOptions options);
79  
80     /**
81      * Creates a <code>Map<String,Blob></code> view of the specified container. Use this when you wan
82      * to control the content type, or manually specify length or size of blobs.
83      * 
84      * Only root-level blobs will be visible.
85      * 
86      * @param container
87      *           existing container you wish to read or modify
88      */
89     BlobMap createBlobMap(String container);
90  
91     /**
92      * @return a portable asynchronous interface for the BlobStore, which returns {@code Future}s for
93      *         each call.
94      */
95     AsyncBlobStore getAsyncBlobStore();
96  
97     /**
98      * @return a portable interface for the BlobStore.
99      */
100    BlobStore getBlobStore();
101 
102    /**
103     * 
104     * @return best guess at the consistency model used in this BlobStore.
105     */
106    ConsistencyModel getConsistencyModel();
107 
108    /**
109     * 
110     * @return a context you can use to the access provider or vendor specific api underlying this
111     *         context.
112     */
113    <S, A> RestContext<S, A> getProviderSpecificContext();
114 
115    Utils getUtils();
116 
117    /**
118     * @see #getUtils
119     */
120    Utils utils();
121 
122    /**
123     * closes threads and resources related to this connection.
124     * 
125     */
126    void close();
127 }