java.lang.Object | ||
↳ | org.springframework.jca.cci.connection.DelegatingConnectionFactory | |
↳ | org.springframework.jca.cci.connection.SingleConnectionFactory |
A CCI ConnectionFactory adapter that returns the same Connection on all
getConnection
calls, and ignores calls to
Connection.close()
.
Useful for testing and standalone environments, to keep using the same Connection for multiple CciTemplate calls, without having a pooling ConnectionFactory, also spanning any number of transactions.
You can either pass in a CCI Connection directly, or let this factory lazily create a Connection via a given target ConnectionFactory.
getConnection()
CciTemplate
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
logger |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new SingleConnectionFactory for bean-style usage.
| |||||||||||
Create a new SingleConnectionFactory that always returns the
given Connection.
| |||||||||||
Create a new SingleConnectionFactory that always returns a single
Connection which it will lazily create via the given target
ConnectionFactory.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Make sure a Connection or ConnectionFactory has been set.
| |||||||||||
Close the underlying Connection.
| |||||||||||
Initialize the single underlying Connection.
| |||||||||||
Reset the underlying shared Connection, to be reinitialized on next access.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Close the given Connection.
| |||||||||||
Create a CCI Connection via this template's ConnectionFactory.
| |||||||||||
Wrap the given Connection with a proxy that delegates every method call to it
but suppresses close calls.
| |||||||||||
Prepare the given Connection before it is exposed.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.jca.cci.connection.DelegatingConnectionFactory
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.beans.factory.DisposableBean
| |||||||||||
From interface
org.springframework.beans.factory.InitializingBean
|
Create a new SingleConnectionFactory for bean-style usage.
Create a new SingleConnectionFactory that always returns the given Connection.
target | the single Connection |
---|
Create a new SingleConnectionFactory that always returns a single Connection which it will lazily create via the given target ConnectionFactory.
targetConnectionFactory | the target ConnectionFactory |
---|
Make sure a Connection or ConnectionFactory has been set.
Close the underlying Connection. The provider of this ConnectionFactory needs to care for proper shutdown.
As this bean implements DisposableBean, a bean factory will automatically invoke this on destruction of its cached singletons.
ResourceException |
---|
ResourceException |
---|
Initialize the single underlying Connection.
Closes and reinitializes the Connection if an underlying Connection is present already.
if thrown by CCI API methods | |
ResourceException |
Reset the underlying shared Connection, to be reinitialized on next access.
Close the given Connection.
con | the Connection to close |
---|
Create a CCI Connection via this template's ConnectionFactory.
if thrown by CCI API methods | |
ResourceException |
Wrap the given Connection with a proxy that delegates every method call to it but suppresses close calls. This is useful for allowing application code to handle a special framework Connection just like an ordinary Connection from a CCI ConnectionFactory.
target | the original Connection to wrap |
---|
Prepare the given Connection before it is exposed.
The default implementation is empty. Can be overridden in subclasses.
con | the Connection to prepare |
---|
ResourceException |
---|