KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jodd > db > jtx > DbJtxTransactionManager


1 // Copyright (c) 2003-2007, Jodd Team (jodd.sf.net). All Rights Reserved.
2

3 package jodd.db.jtx;
4
5 import jodd.jtx.JtxTransactionManager;
6 import jodd.db.connection.ConnectionProvider;
7 import jodd.db.DbSession;
8
9 /**
10  * {@link jodd.jtx.JtxTransactionManager} that uses only one jtx db resource type.
11  * Usually, in applications we have only one transaction-aware resource type, and
12  * that is database. This class simplifies usage, nothing more.
13  * @see jodd.jtx.JtxTransactionManager
14  */

15 public class DbJtxTransactionManager extends JtxTransactionManager {
16
17     public DbJtxTransactionManager() {
18     }
19
20     /**
21      * Registers db transaction resouce manager.
22      * @see jodd.jtx.JtxTransactionManager#registerResourceManager(jodd.jtx.JtxResourceManager)
23      */

24     public void registerDbResourceManager(DbJtxResourceManager resourceManager) {
25         super.registerResourceManager(resourceManager);
26     }
27
28     /**
29      * Creates db transaction manager and registers it.
30      */

31     public void createDbResourceManager(ConnectionProvider provider) {
32         super.registerResourceManager(new DbJtxResourceManager(provider));
33     }
34
35
36     /**
37      * Returns new {@link jodd.db.DbSession} transaction resource.
38      * @see jodd.jtx.JtxTransactionManager#getResource(String)
39      */

40     public DbSession getDbSession() {
41         return (DbSession) getResource(DbJtxResourceManager.DEFAULT_RESOURCE_TYPE);
42     }
43
44 }
Popular Tags