1 5 package com.lutris.appserver.server.sql; 6 7 import org.enhydra.dods.DODS; 8 9 import com.lutris.logging.Logger; 10 11 14 public class DBTransactionFactoryCreator { 15 16 public static AbstractDBTransactionFactory getDBTransactionFactory(String dbTransFactoryClassName, LogicalDatabase ldb){ 17 Class transFactoryClass = null; 18 AbstractDBTransactionFactory transFactory = null; 19 if (dbTransFactoryClassName != null) { 20 try { 21 transFactoryClass = Class.forName(dbTransFactoryClassName); 22 transFactory = (AbstractDBTransactionFactory) transFactoryClass.newInstance(); 23 } catch (Exception e) { 24 DODS.getLogChannel() 25 .write(Logger.ERROR, 26 "Failed to make DBTransactionFactory :" 27 + dbTransFactoryClassName 28 + " creating StandardDBTransactionFactory instead"); 29 transFactory = null; 30 } 31 } 32 if (dbTransFactoryClassName == null || transFactory == null) { 33 try { 34 transFactoryClass = Class.forName("com.lutris.appserver.server.sql.standard.StandardDBTransactionFactory"); 35 transFactory = (AbstractDBTransactionFactory) transFactoryClass.newInstance(); 36 } catch (Exception e) { 37 String str = "Failed to make StandardTransactionFactory : com.lutris.appserver.server.sql.standard.StandardDBTransactionFactory"; 38 DODS.getLogChannel().write(Logger.CRITICAL, str); 39 throw new Error (str); 40 } 41 } 42 transFactory.setLogicalDb(ldb); 43 return transFactory; 44 } 45 } | Popular Tags |