View Javadoc

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.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  }