1 23 24 package org.objectweb.jorm.mapper.rdb.lib; 25 26 import org.objectweb.jorm.lib.MapperJCA; 27 import org.objectweb.jorm.api.JormConfigurator; 28 import org.objectweb.jorm.mapper.rdb.adapter.api.RdbAdapter; 29 import org.objectweb.jorm.mapper.rdb.adapter.RdbAdapterFactory; 30 import org.objectweb.jorm.api.PException; 31 import org.objectweb.util.monolog.api.BasicLevel; 32 33 37 public class MapperJCA_JDBC extends MapperJCA implements PMapperRdb { 38 private RdbAdapter adapter = null; 39 40 public MapperJCA_JDBC() throws PException { 41 super(); 42 } 43 44 public MapperJCA_JDBC(JormConfigurator jc) { 45 super(jc); 46 } 47 48 51 public RdbAdapter getRdbAdapter() { 52 if (adapter == null) { 53 try { 54 String dbn; 55 if (getMapperName().indexOf(".") == -1) 56 dbn = RdbAdapterFactory.DATABASE_NAME_JDBC; 57 else 58 dbn = getMapperName().substring(getMapperName().indexOf(".") + 1); 59 adapter = RdbAdapterFactory.getTypeConverter(dbn); 60 } catch (Exception e) { 61 if (logger != null) { 62 logger.log(BasicLevel.ERROR, "Impossible to find a compatible RdbAdapter:", e); 63 } else { 64 e.printStackTrace(); 65 } 66 } 67 } 68 return adapter; 69 } 70 } 71 | Popular Tags |