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.connection; 18 19 import javax.resource.NotSupportedException; 20 import javax.resource.ResourceException; 21 import javax.resource.cci.IndexedRecord; 22 import javax.resource.cci.MappedRecord; 23 import javax.resource.cci.RecordFactory; 24 25 /** 26 * Implementation of the CCI RecordFactory interface that always throws 27 * NotSupportedException. 28 * 29 * <p>Useful as a placeholder for a RecordFactory argument (for example as 30 * defined by the RecordCreator callback), in particular when the connector's 31 * <code>ConnectionFactory.getRecordFactory()</code> implementation happens to 32 * throw NotSupportedException early rather than throwing the exception from 33 * RecordFactory's methods. 34 * 35 * @author Juergen Hoeller 36 * @since 1.2.4 37 * @see org.springframework.jca.cci.core.RecordCreator#createRecord(javax.resource.cci.RecordFactory) 38 * @see org.springframework.jca.cci.core.CciTemplate#getRecordFactory(javax.resource.cci.ConnectionFactory) 39 * @see javax.resource.cci.ConnectionFactory#getRecordFactory() 40 * @see javax.resource.NotSupportedException 41 */ 42 public class NotSupportedRecordFactory implements RecordFactory { 43 44 public MappedRecord createMappedRecord(String name) throws ResourceException { 45 throw new NotSupportedException("The RecordFactory facility is not supported by the connector"); 46 } 47 48 public IndexedRecord createIndexedRecord(String name) throws ResourceException { 49 throw new NotSupportedException("The RecordFactory facility is not supported by the connector"); 50 } 51 52 } 53