org.wildfly.extras.creaper.commands.datasources.AddSybaseXADataSource Maven / Gradle / Ivy
package org.wildfly.extras.creaper.commands.datasources;
import org.wildfly.extras.creaper.core.ManagementVersion;
import java.util.HashMap;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.DEFAULT_BACKGROUND_VALIDATION_TIME;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.SYBASE_EXCEPTION_SORTER;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.SYBASE_STALE_CONNECTION_CHECKER;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.SYBASE_VALID_CONNECTION_CHECKER;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.SYBASE_XA_DATASOURCE_CLASS;
/**
* Creates a Sybase XA datasource.
*
* Standard XA datasource properties to use are:
*
* - {@code ServerName}
* - {@code PortNumber} (if not set, a default of {@code 4100} will be used)
* - {@code DatabaseName}
* - {@code NetworkProtocol} (if not set, a default of {@code Tds} will be used)
*
*
* Applies defaults from
*
* Example Sybase XA Datasource.
*/
public final class AddSybaseXADataSource extends AddXADataSource {
AddSybaseXADataSource(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 = SYBASE_VALID_CONNECTION_CHECKER;
if (exceptionSorterClass == null) exceptionSorterClass = SYBASE_EXCEPTION_SORTER;
if (staleConnectionCheckerClass == null) staleConnectionCheckerClass = SYBASE_STALE_CONNECTION_CHECKER;
if (xaDatasourceClass == null) xaDatasourceClass = SYBASE_XA_DATASOURCE_CLASS;
if (sameRmOverride == null) sameRmOverride = false;
if (xaDatasourceProperties == null) xaDatasourceProperties = new HashMap();
if (!xaDatasourceProperties.containsKey("NetworkProtocol")) xaDatasourceProperties.put("NetworkProtocol", "Tds");
if (!xaDatasourceProperties.containsKey("PortNumber")) xaDatasourceProperties.put("PortNumber", "4100");
}
public static final class Builder extends AddXADataSource.Builder {
public Builder(String name) {
super(name);
}
public AddSybaseXADataSource build() {
check();
return new AddSybaseXADataSource(this);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy