public class SwiftObjectStorageClient extends Object implements ObjectStorageClient
| Constructor and Description |
|---|
SwiftObjectStorageClient(String authUrl,
String userName,
String password,
String containerName,
String regionName,
String tenantName)
Create a new Swift client and setup connection
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Terminate all connections and shut down this client
|
void |
delete(String objectName)
Deletes an object, if present.
|
Optional<StorageObject> |
get(String objectName)
Gets the
StorageObject including its body. |
Optional<StorageObject> |
get(String objectName,
boolean verify)
Gets the
StorageObject including its body. |
String |
getBucketName() |
byte[] |
getContent(String objectName)
Get the content of the specified object and return it as a byte array.
|
ObjectMetadata |
getMetaData(String objectName)
Get the metadata of the specified object
|
String |
getName() |
Optional<StorageObject> |
getWithoutBody(String objectName)
Gets the
StorageObject metadata without its body. |
boolean |
isAvailable(String id)
This method is not recommended as it is inefficient.
|
List<StorageObject> |
list() |
String |
put(StorageObject storageObject)
Creates or updates a
StorageObject. |
String |
put(String key,
org.jclouds.io.Payload value)
Creates or updates a
StorageObject. |
public String getName()
getName in interface ObjectStorageClientObjectStorageClient.getName()public String getBucketName()
getBucketName in interface ObjectStorageClientObjectStorageClient.getBucketName()public List<StorageObject> list()
list in interface ObjectStorageClientList.ObjectStorageClient.list()public boolean isAvailable(String id)
isAvailable in interface ObjectStorageClientObjectStorageClient.isAvailable(String)public String put(String key, org.jclouds.io.Payload value)
ObjectStorageClientStorageObject.put in interface ObjectStorageClientkey - corresponds to StorageObject.getName().value - corresponds to StorageObject.getPayload().StorageObject.getETag() of the object.ObjectStorageClient.put(String, Payload)public String put(StorageObject storageObject)
ObjectStorageClientStorageObject.put in interface ObjectStorageClientstorageObject - corresponds to StorageObject.getName().StorageObject.getETag() of the object.ObjectStorageClient.put(StorageObject)public Optional<StorageObject> getWithoutBody(String objectName)
ObjectStorageClientStorageObject metadata without its body.getWithoutBody in interface ObjectStorageClientobjectName - corresponds to StorageObject.getName().StorageObject or empty Optional, if not found.ObjectStorageClient.getWithoutBody(String)public Optional<StorageObject> get(String objectName)
ObjectStorageClientStorageObject including its body.
Note that as of version 1.3 we no longer verify if the object was retrieved correctly. To do this you need to use
ObjectStorageClient.get(String, boolean) methodget in interface ObjectStorageClientobjectName - corresponds to StorageObject.getName().StorageObject or empty Optional, if not found.ObjectStorageClient.get(String)public Optional<StorageObject> get(String objectName, boolean verify) throws ContentValidationException
ObjectStorageClientStorageObject including its body.get in interface ObjectStorageClientobjectName - corresponds to StorageObject.getName().verify - if true then the MD5 hash of the downloaded content is compared to the known MD5 hash stored on the
serverStorageObject or empty Optional, if not found.ContentValidationException - thrown when verification of the validity of downloaded content fails.ObjectStorageClient.get(String, boolean)public byte[] getContent(String objectName)
ObjectStorageClientgetContent in interface ObjectStorageClientobjectName - corresponds to StorageObject.getName().ObjectStorageClient.getContent(String)public ObjectMetadata getMetaData(String objectName)
ObjectStorageClientgetMetaData in interface ObjectStorageClientobjectName - corresponds to StorageObject.getName().public void delete(String objectName)
ObjectStorageClientdelete in interface ObjectStorageClientobjectName - corresponds to StorageObject.getName().ObjectStorageClient.delete(String)public void close()
ObjectStorageClientclose in interface ObjectStorageClientObjectStorageClient.close()Copyright © 2020. All rights reserved.