01: /*
02: * Copyright 2002-2005 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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)
45: throws ResourceException {
46: throw new NotSupportedException(
47: "The RecordFactory facility is not supported by the connector");
48: }
49:
50: public IndexedRecord createIndexedRecord(String name)
51: throws ResourceException {
52: throw new NotSupportedException(
53: "The RecordFactory facility is not supported by the connector");
54: }
55:
56: }
|