use of org.pentaho.metadata.model.SqlDataSource.DataSourceType in project pentaho-kettle by pentaho.
the class MetadataGenerator method createSqlDataSource.
private SqlDataSource createSqlDataSource(DatabaseMeta databaseMeta) {
SqlDataSource dataSource = new SqlDataSource();
dataSource.setDatabaseName(databaseMeta.getDatabaseName());
dataSource.setHostname(databaseMeta.getHostname());
dataSource.setUsername(databaseMeta.getUsername());
dataSource.setPassword(databaseMeta.getPassword());
dataSource.setPort(databaseMeta.getDatabasePortNumberString());
dataSource.setAttributes(databaseMeta.getExtraOptions());
DataSourceType dataSourceType;
switch(databaseMeta.getAccessType()) {
case DatabaseMeta.TYPE_ACCESS_NATIVE:
dataSourceType = DataSourceType.NATIVE;
break;
case DatabaseMeta.TYPE_ACCESS_ODBC:
dataSourceType = DataSourceType.ODBC;
break;
case DatabaseMeta.TYPE_ACCESS_JNDI:
dataSourceType = DataSourceType.JNDI;
break;
case DatabaseMeta.TYPE_ACCESS_OCI:
dataSourceType = DataSourceType.OCI;
break;
default:
dataSourceType = DataSourceType.CUSTOM;
break;
}
dataSource.setType(dataSourceType);
return dataSource;
}
Aggregations