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.ResourceException; 20 import javax.resource.cci.Record; 21 import javax.resource.cci.RecordFactory; 22 23 import org.springframework.dao.DataAccessException; 24 25 /** 26 * Callback interface for creating a CCI Record instance, 27 * usually based on the passed-in CCI RecordFactory. 28 * 29 * <p>Used for input Record creation in CciTemplate. Alternatively, 30 * Record instances can be passed into CciTemplate's corresponding 31 * <code>execute</code> methods directly, either instantiated manually 32 * or created through CciTemplate's Record factory methods. 33 * 34 * <P>Also used for creating default output Records in CciTemplate. 35 * This is useful when the JCA connector needs an explicit output Record 36 * instance, but no output Records should be passed into CciTemplate's 37 * <code>execute</code> methods. 38 * 39 * @author Thierry Templier 40 * @author Juergen Hoeller 41 * @since 1.2 42 * @see CciTemplate#execute(javax.resource.cci.InteractionSpec, RecordCreator) 43 * @see CciTemplate#execute(javax.resource.cci.InteractionSpec, RecordCreator, RecordExtractor) 44 * @see CciTemplate#createIndexedRecord(String) 45 * @see CciTemplate#createMappedRecord(String) 46 * @see CciTemplate#setOutputRecordCreator(RecordCreator) 47 */ 48 public interface RecordCreator { 49 50 /** 51 * Create a CCI Record instance, usually based on the passed-in CCI RecordFactory. 52 * <p>For use as <i>input</i> creator with CciTemplate's <code>execute</code> methods, 53 * this method should create a <i>populated</i> Record instance. For use as 54 * <i>output</i> Record creator, it should return an <i>empty</i> Record instance. 55 * @param recordFactory the CCI RecordFactory (never <code>null</code>, but not guaranteed to be 56 * supported by the connector: its create methods might throw NotSupportedException) 57 * @return the Record instance 58 * @throws ResourceException if thrown by a CCI method, to be auto-converted 59 * to a DataAccessException 60 * @throws DataAccessException in case of custom exceptions 61 */ 62 Record createRecord(RecordFactory recordFactory) throws ResourceException, DataAccessException; 63 64 } 65