public class SecuredContainerMapper extends AbstractDatabaseMapper
OFS
(Metadata
is stored in the encrypted database
and the encrypted data is stored in the file system). All create, read, update and delete operations relating to
secured containers are handled by the mapper. No logic for encrypting or decrypting exists in the mapper.Constructor and Description |
---|
SecuredContainerMapper(KeyRing keyRing,
DataAccess dataAccess,
OFS ofs)
Create a SecuredContainer mapper for the
OFS and data access. |
Modifier and Type | Method and Description |
---|---|
void |
create(byte[] securedContainerBytes,
Metadata metadata,
String ofsLocation,
org.threeten.bp.ZonedDateTime syncedAt)
Writes the encrypted content of the container in the file system and the metadata in the encrypted database.
|
void |
create(Metadata metadata,
String ofsLocation,
org.threeten.bp.ZonedDateTime syncedAt)
Writes the given metadata, ofs location and sync time to the encrypted database.
|
void |
delete(UUID containerId)
Deletes the encrypted content of the container from the file system and deletes the metadata records from the
encrypted database.
|
void |
deleteAll()
Deletes all of the containers stored in the
OFS /encrypted database |
SecuredContainer |
get(UUID containerId)
Gets the secured container from the
OFS . |
List<Access> |
getAccess(UUID userId,
UUID containerId)
Gets a list of
Access from the database for a Container with the given containerId. |
List<ContainerDbInfo> |
getAllInfo()
Gets all the
ContainerDbInfo (container metadata) that is stored in the encrypted database in the OFS . |
ContainerDbInfo |
getInfo(UUID containerId)
Gets the
ContainerDbInfo for a container from the database. |
void |
update(byte[] securedContainerBytes,
Metadata metadata,
String ofsLocation,
org.threeten.bp.ZonedDateTime syncedAt)
Updates the encrypted content of the container in the file system and the metadata in the encrypted database.
|
void |
update(Metadata metadata,
String ofsLocation,
org.threeten.bp.ZonedDateTime syncedAt)
Updates the container metadata, OFS location and the last synced time in the data access.
|
getDataAccess
getKeyRing, getOfs, setKeyRing
public SecuredContainerMapper(KeyRing keyRing, DataAccess dataAccess, OFS ofs)
OFS
and data access.keyRing
- the key ringdataAccess
- the data access for storing/retrieving the metadata, ofs location and sync timesofs
- the OFS
for storing/retrieving the encrypted contentpublic void create(byte[] securedContainerBytes, Metadata metadata, String ofsLocation, org.threeten.bp.ZonedDateTime syncedAt) throws IOException, SQLException
securedContainerBytes
- the container's encrypted contentmetadata
- the container's metadataofsLocation
- the container's file location in the OFS
syncedAt
- the last time this was synced with the ServerProvider
IOException
- thrown if there were any issues writing the encrypted data to the file systemSQLException
- thrown if there were any issues writing the metadata to the encrypted databasepublic void create(Metadata metadata, String ofsLocation, org.threeten.bp.ZonedDateTime syncedAt) throws SQLException
metadata
- the container's metadataofsLocation
- the container's file location in the OFS
syncedAt
- the last time this was synced with the ServerProvider
SQLException
- thrown if there were any issues writing the information to the encrypted databasepublic void delete(UUID containerId) throws SQLException, IOException
containerId
- the container's ID to deleteSQLException
- thrown if there were any issues deleting the related information from the encrypted
databaseIOException
- thrown if there were any issues deleting the encrypted data from the file systempublic void deleteAll() throws SQLException, IOException
OFS
/encrypted databaseSQLException
- thrown if there were any issues deleting the data from the encrypted databaseIOException
- thrown if there were any issues deleting the encrypted data from the file systempublic SecuredContainer get(UUID containerId) throws SQLException, IOException
OFS
. This will have the encrypted data from the file system as well
as the metadata from the encrypted database.containerId
- the id of the secured containerSecuredContainer
with the encrypted data and the metadataSQLException
- thrown if there were any issues getting the data from the encrypted databaseIOException
- thrown if there were any issues getting the encrypted data from the file systempublic List<Access> getAccess(UUID userId, UUID containerId) throws SQLException
Access
from the database for a Container with the given containerId.userId
- the user'd id with the access (null for access regardless of user id)containerId
- the container's id with the access (null for all access regardless of container id)SQLException
- thrown if there were any issues getting the data from the encrypted databasepublic List<ContainerDbInfo> getAllInfo() throws SQLException
ContainerDbInfo
(container metadata) that is stored in the encrypted database in the OFS
. Will return an empty list if there are no container records in the database.ContainerDbInfo
stored in the encrypted databaseSQLException
- thrown if there were any issues getting the data from the encrypted databasepublic ContainerDbInfo getInfo(UUID containerId) throws SQLException
ContainerDbInfo
for a container from the database. This is the metadata of the secured
container (Metadata
, ofs location and last sync time).containerId
- the id of the secured containerSQLException
- thrown if there were any issues getting the data from the encrypted databasepublic void update(byte[] securedContainerBytes, Metadata metadata, String ofsLocation, org.threeten.bp.ZonedDateTime syncedAt) throws IOException, SQLException
securedContainerBytes
- the container's encrypted datametadata
- the container's metadataofsLocation
- the container's file location in the OFS
syncedAt
- the last time this was synced with the ServerProvider
SQLException
- thrown if there were any issues updating the data in the encrypted databaseIOException
- thrown if there were any issues updating the encrypted data in the file systempublic void update(Metadata metadata, String ofsLocation, org.threeten.bp.ZonedDateTime syncedAt) throws SQLException
metadata
- the container's metadataofsLocation
- the container's file location in the OFS
syncedAt
- the last time this was synced with the ServerProvider
SQLException
- thrown if there were any issues updating the data in the encrypted databaseCopyright © 2021. All rights reserved.