001/* 002 * Copyright 2002-2012 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.jca.cci.connection; 018 019import javax.resource.NotSupportedException; 020import javax.resource.ResourceException; 021import javax.resource.cci.IndexedRecord; 022import javax.resource.cci.MappedRecord; 023import javax.resource.cci.RecordFactory; 024 025/** 026 * Implementation of the CCI RecordFactory interface that always throws 027 * NotSupportedException. 028 * 029 * <p>Useful as a placeholder for a RecordFactory argument (for example as 030 * defined by the RecordCreator callback), in particular when the connector's 031 * {@code ConnectionFactory.getRecordFactory()} implementation happens to 032 * throw NotSupportedException early rather than throwing the exception from 033 * RecordFactory's methods. 034 * 035 * @author Juergen Hoeller 036 * @since 1.2.4 037 * @see org.springframework.jca.cci.core.RecordCreator#createRecord(javax.resource.cci.RecordFactory) 038 * @see org.springframework.jca.cci.core.CciTemplate#getRecordFactory(javax.resource.cci.ConnectionFactory) 039 * @see javax.resource.cci.ConnectionFactory#getRecordFactory() 040 * @see javax.resource.NotSupportedException 041 */ 042public class NotSupportedRecordFactory implements RecordFactory { 043 044 @Override 045 public MappedRecord createMappedRecord(String name) throws ResourceException { 046 throw new NotSupportedException("The RecordFactory facility is not supported by the connector"); 047 } 048 049 @Override 050 public IndexedRecord createIndexedRecord(String name) throws ResourceException { 051 throw new NotSupportedException("The RecordFactory facility is not supported by the connector"); 052 } 053 054}