// Path: connector/genericconnector-api/src/main/java/ch/maxant/generic_jca_adapter/BasicTransactionAssistanceFactory.java
// public interface BasicTransactionAssistanceFactory {
// 
//     /**
//      * Get transaction assistant from factory so that a callback can be 
//      * bound into the transaction as well as recovery which is controlled
//      * by the app server's transaction manager.
//      * @exception ResourceException Thrown if an assistant can't be obtained
//      */
//     TransactionAssistant getTransactionAssistant() throws ResourceException;   
//     
// }
// 
// Path: connector/genericconnector-api/src/main/java/ch/maxant/generic_jca_adapter/TransactionAssistant.java
// public interface TransactionAssistant extends AutoCloseable {
// 
//     /** Submit some work (a function) to be bound into the
//      * currently active transaction. */
//     <O> O executeInActiveTransaction(ExecuteCallback<O> tc) throws Exception;
// 
//     /** Call before completing the transaction in order 
//      * to free up resources used by the app server. */
//     @Override
//     void close();
// }


import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import ch.maxant.generic_jca_adapter.BasicTransactionAssistanceFactory;
import ch.maxant.generic_jca_adapter.TransactionAssistant;
import ch.maxant.jca_demo.bookingsystem.BookingSystem;
import ch.maxant.jca_demo.bookingsystem.BookingSystemWebServiceService;
import ch.maxant.jca_demo.letterwriter.LetterWebServiceService;
import ch.maxant.jca_demo.letterwriter.LetterWriter;
/*
   Copyright 2015 Ant Kutschera

   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.

based on https://raw.githubusercontent.com/spring-projects/spring-boot/master/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/java/sample/bitronix/AccountService.java
 */

package ch.maxant.generic_jca_adapter.demo;




@Service
@Transactional
public class AppService {

	@Autowired
	private AppRepository appRepository;

	@Autowired @Qualifier("xa/bookingService")
// Path: connector/genericconnector-api/src/main/java/ch/maxant/generic_jca_adapter/BasicTransactionAssistanceFactory.java
// public interface BasicTransactionAssistanceFactory {
// 
//     /**
//      * Get transaction assistant from factory so that a callback can be 
//      * bound into the transaction as well as recovery which is controlled
//      * by the app server's transaction manager.
//      * @exception ResourceException Thrown if an assistant can't be obtained
//      */
//     TransactionAssistant getTransactionAssistant() throws ResourceException;   
//     
// }
// 
// Path: connector/genericconnector-api/src/main/java/ch/maxant/generic_jca_adapter/TransactionAssistant.java
// public interface TransactionAssistant extends AutoCloseable {
// 
//     /** Submit some work (a function) to be bound into the
//      * currently active transaction. */
//     <O> O executeInActiveTransaction(ExecuteCallback<O> tc) throws Exception;
// 
//     /** Call before completing the transaction in order 
//      * to free up resources used by the app server. */
//     @Override
//     void close();
// }


// Path: demo/genericconnector-demo-springboot-common/src/main/java/ch/maxant/generic_jca_adapter/demo/AppService.java
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import ch.maxant.generic_jca_adapter.BasicTransactionAssistanceFactory;
import ch.maxant.generic_jca_adapter.TransactionAssistant;
import ch.maxant.jca_demo.bookingsystem.BookingSystem;
import ch.maxant.jca_demo.bookingsystem.BookingSystemWebServiceService;
import ch.maxant.jca_demo.letterwriter.LetterWebServiceService;
import ch.maxant.jca_demo.letterwriter.LetterWriter;

/*
   Copyright 2015 Ant Kutschera

   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.

based on https://raw.githubusercontent.com/spring-projects/spring-boot/master/spring-boot-samples/spring-boot-sample-jta-bitronix/src/main/java/sample/bitronix/AccountService.java
 */

package ch.maxant.generic_jca_adapter.demo;




@Service
@Transactional
public class AppService {

	@Autowired
	private AppRepository appRepository;

	@Autowired @Qualifier("xa/bookingService")
	BasicTransactionAssistanceFactory bookingServiceFactory;