java.lang.Object | |
↳ | org.springframework.jca.cci.core.CciTemplate |
This is the central class in the CCI core package.
It simplifies the use of CCI and helps to avoid common errors.
It executes core CCI workflow, leaving application code to provide parameters
to CCI and extract results. This class executes EIS queries or updates,
catching ResourceExceptions and translating them to the generic exception
hierarchy defined in the org.springframework.dao
package.
Code using this class can pass in and receive javax.resource.cci.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.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Construct a new CciTemplate for bean usage.
| |||||||||||
Construct a new CciTemplate, given a ConnectionFactory to obtain Connections from.
| |||||||||||
Construct a new CciTemplate, given a ConnectionFactory to obtain Connections from.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create an indexed Record through the ConnectionFactory's RecordFactory.
| |||||||||||
Create a mapped Record from the ConnectionFactory's RecordFactory.
| |||||||||||
Execute the specified interaction on an EIS with CCI.
| |||||||||||
Execute the specified interaction on an EIS with CCI.
| |||||||||||
Execute the specified interaction on an EIS with CCI.
| |||||||||||
Execute the specified interaction on an EIS with CCI.
| |||||||||||
Execute the specified interaction on an EIS with CCI.
| |||||||||||
Execute a request on an EIS with CCI, implemented as callback action
working on a CCI Interaction.
| |||||||||||
Execute a request on an EIS with CCI, implemented as callback action
working on a CCI Connection.
| |||||||||||
Return the CCI ConnectionFactory used by this template.
| |||||||||||
Return the CCI ConnectionSpec used by this template, if any.
| |||||||||||
Create a template derived from this template instance,
inheriting the ConnectionFactory and other settings but
overriding the ConnectionSpec used for obtaining Connections.
| |||||||||||
Return a RecordCreator that should be used for creating default output Records.
| |||||||||||
Set the CCI ConnectionFactory to obtain Connections from.
| |||||||||||
Set the CCI ConnectionSpec that this template instance is
supposed to obtain Connections for.
| |||||||||||
Set a RecordCreator that should be used for creating default output Records.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Invoke the given RecordCreator, converting JCA ResourceExceptions
to Spring's DataAccessException hierarchy.
| |||||||||||
Execute the specified interaction on an EIS with CCI.
| |||||||||||
Return a RecordFactory for the given ConnectionFactory.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.jca.cci.core.CciOperations
|
Construct a new CciTemplate for bean usage.
Note: The ConnectionFactory has to be set before using the instance.
Construct a new CciTemplate, given a ConnectionFactory to obtain Connections from. Note: This will trigger eager initialization of the exception translator.
connectionFactory | JCA ConnectionFactory to obtain Connections from |
---|
Construct a new CciTemplate, given a ConnectionFactory to obtain Connections from. Note: This will trigger eager initialization of the exception translator.
connectionFactory | JCA ConnectionFactory to obtain Connections from |
---|---|
connectionSpec | the CCI ConnectionSpec to obtain Connections for
(may be null )
|
Create an indexed Record through the ConnectionFactory's RecordFactory.
name | the name of the record |
---|
DataAccessException | if creation of the Record failed |
---|
Create a mapped Record from the ConnectionFactory's RecordFactory.
name | record name |
---|
DataAccessException | if creation of the Record failed |
---|
Execute the specified interaction on an EIS with CCI.
spec | the CCI InteractionSpec instance that defines the interaction (connector-specific) |
---|---|
inputCreator | object that creates the input record to use |
outputExtractor | object to convert the output record to a result object |
DataAccessException |
---|
Execute the specified interaction on an EIS with CCI.
spec | the CCI InteractionSpec instance that defines the interaction (connector-specific) |
---|---|
inputRecord | the input record |
outputExtractor | object to convert the output record to a result object |
DataAccessException |
---|
Execute the specified interaction on an EIS with CCI.
spec | the CCI InteractionSpec instance that defines the interaction (connector-specific) |
---|---|
inputCreator | object that creates the input record to use |
DataAccessException |
---|
Execute the specified interaction on an EIS with CCI.
spec | the CCI InteractionSpec instance that defines the interaction (connector-specific) |
---|---|
inputRecord | the input record |
DataAccessException |
---|
Execute the specified interaction on an EIS with CCI.
spec | the CCI InteractionSpec instance that defines the interaction (connector-specific) |
---|---|
inputRecord | the input record |
outputRecord | the output record |
DataAccessException |
---|
Execute a request on an EIS with CCI, implemented as callback action working on a CCI Interaction. This allows for implementing arbitrary data access operations on a single Interaction, within Spring's managed CCI environment: that is, participating in Spring-managed transactions and converting JCA ResourceExceptions into Spring's DataAccessException hierarchy.
The callback action can return a result object, for example a domain object or a collection of domain objects.
action | the callback object that specifies the action |
---|
DataAccessException |
---|
Execute a request on an EIS with CCI, implemented as callback action working on a CCI Connection. This allows for implementing arbitrary data access operations, within Spring's managed CCI environment: that is, participating in Spring-managed transactions and converting JCA ResourceExceptions into Spring's DataAccessException hierarchy.
The callback action can return a result object, for example a domain object or a collection of domain objects.
action | the callback object that specifies the action |
---|
DataAccessException |
---|
Return the CCI ConnectionFactory used by this template.
Return the CCI ConnectionSpec used by this template, if any.
Create a template derived from this template instance, inheriting the ConnectionFactory and other settings but overriding the ConnectionSpec used for obtaining Connections.
connectionSpec | the CCI ConnectionSpec that the derived template instance is supposed to obtain Connections for |
---|
Return a RecordCreator that should be used for creating default output Records.
Set the CCI ConnectionFactory to obtain Connections from.
Set the CCI ConnectionSpec that this template instance is supposed to obtain Connections for.
Set a RecordCreator that should be used for creating default output Records.
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.
Invoke the given RecordCreator, converting JCA ResourceExceptions to Spring's DataAccessException hierarchy.
recordCreator | the RecordCreator to invoke |
---|
DataAccessException | if creation of the Record failed |
---|
Execute the specified interaction on an EIS with CCI. All other interaction execution methods go through this.
spec | the CCI InteractionSpec instance that defines the interaction (connector-specific) |
---|---|
inputRecord | the input record |
outputRecord | output record (can be null ) |
outputExtractor | object to convert the output record to a result object |
DataAccessException | if there is any problem |
---|
Return a RecordFactory for the given ConnectionFactory.
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 ConnectionFactory |
---|
if thrown by CCI methods | |
ResourceException |