Search in sources :

Example 1 with ConnectionString

use of com.ctrip.platform.dal.dao.configure.ConnectionString in project dal by ctripcorp.

the class PropertyFileConnectionStringProvider method getConnectionStrings.

@Override
public Map<String, DalConnectionString> getConnectionStrings(Set<String> names) throws Exception {
    if (names == null || names.isEmpty())
        return null;
    Map<String, DalConnectionString> map = new HashMap<>();
    for (String name : names) {
        StringBuilder sb = new StringBuilder();
        sb.append(properties.getProperty(name + USER_NAME));
        sb.append(COMMA);
        sb.append(properties.getProperty(name + PASSWORD));
        sb.append(COMMA);
        sb.append(properties.getProperty(name + CONNECTION_URL));
        sb.append(COMMA);
        sb.append(properties.getProperty(name + DRIVER_CLASS_NAME));
        DalConnectionString connectionString = new ConnectionString(name, sb.toString(), sb.toString());
        map.put(name, connectionString);
    }
    return map;
}
Also used : HashMap(java.util.HashMap) DalConnectionString(com.ctrip.platform.dal.dao.configure.DalConnectionString) ConnectionString(com.ctrip.platform.dal.dao.configure.ConnectionString) DalConnectionString(com.ctrip.platform.dal.dao.configure.DalConnectionString) ConnectionString(com.ctrip.platform.dal.dao.configure.ConnectionString) DalConnectionString(com.ctrip.platform.dal.dao.configure.DalConnectionString)

Aggregations

ConnectionString (com.ctrip.platform.dal.dao.configure.ConnectionString)1 DalConnectionString (com.ctrip.platform.dal.dao.configure.DalConnectionString)1 HashMap (java.util.HashMap)1