Class FileDriverMapper
- java.lang.Object
-
- fr.gouv.vitam.storage.engine.server.spi.mapper.FileDriverMapper
-
- All Implemented Interfaces:
DriverMapper
public class FileDriverMapper extends java.lang.Object implements DriverMapper
The driver mapper implementation Using file to persist driver / offer association. One file by driver (the filename is the driver name). In the file, offers are isolated by delimiter.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOffersTo(java.util.List<java.lang.String> offersIdsToAdd, java.lang.String driverName)
Add list of offers to a driver's offers persisted list (and persists it)void
addOfferTo(java.lang.String offerId, java.lang.String driverName)
Add one offer to a driver's offers persisted list (and persists it)static FileDriverMapper
getInstance()
Get the driver mapper instancejava.util.List<java.lang.String>
getOffersFor(java.lang.String driverName)
Get persisted offers list for a drivervoid
removeOffersTo(java.util.List<java.lang.String> offersIdsToRemove, java.lang.String driverName)
Remove list of offers to a driver's offers persisted list (and persist it)void
removeOfferTo(java.lang.String offerId, java.lang.String driverName)
Remove one offer to a driver's offers persisted list (and persists it)
-
-
-
Method Detail
-
getInstance
public static FileDriverMapper getInstance() throws StorageDriverMapperException
Get the driver mapper instance- Returns:
- the FileDriverMapper instance
- Throws:
StorageDriverMapperException
- if cannot initialize FileDriverMapper (error with the configuration file)
-
getOffersFor
public java.util.List<java.lang.String> getOffersFor(java.lang.String driverName) throws StorageDriverMapperException
Description copied from interface:DriverMapper
Get persisted offers list for a driver- Specified by:
getOffersFor
in interfaceDriverMapper
- Parameters:
driverName
- the driver name- Returns:
- offers IDs list for driverName or empty list if there is actually no association
- Throws:
StorageDriverMapperException
- if application cannot have information (reading error for example)
-
addOfferTo
public void addOfferTo(java.lang.String offerId, java.lang.String driverName) throws StorageDriverMapperException
Description copied from interface:DriverMapper
Add one offer to a driver's offers persisted list (and persists it)- Specified by:
addOfferTo
in interfaceDriverMapper
- Parameters:
offerId
- the offer ID to append and persistdriverName
- the driver name- Throws:
StorageDriverMapperException
- if application cannot have information (writing error for example)
-
addOffersTo
public void addOffersTo(java.util.List<java.lang.String> offersIdsToAdd, java.lang.String driverName) throws StorageDriverMapperException
Description copied from interface:DriverMapper
Add list of offers to a driver's offers persisted list (and persists it)- Specified by:
addOffersTo
in interfaceDriverMapper
- Parameters:
offersIdsToAdd
- the offers IDs list to append and persistdriverName
- the driver name- Throws:
StorageDriverMapperException
- if application cannot have information (writing error for example)
-
removeOfferTo
public void removeOfferTo(java.lang.String offerId, java.lang.String driverName) throws StorageDriverMapperException
Description copied from interface:DriverMapper
Remove one offer to a driver's offers persisted list (and persists it)- Specified by:
removeOfferTo
in interfaceDriverMapper
- Parameters:
offerId
- the offer ID to remove and persistdriverName
- the driver name- Throws:
StorageDriverMapperException
- if application cannot have information (writing error for example)
-
removeOffersTo
public void removeOffersTo(java.util.List<java.lang.String> offersIdsToRemove, java.lang.String driverName) throws StorageDriverMapperException
Description copied from interface:DriverMapper
Remove list of offers to a driver's offers persisted list (and persist it)- Specified by:
removeOffersTo
in interfaceDriverMapper
- Parameters:
offersIdsToRemove
- the offers IDs list to remove and persistdriverName
- the driver name- Throws:
StorageDriverMapperException
- if application cannot have information (writing error for example)
-
-