use of org.jkiss.dbeaver.ext.postgresql.model.impls.PostgreServerType in project dbeaver by serge-rider.
the class PostgreUtils method getServerType.
public static PostgreServerType getServerType(DBPDriver driver) {
String serverTypeName = CommonUtils.toString(driver.getDriverParameter(PostgreConstants.PROP_SERVER_TYPE));
if (CommonUtils.isEmpty(serverTypeName)) {
serverTypeName = PostgreServerPostgreSQL.TYPE_ID;
}
PostgreServerType serverType = PostgreServerTypeRegistry.getInstance().getServerType(serverTypeName);
if (serverType == null) {
throw new IllegalStateException("PostgreSQL server type '" + serverTypeName + "' not found");
}
return serverType;
}
use of org.jkiss.dbeaver.ext.postgresql.model.impls.PostgreServerType in project dbeaver by serge-rider.
the class PostgreConnectionPage method getImage.
@Override
public Image getImage() {
final DBPDriver driver = site.getDriver();
PostgreServerType serverType = PostgreUtils.getServerType(driver);
return DBeaverIcons.getImage(serverType.getIcon());
}
use of org.jkiss.dbeaver.ext.postgresql.model.impls.PostgreServerType in project dbeaver by serge-rider.
the class PostgreDataSourceProvider method getConnectionURL.
@Override
public String getConnectionURL(DBPDriver driver, DBPConnectionConfiguration connectionInfo) {
DBAAuthModel authModel = connectionInfo.getAuthModel();
if (authModel instanceof DBPDataSourceURLProvider) {
return ((DBPDataSourceURLProvider) authModel).getConnectionURL(driver, connectionInfo);
}
PostgreServerType serverType = PostgreUtils.getServerType(driver);
if (serverType.supportsCustomConnectionURL()) {
return JDBCURL.generateUrlByTemplate(driver, connectionInfo);
}
StringBuilder url = new StringBuilder();
url.append("jdbc:postgresql://");
url.append(connectionInfo.getHostName());
if (!CommonUtils.isEmpty(connectionInfo.getHostPort())) {
url.append(":").append(connectionInfo.getHostPort());
}
url.append("/");
if (!CommonUtils.isEmpty(connectionInfo.getDatabaseName())) {
url.append(connectionInfo.getDatabaseName());
}
// }
return url.toString();
}
Aggregations