public Connection(Properties info) { this.info = info; this.dbi = new DBI( info.getProperty("url"), info.getProperty("user"), info.getProperty("password")); if (Boolean.parseBoolean(info.getProperty("encrypt", "false"))) { dbi.define("encryptClass", new AESEncrypt(info.getProperty("encryptionKey"))); } else { dbi.define("encryptClass", new NoopEncrypt()); } }
public DSSet getDSSet() { if (this.dsSet == null) { DSSetDAO dsSetDAO = dbi.onDemand(DSSetDAO.class); if (info.containsKey("dsSetId")) { this.dsSet = dsSetDAO.find(Integer.parseInt(info.getProperty("dsSetId"))); } else { List<DSSet> dsSets = dsSetDAO.findAll(); this.dsSet = dsSets.get(0); } dbi.define("dsSetId", dsSet.getId()); } return dsSet; }
/** * See org.springframework.beans.factory.FactoryBean#getObject */ public Object getObject() throws Exception { final DBI dbi = new DBI(new SpringDataSourceConnectionFactory(dataSource)); if (statementLocator != null) { dbi.setStatementLocator(statementLocator); } for (Map.Entry<String, Object> entry : globalDefines.entrySet()) { dbi.define(entry.getKey(), entry.getValue()); } return dbi; }
/** * See org.springframework.beans.factory.FactoryBean#getObject */ @Override public Object getObject() throws Exception { final DBI dbi = new DBI(new SpringDataSourceConnectionFactory(dataSource)); if (statementLocator != null) { dbi.setStatementLocator(statementLocator); } for (Map.Entry<String, Object> entry : globalDefines.entrySet()) { dbi.define(entry.getKey(), entry.getValue()); } return dbi; }