Class DataSourceValidator
- java.lang.Object
-
- net.shibboleth.idp.attribute.resolver.dc.rdbms.impl.DataSourceValidator
-
- All Implemented Interfaces:
Validator
public class DataSourceValidator extends Object implements Validator
Validator implementation that invokesDataSource.getConnection()to determine if the DataSource is properly configured.
-
-
Field Summary
Fields Modifier and Type Field Description private DataSourcedataSourceJDBC data source to validate.private org.slf4j.LoggerlogClass logger.private booleanthrowOnValidateErrorWhether validate should throw.
-
Constructor Summary
Constructors Constructor Description DataSourceValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DataSourcegetDataSource()Returns the data source.booleanisThrowValidateError()Returns whetherValidator.validate()should throw or log errors.voidsetDataSource(DataSource source)Sets the data source.voidsetThrowValidateError(boolean value)Sets whetherValidator.validate()should throw or log errors.voidvalidate()Probe the data connector and conditionally fails if it is not valid and ready for use.
-
-
-
Field Detail
-
log
private final org.slf4j.Logger log
Class logger.
-
dataSource
@NonnullAfterInit private DataSource dataSource
JDBC data source to validate.
-
throwOnValidateError
private boolean throwOnValidateError
Whether validate should throw.
-
-
Method Detail
-
setDataSource
public void setDataSource(@Nonnull DataSource source)Sets the data source.- Parameters:
source- the data source
-
getDataSource
public DataSource getDataSource()
Returns the data source.- Returns:
- data source
-
setThrowValidateError
public void setThrowValidateError(boolean value)
Sets whetherValidator.validate()should throw or log errors.- Specified by:
setThrowValidateErrorin interfaceValidator- Parameters:
value- whetherValidator.validate()should throw or log errors
-
isThrowValidateError
public boolean isThrowValidateError()
Returns whetherValidator.validate()should throw or log errors.- Specified by:
isThrowValidateErrorin interfaceValidator- Returns:
- whether
Validator.validate()should throw or log errors
-
validate
public void validate() throws ValidationExceptionProbe the data connector and conditionally fails if it is not valid and ready for use.- Specified by:
validatein interfaceValidator- Throws:
ValidationException- thrown if validation fails andValidator.isThrowValidateError()is true
-
-