Package fr.gouv.vitam.workspace.client
Class WorkspaceClient
- java.lang.Object
-
- fr.gouv.vitam.common.client.DefaultClient
-
- fr.gouv.vitam.workspace.client.WorkspaceClient
-
- All Implemented Interfaces:
BasicClient
,MockOrRestClient
,VitamAutoCloseable
,java.lang.AutoCloseable
public class WorkspaceClient extends DefaultClient
-
-
Field Summary
-
Fields inherited from interface fr.gouv.vitam.common.client.BasicClient
STATUS_URL
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.ws.rs.core.Response
bulkGetObjects(java.lang.String containerName, java.util.List<java.lang.String> objectURIs)
void
checkStatus()
Check the status from the servicevoid
checkStatus(javax.ws.rs.core.MultivaluedHashMap<java.lang.String,java.lang.Object> headers)
Check the status from the service used to passe "X-SSL-CLIENT-CERT" header that contain a pem certificatevoid
close()
Close the underneath http clientvoid
compress(java.lang.String containerName, CompressInformation compressInformation)
void
consumeAnyEntityAndClose(javax.ws.rs.core.Response response)
Helper when an error occurs on client usage side to consume response howeverlong
countObjects(java.lang.String containerName)
void
createContainer(java.lang.String containerName)
void
createFolder(java.lang.String containerName, java.lang.String folderName)
void
deleteContainer(java.lang.String containerName, boolean deleteRecursive)
void
deleteFolder(java.lang.String containerName, java.lang.String folderName)
void
deleteObject(java.lang.String containerName, java.lang.String objectName)
javax.ws.rs.client.Client
getChunkedClient()
javax.ws.rs.client.Client
getClient()
VitamClientFactory<?>
getClientFactory()
RequestResponse<java.util.Map<java.lang.String,FileParams>>
getFilesWithParamsFromFolder(java.lang.String containerName, java.lang.String folderName)
RequestResponse<java.util.List<java.net.URI>>
getListUriDigitalObjectFromFolder(java.lang.String containerName, java.lang.String folderName)
javax.ws.rs.core.Response
getObject(java.lang.String containerName, java.lang.String objectName)
javax.ws.rs.core.Response
getObject(java.lang.String containerName, java.lang.String objectName, long offset, java.lang.Long maxChunkSize)
java.lang.String
getResourcePath()
Get the resource path of the server.java.lang.String
getServiceUrl()
Get the service URLboolean
isExistingContainer(java.lang.String containerName)
boolean
isExistingFolder(java.lang.String containerName, java.lang.String folderName)
boolean
isExistingObject(java.lang.String containerName, java.lang.String objectName)
javax.ws.rs.core.Response
make(VitamRequestBuilder request)
javax.ws.rs.core.Response
makeSpecifyingUrl(VitamRequestBuilder request)
void
purgeOldFilesInContainer(java.lang.String containerName, TimeToLive timeToLive)
void
putAtomicObject(java.lang.String containerName, java.lang.String objectName, java.io.InputStream stream, long size)
void
putObject(java.lang.String containerName, java.lang.String objectName, java.io.InputStream stream)
void
putObject(java.lang.String containerName, java.lang.String objectName, java.lang.Object object)
static void
staticConsumeAnyEntityAndClose(javax.ws.rs.core.Response response)
This method consume everything (in particular InputStream) and close the response.java.lang.String
toString()
void
uncompressObject(java.lang.String containerName, java.lang.String folderName, java.lang.String archiveType, java.io.InputStream inputStreamObject)
-
-
-
Method Detail
-
createContainer
public void createContainer(java.lang.String containerName) throws ContentAddressableStorageServerException
-
deleteContainer
public void deleteContainer(java.lang.String containerName, boolean deleteRecursive) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
-
isExistingContainer
public boolean isExistingContainer(java.lang.String containerName) throws ContentAddressableStorageServerException
-
countObjects
public long countObjects(java.lang.String containerName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
-
createFolder
public void createFolder(java.lang.String containerName, java.lang.String folderName) throws ContentAddressableStorageAlreadyExistException, ContentAddressableStorageServerException
-
deleteFolder
public void deleteFolder(java.lang.String containerName, java.lang.String folderName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
-
isExistingFolder
public boolean isExistingFolder(java.lang.String containerName, java.lang.String folderName) throws ContentAddressableStorageServerException
-
putObject
public void putObject(java.lang.String containerName, java.lang.String objectName, java.io.InputStream stream) throws ContentAddressableStorageServerException
-
putObject
public void putObject(java.lang.String containerName, java.lang.String objectName, java.lang.Object object) throws ContentAddressableStorageServerException
-
putAtomicObject
public void putAtomicObject(java.lang.String containerName, java.lang.String objectName, java.io.InputStream stream, long size) throws ContentAddressableStorageServerException
-
getObject
public javax.ws.rs.core.Response getObject(java.lang.String containerName, java.lang.String objectName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
-
getObject
public javax.ws.rs.core.Response getObject(java.lang.String containerName, java.lang.String objectName, long offset, java.lang.Long maxChunkSize) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
-
bulkGetObjects
public javax.ws.rs.core.Response bulkGetObjects(java.lang.String containerName, java.util.List<java.lang.String> objectURIs) throws ContentAddressableStorageServerException, ContentAddressableStorageNotFoundException
-
deleteObject
public void deleteObject(java.lang.String containerName, java.lang.String objectName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
-
isExistingObject
public boolean isExistingObject(java.lang.String containerName, java.lang.String objectName) throws ContentAddressableStorageServerException
-
getListUriDigitalObjectFromFolder
public RequestResponse<java.util.List<java.net.URI>> getListUriDigitalObjectFromFolder(java.lang.String containerName, java.lang.String folderName) throws ContentAddressableStorageServerException
-
getFilesWithParamsFromFolder
public RequestResponse<java.util.Map<java.lang.String,FileParams>> getFilesWithParamsFromFolder(java.lang.String containerName, java.lang.String folderName) throws ContentAddressableStorageServerException
-
compress
public void compress(java.lang.String containerName, CompressInformation compressInformation) throws ContentAddressableStorageServerException
-
uncompressObject
public void uncompressObject(java.lang.String containerName, java.lang.String folderName, java.lang.String archiveType, java.io.InputStream inputStreamObject) throws ContentAddressableStorageException
-
purgeOldFilesInContainer
public void purgeOldFilesInContainer(java.lang.String containerName, TimeToLive timeToLive) throws ContentAddressableStorageServerException
-
staticConsumeAnyEntityAndClose
public static void staticConsumeAnyEntityAndClose(javax.ws.rs.core.Response response)
This method consume everything (in particular InputStream) and close the response.- Parameters:
response
-
-
consumeAnyEntityAndClose
public final void consumeAnyEntityAndClose(javax.ws.rs.core.Response response)
Description copied from interface:MockOrRestClient
Helper when an error occurs on client usage side to consume response however- Specified by:
consumeAnyEntityAndClose
in interfaceMockOrRestClient
-
checkStatus
public void checkStatus() throws VitamApplicationServerException
Description copied from interface:MockOrRestClient
Check the status from the service- Specified by:
checkStatus
in interfaceMockOrRestClient
- Throws:
VitamApplicationServerException
- if the Server is unavailable
-
checkStatus
public void checkStatus(javax.ws.rs.core.MultivaluedHashMap<java.lang.String,java.lang.Object> headers) throws VitamApplicationServerException
Description copied from interface:MockOrRestClient
Check the status from the service used to passe "X-SSL-CLIENT-CERT" header that contain a pem certificate- Specified by:
checkStatus
in interfaceMockOrRestClient
- Throws:
VitamApplicationServerException
- if the Server is unavailable
-
getResourcePath
public java.lang.String getResourcePath()
Description copied from interface:MockOrRestClient
Get the resource path of the server.- Specified by:
getResourcePath
in interfaceMockOrRestClient
- Returns:
- the resource path as string
-
getServiceUrl
public java.lang.String getServiceUrl()
Description copied from interface:MockOrRestClient
Get the service URL- Specified by:
getServiceUrl
in interfaceMockOrRestClient
- Returns:
- the service URL
-
close
public void close()
Description copied from interface:MockOrRestClient
Close the underneath http client- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceMockOrRestClient
- Specified by:
close
in interfaceVitamAutoCloseable
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
makeSpecifyingUrl
public javax.ws.rs.core.Response makeSpecifyingUrl(VitamRequestBuilder request) throws VitamClientInternalException
- Throws:
VitamClientInternalException
-
make
public javax.ws.rs.core.Response make(VitamRequestBuilder request) throws VitamClientInternalException
- Throws:
VitamClientInternalException
-
getClientFactory
public VitamClientFactory<?> getClientFactory()
-
getClient
public javax.ws.rs.client.Client getClient()
-
getChunkedClient
public javax.ws.rs.client.Client getChunkedClient()
-
-