KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > pim > spec > TransactionContextFactory


1 /*
2  * Created on May 12, 2005
3  *
4  * TODO To change the template for this generated file go to Window -
5  * Preferences - Java - Code Style - Code Templates
6  */

7 package org.enhydra.pim.spec;
8
9 import org.enhydra.pim.business.TransactionContextI;
10 import org.enhydra.pim.exception.EnhydraPimException;
11
12 /**
13  * @author P.Djojic May 12, 2005 8:52:24 PM
14  *
15  * TODO TransactionContextFactory
16  */

17 public class TransactionContextFactory {
18
19     /**
20      * Create a TransactionContext
21      */

22
23     public static TransactionContextI getTransactionContext() throws EnhydraPimException {
24
25         TransactionContextI result = null;
26
27         Class JavaDoc objectClass = null;
28
29         try {
30             if (SpecUtil.useEjb) {
31                 objectClass = Class.forName("org.enhydra.pim.data.JtaTransactionContext");
32                 result = (TransactionContextI) objectClass.newInstance();
33             } else {
34                 objectClass = Class.forName("org.enhydra.pim.data.TransactionContext");
35                 result = (TransactionContextI) objectClass.newInstance();
36             }
37         } catch (Exception JavaDoc ex) {
38             System.out.println("Error on creating the TransactionContext object" + ex);
39         }
40         return result;
41     }
42 }
Popular Tags