1 27 package org.objectweb.speedo.mapper.rdb; 28 29 import java.util.Properties ; 30 31 import javax.jdo.PersistenceManagerFactory; 32 33 import org.objectweb.jorm.api.PException; 34 import org.objectweb.jorm.mapper.rdb.lib.ConnectionSpecJDBC; 35 import org.objectweb.speedo.api.SpeedoProperties; 36 import org.objectweb.speedo.mapper.api.ConnectionSpecFactory; 37 38 41 public class JdbcConnectionSpecFactory implements ConnectionSpecFactory { 42 43 public Object getConnectionSpec(PersistenceManagerFactory pmf, 44 String user, 45 String password) { 46 Properties p = pmf.getProperties(); 47 try { 48 return new ConnectionSpecJDBC( 49 p.getProperty(SpeedoProperties.JDO_OPTION_CONNECTION_URL), 50 p.getProperty(SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME), 51 user, 52 password); 53 } catch (PException e) { 54 return null; 55 } 56 } 57 } 58 | Popular Tags |