예제 #1
0
 public void refreshObjectMeta(S3Object object) throws IOException {
   if (object.isTransient())
     throw new RuntimeException("transient object cannot updated, check transient status first");
   com.amazon.s3.S3Object obj = awsAuthConnection.head(name, object.getKey(), null).object;
   if (obj == null) object.setTransient(true);
   else object.setMeta(obj.metadata);
 }
예제 #2
0
 public S3Object find(String key) throws IOException {
   for (S3Object obj : getObjects())
     if (obj.getKey().equals(key)) {
       obj.refreshMeta();
       return obj;
     }
   return null;
 }
예제 #3
0
 /**
  * update data for the object
  *
  * @param object
  * @throws IOException
  */
 public void refreshObject(S3Object object) throws IOException {
   com.amazon.s3.S3Object obj = awsAuthConnection.get(name, object.getKey(), null).object;
   object.setTransient(obj == null);
   if (!object.isTransient()) {
     object.setData(obj.data);
     object.setMeta(obj.metadata);
   }
 }
예제 #4
0
 public void removeObject(S3Object obj) throws IOException {
   Response response = awsAuthConnection.delete(name, obj.getKey(), null);
   response.assertSuccess();
 }
예제 #5
0
 public void updateObjectMeta(S3Object obj) throws IOException {
   awsAuthConnection.copy(name, obj.getKey(), name, obj.getKey(), obj.getMeta(), null);
 }
예제 #6
0
 public void saveObject(S3Object obj) throws IOException {
   obj.setBucket(this);
   com.amazon.s3.S3Object object = new com.amazon.s3.S3Object(obj.getData(), obj.getMeta());
   Response response = awsAuthConnection.put(name, obj.getKey(), object, null);
   response.assertSuccess();
 }
예제 #7
0
 public String getSignedUrl(S3Object object) {
   queryStringGenerator.setExpiresIn(60000);
   return queryStringGenerator.get(name, object.getKey(), null);
 }