CB-779 athena db use provider property for s3 location (#1077)

This commit is contained in:
Ainur
2022-08-31 10:57:26 +03:00
committed by GitHub
parent 57b95a0c5b
commit 94c8fa0cd6
3 changed files with 14 additions and 1 deletions
@@ -198,6 +198,7 @@ type DriverInfo {
embedded: Boolean
enabled: Boolean!
requiresServerName: Boolean
requiresDatabaseName: Boolean
licenseRequired: Boolean
license: String
@@ -169,7 +169,6 @@ public class WebServiceUtils extends WebCommonUtils {
if (config.getServerName() != null) {
dsConfig.setServerName(config.getServerName());
}
dsConfig.setUrl(driver.getConnectionURL(dsConfig));
}
if (config.getProperties() != null) {
Map<String, String> newProps = new LinkedHashMap<>();
@@ -197,6 +196,9 @@ public class WebServiceUtils extends WebCommonUtils {
if (config.getConfigurationType() != null) {
dsConfig.setConfigurationType(config.getConfigurationType());
}
if (CommonUtils.isEmpty(config.getUrl())) {
dsConfig.setUrl(driver.getConnectionURL(dsConfig));
}
// Save network handlers
if (config.getNetworkHandlersConfig() != null) {
for (WebNetworkHandlerConfigInput nhc : config.getNetworkHandlersConfig()) {
@@ -44,6 +44,7 @@ import java.util.Map;
public class WebDatabaseDriverConfig {
public static final String URL_SERVER_FIELD = "{server}";
public static final String URL_DATABASE_FIELD = ".*(?:\\{(?:database|file|folder)}).*";
private final WebSession webSession;
private final DBPDriver driver;
private String id;
@@ -249,4 +250,13 @@ public class WebDatabaseDriverConfig {
public DBPDriverConfigurationType[] getConfigurationTypes() {
return driver.getSupportedConfigurationTypes().toArray(DBPDriverConfigurationType[]::new);
}
@Property
public boolean getRequiresDatabaseName() {
if (driver.getSampleURL() == null) {
return false;
}
return driver.getSampleURL().matches(URL_DATABASE_FIELD);
}
}