public class MetadataReadOnlyGoogleCloudStorage extends Object implements GoogleCloudStorage
| Modifier and Type | Field and Description |
|---|---|
static LogUtil |
log |
PATH_DELIMITER| Constructor and Description |
|---|
MetadataReadOnlyGoogleCloudStorage(Collection<GoogleCloudStorageItemInfo> itemInfos)
Constructs a MetadataReadOnlyGoogleCloudStorage which can be used for temporary contexts
where only object metadata read operations will be used through the GoogleCloudStorage
interface.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Releases resources used by this instance.
|
void |
copy(String srcBucketName,
List<String> srcObjectNames,
String dstBucketName,
List<String> dstObjectNames)
Copies metadata of the given objects.
|
WritableByteChannel |
create(StorageResourceId resourceId)
Creates and opens an object for writing.
|
WritableByteChannel |
create(StorageResourceId resourceId,
CreateObjectOptions options)
Creates and opens an object for writing.
|
void |
create(String bucketName)
Creates a bucket.
|
void |
createEmptyObject(StorageResourceId resourceId)
Creates an empty object, useful for placeholders representing, for example, directories.
|
void |
createEmptyObject(StorageResourceId resourceId,
CreateObjectOptions options)
Creates an empty object, useful for placeholders representing, for example, directories.
|
void |
createEmptyObjects(List<StorageResourceId> resourceIds)
Creates a list of empty objects; see
GoogleCloudStorage.createEmptyObject(StorageResourceId) for
the single-item version of this method. |
void |
createEmptyObjects(List<StorageResourceId> resourceIds,
CreateObjectOptions options)
Creates a list of empty objects; see
GoogleCloudStorage.createEmptyObject(StorageResourceId) for
the single-item version of this method. |
void |
deleteBuckets(List<String> bucketNames)
Deletes a list of buckets.
|
void |
deleteObjects(List<StorageResourceId> fullObjectNames)
Deletes the given objects.
|
GoogleCloudStorageItemInfo |
getItemInfo(StorageResourceId resourceId)
Pure fetch from cache.
|
List<GoogleCloudStorageItemInfo> |
getItemInfos(List<StorageResourceId> resourceIds)
Pure fetch from cache.
|
List<GoogleCloudStorageItemInfo> |
listBucketInfo()
Gets a list of GoogleCloudStorageItemInfo for all buckets of this project.
|
List<String> |
listBucketNames()
Gets a list of names of buckets in this project.
|
List<GoogleCloudStorageItemInfo> |
listObjectInfo(String bucketName,
String objectNamePrefix,
String delimiter)
Uses shared prefix-matching logic to filter entries from the metadata cache.
|
List<String> |
listObjectNames(String bucketName,
String objectNamePrefix,
String delimiter)
Gets names of objects contained in the given bucket and whose names begin with
the given prefix.
|
SeekableReadableByteChannel |
open(StorageResourceId resourceId)
Opens an object for reading.
|
List<GoogleCloudStorageItemInfo> |
updateItems(List<UpdatableItemInfo> itemInfoList)
Attempt to update metadata of the objects referenced within the passed itemInfo objects.
|
void |
waitForBucketEmpty(String bucketName)
Waits for the given bucket to be empty.
|
public static final LogUtil log
public MetadataReadOnlyGoogleCloudStorage(Collection<GoogleCloudStorageItemInfo> itemInfos) throws IOException
itemInfos - The collection of item infos with which to serve all list/get object requests.IOExceptionpublic WritableByteChannel create(StorageResourceId resourceId) throws IOException
GoogleCloudStoragecreate in interface GoogleCloudStorageresourceId - identifies a StorageObjectIOException - on IO errorpublic WritableByteChannel create(StorageResourceId resourceId, CreateObjectOptions options) throws IOException
GoogleCloudStoragecreate in interface GoogleCloudStorageresourceId - identifies a StorageObjectoptions - Options to use when creating the objectIOException - on IO errorpublic void createEmptyObject(StorageResourceId resourceId) throws IOException
GoogleCloudStoragecreateEmptyObject in interface GoogleCloudStorageresourceId - identifies a StorageObjectIOException - on IO errorpublic void createEmptyObject(StorageResourceId resourceId, CreateObjectOptions options) throws IOException
GoogleCloudStoragecreateEmptyObject in interface GoogleCloudStorageresourceId - identifies a StorageObjectoptions - options to use when creating the objectIOException - on IO errorpublic void createEmptyObjects(List<StorageResourceId> resourceIds) throws IOException
GoogleCloudStorageGoogleCloudStorage.createEmptyObject(StorageResourceId) for
the single-item version of this method. Implementations may use different flow than the
single-item version for greater efficiency.createEmptyObjects in interface GoogleCloudStorageIOExceptionpublic void createEmptyObjects(List<StorageResourceId> resourceIds, CreateObjectOptions options) throws IOException
GoogleCloudStorageGoogleCloudStorage.createEmptyObject(StorageResourceId) for
the single-item version of this method. Implementations may use different flow than the
single-item version for greater efficiency.createEmptyObjects in interface GoogleCloudStorageIOExceptionpublic SeekableReadableByteChannel open(StorageResourceId resourceId) throws IOException
GoogleCloudStorageopen in interface GoogleCloudStorageresourceId - identifies a StorageObjectIOException - if object exists but cannot be openedpublic void create(String bucketName) throws IOException
GoogleCloudStoragecreate in interface GoogleCloudStoragebucketName - name of the bucket to createIOException - on IO errorpublic void deleteBuckets(List<String> bucketNames) throws IOException
GoogleCloudStoragedeleteBuckets in interface GoogleCloudStoragebucketNames - name of the buckets to deleteIOException - on IO errorpublic void deleteObjects(List<StorageResourceId> fullObjectNames) throws IOException
GoogleCloudStoragedeleteObjects in interface GoogleCloudStoragefullObjectNames - names of objects to delete with their respective bucketNames.IOException - if object exists but cannot be deletedpublic void copy(String srcBucketName, List<String> srcObjectNames, String dstBucketName, List<String> dstObjectNames) throws IOException
GoogleCloudStoragecopy in interface GoogleCloudStoragesrcBucketName - name of the bucket containing the objects to copysrcObjectNames - names of the objects to copydstBucketName - name of the bucket to copy todstObjectNames - names of the objects after copyIOException - in all other error casespublic List<String> listBucketNames() throws IOException
GoogleCloudStoragelistBucketNames in interface GoogleCloudStorageIOExceptionpublic List<GoogleCloudStorageItemInfo> listBucketInfo() throws IOException
GoogleCloudStoragelistBucketInfo in interface GoogleCloudStorageIOExceptionpublic List<String> listObjectNames(String bucketName, String objectNamePrefix, String delimiter) throws IOException
GoogleCloudStoragelistObjectNames in interface GoogleCloudStoragebucketName - bucket nameobjectNamePrefix - object name prefix or null if all objects in the bucket are desireddelimiter - delimiter to use (typically "/"), otherwise nullIOException - on IO errorpublic List<GoogleCloudStorageItemInfo> listObjectInfo(String bucketName, String objectNamePrefix, String delimiter) throws IOException
listObjectInfo in interface GoogleCloudStoragebucketName - bucket nameobjectNamePrefix - object name prefix or null if all objects in the bucket are desireddelimiter - delimiter to use (typically "/"), otherwise nullIOException - on IO errorpublic List<GoogleCloudStorageItemInfo> getItemInfos(List<StorageResourceId> resourceIds) throws IOException
getItemInfos in interface GoogleCloudStorageresourceIds - names of the GCS StorageObjects or Buckets for which to retrieve info.IOException - on IO errorpublic List<GoogleCloudStorageItemInfo> updateItems(List<UpdatableItemInfo> itemInfoList) throws IOException
GoogleCloudStorageupdateItems in interface GoogleCloudStorageIOException - on IO errorpublic GoogleCloudStorageItemInfo getItemInfo(StorageResourceId resourceId) throws IOException
getItemInfo in interface GoogleCloudStorageresourceId - identifies either root, a Bucket, or a StorageObjectIOException - on IO errorpublic void close()
GoogleCloudStorageclose in interface GoogleCloudStoragepublic void waitForBucketEmpty(String bucketName) throws IOException
GoogleCloudStoragewaitForBucketEmpty in interface GoogleCloudStorageIOExceptionCopyright © 2015. All rights reserved.