org.wildfly.extras.creaper.commands.datasources.AddDb2XADataSource 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.DB2_EXCEPTION_SORTER;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.DB2_RECOVERY_PLUGIN;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.DB2_STALE_CONNECTION_CHECKER;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.DB2_VALID_CONNECTION_CHECKER;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.DB2_XA_DATASOURCE_CLASS;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.DEFAULT_BACKGROUND_VALIDATION_TIME;
/**
* Creates a DB2 XA datasource.
*
* Standard XA datasource properties to use are:
*
* - {@code ServerName}
* - {@code PortNumber} (if not set, a default of {@code 50000} will be used)
* - {@code DatabaseName}
*
*
* Applies defaults from
*
* Example IBM DB2 XA Datasource.
*/
public final class AddDb2XADataSource extends AddXADataSource {
AddDb2XADataSource(Builder builder) {
super(builder);
}
@Override
protected void modifyIfNeeded(ManagementVersion serverVersion) {
backgroundValidation = true;
backgroundValidationMillis = DEFAULT_BACKGROUND_VALIDATION_TIME;
validConnectionCheckerClass = DB2_VALID_CONNECTION_CHECKER;
exceptionSorterClass = DB2_EXCEPTION_SORTER;
staleConnectionCheckerClass = DB2_STALE_CONNECTION_CHECKER;
sameRmOverride = false;
xaDatasourceClass = DB2_XA_DATASOURCE_CLASS;
recoveryPluginClass = DB2_RECOVERY_PLUGIN;
if (recoveryPluginProperties == null) recoveryPluginProperties = new HashMap();
if (!recoveryPluginProperties.containsKey("EnableIsValid")) recoveryPluginProperties.put("EnableIsValid", "false");
if (!recoveryPluginProperties.containsKey("IsValidOverride")) recoveryPluginProperties.put("IsValidOverride", "false");
if (!recoveryPluginProperties.containsKey("EnableClose")) recoveryPluginProperties.put("EnableClose", "false");
if (xaDatasourceProperties == null) xaDatasourceProperties = new HashMap();
if (!xaDatasourceProperties.containsKey("PortNumber")) xaDatasourceProperties.put("PortNumber", "50000");
}
public static final class Builder extends AddXADataSource.Builder {
public Builder(String name) {
super(name);
}
public AddDb2XADataSource build() {
check();
return new AddDb2XADataSource(this);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy