made modifications according to comments; need to fix some more

This commit is contained in:
jisookim0513 2014-10-13 23:56:09 -07:00
parent 521398267c
commit 76304d6b7b
3 changed files with 6 additions and 12 deletions

View File

@ -28,23 +28,20 @@ import java.sql.SQLException;
public class DerbyConnectionFactory implements ConnectionFactory
{
private String dbName;
final private String dbName;
public DerbyConnectionFactory(String dbName) {
this.dbName = dbName;
}
public Connection openConnection() throws SQLException {
String nsURL="jdbc:derby://localhost:1527/"+dbName+";create=true";
final String nsURL=String.format("jdbc:derby://localhost:1527/%s;create=true", dbName);
try {
Class.forName("org.apache.derby.jdbc.ClientDriver");
} catch (Exception e) {
throw Throwables.propagate(e);
}
Connection conn = DriverManager.getConnection(nsURL);
return conn;
return DriverManager.getConnection(nsURL);
}
}

View File

@ -59,9 +59,8 @@ public class DerbyConnector extends SQLMetadataConnector
List<Map<String, Object>> tables = handle.select("select * from SYS.SYSTABLES");
boolean tableExists = false;
String existingTableName = "";
String tableNameUpper = tableName.toUpperCase();
for (Map<String, Object> t : tables) {
if (t.get("tablename").equals(tableNameUpper)) {
if (((String)t.get("tablename")).equalsIgnoreCase(tableName)) {
tableExists = true;
existingTableName = (String)t.get("tablename");
}
@ -229,7 +228,7 @@ public class DerbyConnector extends SQLMetadataConnector
public DBI getDBI() { return dbi; }
protected ConnectionFactory getConnectionFactory(String dbName)
private ConnectionFactory getConnectionFactory(String dbName)
{
try {
NetworkServerControl server = new NetworkServerControl(InetAddress.getByName("localhost"),1527);

View File

@ -317,9 +317,8 @@ public class SQLMetadataRuleManager implements MetadataRuleManager
private String getRulesTable() {return dbTables.get().getRulesTable();}
protected List<Rule> getRules(Map<String, Object> stringObjectMap) {
List<Rule> rules = null;
try {
rules = jsonMapper.readValue(
return jsonMapper.readValue(
MapUtils.getString(stringObjectMap, "payload"), new TypeReference<List<Rule>>()
{
}
@ -327,6 +326,5 @@ public class SQLMetadataRuleManager implements MetadataRuleManager
} catch (Exception e) {
throw Throwables.propagate(e);
}
return rules;
}
}