1 /*
2 * Hibernate, Relational Persistence for Idiomatic Java
3 *
4 * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
5 * indicated by the @author tags or express copyright attribution
6 * statements applied by the authors. All third-party contributions are
7 * distributed under license by Red Hat Middleware LLC.
8 *
9 * This copyrighted material is made available to anyone wishing to use, modify,
10 * copy, or redistribute it subject to the terms and conditions of the GNU
11 * Lesser General Public License, as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this distribution; if not, write to:
20 * Free Software Foundation, Inc.
21 * 51 Franklin Street, Fifth Floor
22 * Boston, MA 02110-1301 USA
23 *
24 */
25 package org.hibernate.transaction;
26
27 import java.util.Properties;
28 import javax.transaction.Transaction;
29 import javax.transaction.TransactionManager;
30
31 import org.hibernate.HibernateException;
32
33 /**
34 * Contract for locating the JTA {@link TransactionManager} on given platform.
35 * <p/>
36 * NOTE: this contract has expanded over time, and basically is a platform
37 * abstraction contract for JTA-related information.
38 *
39 * @author Gavin King
40 */
41 public interface TransactionManagerLookup {
42
43 /**
44 * Obtain the JTA {@link TransactionManager}.
45 *
46 * @param props The configuration properties.
47 * @return The JTA {@link TransactionManager}.
48 *
49 * @throws HibernateException Indicates problem locating {@link TransactionManager}.
50 */
51 public TransactionManager getTransactionManager(Properties props) throws HibernateException;
52
53 /**
54 * Return the JNDI namespace of the JTA
55 * {@link javax.transaction.UserTransaction} for this platform or <tt>null</tt>;
56 * optional operation.
57 *
58 * @return The JNDI namespace where we can locate the
59 * {@link javax.transaction.UserTransaction} for this platform.
60 */
61 public String getUserTransactionName();
62
63 /**
64 * Determine an identifier for the given transaction appropriate for use in caching/lookup usages.
65 * <p/>
66 * Generally speaking the transaction itself will be returned here. This method was added specifically
67 * for use in WebSphere and other unfriendly JEE containers (although WebSphere is still the only known
68 * such brain-dead, sales-driven impl).
69 *
70 * @param transaction The transaction to be identified.
71 * @return An appropropriate identifier
72 */
73 public Object getTransactionIdentifier(Transaction transaction);
74 }
75