KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > jca > cci > core > CciOperations


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.jca.cci.core;
18
19 import javax.resource.cci.InteractionSpec JavaDoc;
20 import javax.resource.cci.Record JavaDoc;
21
22 import org.springframework.dao.DataAccessException;
23
24 /**
25  * Interface that specifies a basic set of CCI operations on an EIS.
26  * Implemented by CciTemplate. Not often used, but a useful option
27  * to enhance testability, as it can easily be mocked or stubbed.
28  *
29  * <p>Alternatively, the standard CCI infrastructure can be mocked.
30  * However, mocking this interface constitutes significantly less work.
31  *
32  * @author Juergen Hoeller
33  * @since 1.2
34  * @see CciTemplate
35  */

36 public interface CciOperations {
37
38     /**
39      * Execute a request on an EIS with CCI, implemented as callback action
40      * working on a CCI Connection. This allows for implementing arbitrary
41      * data access operations, within Spring's managed CCI environment:
42      * that is, participating in Spring-managed transactions and converting
43      * JCA ResourceExceptions into Spring's DataAccessException hierarchy.
44      * <p>The callback action can return a result object, for example a
45      * domain object or a collection of domain objects.
46      * @param action the callback object that specifies the action
47      * @return the result object returned by the action, if any
48      * @throws DataAccessException if there is any problem
49      */

50     Object JavaDoc execute(ConnectionCallback action) throws DataAccessException;
51
52     /**
53      * Execute a request on an EIS with CCI, implemented as callback action
54      * working on a CCI Interaction. This allows for implementing arbitrary
55      * data access operations on a single Interaction, within Spring's managed
56      * CCI environment: that is, participating in Spring-managed transactions
57      * and converting JCA ResourceExceptions into Spring's DataAccessException
58      * hierarchy.
59      * <p>The callback action can return a result object, for example a
60      * domain object or a collection of domain objects.
61      * @param action the callback object that specifies the action
62      * @return the result object returned by the action, if any
63      * @throws DataAccessException if there is any problem
64      */

65     Object JavaDoc execute(InteractionCallback action) throws DataAccessException;
66
67     /**
68      * Execute the specified interaction on an EIS with CCI.
69      * @param spec the CCI InteractionSpec instance that defines
70      * the interaction (connector-specific)
71      * @param inputRecord the input record
72      * @return the output record
73      * @throws DataAccessException if there is any problem
74      */

75     Record JavaDoc execute(InteractionSpec JavaDoc spec, Record JavaDoc inputRecord) throws DataAccessException;
76
77     /**
78      * Execute the specified interaction on an EIS with CCI.
79      * @param spec the CCI InteractionSpec instance that defines
80      * the interaction (connector-specific)
81      * @param inputRecord the input record
82      * @param outputRecord the output record
83      * @throws DataAccessException if there is any problem
84      */

85     void execute(InteractionSpec JavaDoc spec, Record JavaDoc inputRecord, Record JavaDoc outputRecord) throws DataAccessException;
86
87     /**
88      * Execute the specified interaction on an EIS with CCI.
89      * @param spec the CCI InteractionSpec instance that defines
90      * the interaction (connector-specific)
91      * @param inputCreator object that creates the input record to use
92      * @return the output record
93      * @throws DataAccessException if there is any problem
94      */

95     Record JavaDoc execute(InteractionSpec JavaDoc spec, RecordCreator inputCreator) throws DataAccessException;
96
97     /**
98      * Execute the specified interaction on an EIS with CCI.
99      * @param spec the CCI InteractionSpec instance that defines
100      * the interaction (connector-specific)
101      * @param inputRecord the input record
102      * @param outputExtractor object to convert the output record to a result object
103      * @return the output data extracted with the RecordExtractor object
104      * @throws DataAccessException if there is any problem
105      */

106     Object JavaDoc execute(InteractionSpec JavaDoc spec, Record JavaDoc inputRecord, RecordExtractor outputExtractor)
107             throws DataAccessException;
108
109     /**
110      * Execute the specified interaction on an EIS with CCI.
111      * @param spec the CCI InteractionSpec instance that defines
112      * the interaction (connector-specific)
113      * @param inputCreator object that creates the input record to use
114      * @param outputExtractor object to convert the output record to a result object
115      * @return the output data extracted with the RecordExtractor object
116      * @throws DataAccessException if there is any problem
117      */

118     Object JavaDoc execute(InteractionSpec JavaDoc spec, RecordCreator inputCreator, RecordExtractor outputExtractor)
119             throws DataAccessException;
120
121 }
122
Popular Tags