KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > usertransaction > DODSUserTransactionFactory


1 package org.enhydra.shark.usertransaction;
2
3 import org.enhydra.dods.DODS;
4 import org.enhydra.shark.api.RootException;
5 import org.enhydra.shark.api.UserTransaction;
6 import org.enhydra.shark.api.TransactionException;
7 import org.enhydra.shark.api.internal.usertransaction.UserTransactionFactory;
8 import org.enhydra.shark.api.internal.working.CallbackUtilities;
9
10 /**
11  * Implementation of UserTransactionFactory interface that creates DODS transaction.
12  * @author Tanja Jovanovic
13  *
14  */

15 public class DODSUserTransactionFactory implements UserTransactionFactory {
16    static boolean _debug_ = false;
17
18    private static final String JavaDoc DBG_PARAM_NAME = "DODSUserTransactionFactory.debug";
19    
20    /**
21     * Configure DODSUserTransactionFactory.
22     *
23     * @param cus an instance of CallbackUtilities used to get
24     * properties for configuring DODS user transaction manager and
25     * user transactions.
26     *
27     * @exception RootException thrown if configuring doesn't succeed.
28     */

29    public void configure (CallbackUtilities cus) throws RootException {
30       if (null == cus)
31          throw new RootException("Cannot configure without call back impl.");
32       _debug_ = Boolean
33          .valueOf(cus.getProperty(DBG_PARAM_NAME, "false"))
34          .booleanValue();
35    }
36
37    /**
38     * Creates user transaction.
39     *
40     * @return Created user transaction.
41     *
42     * @exception TransactionException If something unexpected happens.
43     */

44    public UserTransaction createTransaction () throws TransactionException {
45       try {
46          return new SharkDODSUserTransaction(DODS.getDatabaseManager().createTransaction());
47       } catch (Exception JavaDoc ex) {
48          throw new TransactionException(ex);
49       }
50    }
51 }
52
53
Popular Tags