use of com.sldeditor.datasource.extension.filesystem.node.file.FileHandlerInterface in project sldeditor by robward-scisys.
the class DatabaseConnectionFactory method getConnection.
/**
* Gets the database connection.
*
* @param filename the filename
* @return the new connection
*/
public static DatabaseConnection getConnection(String filename) {
List<FileHandlerInterface> list = getFileHandlers();
if (filename != null) {
for (FileHandlerInterface handler : list) {
for (String fileExtension : handler.getFileExtensionList()) {
if (filename.endsWith(fileExtension)) {
String dbConnectionType = fileHandlerMap.get(handler);
DatabaseConnection dbConnection = createDefault(dbConnectionType);
Map<String, String> connectionDataMap = new HashMap<String, String>();
connectionDataMap.put(JDBCDataStoreFactory.DATABASE.key, filename);
dbConnection.setConnectionDataMap(connectionDataMap);
return dbConnection;
}
}
}
}
return null;
}
Aggregations