public class Swift extends ContentAddressableStorageAbstract
Modifier and Type | Field and Description |
---|---|
protected StorageConfiguration |
configuration |
LISTING_MAX_RESULTS
Constructor and Description |
---|
Swift(Supplier<org.openstack4j.api.OSClient> osClient,
StorageConfiguration configuration)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
countObjects(String containerName)
Determines if a container exists
|
void |
createContainer(String containerName)
Abstract method to get authenticated openstack client, allow to switch between Keystone V2 and Keystone V3
|
void |
deleteObject(String containerName,
String objectName)
Deletes a object representing the data at location containerName/objectName
|
ContainerInformation |
getContainerInformation(String containerName)
Get container information like capacity
|
javax.ws.rs.core.Response |
getObject(String containerName,
String objectName)
Retrieves an object representing the data at location containerName/objectName
|
javax.ws.rs.core.Response |
getObjectAsync(String containerName,
String objectName)
Retrieves an object representing the data at location containerName/objectName
|
com.fasterxml.jackson.databind.JsonNode |
getObjectInformation(String containerName,
String objectName)
Retrieves information about an object at location containerName/objectName
|
MetadatasObject |
getObjectMetadatas(String containerName,
String objectId)
get metadata of the object
|
boolean |
isExistingContainer(String containerName)
Determines if a container exists
|
boolean |
isExistingObject(String containerName,
String objectName)
Determines if an object exists
|
VitamPageSet<? extends VitamStorageMetadata> |
listContainer(String containerName)
List container (create cursor)
|
VitamPageSet<? extends VitamStorageMetadata> |
listContainerNext(String containerName,
String nextMarker)
List container (next on cursor)
|
void |
putObject(String containerName,
String objectName,
InputStream stream,
DigestType digestType,
Long size)
Adds an object representing the data at location containerName/objectName
|
checkObject, computeObjectDigest
protected StorageConfiguration configuration
public Swift(Supplier<org.openstack4j.api.OSClient> osClient, StorageConfiguration configuration)
osClient
- the given type of osClient can be OSClientV2, OSClientV3configuration
- StorageConfigurationpublic void createContainer(String containerName) throws ContentAddressableStorageAlreadyExistException, ContentAddressableStorageServerException
containerName
- name of container to createContentAddressableStorageAlreadyExistException
- Thrown when creating a container while it (containerName)
already existsContentAddressableStorageServerException
- Thrown when internal server error happenspublic boolean isExistingContainer(String containerName)
ContentAddressableStorage
containerName
- name of containerpublic long countObjects(String containerName) throws ContentAddressableStorageNotFoundException
ContentAddressableStorage
containerName
- name of containerContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.public void putObject(String containerName, String objectName, InputStream stream, DigestType digestType, Long size) throws ContentAddressableStorageException
ContentAddressableStorage
containerName
- container to place the object.objectName
- fully qualified object name relative to the container.stream
- the datadigestType
- parameter to compute an hash.size
- size off the input streamContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.ContentAddressableStorageException
- Thrown when put action failed due some other failureContentAddressableStorageAlreadyExistException
- Thrown when object creating existspublic javax.ws.rs.core.Response getObject(String containerName, String objectName) throws ContentAddressableStorageException
ContentAddressableStorage
WARNING : use this method only if the response has to be consumed right away. If the response has to be
forwarded, you should use the method getObjectAsync
instead
containerName
- container where this exists.objectName
- fully qualified name relative to the container.ContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.ContentAddressableStorageException
- Thrown when get action failed due some other failureContentAddressableStorageAlreadyExistException
- Thrown when object creating existspublic javax.ws.rs.core.Response getObjectAsync(String containerName, String objectName) throws ContentAddressableStorageException
ContentAddressableStorage
containerName
- container where this exists.objectName
- fully qualified name relative to the container.ContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.ContentAddressableStorageException
- Thrown when get action failed due some other failureContentAddressableStorageAlreadyExistException
- Thrown when object creating existspublic void deleteObject(String containerName, String objectName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
ContentAddressableStorage
containerName
- container where this exists.objectName
- fully qualified name relative to the container.ContentAddressableStorageNotFoundException
- Thrown when the container cannot be located or the blob cannot
be located in the container.ContentAddressableStorageServerException
public boolean isExistingObject(String containerName, String objectName)
ContentAddressableStorage
containerName
- container where the object residesobjectName
- fully qualified name relative to the container.public ContainerInformation getContainerInformation(String containerName) throws ContentAddressableStorageNotFoundException
ContentAddressableStorage
containerName
- the container nameContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.public com.fasterxml.jackson.databind.JsonNode getObjectInformation(String containerName, String objectName) throws ContentAddressableStorageException
ContentAddressableStorage
containerName
- container where the object is.objectName
- fully qualified name relative to the container.ContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.ContentAddressableStorageException
- Thrown when get action failed due some other failurepublic MetadatasObject getObjectMetadatas(String containerName, String objectId)
ContentAddressableStorage
containerName
- the container nameobjectId
- the objectId to checkpublic VitamPageSet<? extends VitamStorageMetadata> listContainer(String containerName) throws ContentAddressableStorageNotFoundException
ContentAddressableStorage
containerName
- the container nameContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.public VitamPageSet<? extends VitamStorageMetadata> listContainerNext(String containerName, String nextMarker) throws ContentAddressableStorageNotFoundException
ContentAddressableStorage
containerName
- the container namenextMarker
- the last id of the list to get nextContentAddressableStorageNotFoundException
- Thrown when the container cannot be located.public void close()
Copyright © 2018 Vitam. All rights reserved.