jremote jbase5.2.1

com.jbase.jremote.jca.spring
Class JConnectionFactoryUtils

java.lang.Object
  extended by com.jbase.jremote.jca.spring.JConnectionFactoryUtils

public abstract class JConnectionFactoryUtils
extends Object

Helper class that provides static methods for obtaining JRemote Connections from a JConnectionFactory. Includes special support for Spring-managed transactional Connections, e.g. managed by JRemoteLocalTransactionManager or JtaTransactionManager.

See Also:
getConnection(com.jbase.jremote.JConnectionFactory), releaseConnection(com.jbase.jremote.JConnection, com.jbase.jremote.JConnectionFactory), JRemoteLocalTransactionManager, JtaTransactionManager, TransactionSynchronizationManager

Constructor Summary
JConnectionFactoryUtils()
           
 
Method Summary
static JConnection getConnection(JConnectionFactory cf)
          Obtain a JConnection from the given JConnectionFactory.
static boolean isConnectionTransactional(JConnection con, JConnectionFactory cf)
          Determine whether the given JRemote Connection is transactional, that is, bound to the current thread by Spring's transaction facilities.
static void releaseConnection(JConnection con, JConnectionFactory cf)
          Close the given JConnection, obtained from the given JConnectionFactory, if it is not managed externally (that is, not bound to the thread).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JConnectionFactoryUtils

public JConnectionFactoryUtils()
Method Detail

getConnection

public static JConnection getConnection(JConnectionFactory cf)
                                 throws JRemoteException
Obtain a JConnection from the given JConnectionFactory. Translates ResourceExceptions into the Spring hierarchy of unchecked generic data access exceptions, simplifying calling code and making any exception that is thrown more meaningful.

Is aware of a corresponding Connection bound to the current thread, for example when using JRemoteLocalTransactionManager. Will bind a Connection to the thread if transaction synchronization is active (e.g. if in a JTA transaction).

Parameters:
cf - the ConnectionFactory to obtain Connection from
Returns:
a JConnection from the given JConnectionFactory
Throws:
JRemoteException - if the attempt to get a Connection failed
See Also:
releaseConnection(com.jbase.jremote.JConnection, com.jbase.jremote.JConnectionFactory)

isConnectionTransactional

public static boolean isConnectionTransactional(JConnection con,
                                                JConnectionFactory cf)
Determine whether the given JRemote Connection is transactional, that is, bound to the current thread by Spring's transaction facilities.

Parameters:
con - the JConnection to check
cf - the JConnectionFactory that the JConnection was obtained from (may be null)
Returns:
whether the JConnection is transactional

releaseConnection

public static void releaseConnection(JConnection con,
                                     JConnectionFactory cf)
Close the given JConnection, obtained from the given JConnectionFactory, if it is not managed externally (that is, not bound to the thread).

Parameters:
con - the Connection to close if necessary (if this is null, the call will be ignored)
cf - the ConnectionFactory that the Connection was obtained from (can be null)
See Also:
getConnection(com.jbase.jremote.JConnectionFactory)

jremote jbase5.2.1

Copyright © 2016 TEMENOS. All Rights Reserved.