@Override public ObjectStatus[] getObjectStatuses() { StorageObject[] objects = mChunk.getObjects(); ObjectStatus[] ret = new ObjectStatus[objects.length]; for (int i = 0; i < ret.length; ++i) { ret[i] = new ObjectStatus(objects[i].getKey(), objects[i].getMd5HashAsBase64(), objects[i].getContentLength(), objects[i].getLastModifiedDate().getTime()); } return ret; }
/** * Throws an exception if an object is null or contains a null/empty key. * @param object * @param action * the action being attempted which this assertion is applied, for debugging purposes. * @throws ServiceException */ protected void assertValidObject(StorageObject object, String action) throws ServiceException { if (object == null || object.getKey() == null || object.getKey().length() == 0) { throw new ServiceException("The action " + action + " cannot be performed with an invalid object: " + object); } }
/** * Throws an exception if an object is null or contains a null/empty key. * @param object * @param action * the action being attempted which this assertion is applied, for debugging purposes. * @throws ServiceException */ protected void assertValidObject(StorageObject object, String action) throws ServiceException { if (object == null || object.getKey() == null || object.getKey().length() == 0) { throw new ServiceException("The action " + action + " cannot be performed with an invalid object: " + object); } }
public static void registerMBeans(String bucketName, StorageObject[] objects) { if (!isEnabled) { return; } for (int i=0; i<objects.length; i++) { getInstance(bucketName, objects[i].getKey()); } }
public void run() { try { storageService.deleteObject(bucketName, object.getKey()); result = object; } catch (RuntimeException e) { result = e; throw e; } catch (Exception e) { result = e; } }
public static void registerMBeans(String bucketName, StorageObject[] objects) { if (!isEnabled) { return; } for (int i=0; i<objects.length; i++) { getInstance(bucketName, objects[i].getKey()); } }
public void run() { try { storageService.deleteObject(bucketName, object.getKey()); result = object; } catch (RuntimeException e) { result = e; throw e; } catch (Exception e) { result = e; } }
@Override public void fireProgressEvent(ThreadWatcher threadWatcher, List completedResults) { StorageObject[] completedObjects = (StorageObject[]) completedResults .toArray(new StorageObject[completedResults.size()]); for (int i = 0; i < completedObjects.length; i++) { pendingObjectKeysList.remove(completedObjects[i].getKey()); } fireServiceEvent(GetObjectsEvent.newInProgressEvent(threadWatcher, completedObjects, uniqueOperationId)); } @Override
@Override public void fireProgressEvent(ThreadWatcher threadWatcher, List completedResults) { StorageObject[] completedObjects = (StorageObject[]) completedResults .toArray(new StorageObject[completedResults.size()]); for (int i = 0; i < completedObjects.length; i++) { pendingObjectKeysList.remove(completedObjects[i].getKey()); } fireServiceEvent(GetObjectsEvent.newInProgressEvent(threadWatcher, completedObjects, uniqueOperationId)); } @Override
@Override public void fireProgressEvent(ThreadWatcher threadWatcher, List completedResults) { StorageObject[] completedObjects = (StorageObject[]) completedResults .toArray(new StorageObject[completedResults.size()]); for (int i = 0; i < completedObjects.length; i++) { pendingObjectKeysList.remove(completedObjects[i].getKey()); } fireServiceEvent(GetObjectHeadsEvent.newInProgressEvent(threadWatcher, completedObjects, uniqueOperationId)); } @Override
/** * Retrieves details of multiple objects (details only, no data) * * @param bucketName * name of the bucket containing the objects. * @param objects * the objects to retrieve. * @return * objects populated with the details retrieved. * @throws ServiceException */ public StorageObject[] getObjectsHeads(String bucketName, StorageObject[] objects) throws ServiceException { String[] objectKeys = new String[objects.length]; for (int i = 0; i < objects.length; i++) { objectKeys[i] = objects[i].getKey(); } return getObjectsHeads(bucketName, objectKeys); }
@Override public void fireProgressEvent(ThreadWatcher threadWatcher, List completedResults) { StorageObject[] completedObjects = (StorageObject[]) completedResults .toArray(new StorageObject[completedResults.size()]); for (int i = 0; i < completedObjects.length; i++) { pendingObjectKeysList.remove(completedObjects[i].getKey()); } fireServiceEvent(GetObjectHeadsEvent.newInProgressEvent(threadWatcher, completedObjects, uniqueOperationId)); } @Override
@Override public String toString() { return "StorageObject [key=" + getKey() + ", lastModified=" + getLastModifiedDate() + ", dataInputStream=" + dataInputStream + ", Metadata=" + getMetadataMap() + "]"; }
@Override public String toString() { return "StorageObject [key=" + getKey() + ", lastModified=" + getLastModifiedDate() + ", dataInputStream=" + dataInputStream + ", Metadata=" + getMetadataMap() + "]"; }
public void run() { try { AccessControlList acl = storageService.getObjectAcl( bucketName, object.getKey()); object.setAcl(acl); result = object; } catch (RuntimeException e) { result = e; throw e; } catch (Exception e) { result = e; } }
public void run() { try { AccessControlList acl = storageService.getObjectAcl( bucketName, object.getKey()); object.setAcl(acl); result = object; } catch (RuntimeException e) { result = e; throw e; } catch (Exception e) { result = e; } }
@Override public ObjectStatus[] getObjectStatuses() { StorageObject[] objects = mChunk.getObjects(); ObjectStatus[] ret = new ObjectStatus[objects.length]; for (int i = 0; i < ret.length; ++i) { ret[i] = new ObjectStatus(objects[i].getKey(), objects[i].getMd5HashAsBase64(), objects[i].getContentLength(), objects[i].getLastModifiedDate().getTime()); } return ret; }
/** * Applies access control settings to an object. The ACL settings must be included * with the object. * * This method can be performed by anonymous services, but can only succeed if the * object's existing ACL already allows write access by the anonymous user. * In general, you can only access the ACL of an object if the ACL already in place * for that object allows you to do so. * * @param bucketName * the name of the bucket containing the object to modify. * @param object * the object with ACL settings that will be applied. * @throws ServiceException */ public void putObjectAcl(String bucketName, StorageObject object) throws ServiceException { assertValidObject(object, "Put Object Access Control List"); putObjectAcl(bucketName, object.getKey(), object.getAcl()); }
@Override public Object clone() { StorageObject clone = new StorageObject(getKey()); clone.dataInputStream = dataInputStream; clone.acl = acl; clone.isMetadataComplete = isMetadataComplete; clone.dataInputFile = dataInputFile; clone.setOwner(this.getOwner()); clone.addAllMetadata(getMetadataMap()); return clone; }
@Override public Object clone() { StorageObject clone = new StorageObject(getKey()); clone.dataInputStream = dataInputStream; clone.acl = acl; clone.isMetadataComplete = isMetadataComplete; clone.dataInputFile = dataInputFile; clone.setOwner(this.getOwner()); clone.addAllMetadata(getMetadataMap()); return clone; }