Update default datasource definition to XA
This commit is contained in:
parent
fc6d6ff7f7
commit
550ec2ff51
5 changed files with 120 additions and 60 deletions
|
@ -15,11 +15,11 @@
|
|||
<!-- replace JDBC URL -->
|
||||
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
|
||||
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
|
||||
/*[local-name()='datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name=$pool.name]
|
||||
/*[local-name()='connection-url' and starts-with(namespace-uri(), $nsDS)]">
|
||||
<connection-url>
|
||||
/*[local-name()='xa-datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name=$pool.name]
|
||||
/*[local-name()='xa-datasource-property' and starts-with(namespace-uri(), $nsDS) and @name='URL']">
|
||||
<xa-datasource-property name="URL">
|
||||
<xsl:value-of select="$jdbc.url"/>
|
||||
</connection-url>
|
||||
</xa-datasource-property>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Copy everything else. -->
|
||||
|
|
|
@ -29,24 +29,42 @@
|
|||
<!-- Remove keycloak datasource definition. -->
|
||||
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
|
||||
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
|
||||
/*[local-name()='datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name='KeycloakDS']">
|
||||
/*[local-name()='xa-datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name='KeycloakDS']">
|
||||
</xsl:template>
|
||||
|
||||
<xsl:param name="jdbc.url" select="'jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE'"/>
|
||||
<xsl:param name="driver" select="'h2'"/>
|
||||
<xsl:param name="db.jdbc_url"/>
|
||||
<xsl:param name="db.hostname"/>
|
||||
<xsl:param name="db.name"/>
|
||||
<xsl:param name="db.port"/>
|
||||
<xsl:param name="driver"/>
|
||||
<xsl:param name="datasource.class.xa"/>
|
||||
|
||||
<xsl:param name="username" select="'sa'"/>
|
||||
<xsl:param name="password" select="'sa'"/>
|
||||
|
||||
<xsl:param name="min.poolsize" select="'10'"/>
|
||||
<xsl:param name="max.poolsize" select="'50'"/>
|
||||
<xsl:param name="pool.prefill" select="'true'"/>
|
||||
<xsl:param name="username"/>
|
||||
<xsl:param name="password"/>
|
||||
|
||||
<xsl:variable name="newDatasourceDefinition">
|
||||
<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" use-java-context="true">
|
||||
<connection-url>
|
||||
<xsl:value-of select="$jdbc.url"/>
|
||||
</connection-url>
|
||||
<xa-datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" use-java-context="true">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($driver, 'oracle')">
|
||||
<xa-datasource-property name="URL">
|
||||
<xsl:value-of select="$db.jdbc_url"/>
|
||||
</xa-datasource-property>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xa-datasource-property name="ServerName">
|
||||
<xsl:value-of select="$db.hostname"/>
|
||||
</xa-datasource-property>
|
||||
<xa-datasource-property name="PortNumber">
|
||||
<xsl:value-of select="$db.port"/>
|
||||
</xa-datasource-property>
|
||||
<xa-datasource-property name="DatabaseName">
|
||||
<xsl:value-of select="$db.name"/>
|
||||
</xa-datasource-property>
|
||||
<xsl:if test="contains($driver, 'db2')">
|
||||
<xa-datasource-property name="DriverType">4</xa-datasource-property>
|
||||
</xsl:if>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<driver>
|
||||
<xsl:value-of select="$driver"/>
|
||||
</driver>
|
||||
|
@ -58,23 +76,16 @@
|
|||
<xsl:value-of select="$password"/>
|
||||
</password>
|
||||
</security>
|
||||
<pool>
|
||||
<min-pool-size>
|
||||
<xsl:value-of select="$min.poolsize"/>
|
||||
</min-pool-size>
|
||||
<max-pool-size>
|
||||
<xsl:value-of select="$max.poolsize"/>
|
||||
</max-pool-size>
|
||||
<prefill>
|
||||
<xsl:value-of select="$pool.prefill"/>
|
||||
</prefill>
|
||||
</pool>
|
||||
</datasource>
|
||||
</xa-datasource>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="newDriverDefinition">
|
||||
<xsl:if test="$driver != 'h2'">
|
||||
<driver name="{$driver}" module="com.{$driver}" />
|
||||
<driver name="{$driver}" module="com.{$driver}">
|
||||
<xa-datasource-class>
|
||||
<xsl:value-of select="$datasource.class.xa"/>
|
||||
</xa-datasource-class>
|
||||
</driver>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
|
|
|
@ -429,7 +429,7 @@
|
|||
<property>jdbc.mvn.version</property>
|
||||
</requireProperty>
|
||||
<requireProperty>
|
||||
<property>keycloak.connectionsJpa.url</property>
|
||||
<property>datasource.class.xa</property>
|
||||
</requireProperty>
|
||||
<requireProperty>
|
||||
<property>keycloak.connectionsJpa.user</property>
|
||||
|
@ -508,9 +508,25 @@
|
|||
<outputDir>${auth.server.home}/standalone/configuration</outputDir>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<name>jdbc.url</name>
|
||||
<name>db.jdbc_url</name>
|
||||
<value>${keycloak.connectionsJpa.url}</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>db.hostname</name>
|
||||
<value>${db.hostname}</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>db.port</name>
|
||||
<value>${db.port}</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>db.name</name>
|
||||
<value>${db.name}</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>datasource.class.xa</name>
|
||||
<value>${datasource.class.xa}</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>driver</name>
|
||||
<value>${jdbc.mvn.artifactId}</value>
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<property>jdbc.mvn.version</property>
|
||||
</requireProperty>
|
||||
<requireProperty>
|
||||
<property>keycloak.connectionsJpa.url</property>
|
||||
<property>datasource.class.xa</property>
|
||||
</requireProperty>
|
||||
<requireProperty>
|
||||
<property>keycloak.connectionsJpa.user</property>
|
||||
|
@ -164,9 +164,25 @@
|
|||
<outputDir>${keycloak.server.home}/standalone/configuration</outputDir>
|
||||
<parameters>
|
||||
<parameter>
|
||||
<name>jdbc.url</name>
|
||||
<name>db.jdbc_url</name>
|
||||
<value>${keycloak.connectionsJpa.url}</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>db.hostname</name>
|
||||
<value>${db.hostname}</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>db.port</name>
|
||||
<value>${db.port}</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>db.name</name>
|
||||
<value>${db.name}</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>datasource.class.xa</name>
|
||||
<value>${datasource.class.xa}</value>
|
||||
</parameter>
|
||||
<parameter>
|
||||
<name>driver</name>
|
||||
<value>${jdbc.mvn.artifactId}</value>
|
||||
|
|
|
@ -25,27 +25,51 @@
|
|||
|
||||
<xsl:variable name="nsDS" select="'urn:jboss:domain:datasources:'"/>
|
||||
|
||||
<!-- Remove keycloak datasource definition. -->
|
||||
<!-- Remove keycloak datasource definition. For versions from 2.3.0-->
|
||||
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
|
||||
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
|
||||
/*[local-name()='xa-datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name='KeycloakDS']">
|
||||
</xsl:template>
|
||||
|
||||
<!-- Remove keycloak xa-datasource definition. For versions below 2.3.0-->
|
||||
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
|
||||
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
|
||||
/*[local-name()='datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name='KeycloakDS']">
|
||||
</xsl:template>
|
||||
|
||||
<xsl:param name="jdbc.url" select="'jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE'"/>
|
||||
<xsl:param name="driver" select="'h2'"/>
|
||||
<xsl:param name="db.jdbc_url"/>
|
||||
<xsl:param name="db.hostname"/>
|
||||
<xsl:param name="db.name"/>
|
||||
<xsl:param name="db.port"/>
|
||||
<xsl:param name="driver"/>
|
||||
<xsl:param name="datasource.class.xa"/>
|
||||
|
||||
<xsl:param name="username" select="'sa'"/>
|
||||
<xsl:param name="password" select="'sa'"/>
|
||||
|
||||
<xsl:param name="min.poolsize" select="'10'"/>
|
||||
<xsl:param name="max.poolsize" select="'50'"/>
|
||||
<xsl:param name="pool.prefill" select="'true'"/>
|
||||
<xsl:param name="username"/>
|
||||
<xsl:param name="password"/>
|
||||
|
||||
<xsl:variable name="newDatasourceDefinition">
|
||||
<datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
|
||||
<connection-url>
|
||||
<xsl:value-of select="$jdbc.url"/>
|
||||
</connection-url>
|
||||
<xa-datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($driver, 'oracle')">
|
||||
<xa-datasource-property name="URL">
|
||||
<xsl:value-of select="$db.jdbc_url"/>
|
||||
</xa-datasource-property>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xa-datasource-property name="ServerName">
|
||||
<xsl:value-of select="$db.hostname"/>
|
||||
</xa-datasource-property>
|
||||
<xa-datasource-property name="PortNumber">
|
||||
<xsl:value-of select="$db.port"/>
|
||||
</xa-datasource-property>
|
||||
<xa-datasource-property name="DatabaseName">
|
||||
<xsl:value-of select="$db.name"/>
|
||||
</xa-datasource-property>
|
||||
<xsl:if test="contains($driver, 'db2')">
|
||||
<xa-datasource-property name="DriverType">4</xa-datasource-property>
|
||||
</xsl:if>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<driver>
|
||||
<xsl:value-of select="$driver"/>
|
||||
</driver>
|
||||
|
@ -57,23 +81,16 @@
|
|||
<xsl:value-of select="$password"/>
|
||||
</password>
|
||||
</security>
|
||||
<pool>
|
||||
<min-pool-size>
|
||||
<xsl:value-of select="$min.poolsize"/>
|
||||
</min-pool-size>
|
||||
<max-pool-size>
|
||||
<xsl:value-of select="$max.poolsize"/>
|
||||
</max-pool-size>
|
||||
<prefill>
|
||||
<xsl:value-of select="$pool.prefill"/>
|
||||
</prefill>
|
||||
</pool>
|
||||
</datasource>
|
||||
</xa-datasource>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="newDriverDefinition">
|
||||
<xsl:if test="$driver != 'h2'">
|
||||
<driver name="{$driver}" module="com.{$driver}" />
|
||||
<driver name="{$driver}" module="com.{$driver}">
|
||||
<xa-datasource-class>
|
||||
<xsl:value-of select="$xa.datasource.class"/>
|
||||
</xa-datasource-class>
|
||||
</driver>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
|
|
Loading…
Reference in a new issue