Class DestinationFactoryUtils
java.lang.Object
org.frankframework.extensions.sap.jco3.tx.DestinationFactoryUtils
Helper class for managing a JCo destinations, in particular
for obtaining transactional resources.
based on org.springframework.jms.connection.ConnectionFactoryUtils
.
- Since:
- 5.0
- Author:
- Gerrit van Brakel, Jaco de Groot
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Callback interface for resource creation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.sap.conn.jco.JCoDestination
doGetTransactionalDestination
(SapSystemImpl sapSystem, DestinationFactoryUtils.ResourceFactory resourceFactory) Obtain a JCoDestination that is synchronized with the current transaction, if any.static String
doGetTransactionalTid
(SapSystemImpl sapSystem, DestinationFactoryUtils.ResourceFactory resourceFactory) Obtain a JMS String that is synchronized with the current transaction, if any.static com.sap.conn.jco.JCoDestination
getTransactionalDestination
(SapSystemImpl sapSystem, boolean synchedLocalTransactionAllowed) static String
getTransactionalTid
(SapSystemImpl sapSystem, com.sap.conn.jco.JCoDestination existingDestination, boolean synchedLocalTransactionAllowed) Obtain a TID String that is synchronized with the current transaction, if any.static boolean
isDestinationTransactional
(com.sap.conn.jco.JCoDestination destination, SapSystemImpl sapSystem) Determine whether the given JCoDestination is transactional, that is, bound to the current thread by Spring's transaction facilities.
-
Constructor Details
-
DestinationFactoryUtils
public DestinationFactoryUtils()
-
-
Method Details
-
isDestinationTransactional
public static boolean isDestinationTransactional(com.sap.conn.jco.JCoDestination destination, SapSystemImpl sapSystem) Determine whether the given JCoDestination is transactional, that is, bound to the current thread by Spring's transaction facilities.- Parameters:
destination
- the JCoDestination to checksapSystem
- the SapSystem that the Session originated from- Returns:
- whether the Destination is transactional
-
getTransactionalTid
public static String getTransactionalTid(SapSystemImpl sapSystem, com.sap.conn.jco.JCoDestination existingDestination, boolean synchedLocalTransactionAllowed) throws com.sap.conn.jco.JCoException Obtain a TID String that is synchronized with the current transaction, if any.- Parameters:
sapSystem
- the SapSystem to obtain a TID forexistingDestination
- the existing JCoDestination to obtain a String for (may benull
)synchedLocalTransactionAllowed
- whether to allow for a local JMS transaction that is synchronized with a Spring-managed transaction (where the main transaction might be a JDBC-based one for a specific DataSource, for example), with the JMS transaction committing right after the main transaction. If not allowed, the given SapSystem needs to handle transaction enlistment underneath the covers.- Returns:
- the TID, or
null
if none found - Throws:
SapException
- in case of JCo failurecom.sap.conn.jco.JCoException
-
getTransactionalDestination
public static com.sap.conn.jco.JCoDestination getTransactionalDestination(SapSystemImpl sapSystem, boolean synchedLocalTransactionAllowed) throws com.sap.conn.jco.JCoException - Throws:
com.sap.conn.jco.JCoException
-
doGetTransactionalTid
public static String doGetTransactionalTid(SapSystemImpl sapSystem, DestinationFactoryUtils.ResourceFactory resourceFactory) throws com.sap.conn.jco.JCoException Obtain a JMS String that is synchronized with the current transaction, if any.- Parameters:
sapSystem
- the JMS SapSystem to bind for (used as TransactionSynchronizationManager key)resourceFactory
- the ResourceFactory to use for extracting or creating JMS resources- Returns:
- the transactional String, or
null
if none found - Throws:
com.sap.conn.jco.JCoException
- in case of failure
-
doGetTransactionalDestination
public static com.sap.conn.jco.JCoDestination doGetTransactionalDestination(SapSystemImpl sapSystem, DestinationFactoryUtils.ResourceFactory resourceFactory) throws com.sap.conn.jco.JCoException Obtain a JCoDestination that is synchronized with the current transaction, if any.- Parameters:
sapSystem
- the JMS SapSystem to bind for (used as TransactionSynchronizationManager key)resourceFactory
- the ResourceFactory to use for extracting or creating JMS resources- Returns:
- the transactional JCoDestination, or
null
if none found - Throws:
com.sap.conn.jco.JCoException
- in case of failure
-