@Deprecated public class CciTemplate extends Object implements CciOperations
org.springframework.dao
package.
Code using this class can pass in and receive Record
instances, or alternatively implement callback interfaces for creating input
Records and extracting result objects from output Records (or CCI ResultSets).
Can be used within a service implementation via direct instantiation with a ConnectionFactory reference, or get prepared in an application context and given to services as bean reference. Note: The ConnectionFactory should always be configured as a bean in the application context, in the first case given to the service directly, in the second case to the prepared template.
RecordCreator
,
RecordExtractor
Constructor and Description |
---|
CciTemplate()
Deprecated.
Construct a new CciTemplate for bean usage.
|
CciTemplate(ConnectionFactory connectionFactory)
Deprecated.
Construct a new CciTemplate, given a ConnectionFactory to obtain Connections from.
|
CciTemplate(ConnectionFactory connectionFactory,
ConnectionSpec connectionSpec)
Deprecated.
Construct a new CciTemplate, given a ConnectionFactory to obtain Connections from.
|
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Deprecated.
|
IndexedRecord |
createIndexedRecord(String name)
Deprecated.
Create an indexed Record through the ConnectionFactory's RecordFactory.
|
MappedRecord |
createMappedRecord(String name)
Deprecated.
Create a mapped Record from the ConnectionFactory's RecordFactory.
|
protected Record |
createRecord(RecordCreator recordCreator)
Deprecated.
Invoke the given RecordCreator, converting JCA ResourceExceptions
to Spring's DataAccessException hierarchy.
|
protected <T> T |
doExecute(InteractionSpec spec,
Record inputRecord,
Record outputRecord,
RecordExtractor<T> outputExtractor)
Deprecated.
Execute the specified interaction on an EIS with CCI.
|
<T> T |
execute(ConnectionCallback<T> action)
Deprecated.
Execute a request on an EIS with CCI, implemented as callback action
working on a CCI Connection.
|
<T> T |
execute(InteractionCallback<T> action)
Deprecated.
Execute a request on an EIS with CCI, implemented as callback action
working on a CCI Interaction.
|
Record |
execute(InteractionSpec spec,
Record inputRecord)
Deprecated.
Execute the specified interaction on an EIS with CCI.
|
Record |
execute(InteractionSpec spec,
RecordCreator inputCreator)
Deprecated.
Execute the specified interaction on an EIS with CCI.
|
<T> T |
execute(InteractionSpec spec,
RecordCreator inputCreator,
RecordExtractor<T> outputExtractor)
Deprecated.
Execute the specified interaction on an EIS with CCI.
|
void |
execute(InteractionSpec spec,
Record inputRecord,
Record outputRecord)
Deprecated.
Execute the specified interaction on an EIS with CCI.
|
<T> T |
execute(InteractionSpec spec,
Record inputRecord,
RecordExtractor<T> outputExtractor)
Deprecated.
Execute the specified interaction on an EIS with CCI.
|
ConnectionFactory |
getConnectionFactory()
Deprecated.
Return the CCI ConnectionFactory used by this template.
|
ConnectionSpec |
getConnectionSpec()
Deprecated.
Return the CCI ConnectionSpec used by this template, if any.
|
CciTemplate |
getDerivedTemplate(ConnectionSpec connectionSpec)
Deprecated.
Create a template derived from this template instance,
inheriting the ConnectionFactory and other settings but
overriding the ConnectionSpec used for obtaining Connections.
|
RecordCreator |
getOutputRecordCreator()
Deprecated.
Return a RecordCreator that should be used for creating default output Records.
|
protected RecordFactory |
getRecordFactory(ConnectionFactory connectionFactory)
Deprecated.
Return a RecordFactory for the given ConnectionFactory.
|
void |
setConnectionFactory(ConnectionFactory connectionFactory)
Deprecated.
Set the CCI ConnectionFactory to obtain Connections from.
|
void |
setConnectionSpec(ConnectionSpec connectionSpec)
Deprecated.
Set the CCI ConnectionSpec that this template instance is
supposed to obtain Connections for.
|
void |
setOutputRecordCreator(RecordCreator creator)
Deprecated.
Set a RecordCreator that should be used for creating default output Records.
|
public CciTemplate()
Note: The ConnectionFactory has to be set before using the instance.
public CciTemplate(ConnectionFactory connectionFactory)
connectionFactory
- the JCA ConnectionFactory to obtain Connections frompublic CciTemplate(ConnectionFactory connectionFactory, @Nullable ConnectionSpec connectionSpec)
connectionFactory
- the JCA ConnectionFactory to obtain Connections fromconnectionSpec
- the CCI ConnectionSpec to obtain Connections for
(may be null
)public void setConnectionFactory(@Nullable ConnectionFactory connectionFactory)
@Nullable public ConnectionFactory getConnectionFactory()
public void setConnectionSpec(@Nullable ConnectionSpec connectionSpec)
@Nullable public ConnectionSpec getConnectionSpec()
public void setOutputRecordCreator(@Nullable RecordCreator creator)
Default is none: When no explicit output Record gets passed into an
execute
method, CCI's Interaction.execute
variant
that returns an output Record will be called.
Specify a RecordCreator here if you always need to call CCI's
Interaction.execute
variant with a passed-in output Record.
Unless there is an explicitly specified output Record, CciTemplate will
then invoke this RecordCreator to create a default output Record instance.
@Nullable public RecordCreator getOutputRecordCreator()
public void afterPropertiesSet()
public CciTemplate getDerivedTemplate(ConnectionSpec connectionSpec)
connectionSpec
- the CCI ConnectionSpec that the derived template
instance is supposed to obtain Connections forsetConnectionSpec(javax.resource.cci.ConnectionSpec)
@Nullable public <T> T execute(ConnectionCallback<T> action) throws DataAccessException
CciOperations
The callback action can return a result object, for example a domain object or a collection of domain objects.
execute
in interface CciOperations
action
- the callback object that specifies the actionDataAccessException
- if there is any problem@Nullable public <T> T execute(InteractionCallback<T> action) throws DataAccessException
CciOperations
The callback action can return a result object, for example a domain object or a collection of domain objects.
execute
in interface CciOperations
action
- the callback object that specifies the actionDataAccessException
- if there is any problem@Nullable public Record execute(InteractionSpec spec, Record inputRecord) throws DataAccessException
CciOperations
execute
in interface CciOperations
spec
- the CCI InteractionSpec instance that defines
the interaction (connector-specific)inputRecord
- the input recordDataAccessException
- if there is any problempublic void execute(InteractionSpec spec, Record inputRecord, Record outputRecord) throws DataAccessException
CciOperations
execute
in interface CciOperations
spec
- the CCI InteractionSpec instance that defines
the interaction (connector-specific)inputRecord
- the input recordoutputRecord
- the output recordDataAccessException
- if there is any problempublic Record execute(InteractionSpec spec, RecordCreator inputCreator) throws DataAccessException
CciOperations
execute
in interface CciOperations
spec
- the CCI InteractionSpec instance that defines
the interaction (connector-specific)inputCreator
- object that creates the input record to useDataAccessException
- if there is any problempublic <T> T execute(InteractionSpec spec, Record inputRecord, RecordExtractor<T> outputExtractor) throws DataAccessException
CciOperations
execute
in interface CciOperations
spec
- the CCI InteractionSpec instance that defines
the interaction (connector-specific)inputRecord
- the input recordoutputExtractor
- object to convert the output record to a result objectDataAccessException
- if there is any problempublic <T> T execute(InteractionSpec spec, RecordCreator inputCreator, RecordExtractor<T> outputExtractor) throws DataAccessException
CciOperations
execute
in interface CciOperations
spec
- the CCI InteractionSpec instance that defines
the interaction (connector-specific)inputCreator
- object that creates the input record to useoutputExtractor
- object to convert the output record to a result objectDataAccessException
- if there is any problem@Nullable protected <T> T doExecute(InteractionSpec spec, Record inputRecord, @Nullable Record outputRecord, @Nullable RecordExtractor<T> outputExtractor) throws DataAccessException
spec
- the CCI InteractionSpec instance that defines
the interaction (connector-specific)inputRecord
- the input recordoutputRecord
- output record (can be null
)outputExtractor
- object to convert the output record to a result objectDataAccessException
- if there is any problempublic IndexedRecord createIndexedRecord(String name) throws DataAccessException
name
- the name of the recordDataAccessException
- if creation of the Record failedgetRecordFactory(javax.resource.cci.ConnectionFactory)
,
RecordFactory.createIndexedRecord(String)
public MappedRecord createMappedRecord(String name) throws DataAccessException
name
- record nameDataAccessException
- if creation of the Record failedgetRecordFactory(javax.resource.cci.ConnectionFactory)
,
RecordFactory.createMappedRecord(String)
protected Record createRecord(RecordCreator recordCreator) throws DataAccessException
recordCreator
- the RecordCreator to invokeDataAccessException
- if creation of the Record failedgetRecordFactory(javax.resource.cci.ConnectionFactory)
,
RecordCreator.createRecord(javax.resource.cci.RecordFactory)
protected RecordFactory getRecordFactory(ConnectionFactory connectionFactory) throws ResourceException
Default implementation returns the connector's RecordFactory if available, falling back to a NotSupportedRecordFactory placeholder. This allows to invoke a RecordCreator callback with a non-null RecordFactory reference in any case.
connectionFactory
- the CCI ConnectionFactoryResourceException
- if thrown by CCI methodsNotSupportedRecordFactory