Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 public S3Object find(String key) throws IOException {
   for (S3Object obj : getObjects())
     if (obj.getKey().equals(key)) {
       obj.refreshMeta();
       return obj;
     }
   return null;
 }
Ejemplo n.º 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);
   }
 }
Ejemplo n.º 4
0
 public void removeObject(S3Object obj) throws IOException {
   Response response = awsAuthConnection.delete(name, obj.getKey(), null);
   response.assertSuccess();
 }
Ejemplo n.º 5
0
 public void updateObjectMeta(S3Object obj) throws IOException {
   awsAuthConnection.copy(name, obj.getKey(), name, obj.getKey(), obj.getMeta(), null);
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 7
0
 public String getSignedUrl(S3Object object) {
   queryStringGenerator.setExpiresIn(60000);
   return queryStringGenerator.get(name, object.getKey(), null);
 }