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.transaction.support;
018
019import org.springframework.transaction.PlatformTransactionManager;
020
021/**
022 * Extension of the {@link org.springframework.transaction.PlatformTransactionManager}
023 * interface, indicating a native resource transaction manager, operating on a single
024 * target resource. Such transaction managers differ from JTA transaction managers in
025 * that they do not use XA transaction enlistment for an open number of resources but
026 * rather focus on leveraging the native power and simplicity of a single target resource.
027 *
028 * <p>This interface is mainly used for abstract introspection of a transaction manager,
029 * giving clients a hint on what kind of transaction manager they have been given
030 * and on what concrete resource the transaction manager is operating on.
031 *
032 * @author Juergen Hoeller
033 * @since 2.0.4
034 * @see TransactionSynchronizationManager
035 */
036public interface ResourceTransactionManager extends PlatformTransactionManager {
037
038        /**
039         * Return the resource factory that this transaction manager operates on,
040         * e.g. a JDBC DataSource or a JMS ConnectionFactory.
041         * <p>This target resource factory is usually used as resource key for
042         * {@link TransactionSynchronizationManager}'s resource bindings per thread.
043         * @return the target resource factory (never {@code null})
044         * @see TransactionSynchronizationManager#bindResource
045         * @see TransactionSynchronizationManager#getResource
046         */
047        Object getResourceFactory();
048
049}