|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jca.cci.connection.DelegatingConnectionFactory org.springframework.jca.cci.connection.SingleConnectionFactory
public class 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 environemtns, 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()
,
Connection.close()
,
CciTemplate
,
Serialized FormField Summary | |
---|---|
protected org.apache.commons.logging.Log |
logger
|
Constructor Summary | |
---|---|
SingleConnectionFactory()
Create a new SingleConnectionFactory for bean-style usage. |
|
SingleConnectionFactory(Connection target)
Create a new SingleConnectionFactory that always returns the given Connection. |
|
SingleConnectionFactory(ConnectionFactory targetConnectionFactory)
Create a new SingleConnectionFactory that always returns a single Connection that it will lazily create via the given target ConnectionFactory. |
Method Summary | |
---|---|
void |
afterPropertiesSet()
Make sure a connection or connection factory has been set. |
void |
destroy()
Close the underlying connection. |
protected Connection |
doCreateConnection()
Create a CCI Connection via this template's ConnectionFactory. |
protected Connection |
getCloseSuppressingConnectionProxy(Connection target)
Wrap the given Connection with a proxy that delegates every method call to it but suppresses close calls. |
Connection |
getConnection()
|
Connection |
getConnection(ConnectionSpec connectionSpec)
|
ResourceAdapterMetaData |
getMetaData()
|
RecordFactory |
getRecordFactory()
|
Reference |
getReference()
|
protected void |
init()
Initialize the single Connection. |
void |
setReference(Reference reference)
|
Methods inherited from class org.springframework.jca.cci.connection.DelegatingConnectionFactory |
---|
getTargetConnectionFactory, setTargetConnectionFactory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.apache.commons.logging.Log logger
Constructor Detail |
---|
public SingleConnectionFactory()
DelegatingConnectionFactory.setTargetConnectionFactory(javax.resource.cci.ConnectionFactory)
public SingleConnectionFactory(Connection target)
target
- the single Connectionpublic SingleConnectionFactory(ConnectionFactory targetConnectionFactory)
targetConnectionFactory
- the target ConnectionFactoryMethod Detail |
---|
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class DelegatingConnectionFactory
protected void init() throws ResourceException
ResourceException
- if thrown by CCI API methodsprotected Connection doCreateConnection() throws ResourceException
ResourceException
- if thrown by CCI API methodspublic void destroy() throws ResourceException
As this bean implements DisposableBean, a bean factory will automatically invoke this on destruction of its cached singletons.
destroy
in interface DisposableBean
ResourceException
public Connection getConnection() throws ResourceException
getConnection
in interface ConnectionFactory
getConnection
in class DelegatingConnectionFactory
ResourceException
public Connection getConnection(ConnectionSpec connectionSpec) throws ResourceException
getConnection
in interface ConnectionFactory
getConnection
in class DelegatingConnectionFactory
ResourceException
public RecordFactory getRecordFactory() throws ResourceException
getRecordFactory
in interface ConnectionFactory
getRecordFactory
in class DelegatingConnectionFactory
ResourceException
public ResourceAdapterMetaData getMetaData() throws ResourceException
getMetaData
in interface ConnectionFactory
getMetaData
in class DelegatingConnectionFactory
ResourceException
public void setReference(Reference reference)
setReference
in class DelegatingConnectionFactory
public Reference getReference() throws NamingException
getReference
in interface Referenceable
getReference
in class DelegatingConnectionFactory
NamingException
protected Connection getCloseSuppressingConnectionProxy(Connection target)
target
- the original Connection to wrap
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |