KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > jca > cci > object > SimpleRecordOperation


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.object;
18
19 import javax.resource.cci.ConnectionFactory JavaDoc;
20 import javax.resource.cci.InteractionSpec JavaDoc;
21 import javax.resource.cci.Record JavaDoc;
22
23 import org.springframework.dao.DataAccessException;
24
25 /**
26  * EIS operation object that accepts a passed-in CCI input Record
27  * and returns a corresponding CCI output Record.
28  *
29  * @author Juergen Hoeller
30  * @since 1.2
31  */

32 public class SimpleRecordOperation extends EisOperation {
33
34     /**
35      * Constructor that allows use as a JavaBean.
36      */

37     public SimpleRecordOperation() {
38     }
39
40     /**
41      * Convenient constructor with ConnectionFactory and specifications
42      * (connection and interaction).
43      * @param connectionFactory ConnectionFactory to use to obtain connections
44      */

45     public SimpleRecordOperation(ConnectionFactory JavaDoc connectionFactory, InteractionSpec JavaDoc interactionSpec) {
46         getCciTemplate().setConnectionFactory(connectionFactory);
47         setInteractionSpec(interactionSpec);
48     }
49
50     /**
51      * Execute the CCI interaction encapsulated by this operation object.
52      * <p>This method will call CCI's <code>Interaction.execute</code> variant
53      * that returns an output Record.
54      * @param inputRecord the input record
55      * @return the output record
56      * @throws DataAccessException if there is any problem
57      * @see javax.resource.cci.Interaction#execute(javax.resource.cci.InteractionSpec, Record)
58      */

59     public Record JavaDoc execute(Record JavaDoc inputRecord) throws DataAccessException {
60         return getCciTemplate().execute(getInteractionSpec(), inputRecord);
61     }
62
63     /**
64      * Execute the CCI interaction encapsulated by this operation object.
65      * <p>This method will call CCI's <code>Interaction.execute</code> variant
66      * with a passed-in output Record.
67      * @param inputRecord the input record
68      * @param outputRecord the output record
69      * @throws DataAccessException if there is any problem
70      * @see javax.resource.cci.Interaction#execute(javax.resource.cci.InteractionSpec, Record, Record)
71      */

72     public void execute(Record JavaDoc inputRecord, Record JavaDoc outputRecord) throws DataAccessException {
73         getCciTemplate().execute(getInteractionSpec(), inputRecord, outputRecord);
74     }
75
76 }
77
Popular Tags