KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.sql.SQLException JavaDoc;
20
21 import javax.resource.ResourceException JavaDoc;
22 import javax.resource.cci.Record JavaDoc;
23
24 import org.springframework.dao.DataAccessException;
25
26 /**
27  * Callback interface for extracting a result object from a CCI Record instance.
28  *
29  * <p>Used for output object creation in CciTemplate. Alternatively, output
30  * Records can also be returned to client code as-is. In case of a CCI ResultSet
31  * as execution result, you will almost always want to implement a RecordExtractor,
32  * to be able to read the ResultSet in a managed fashion, with the CCI Connection
33  * still open while reading the ResultSet.
34  *
35  * <p>Implementations of this interface perform the actual work of extracting
36  * results, but don't need to worry about exception handling. ResourceExceptions
37  * will be caught and handled correctly by the CciTemplate class.
38  *
39  * @author Thierry Templier
40  * @author Juergen Hoeller
41  * @since 1.2
42  * @see CciTemplate#execute(javax.resource.cci.InteractionSpec, Record, RecordExtractor)
43  * @see CciTemplate#execute(javax.resource.cci.InteractionSpec, RecordCreator, RecordExtractor)
44  * @see javax.resource.cci.ResultSet
45  */

46 public interface RecordExtractor {
47     
48     /**
49      * Process the data in the given Record, creating a corresponding result object.
50      * @param record the Record to extract data from
51      * (possibly a CCI ResultSet)
52      * @return an arbitrary result object, or <code>null</code> if none
53      * (the extractor will typically be stateful in the latter case)
54      * @throws ResourceException if thrown by a CCI method, to be auto-converted
55      * to a DataAccessException
56      * @throws SQLException if thrown by a ResultSet method, to be auto-converted
57      * to a DataAccessException
58      * @throws DataAccessException in case of custom exceptions
59      * @see javax.resource.cci.ResultSet
60      */

61     Object JavaDoc extractData(Record JavaDoc record) throws ResourceException JavaDoc, SQLException JavaDoc, DataAccessException;
62
63 }
64
Popular Tags