01: /*
02: * Copyright 2002-2007 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.transaction.jta;
18:
19: import javax.transaction.NotSupportedException;
20: import javax.transaction.SystemException;
21: import javax.transaction.Transaction;
22:
23: /**
24: * Strategy interface for creating JTA {@link javax.transaction.Transaction}
25: * objects based on specified transactional characteristics.
26: *
27: * <p>The default implementation, {@link SimpleTransactionFactory}, simply
28: * wraps a standard JTA {@link javax.transaction.TransactionManager}.
29: * This strategy interface allows for more sophisticated implementations
30: * that adapt to vendor-specific JTA extensions.
31: *
32: * @author Juergen Hoeller
33: * @since 2.5
34: * @see javax.transaction.TransactionManager#getTransaction()
35: * @see SimpleTransactionFactory
36: * @see JtaTransactionManager
37: */
38: public interface TransactionFactory {
39:
40: /**
41: * Create an active Transaction object based on the given name and timeout.
42: * @param name the transaction name (may be <code>null</code>)
43: * @param timeout the transaction timeout (may be -1 for the default timeout)
44: * @return the active Transaction object (never <code>null</code>)
45: * @throws NotSupportedException if the transaction manager does not support
46: * a transaction of the specified type
47: * @throws SystemException if the transaction managed failed to create the
48: * transaction
49: */
50: Transaction createTransaction(String name, int timeout)
51: throws NotSupportedException, SystemException;
52:
53: }
|