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); }
public S3Object find(String key) throws IOException { for (S3Object obj : getObjects()) if (obj.getKey().equals(key)) { obj.refreshMeta(); return obj; } return null; }
/** * 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); } }
public List<S3Object> getObjects() throws IOException { List<S3Object> retVal = new ArrayList<S3Object>(); ListBucketResponse response = awsAuthConnection.listBucket(name, null, null, null, null); if (response != null) { for (Object be : response.getEntries()) { ListEntry le = (ListEntry) be; S3Object obj = S3Object.loadedFromServer(this, le.key); obj.setLastModified(le.lastModified); obj.setSize(le.size); retVal.add(obj); } } return retVal; }
public void removeObject(S3Object obj) throws IOException { Response response = awsAuthConnection.delete(name, obj.getKey(), null); response.assertSuccess(); }
public void updateObjectMeta(S3Object obj) throws IOException { awsAuthConnection.copy(name, obj.getKey(), name, obj.getKey(), obj.getMeta(), null); }
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(); }
public String getSignedUrl(S3Object object) { queryStringGenerator.setExpiresIn(60000); return queryStringGenerator.get(name, object.getKey(), null); }