Class ChecksumsManager
java.lang.Object
edu.ucsb.nceas.metacat.systemmetadata.ChecksumsManager
The class to save, get and query checksums from db for a pid
- Author:
- Tao
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
delete
(org.dataone.service.types.v1.Identifier pid, DBConnection conn) Delete the checksums from the table for the given pidList<org.dataone.service.types.v1.Checksum>
get
(org.dataone.service.types.v1.Identifier pid) Find all checksums for the given pid.List<org.dataone.service.types.v1.Identifier>
query
(org.dataone.service.types.v1.Checksum checksum) Find the list of pid which has the checksum matching the given value.void
save
(org.dataone.service.types.v1.Identifier id, Map<String, String> checksums, DBConnection dbConn) Save the checksums into database.
-
Constructor Details
-
ChecksumsManager
public ChecksumsManager()
-
-
Method Details
-
save
public void save(org.dataone.service.types.v1.Identifier id, Map<String, String> checksums, DBConnection dbConn) throws SQLException, org.dataone.service.exceptions.ServiceFailureSave the checksums into database. The callers need to provide the database connection- Parameters:
id
- the identifier which has the checksumschecksums
- the checksums map whose key is algorithm and value is the checksum valuedbConn
- the connection used to connect database- Throws:
SQLException
org.dataone.service.exceptions.ServiceFailure
-
get
public List<org.dataone.service.types.v1.Checksum> get(org.dataone.service.types.v1.Identifier pid) throws org.dataone.service.exceptions.InvalidRequest, SQLException Find all checksums for the given pid. An empty list will be returned if nothing was found.- Parameters:
pid
- the identifier to identify the checksum- Returns:
- a list of checksums for the pid. An empty list will be returned if nothing was found.
- Throws:
org.dataone.service.exceptions.InvalidRequest
SQLException
-
query
public List<org.dataone.service.types.v1.Identifier> query(org.dataone.service.types.v1.Checksum checksum) throws org.dataone.service.exceptions.InvalidRequest, SQLException Find the list of pid which has the checksum matching the given value. An empty list will be returned if no matching.- Parameters:
checksum
- the checksum should be matched- Returns:
- the list of pid matching the given checksum. An empty list will be returned if no matching
- Throws:
org.dataone.service.exceptions.InvalidRequest
SQLException
-
delete
public void delete(org.dataone.service.types.v1.Identifier pid, DBConnection conn) throws SQLException Delete the checksums from the table for the given pid- Parameters:
pid
- the pid which will be deletedconn
- the connection which will be used to delete- Throws:
SQLException
-