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 java.io.File;
22 import java.io.InputStream;
23 import java.util.Map;
24
25 import org.jclouds.blobstore.internal.InputStreamMapImpl;
26 import org.jclouds.blobstore.options.ListContainerOptions;
27
28 import com.google.inject.ImplementedBy;
29
30 /**
31 * Map view of an {@link org.jclouds.aws.s3.domain.S3Bucket}. Provides additional methods for
32 * inserting common object types.
33 * <p/>
34 * <h2>Note</h2> All <code>put</code> operations will invoke
35 * {@link org.jclouds.aws.s3.domain.S3Object#generateETag}. By extension,
36 * {@link #put(Object, Object)} will result in the InputStream being converted to a byte array. For
37 * this reason, do not use {@link #put(Object, Object)} to store files. Use
38 * {@link #putFile(String, File)} or {@link S3ObjectMap} instead.
39 *
40 * @author Adrian Cole
41 */
42 @ImplementedBy(InputStreamMapImpl.class)
43 public interface InputStreamMap extends ListableMap<String, InputStream> {
44 public static interface Factory {
45 InputStreamMap create(String containerName, ListContainerOptions options);
46 }
47
48 InputStream putString(String key, String value);
49
50 InputStream putFile(String key, File value);
51
52 InputStream putBytes(String key, byte[] value);
53
54 void putAllStrings(Map<? extends String, ? extends String> map);
55
56 void putAllBytes(Map<? extends String, ? extends byte[]> map);
57
58 void putAllFiles(Map<? extends String, ? extends File> map);
59
60 }