KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > scriptmappersistence > HibernateScriptMappingMgr


1 /*
2  * Shark Hibernate ScriptMappPersistence - Open Wide
3  */

4 package org.enhydra.shark.scriptmappersistence;
5
6 import org.enhydra.shark.api.RootException;
7 import org.enhydra.shark.api.ScriptMappingTransaction;
8 import org.enhydra.shark.api.TransactionException;
9 import org.enhydra.shark.api.internal.scriptmappersistence.ScriptMappingManager;
10 import org.enhydra.shark.api.internal.working.CallbackUtilities;
11
12 /**
13  * Implementation of ScriptMappingsManager interface
14  * @author Vladislav Pernin
15  */

16 public class HibernateScriptMappingMgr implements ScriptMappingManager
17 {
18    public static boolean _debug_ = false;
19
20    private static final String JavaDoc DBG_PARAM_NAME = "HibernateScriptMappingMgr.debug";
21
22    public void configure (CallbackUtilities cus) throws RootException {
23       if (null == cus)
24              throw new RootException("Cannot configure without call back impl.");
25            _debug_ = Boolean
26              .valueOf(cus.getProperty(DBG_PARAM_NAME, "false"))
27              .booleanValue();
28    }
29
30    public ScriptMappingTransaction getScriptMappingTransaction() throws TransactionException {
31              try {
32                return new HibernateScriptMappingTransaction(ThreadLocalSession.currentSession().beginTransaction());
33              } catch (Exception JavaDoc ex) {
34                throw new TransactionException(ex);
35              }
36    }
37 }
38
39
Popular Tags