/** * A convenience method to download multiple objects from S3 to pre-existing output streams, which * is particularly useful for downloading objects to files. * * @param bucketName * name of the bucket containing the objects * @param downloadPackages * an array of download package objects that manage the output of data for an object. * * @throws ServiceException */ public void downloadObjects(String bucketName, final DownloadPackage[] downloadPackages) throws ServiceException { downloadObjects(bucketName, downloadPackages, null); }
/** * Retrieves multiple objects (including details and data). * The objects' data will be stored in temporary files, and can be retrieved using * {@link StorageObject#getDataInputStream()}. * * @param bucketName * name of the bucket containing the objects. * @param objects * the objects to retrieve. * @return * the retrieved objects. * @throws ServiceException */ public StorageObject[] getObjects(String bucketName, StorageObject[] objects) throws ServiceException { return getObjects(bucketName, objects, null); }
/** * Retrieves details of multiple objects (details only, no data) * * @param bucketName * name of the bucket containing the objects. * @param objectKeys * the key names of the objects to retrieve. * @return * objects populated with the details retrieved. * @throws ServiceException */ public StorageObject[] getObjectsHeads(String bucketName, final String[] objectKeys) throws ServiceException { return getObjectsHeads(bucketName, objectKeys, null); }
(new ThreadedStorageService(service, adaptor)).getObjectsHeads( bucketName, objectKeys, errorPermitter); throwError(adaptor); return reorderStorageObjects(objectKeys, objectList);
/** * Creates multiple buckets. * * @param bucketNames * name of the buckets to create. * @return * the created buckets. * @throws ServiceException */ public StorageBucket[] createBuckets(final String[] bucketNames) throws ServiceException { final List<StorageBucket> bucketList = new ArrayList<StorageBucket>(); StorageServiceEventAdaptor adaptor = new StorageServiceEventAdaptor() { @Override public void event(CreateBucketsEvent event) { super.event(event); if (ServiceEvent.EVENT_IN_PROGRESS == event.getEventCode()) { bucketList.addAll(Arrays.asList(event.getCreatedBuckets())); } }; }; (new ThreadedStorageService(service, adaptor)).createBuckets(bucketNames); throwError(adaptor); return bucketList.toArray(new StorageBucket[bucketList.size()]); }
(new ThreadedStorageService(service, adaptor)).getObjectsHeads( bucketName, objectKeys, errorPermitter); throwError(adaptor); return reorderStorageObjects(objectKeys, objectList);
/** * Creates multiple buckets. * * @param bucketNames * name of the buckets to create. * @return * the created buckets. * @throws ServiceException */ public StorageBucket[] createBuckets(final String[] bucketNames) throws ServiceException { final List<StorageBucket> bucketList = new ArrayList<StorageBucket>(); StorageServiceEventAdaptor adaptor = new StorageServiceEventAdaptor() { @Override public void event(CreateBucketsEvent event) { super.event(event); if (ServiceEvent.EVENT_IN_PROGRESS == event.getEventCode()) { bucketList.addAll(Arrays.asList(event.getCreatedBuckets())); } }; }; (new ThreadedStorageService(service, adaptor)).createBuckets(bucketNames); throwError(adaptor); return bucketList.toArray(new StorageBucket[bucketList.size()]); }
}; (new ThreadedStorageService(service, adaptor)).downloadObjects(bucketName, downloadPackages); throwError(adaptor); return reorderStorageObjects(originalObjectKeyNames, objectList);
/** * Retrieves Access Control List (ACL) settings for multiple objects. * * @param bucketName * name of the bucket containing the objects. * @param objects * the objects whose ACLs will be retrieved. * @return * objects including the ACL information retrieved. * @throws ServiceException */ public StorageObject[] getObjectACLs(String bucketName, final StorageObject[] objects) throws ServiceException { final List<StorageObject> objectList = new ArrayList<StorageObject>(); StorageServiceEventAdaptor adaptor = new StorageServiceEventAdaptor() { @Override public void event(LookupACLEvent event) { super.event(event); if (ServiceEvent.EVENT_IN_PROGRESS == event.getEventCode()) { objectList.addAll(Arrays.asList(event.getObjectsWithACL())); } }; }; (new ThreadedStorageService(service, adaptor)).getObjectACLs(bucketName, objects); throwError(adaptor); return objectList.toArray(new StorageObject[objectList.size()]); }
/** * Retrieves details of multiple objects (details only, no data) * * @param bucketName * name of the bucket containing the objects. * @param objectKeys * the key names of the objects to retrieve. * @return * objects populated with the details retrieved. * @throws ServiceException */ public StorageObject[] getObjectsHeads(String bucketName, final String[] objectKeys) throws ServiceException { return getObjectsHeads(bucketName, objectKeys, null); }
/** * Retrieves multiple objects (including details and data). * The objects' data will be stored in temporary files, and can be retrieved using * {@link StorageObject#getDataInputStream()}. * * @param bucketName * name of the bucket containing the objects. * @param objects * the objects to retrieve. * @return * the retrieved objects. * @throws ServiceException */ public StorageObject[] getObjects(String bucketName, StorageObject[] objects) throws ServiceException { return getObjects(bucketName, objects, null); }
/** * A convenience method to download multiple objects from S3 to pre-existing output streams, which * is particularly useful for downloading objects to files. * * @param bucketName * name of the bucket containing the objects * @param downloadPackages * an array of download package objects that manage the output of data for an object. * * @throws ServiceException */ public void downloadObjects(String bucketName, final DownloadPackage[] downloadPackages) throws ServiceException { downloadObjects(bucketName, downloadPackages, null); }
}; (new ThreadedStorageService(service, adaptor)).downloadObjects(bucketName, downloadPackages); throwError(adaptor); return reorderStorageObjects(originalObjectKeyNames, objectList);
/** * Updates/sets Access Control List (ACL) settings for multiple objects. * * @param bucketName * name of the bucket containing the objects. * @param objects * objects containing ACL settings that will be updated/set. * @return * objects whose ACL settings were updated/set. * @throws ServiceException */ public StorageObject[] putACLs(String bucketName, final StorageObject[] objects) throws ServiceException { final List<StorageObject> objectList = new ArrayList<StorageObject>(); StorageServiceEventAdaptor adaptor = new StorageServiceEventAdaptor() { @Override public void event(UpdateACLEvent event) { super.event(event); if (ServiceEvent.EVENT_IN_PROGRESS == event.getEventCode()) { objectList.addAll(Arrays.asList(event.getObjectsWithUpdatedACL())); } }; }; (new ThreadedStorageService(service, adaptor)).putACLs(bucketName, objects); throwError(adaptor); return objectList.toArray(new StorageObject[objectList.size()]); }
/** * 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); }
/** * Retrieves multiple objects (including details and data). * The objects' data will be stored in temporary files, and can be retrieved using * {@link StorageObject#getDataInputStream()}. * * @param bucketName * name of the bucket containing the objects. * @param objectKeys * the key names of the objects to retrieve. * @return * the retrieved objects. * * @throws ServiceException */ public StorageObject[] getObjects(String bucketName, final String[] objectKeys) throws ServiceException { StorageObject[] objects = new StorageObject[objectKeys.length]; for (int i = 0; i < objectKeys.length; i++) { objects[i] = new StorageObject(objectKeys[i]); } return getObjects(bucketName, objects); }
/** * Updates/sets Access Control List (ACL) settings for multiple objects. * * @param bucketName * name of the bucket containing the objects. * @param objects * objects containing ACL settings that will be updated/set. * @return * objects whose ACL settings were updated/set. * @throws ServiceException */ public StorageObject[] putACLs(String bucketName, final StorageObject[] objects) throws ServiceException { final List<StorageObject> objectList = new ArrayList<StorageObject>(); StorageServiceEventAdaptor adaptor = new StorageServiceEventAdaptor() { @Override public void event(UpdateACLEvent event) { super.event(event); if (ServiceEvent.EVENT_IN_PROGRESS == event.getEventCode()) { objectList.addAll(Arrays.asList(event.getObjectsWithUpdatedACL())); } }; }; (new ThreadedStorageService(service, adaptor)).putACLs(bucketName, objects); throwError(adaptor); return objectList.toArray(new StorageObject[objectList.size()]); }
/** * 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); }
/** * Retrieves multiple objects (including details and data). * The objects' data will be stored in temporary files, and can be retrieved using * {@link StorageObject#getDataInputStream()}. * * @param bucketName * name of the bucket containing the objects. * @param objectKeys * the key names of the objects to retrieve. * @return * the retrieved objects. * * @throws ServiceException */ public StorageObject[] getObjects(String bucketName, final String[] objectKeys) throws ServiceException { StorageObject[] objects = new StorageObject[objectKeys.length]; for (int i = 0; i < objectKeys.length; i++) { objects[i] = new StorageObject(objectKeys[i]); } return getObjects(bucketName, objects); }
/** * Retrieves Access Control List (ACL) settings for multiple objects. * * @param bucketName * name of the bucket containing the objects. * @param objects * the objects whose ACLs will be retrieved. * @return * objects including the ACL information retrieved. * @throws ServiceException */ public StorageObject[] getObjectACLs(String bucketName, final StorageObject[] objects) throws ServiceException { final List<StorageObject> objectList = new ArrayList<StorageObject>(); StorageServiceEventAdaptor adaptor = new StorageServiceEventAdaptor() { @Override public void event(LookupACLEvent event) { super.event(event); if (ServiceEvent.EVENT_IN_PROGRESS == event.getEventCode()) { objectList.addAll(Arrays.asList(event.getObjectsWithACL())); } }; }; (new ThreadedStorageService(service, adaptor)).getObjectACLs(bucketName, objects); throwError(adaptor); return objectList.toArray(new StorageObject[objectList.size()]); }