1 /** 2 * Copyright 2004-2014 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.common.aws.s3; 17 18 import java.io.File; 19 20 import org.kuali.common.aws.s3.model.CopyObjectResult; 21 import org.kuali.common.aws.s3.model.PutObjectResult; 22 23 public interface S3Service { 24 25 /** 26 * Return true if this key exists in this bucket. 27 */ 28 boolean exists(String bucket, String key); 29 30 /** 31 * Create a copy of an object inside a bucket 32 */ 33 CopyObjectResult copyObject(String bucket, String srcKey, String dstKey); 34 35 /** 36 * Read the contents of an object into a string using UTF8 37 */ 38 String readObjectToString(String bucket, String key); 39 40 /** 41 * Write a string to a bucket using UTF8 42 */ 43 PutObjectResult writeStringToObject(String bucket, String key, String data); 44 45 /** 46 * Copy a file from the local file system to a bucket using UTF8 47 */ 48 PutObjectResult putFile(String bucket, String key, File file); 49 50 /** 51 * Copy a file from the local file system to a bucket using the indicated encoding 52 */ 53 PutObjectResult putFile(String bucket, String key, File file, String encoding); 54 55 /** 56 * Return the region we are operating on 57 */ 58 String getRegion(); 59 60 }