Remove Narayana support

The Spring Boot integration is now handled by the Narayana project
itself at https://github.com/snowdrop/narayana-spring-boot

This commit removes our support.

Closes gh-12026
This commit is contained in:
Stephane Nicoll
2018-08-17 15:08:55 +02:00
parent 598f630b8c
commit 930c838da9
39 changed files with 1 additions and 2509 deletions

View File

@@ -668,21 +668,6 @@
<artifactId>jooq</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jboss.narayana.jta</groupId>
<artifactId>jms</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jboss.narayana.jta</groupId>
<artifactId>jta</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jboss.narayana.jts</groupId>
<artifactId>narayana-jts-integration</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>

View File

@@ -42,7 +42,7 @@ import org.springframework.context.annotation.Import;
ActiveMQAutoConfiguration.class, ArtemisAutoConfiguration.class,
HibernateJpaAutoConfiguration.class })
@Import({ JndiJtaConfiguration.class, BitronixJtaConfiguration.class,
AtomikosJtaConfiguration.class, NarayanaJtaConfiguration.class })
AtomikosJtaConfiguration.class })
@EnableConfigurationProperties(JtaProperties.class)
public class JtaAutoConfiguration {

View File

@@ -1,172 +0,0 @@
/*
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.transaction.jta;
import java.io.File;
import javax.jms.Message;
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
import com.arjuna.ats.arjuna.recovery.RecoveryManager;
import com.arjuna.ats.jbossatx.jta.RecoveryManagerService;
import org.jboss.narayana.jta.jms.TransactionHelper;
import org.jboss.tm.XAResourceRecoveryRegistry;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.jdbc.XADataSourceWrapper;
import org.springframework.boot.jms.XAConnectionFactoryWrapper;
import org.springframework.boot.jta.narayana.NarayanaBeanFactoryPostProcessor;
import org.springframework.boot.jta.narayana.NarayanaConfigurationBean;
import org.springframework.boot.jta.narayana.NarayanaProperties;
import org.springframework.boot.jta.narayana.NarayanaRecoveryManagerBean;
import org.springframework.boot.jta.narayana.NarayanaXAConnectionFactoryWrapper;
import org.springframework.boot.jta.narayana.NarayanaXADataSourceWrapper;
import org.springframework.boot.system.ApplicationHome;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.jta.JtaTransactionManager;
import org.springframework.util.StringUtils;
/**
* JTA Configuration for <a href="http://narayana.io/">Narayana</a>.
*
* @author Gytis Trikleris
* @author Kazuki Shimizu
* @since 1.4.0
*/
@Configuration
@ConditionalOnClass({ JtaTransactionManager.class,
com.arjuna.ats.jta.UserTransaction.class, XAResourceRecoveryRegistry.class })
@ConditionalOnMissingBean(PlatformTransactionManager.class)
@EnableConfigurationProperties(JtaProperties.class)
public class NarayanaJtaConfiguration {
private final JtaProperties jtaProperties;
private final TransactionManagerCustomizers transactionManagerCustomizers;
public NarayanaJtaConfiguration(JtaProperties jtaProperties,
ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
this.jtaProperties = jtaProperties;
this.transactionManagerCustomizers = transactionManagerCustomizers
.getIfAvailable();
}
@Bean
@ConditionalOnMissingBean
public NarayanaProperties narayanaProperties() {
return new NarayanaProperties();
}
@Bean
@ConditionalOnMissingBean
public NarayanaConfigurationBean narayanaConfiguration(
NarayanaProperties properties) {
properties.setLogDir(getLogDir().getAbsolutePath());
if (this.jtaProperties.getTransactionManagerId() != null) {
properties.setTransactionManagerId(
this.jtaProperties.getTransactionManagerId());
}
return new NarayanaConfigurationBean(properties);
}
private File getLogDir() {
if (StringUtils.hasLength(this.jtaProperties.getLogDir())) {
return new File(this.jtaProperties.getLogDir());
}
File home = new ApplicationHome().getDir();
return new File(home, "transaction-logs");
}
@Bean
@DependsOn("narayanaConfiguration")
@ConditionalOnMissingBean
public UserTransaction narayanaUserTransaction() {
return com.arjuna.ats.jta.UserTransaction.userTransaction();
}
@Bean
@DependsOn("narayanaConfiguration")
@ConditionalOnMissingBean
public TransactionManager narayanaTransactionManager() {
return com.arjuna.ats.jta.TransactionManager.transactionManager();
}
@Bean
@DependsOn("narayanaConfiguration")
public RecoveryManagerService narayanaRecoveryManagerService() {
RecoveryManager.delayRecoveryManagerThread();
return new RecoveryManagerService();
}
@Bean
@ConditionalOnMissingBean
public NarayanaRecoveryManagerBean narayanaRecoveryManager(
RecoveryManagerService recoveryManagerService) {
return new NarayanaRecoveryManagerBean(recoveryManagerService);
}
@Bean
public JtaTransactionManager transactionManager(UserTransaction userTransaction,
TransactionManager transactionManager) {
JtaTransactionManager jtaTransactionManager = new JtaTransactionManager(
userTransaction, transactionManager);
if (this.transactionManagerCustomizers != null) {
this.transactionManagerCustomizers.customize(jtaTransactionManager);
}
return jtaTransactionManager;
}
@Bean
@ConditionalOnMissingBean
public XADataSourceWrapper xaDataSourceWrapper(
NarayanaRecoveryManagerBean narayanaRecoveryManagerBean,
NarayanaProperties narayanaProperties) {
return new NarayanaXADataSourceWrapper(narayanaRecoveryManagerBean,
narayanaProperties);
}
@Bean
@ConditionalOnMissingBean
public static NarayanaBeanFactoryPostProcessor narayanaBeanFactoryPostProcessor() {
return new NarayanaBeanFactoryPostProcessor();
}
@Configuration
@ConditionalOnClass({ Message.class, TransactionHelper.class })
static class NarayanaJtaJmsConfiguration {
@Bean
@ConditionalOnMissingBean(XAConnectionFactoryWrapper.class)
public NarayanaXAConnectionFactoryWrapper xaConnectionFactoryWrapper(
TransactionManager transactionManager,
NarayanaRecoveryManagerBean narayanaRecoveryManagerBean,
NarayanaProperties narayanaProperties) {
return new NarayanaXAConnectionFactoryWrapper(transactionManager,
narayanaRecoveryManagerBean, narayanaProperties);
}
}
}

View File

@@ -31,7 +31,6 @@ import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
import javax.transaction.xa.XAResource;
import com.arjuna.ats.jbossatx.jta.RecoveryManagerService;
import com.atomikos.icatch.config.UserTransactionService;
import com.atomikos.icatch.jta.UserTransactionManager;
import com.atomikos.jms.AtomikosConnectionFactoryBean;
@@ -52,9 +51,6 @@ import org.springframework.boot.jta.atomikos.AtomikosProperties;
import org.springframework.boot.jta.bitronix.BitronixDependentBeanFactoryPostProcessor;
import org.springframework.boot.jta.bitronix.PoolingConnectionFactoryBean;
import org.springframework.boot.jta.bitronix.PoolingDataSourceBean;
import org.springframework.boot.jta.narayana.NarayanaBeanFactoryPostProcessor;
import org.springframework.boot.jta.narayana.NarayanaConfigurationBean;
import org.springframework.boot.jta.narayana.NarayanaRecoveryManagerBean;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -140,20 +136,6 @@ public class JtaAutoConfigurationTests {
this.context.getBean(JtaTransactionManager.class);
}
@Test
public void narayanaSanityCheck() {
this.context = new AnnotationConfigApplicationContext(JtaProperties.class,
NarayanaJtaConfiguration.class);
this.context.getBean(NarayanaConfigurationBean.class);
this.context.getBean(UserTransaction.class);
this.context.getBean(TransactionManager.class);
this.context.getBean(XADataSourceWrapper.class);
this.context.getBean(XAConnectionFactoryWrapper.class);
this.context.getBean(NarayanaBeanFactoryPostProcessor.class);
this.context.getBean(JtaTransactionManager.class);
this.context.getBean(RecoveryManagerService.class);
}
@Test
public void defaultBitronixServerId() throws UnknownHostException {
this.context = new AnnotationConfigApplicationContext(
@@ -285,16 +267,6 @@ public class JtaAutoConfigurationTests {
assertThat(transactionManager.isRollbackOnCommitFailure()).isTrue();
}
@Test
public void narayanaRecoveryManagerBeanCanBeCustomized() {
this.context = new AnnotationConfigApplicationContext();
this.context.register(CustomNarayanaRecoveryManagerConfiguration.class,
JtaProperties.class, NarayanaJtaConfiguration.class);
this.context.refresh();
assertThat(this.context.getBean(NarayanaRecoveryManagerBean.class))
.isInstanceOf(CustomNarayanaRecoveryManagerBean.class);
}
@Configuration
@EnableConfigurationProperties(JtaProperties.class)
public static class JtaPropertiesConfiguration {
@@ -337,25 +309,4 @@ public class JtaAutoConfigurationTests {
}
@Configuration
public static class CustomNarayanaRecoveryManagerConfiguration {
@Bean
public NarayanaRecoveryManagerBean customRecoveryManagerBean(
RecoveryManagerService recoveryManagerService) {
return new CustomNarayanaRecoveryManagerBean(recoveryManagerService);
}
}
static final class CustomNarayanaRecoveryManagerBean
extends NarayanaRecoveryManagerBean {
private CustomNarayanaRecoveryManagerBean(
RecoveryManagerService recoveryManagerService) {
super(recoveryManagerService);
}
}
}