Class JdbcRevocationSource<T extends RevocationToken>
- java.lang.Object
-
- eu.europa.esig.dss.spi.x509.revocation.RepositoryRevocationSource<T>
-
- eu.europa.esig.dss.spi.x509.revocation.JdbcRevocationSource<T>
-
- All Implemented Interfaces:
RevocationSource<T>,Serializable
- Direct Known Subclasses:
JdbcCacheCRLSource,JdbcCacheOCSPSource
public abstract class JdbcRevocationSource<T extends RevocationToken> extends RepositoryRevocationSource<T>
Abstract class to retrieve token from a JDBC datasource- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected DataSourcedataSource-
Fields inherited from class eu.europa.esig.dss.spi.x509.revocation.RepositoryRevocationSource
proxiedSource
-
-
Constructor Summary
Constructors Constructor Description JdbcRevocationSource()
-
Method Summary
Modifier and Type Method Description protected abstract TbuildRevocationTokenFromResult(ResultSet rs, CertificateToken certificateToken, CertificateToken issuerCertificateToken)BuildRevocationTokenfrom the obtainedResultSetprotected voidcloseQuietly(Connection c, Statement s, ResultSet rs)Close the statement and connection and resultset without throwing the exceptionvoiddestroyTable()Removes table from DBprotected TfindRevocation(String key, CertificateToken certificateToken, CertificateToken issuerCertificateToken)Finds a RevocationToken in the cacheprotected abstract StringgetCreateTableQuery()Returns CREATE_TABLE sql queryprotected abstract StringgetDeleteTableQuery()Returns an sql query to remove a table from DBprotected abstract StringgetFindRevocationQuery()Returns an sql query to get revocation data from DBprotected abstract StringgetRemoveRevocationTokenEntryQuery()Returns an sql query to remove a record from DBprotected abstract StringgetTableExistenceQuery()Returns an sql query to check table existencevoidinitTable()Initialize the revocation token table by creating the table if it does not exist.booleanisTableExists()protected voidremoveRevocation(T token)Removes the RevocationToken from cacheprotected voidrollback(Connection c)Rollaback transaction for the givenConnectionvoidsetDataSource(DataSource dataSource)-
Methods inherited from class eu.europa.esig.dss.spi.x509.revocation.RepositoryRevocationSource
getRevocationToken, getRevocationToken, initRevocationTokenKey, insertRevocation, setDefaultNextUpdateDelay, setMaxNextUpdateDelay, setProxySource, setRemoveExpired, updateRevocation
-
-
-
-
Field Detail
-
dataSource
protected transient DataSource dataSource
-
-
Method Detail
-
getCreateTableQuery
protected abstract String getCreateTableQuery()
Returns CREATE_TABLE sql query- Returns:
Stringsql query
-
getTableExistenceQuery
protected abstract String getTableExistenceQuery()
Returns an sql query to check table existence- Returns:
Stringsql query
-
getFindRevocationQuery
protected abstract String getFindRevocationQuery()
Returns an sql query to get revocation data from DB- Returns:
Stringsql query
-
getDeleteTableQuery
protected abstract String getDeleteTableQuery()
Returns an sql query to remove a table from DB- Returns:
Stringsql query
-
getRemoveRevocationTokenEntryQuery
protected abstract String getRemoveRevocationTokenEntryQuery()
Returns an sql query to remove a record from DB- Returns:
Stringsql query
-
buildRevocationTokenFromResult
protected abstract T buildRevocationTokenFromResult(ResultSet rs, CertificateToken certificateToken, CertificateToken issuerCertificateToken) throws RevocationException
BuildRevocationTokenfrom the obtainedResultSet- Parameters:
rs-ResultSetanswer from DBcertificateToken-CertificateTokenof certificate to get revocation data forissuerCertificateToken-CertificateTokenif issuer of the certificateToken- Returns:
RevocationToken- Throws:
RevocationException
-
setDataSource
public void setDataSource(DataSource dataSource)
- Parameters:
dataSource- the dataSource to set
-
findRevocation
protected T findRevocation(String key, CertificateToken certificateToken, CertificateToken issuerCertificateToken)
Description copied from class:RepositoryRevocationSourceFinds a RevocationToken in the cache- Specified by:
findRevocationin classRepositoryRevocationSource<T extends RevocationToken>- Parameters:
key- the keyStringcertificateToken-CertificateTokenissuerCertificateToken-CertificateToken- Returns:
RevocationTokenobject
-
removeRevocation
protected void removeRevocation(T token)
Description copied from class:RepositoryRevocationSourceRemoves the RevocationToken from cache- Specified by:
removeRevocationin classRepositoryRevocationSource<T extends RevocationToken>- Parameters:
token-RevocationToken
-
initTable
public void initTable() throws SQLExceptionInitialize the revocation token table by creating the table if it does not exist.- Throws:
SQLException- in case of SQL connection error
-
isTableExists
public boolean isTableExists()
-
destroyTable
public void destroyTable() throws SQLExceptionRemoves table from DB- Throws:
SQLException- in case of error
-
rollback
protected void rollback(Connection c)
Rollaback transaction for the givenConnection- Parameters:
c-Connection
-
closeQuietly
protected void closeQuietly(Connection c, Statement s, ResultSet rs)
Close the statement and connection and resultset without throwing the exception- Parameters:
c- the connections- the statementrs- the ResultSet
-
-