public class DelegatingConnectionFactory extends java.lang.Object implements InitializingBean
ConnectionFactory
implementation that delegates all calls
to a given target ConnectionFactory
.
This class is meant to be subclassed, with subclasses overriding only
those methods (such as getConnection()
) that should not simply
delegate to the target ConnectionFactory
.
getConnection()
Modifier and Type | Field and Description |
---|---|
private ConnectionFactory |
targetConnectionFactory |
Constructor and Description |
---|
DelegatingConnectionFactory() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Invoked by the containing
BeanFactory after it has set all bean properties
and satisfied BeanFactoryAware , ApplicationContextAware etc. |
Connection |
getConnection() |
Connection |
getConnection(ConnectionSpec connectionSpec) |
ResourceAdapterMetaData |
getMetaData() |
RecordFactory |
getRecordFactory() |
javax.naming.Reference |
getReference() |
ConnectionFactory |
getTargetConnectionFactory()
Return the target ConnectionFactory that this ConnectionFactory should delegate to.
|
protected ConnectionFactory |
obtainTargetConnectionFactory()
Obtain the target
ConnectionFactory for actual use (never null ). |
void |
setReference(javax.naming.Reference reference) |
void |
setTargetConnectionFactory(ConnectionFactory targetConnectionFactory)
Set the target ConnectionFactory that this ConnectionFactory should delegate to.
|
@Nullable private ConnectionFactory targetConnectionFactory
public void setTargetConnectionFactory(@Nullable ConnectionFactory targetConnectionFactory)
@Nullable public ConnectionFactory getTargetConnectionFactory()
protected ConnectionFactory obtainTargetConnectionFactory()
ConnectionFactory
for actual use (never null
).public void afterPropertiesSet()
InitializingBean
BeanFactory
after it has set all bean properties
and satisfied BeanFactoryAware
, ApplicationContextAware
etc.
This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
afterPropertiesSet
in interface InitializingBean
public Connection getConnection() throws ResourceException
ResourceException
public Connection getConnection(ConnectionSpec connectionSpec) throws ResourceException
ResourceException
public RecordFactory getRecordFactory() throws ResourceException
ResourceException
public ResourceAdapterMetaData getMetaData() throws ResourceException
ResourceException
public javax.naming.Reference getReference() throws javax.naming.NamingException
javax.naming.NamingException
public void setReference(javax.naming.Reference reference)