/* * Copyright 2002-2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.transaction.jta; import javax.transaction.NotSupportedException; import javax.transaction.SystemException; import javax.transaction.Transaction; /** * Strategy interface for creating JTA {@link javax.transaction.Transaction} * objects based on specified transactional characteristics. * * <p>The default implementation, {@link SimpleTransactionFactory}, simply * wraps a standard JTA {@link javax.transaction.TransactionManager}. * This strategy interface allows for more sophisticated implementations * that adapt to vendor-specific JTA extensions. * * @author Juergen Hoeller * @since 2.5 * @see javax.transaction.TransactionManager#getTransaction() * @see SimpleTransactionFactory * @see JtaTransactionManager */ public interface TransactionFactory { /** * Create an active Transaction object based on the given name and timeout. * @param name the transaction name (may be <code>null</code>) * @param timeout the transaction timeout (may be -1 for the default timeout) * @return the active Transaction object (never <code>null</code>) * @throws NotSupportedException if the transaction manager does not support * a transaction of the specified type * @throws SystemException if the transaction managed failed to create the * transaction */ Transaction createTransaction(String name, int timeout) throws NotSupportedException, SystemException; }