All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wildfly.extras.creaper.commands.datasources.AddMssqlXADataSource Maven / Gradle / Ivy

There is a newer version: 2.0.3
Show newest version
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.MSSQL_EXCEPTION_SORTER;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.MSSQL_VALID_CONNECTION_CHECKER;
import static org.wildfly.extras.creaper.commands.datasources.DatasourceConstants.MSSQL_XA_DATASOURCE_CLASS;

/**
 * Creates an MS SQL XA datasource.
 *
 * 

Standard XA datasource properties to use are:

*
    *
  • {@code ServerName}
  • *
  • {@code PortNumber} (if not set, a default of {@code 1433} will be used)
  • *
  • {@code DatabaseName}
  • *
  • {@code SelectMethod} (if not set, a default of {@code cursor} will be used)
  • *
* *

Applies defaults from * * Example Microsoft SQLServer XA Datasource.

*/ public final class AddMssqlXADataSource extends AddXADataSource { AddMssqlXADataSource(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.greaterThan(ManagementVersion.VERSION_1_7_0)) // implementation of MS SQL exception sorter was not available in previous versions exceptionSorterClass = MSSQL_EXCEPTION_SORTER; if (sameRmOverride == null) sameRmOverride = true; if (xaDatasourceClass == null) xaDatasourceClass = MSSQL_XA_DATASOURCE_CLASS; if (xaDatasourceProperties == null) xaDatasourceProperties = new HashMap(); if (!xaDatasourceProperties.containsKey("PortNumber")) xaDatasourceProperties.put("PortNumber", "1433"); if (!xaDatasourceProperties.containsKey("SelectMethod")) xaDatasourceProperties.put("SelectMethod", "cursor"); } public static final class Builder extends AddXADataSource.Builder { public Builder(String name) { super(name); } public AddMssqlXADataSource build() { check(); return new AddMssqlXADataSource(this); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy