Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AtomikosTransactionManagerLookup |
|
| 2.5;2.5 |
1 | /* | |
2 | * Copyright 2008-2009 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
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 | package org.kuali.rice.core.jta; | |
17 | ||
18 | /* | |
19 | * Copyright 2007 The Kuali Foundation | |
20 | * | |
21 | * Licensed under the Educational Community License, Version 1.0 (the "License"); | |
22 | * you may not use this file except in compliance with the License. | |
23 | * You may obtain a copy of the License at | |
24 | * | |
25 | * http://www.opensource.org/licenses/ecl1.php | |
26 | * | |
27 | * Unless required by applicable law or agreed to in writing, software | |
28 | * distributed under the License is distributed on an "AS IS" BASIS, | |
29 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
30 | * See the License for the specific language governing permissions and | |
31 | * limitations under the License. | |
32 | */ | |
33 | ||
34 | import java.util.Properties; | |
35 | ||
36 | import javax.transaction.TransactionManager; | |
37 | ||
38 | import org.hibernate.HibernateException; | |
39 | import org.hibernate.transaction.TransactionManagerLookup; | |
40 | ||
41 | /** | |
42 | * TransactionManager lookup strategy for Atomikos Transactions. | |
43 | * | |
44 | * @author Ludovic Orban | |
45 | */ | |
46 | ||
47 | // See: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2821 | |
48 | // Once added to Hibernate distribution, we can remove this class | |
49 | 0 | public class AtomikosTransactionManagerLookup implements TransactionManagerLookup { |
50 | ||
51 | public TransactionManager getTransactionManager(Properties props) throws HibernateException { | |
52 | try { | |
53 | 0 | Class clazz = Class.forName("com.atomikos.icatch.jta.UserTransactionManager"); |
54 | 0 | return (TransactionManager) clazz.newInstance(); |
55 | 0 | } catch (Exception e) { |
56 | 0 | throw new HibernateException("Could not obtain Atomikos transaction manager instance", e); |
57 | } | |
58 | } | |
59 | ||
60 | public String getUserTransactionName() { | |
61 | 0 | return "java:comp/UserTransaction"; |
62 | } | |
63 | ||
64 | } |