Class StorageDistributionImpl
- java.lang.Object
-
- fr.gouv.vitam.storage.engine.server.distribution.impl.StorageDistributionImpl
-
- All Implemented Interfaces:
VitamAutoCloseable
,StorageDistribution
,java.lang.AutoCloseable
public class StorageDistributionImpl extends java.lang.Object implements StorageDistribution
StorageDistribution service Implementation process continue if needed)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COPY_OBJECT_ORIGIN
static java.lang.String
DIGEST
static java.lang.String
NORMAL_ORIGIN
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BulkObjectStoreResponse
bulkCreateFromWorkspace(java.lang.String strategyId, BulkObjectStoreRequest bulkObjectStoreRequest, java.lang.String requester)
java.util.Map<java.lang.String,AccessRequestStatus>
checkAccessRequestStatuses(java.lang.String strategyId, java.lang.String optionalOfferId, java.util.List<java.lang.String> accessRequestIds, boolean adminCrossTenantAccessRequestAllowed)
boolean
checkObjectAvailability(java.lang.String strategyId, java.lang.String optionalOfferId, DataCategory dataCategory, java.util.List<java.lang.String> objectsNames)
java.util.Map<java.lang.String,java.lang.Boolean>
checkObjectExisting(java.lang.String strategyId, java.lang.String objectId, DataCategory category, java.util.List<java.lang.String> offerIds)
Verify if object existsvoid
close()
StoredInfoResult
copyObjectFromOfferToOffer(DataContext context, java.lang.String sourceOffer, java.lang.String destinationOffer)
copy object from on offer to an anotherjava.util.Optional<java.lang.String>
createAccessRequestIfRequired(java.lang.String strategyId, java.lang.String optionalOfferId, DataCategory dataCategory, java.util.List<java.lang.String> objectsNames)
void
deleteObjectInAllOffers(java.lang.String strategyId, DataContext context)
Delete an objectvoid
deleteObjectInOffers(java.lang.String strategyId, DataContext context, java.util.List<java.lang.String> offers)
Delete an object in offersjava.util.List<BatchObjectInformationResponse>
getBatchObjectInformation(java.lang.String strategyId, DataCategory type, java.util.List<java.lang.String> objectIds, java.util.List<java.lang.String> offerIds)
javax.ws.rs.core.Response
getContainerByCategory(java.lang.String strategyId, java.lang.String origin, java.lang.String objectId, DataCategory category, AccessLogInfoModel logInformation)
Get a specific Object binary data as an input streamjavax.ws.rs.core.Response
getContainerByCategory(java.lang.String strategyId, java.lang.String origin, java.lang.String objectId, DataCategory category, java.lang.String offerId)
Get a specific Object binary data as an input streamcom.fasterxml.jackson.databind.JsonNode
getContainerInformation(java.lang.String strategyId)
Get Storage Information (availability and capacity) for the requested tenant + strategycom.fasterxml.jackson.databind.JsonNode
getContainerInformation(java.lang.String strategyId, DataCategory type, java.lang.String objectId, java.util.List<java.lang.String> offerIds, boolean noCache)
Get a specific Object informationjava.util.List<java.lang.String>
getOfferIds(java.lang.String strategyId)
get offer ids listRequestResponse<OfferLog>
getOfferLogs(java.lang.String strategyId, DataCategory category, java.lang.Long offset, int limit, Order order)
Get offer log from referentRequestResponse<OfferLog>
getOfferLogsByOfferId(java.lang.String strategyId, java.lang.String offerId, DataCategory category, java.lang.Long offset, int limit, Order order)
Get offer log from the given offerjava.lang.String
getReferentOffer(java.lang.String strategyId)
java.util.Map<java.lang.String,StorageStrategy>
getStrategies()
Retrieve all the available storage strategiesprotected StorageStrategyProvider
getStrategyProvider()
javax.ws.rs.core.Response
launchOfferLogCompaction(java.lang.String offerReferenceId, java.lang.Integer tenantId)
CloseableIterator<ObjectEntry>
listContainerObjects(java.lang.String strategyId, DataCategory category)
List container objectsCloseableIterator<ObjectEntry>
listContainerObjectsForOffer(DataCategory category, java.lang.String offerId, boolean includeDisabled)
void
removeAccessRequest(java.lang.String strategyId, java.lang.String optionalOfferId, java.lang.String accessRequestId, boolean adminCrossTenantAccessRequestAllowed)
StoredInfoResult
storeDataInAllOffers(java.lang.String strategyId, java.lang.String objectId, ObjectDescription createObjectDescription, DataCategory category, java.lang.String requester)
Store data of any type for given tenant on storage offers associated to given strategyStoredInfoResult
storeDataInOffers(java.lang.String strategyId, java.lang.String origin, StreamAndInfo streamAndInfo, java.lang.String objectId, DataCategory category, java.lang.String requester, java.util.List<java.lang.String> offerIds)
StoredInfoResult
storeDataInOffers(java.lang.String strategyId, java.lang.String origin, java.lang.String objectId, DataCategory category, java.lang.String requester, java.util.List<java.lang.String> offerIds, javax.ws.rs.core.Response response)
Store data of any type for given tenant on the given storage offer.
-
-
-
Field Detail
-
NORMAL_ORIGIN
public static final java.lang.String NORMAL_ORIGIN
- See Also:
- Constant Field Values
-
COPY_OBJECT_ORIGIN
public static final java.lang.String COPY_OBJECT_ORIGIN
- See Also:
- Constant Field Values
-
DIGEST
public static final java.lang.String DIGEST
- See Also:
- Constant Field Values
-
-
Method Detail
-
copyObjectFromOfferToOffer
public StoredInfoResult copyObjectFromOfferToOffer(DataContext context, java.lang.String sourceOffer, java.lang.String destinationOffer) throws StorageException
Description copied from interface:StorageDistribution
copy object from on offer to an another- Specified by:
copyObjectFromOfferToOffer
in interfaceStorageDistribution
- Parameters:
context
- the contextsourceOffer
- source offerdestinationOffer
- destination Offer- Returns:
- StoredInfoResult Object
- Throws:
StorageException
- StorageException
-
storeDataInOffers
public StoredInfoResult storeDataInOffers(java.lang.String strategyId, java.lang.String origin, java.lang.String objectId, DataCategory category, java.lang.String requester, java.util.List<java.lang.String> offerIds, javax.ws.rs.core.Response response) throws StorageException
Description copied from interface:StorageDistribution
Store data of any type for given tenant on the given storage offer.- Specified by:
storeDataInOffers
in interfaceStorageDistribution
- Parameters:
strategyId
- id of the strategyorigin
- origin of the transaction (normal, bulk, offer_sync)objectId
- the workspace URI of the data to be retrieve (and stored incategory
- the category of the data to store (unit, object...)requester
- the requester informationofferIds
- offer identifiersresponse
- the response- Returns:
- a StoredInfoResult containing information about the created Data
- Throws:
StorageException
- StorageException
-
storeDataInOffers
public StoredInfoResult storeDataInOffers(java.lang.String strategyId, java.lang.String origin, StreamAndInfo streamAndInfo, java.lang.String objectId, DataCategory category, java.lang.String requester, java.util.List<java.lang.String> offerIds) throws StorageException
- Specified by:
storeDataInOffers
in interfaceStorageDistribution
- Parameters:
strategyId
- id of the strategyorigin
- origin of the transaction (normal, bulk, offer_sync)streamAndInfo
- streamAndInfoobjectId
- id of the objectcategory
- the object type to listrequester
- the requester informationofferIds
- offer identfiers- Returns:
- StoredInfoResult
- Throws:
StorageException
- StorageException
-
storeDataInAllOffers
public StoredInfoResult storeDataInAllOffers(java.lang.String strategyId, java.lang.String objectId, ObjectDescription createObjectDescription, DataCategory category, java.lang.String requester) throws StorageException
Description copied from interface:StorageDistribution
Store data of any type for given tenant on storage offers associated to given strategy- Specified by:
storeDataInAllOffers
in interfaceStorageDistribution
- Parameters:
strategyId
- id of the strategyobjectId
- the workspace URI of the data to be retrieve (and stored in offer)createObjectDescription
- object additional informationscategory
- the category of the data to store (unit, object...)requester
- the requester information- Returns:
- a StoredInfoResult containing informations about the created Data
- Throws:
StorageException
- StorageException
-
bulkCreateFromWorkspace
public BulkObjectStoreResponse bulkCreateFromWorkspace(java.lang.String strategyId, BulkObjectStoreRequest bulkObjectStoreRequest, java.lang.String requester) throws StorageException
- Specified by:
bulkCreateFromWorkspace
in interfaceStorageDistribution
- Throws:
StorageException
-
getOfferIds
public java.util.List<java.lang.String> getOfferIds(java.lang.String strategyId) throws StorageException
Description copied from interface:StorageDistribution
get offer ids list- Specified by:
getOfferIds
in interfaceStorageDistribution
- Parameters:
strategyId
- strategy id- Returns:
- offers ids list
- Throws:
StorageException
-
getStrategies
public java.util.Map<java.lang.String,StorageStrategy> getStrategies() throws StorageException
Description copied from interface:StorageDistribution
Retrieve all the available storage strategies- Specified by:
getStrategies
in interfaceStorageDistribution
- Returns:
- all storage strategies by id
- Throws:
StorageException
- if any unwanted technical issue happens
-
createAccessRequestIfRequired
public java.util.Optional<java.lang.String> createAccessRequestIfRequired(java.lang.String strategyId, java.lang.String optionalOfferId, DataCategory dataCategory, java.util.List<java.lang.String> objectsNames) throws StorageException
- Specified by:
createAccessRequestIfRequired
in interfaceStorageDistribution
- Throws:
StorageException
-
checkAccessRequestStatuses
public java.util.Map<java.lang.String,AccessRequestStatus> checkAccessRequestStatuses(java.lang.String strategyId, java.lang.String optionalOfferId, java.util.List<java.lang.String> accessRequestIds, boolean adminCrossTenantAccessRequestAllowed) throws StorageException
- Specified by:
checkAccessRequestStatuses
in interfaceStorageDistribution
- Throws:
StorageException
-
removeAccessRequest
public void removeAccessRequest(java.lang.String strategyId, java.lang.String optionalOfferId, java.lang.String accessRequestId, boolean adminCrossTenantAccessRequestAllowed) throws StorageException
- Specified by:
removeAccessRequest
in interfaceStorageDistribution
- Throws:
StorageException
-
checkObjectAvailability
public boolean checkObjectAvailability(java.lang.String strategyId, java.lang.String optionalOfferId, DataCategory dataCategory, java.util.List<java.lang.String> objectsNames) throws StorageException
- Specified by:
checkObjectAvailability
in interfaceStorageDistribution
- Throws:
StorageException
-
getReferentOffer
public java.lang.String getReferentOffer(java.lang.String strategyId) throws StorageTechnicalException, StorageNotFoundException
- Specified by:
getReferentOffer
in interfaceStorageDistribution
- Throws:
StorageTechnicalException
StorageNotFoundException
-
launchOfferLogCompaction
public javax.ws.rs.core.Response launchOfferLogCompaction(java.lang.String offerReferenceId, java.lang.Integer tenantId) throws StorageException
- Specified by:
launchOfferLogCompaction
in interfaceStorageDistribution
- Throws:
StorageException
-
getContainerInformation
public com.fasterxml.jackson.databind.JsonNode getContainerInformation(java.lang.String strategyId) throws StorageException
Description copied from interface:StorageDistribution
Get Storage Information (availability and capacity) for the requested tenant + strategy- Specified by:
getContainerInformation
in interfaceStorageDistribution
- Parameters:
strategyId
- id of the strategy- Returns:
- a JsonNode containing informations about the storage
- Throws:
StorageNotFoundException
- Thrown if the Container does not existStorageTechnicalException
- Thrown in case of any technical problemStorageException
-
listContainerObjects
public CloseableIterator<ObjectEntry> listContainerObjects(java.lang.String strategyId, DataCategory category) throws StorageException
Description copied from interface:StorageDistribution
List container objects- Specified by:
listContainerObjects
in interfaceStorageDistribution
- Parameters:
strategyId
- the strategy id to get offerscategory
- the object type to list- Returns:
- a response with object listing
- Throws:
StorageException
- thrown in case of any technical problem
-
listContainerObjectsForOffer
public CloseableIterator<ObjectEntry> listContainerObjectsForOffer(DataCategory category, java.lang.String offerId, boolean includeDisabled) throws StorageException
- Specified by:
listContainerObjectsForOffer
in interfaceStorageDistribution
- Throws:
StorageException
-
getOfferLogs
public RequestResponse<OfferLog> getOfferLogs(java.lang.String strategyId, DataCategory category, java.lang.Long offset, int limit, Order order) throws StorageException
Description copied from interface:StorageDistribution
Get offer log from referent- Specified by:
getOfferLogs
in interfaceStorageDistribution
- Parameters:
strategyId
- the strategy id to get offerscategory
- the object type to listoffset
- offset of the excluded objectlimit
- the number of result wantedorder
- order- Returns:
- list of offer log
- Throws:
StorageException
- thrown in case of any technical problem
-
getOfferLogsByOfferId
public RequestResponse<OfferLog> getOfferLogsByOfferId(java.lang.String strategyId, java.lang.String offerId, DataCategory category, java.lang.Long offset, int limit, Order order) throws StorageException
Get offer log from the given offer- Specified by:
getOfferLogsByOfferId
in interfaceStorageDistribution
- Parameters:
strategyId
- the strategy id to get offersofferId
- offerIdcategory
- the object type to listoffset
- offset of the excluded objectlimit
- the number of result wantedorder
- order- Returns:
- list of offer log
- Throws:
StorageException
- thrown in case of any technical problem
-
getContainerByCategory
public javax.ws.rs.core.Response getContainerByCategory(java.lang.String strategyId, java.lang.String origin, java.lang.String objectId, DataCategory category, AccessLogInfoModel logInformation) throws StorageException
Description copied from interface:StorageDistribution
Get a specific Object binary data as an input stream- Specified by:
getContainerByCategory
in interfaceStorageDistribution
- Parameters:
strategyId
- id of the strategyorigin
- originobjectId
- id of the objectcategory
- category of the objectlogInformation
- information for accessLog- Returns:
- an object as a Response with an InputStream
- Throws:
StorageNotFoundException
- Thrown if the Container or the object does not existStorageTechnicalException
- thrown if a technical error happenedStorageException
-
getContainerByCategory
public javax.ws.rs.core.Response getContainerByCategory(java.lang.String strategyId, java.lang.String origin, java.lang.String objectId, DataCategory category, java.lang.String offerId) throws StorageException
Description copied from interface:StorageDistribution
Get a specific Object binary data as an input stream- Specified by:
getContainerByCategory
in interfaceStorageDistribution
- Parameters:
strategyId
- id of the strategyorigin
- originobjectId
- id of the objectcategory
- categoryofferId
- offer identfier- Returns:
- an object as a Response with an InputStream
- Throws:
StorageNotFoundException
- Thrown if the Container or the object does not existStorageTechnicalException
- thrown if a technical error happenedStorageException
-
getContainerInformation
public com.fasterxml.jackson.databind.JsonNode getContainerInformation(java.lang.String strategyId, DataCategory type, java.lang.String objectId, java.util.List<java.lang.String> offerIds, boolean noCache) throws StorageException
Description copied from interface:StorageDistribution
Get a specific Object information- Specified by:
getContainerInformation
in interfaceStorageDistribution
- Parameters:
strategyId
- id of the strategytype
- data categoryobjectId
- id of the objectofferIds
- list id of offers- Returns:
- JsonNode containing informations about the requested object
- Throws:
StorageException
-
checkObjectExisting
public java.util.Map<java.lang.String,java.lang.Boolean> checkObjectExisting(java.lang.String strategyId, java.lang.String objectId, DataCategory category, java.util.List<java.lang.String> offerIds) throws StorageException
Verify if object exists- Specified by:
checkObjectExisting
in interfaceStorageDistribution
- Parameters:
strategyId
- id of the strategyobjectId
- id of the objectcategory
- categoryofferIds
- list id of offers @return- Returns:
- list of result existence by offerId
- Throws:
StorageException
- StorageException
-
deleteObjectInAllOffers
public void deleteObjectInAllOffers(java.lang.String strategyId, DataContext context) throws StorageException
Description copied from interface:StorageDistribution
Delete an object- Specified by:
deleteObjectInAllOffers
in interfaceStorageDistribution
- Parameters:
strategyId
- id of the strategy- Throws:
StorageNotFoundException
- Thrown if the Container or the object does not existStorageTechnicalException
- thrown if a technical error happenedStorageException
-
deleteObjectInOffers
public void deleteObjectInOffers(java.lang.String strategyId, DataContext context, java.util.List<java.lang.String> offers) throws StorageException
Description copied from interface:StorageDistribution
Delete an object in offers- Specified by:
deleteObjectInOffers
in interfaceStorageDistribution
- Parameters:
strategyId
- id of the strategycontext
- contextoffers
- offers- Throws:
StorageNotFoundException
- Thrown if the Container or the object does not existStorageTechnicalException
- thrown if a technical error happenedStorageException
-
getBatchObjectInformation
public java.util.List<BatchObjectInformationResponse> getBatchObjectInformation(java.lang.String strategyId, DataCategory type, java.util.List<java.lang.String> objectIds, java.util.List<java.lang.String> offerIds) throws StorageException
- Specified by:
getBatchObjectInformation
in interfaceStorageDistribution
- Throws:
StorageException
-
getStrategyProvider
protected StorageStrategyProvider getStrategyProvider()
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceVitamAutoCloseable
-
-