use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.DatabaseVendor in project cloudbreak by hortonworks.
the class SupportedDatabaseProvider method getSupportedServiceEntry.
private static SupportedExternalDatabaseServiceEntry getSupportedServiceEntry(String name, DatabaseVendor... vendors) {
SupportedExternalDatabaseServiceEntry entry = new SupportedExternalDatabaseServiceEntry();
entry.setName(name.toUpperCase().replaceAll(" ", "_"));
entry.setDisplayName(name);
for (DatabaseVendor databaseVendor : vendors) {
entry.getDatabases().add(new SupportedDatabaseEntry(databaseVendor.name(), databaseVendor.displayName(), databaseVendor.jdbcUrlDriverId(), databaseVendor.versions()));
}
return entry;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.DatabaseVendor in project cloudbreak by hortonworks.
the class DatabaseVendorUtilTest method testValidUrls.
@Test
public void testValidUrls() {
for (DatabaseVendor databaseVendor : TO_TEST) {
String jdbcUrl = "jdbc:" + databaseVendor.jdbcUrlDriverId() + ":etc";
Optional<DatabaseVendor> foundVendor = underTest.getVendorByJdbcUrl(jdbcUrl);
assertFalse(foundVendor.isEmpty());
assertEquals("Expected " + databaseVendor + " but got " + foundVendor.get(), databaseVendor, foundVendor.get());
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.DatabaseVendor in project cloudbreak by hortonworks.
the class DatabaseV4RequestToRDSConfigConverter method convert.
public RDSConfig convert(DatabaseV4Request source) {
RDSConfig rdsConfig = new RDSConfig();
if (Strings.isNullOrEmpty(source.getName())) {
rdsConfig.setName(missingResourceNameGenerator.generateName(APIResourceType.RDS_CONFIG));
} else {
rdsConfig.setName(source.getName());
}
rdsConfig.setDescription(source.getDescription());
rdsConfig.setConnectionURL(source.getConnectionURL());
DatabaseVendor databaseVendor = DatabaseVendor.getVendorByJdbcUrl(source).get();
rdsConfig.setDatabaseEngine(databaseVendor);
rdsConfig.setConnectionDriver(databaseVendor.connectionDriver());
rdsConfig.setConnectionUserName(source.getConnectionUserName());
rdsConfig.setConnectionPassword(source.getConnectionPassword());
rdsConfig.setCreationDate(new Date().getTime());
rdsConfig.setStatus(ResourceStatus.USER_MANAGED);
rdsConfig.setType(source.getType());
if (rdsConfig.getDatabaseEngine() != DatabaseVendor.POSTGRES && StringUtils.isEmpty(source.getConnectorJarUrl())) {
String msg = String.format("The 'connectorJarUrl' field needs to be specified for database engine: '%s'.", rdsConfig.getDatabaseEngine());
LOGGER.info(msg);
}
rdsConfig.setConnectorJarUrl(source.getConnectorJarUrl());
return rdsConfig;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.DatabaseVendor in project cloudbreak by hortonworks.
the class RDSConfigToDatabaseV4RequestConverter method convert.
public DatabaseV4Request convert(RDSConfig source) {
DatabaseV4Request rdsConfigRequest = new DatabaseV4Request();
rdsConfigRequest.setName(source.getName());
rdsConfigRequest.setConnectorJarUrl(source.getConnectorJarUrl());
rdsConfigRequest.setConnectionUserName("fake-username");
rdsConfigRequest.setConnectionPassword("fake-password");
rdsConfigRequest.setConnectionURL(source.getConnectionURL());
rdsConfigRequest.setType(source.getType());
DatabaseVendor databaseEngine = source.getDatabaseEngine();
rdsConfigRequest.setOracle(prepareOracleRequest(databaseEngine));
return rdsConfigRequest;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.DatabaseVendor in project cloudbreak by hortonworks.
the class RDSConfigToDatabaseV4RequestConverter method prepareOracleRequest.
public OracleParameters prepareOracleRequest(DatabaseVendor databaseEngine) {
OracleParameters oracleParameters = null;
if (ORACLE12.equals(databaseEngine) || ORACLE11.equals(databaseEngine)) {
oracleParameters = new OracleParameters();
oracleParameters.setVersion(databaseEngine.versions().stream().findFirst().get());
}
return oracleParameters;
}
Aggregations