KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > transaction > DODSTransactionFactory


1 /* TransactionManager.java */
2
3 package org.enhydra.shark.transaction;
4
5
6 import org.enhydra.dods.DODS;
7 import org.enhydra.shark.api.RootException;
8 import org.enhydra.shark.api.TransactionException;
9 import org.enhydra.shark.api.internal.transaction.SharkInternalTransaction;
10 import org.enhydra.shark.api.internal.transaction.TransactionFactory;
11 import org.enhydra.shark.api.internal.working.CallbackUtilities;
12
13 /**
14  * Implementation of TransactionFactory interface that creates DODS transaction.
15  *
16  */

17 public class DODSTransactionFactory implements TransactionFactory {
18
19    private CallbackUtilities cus;
20    
21    static boolean _debug_ = false;
22    
23    private static final String JavaDoc DBG_PARAM_NAME = "DODSTransactionFactory.debug";
24    
25    public void configure (CallbackUtilities cus) throws RootException {
26       if (null == cus)
27          throw new RootException("Cannot configure without call back impl.");
28       this.cus=cus;
29       _debug_ = Boolean
30          .valueOf(cus.getProperty(DBG_PARAM_NAME, "false"))
31          .booleanValue();
32    }
33
34
35    public SharkInternalTransaction createTransaction () throws TransactionException {
36       try {
37          return new SharkDODSTransaction(DODS.getDatabaseManager().createTransaction());
38       } catch (Exception JavaDoc ex) {
39          throw new TransactionException(ex);
40       }
41    }
42
43 }
44
45
Popular Tags