org.wildfly.extras.creaper.commands.datasources.AddMssqlDataSource Maven / Gradle / Ivy
package org.wildfly.extras.creaper.commands.datasources;
import org.wildfly.extras.creaper.core.ManagementVersion;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.DEFAULT_BACKGROUND_VALIDATION_TIME;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.MSSQL_EXCEPTION_SORTER;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.MSSQL_VALID_CONNECTION_CHECKER;
/**
* Creates an MS SQL datasource.
*
* Connection URL format: {@code jdbc:sqlserver://localhost:1433;DatabaseName=database-name}
*
* Applies defaults from
*
* Example Microsoft SQLServer Datasource.
*/
public final class AddMssqlDataSource extends AddDataSource {
AddMssqlDataSource(Builder builder) {
super(builder);
}
@Override
protected void modifyIfNeeded(ManagementVersion serverVersion) {
if (backgroundValidation == null) backgroundValidation = true;
if (backgroundValidationMillis == null) backgroundValidationMillis = DEFAULT_BACKGROUND_VALIDATION_TIME;
if (validConnectionCheckerClass == null) validConnectionCheckerClass = MSSQL_VALID_CONNECTION_CHECKER;
if (exceptionSorterClass == null && serverVersion.greaterThanOrEqualTo(ManagementVersion.VERSION_1_7_0))
// implementation of MS SQL exception sorter was not available in previous versions
exceptionSorterClass = MSSQL_EXCEPTION_SORTER;
}
public static final class Builder extends AddDataSource.Builder {
public Builder(String name) {
super(name);
}
public AddMssqlDataSource build() {
check();
return new AddMssqlDataSource(this);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy