Search in sources :

Example 1 with PostgreServerType

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;
}
Also used : PostgreServerType(org.jkiss.dbeaver.ext.postgresql.model.impls.PostgreServerType)

Example 2 with PostgreServerType

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());
}
Also used : DBPDriver(org.jkiss.dbeaver.model.connection.DBPDriver) PostgreServerType(org.jkiss.dbeaver.ext.postgresql.model.impls.PostgreServerType)

Example 3 with PostgreServerType

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();
}
Also used : PostgreServerType(org.jkiss.dbeaver.ext.postgresql.model.impls.PostgreServerType) DBPDataSourceURLProvider(org.jkiss.dbeaver.model.DBPDataSourceURLProvider) DBAAuthModel(org.jkiss.dbeaver.model.auth.DBAAuthModel)

Aggregations

PostgreServerType (org.jkiss.dbeaver.ext.postgresql.model.impls.PostgreServerType)3 DBPDataSourceURLProvider (org.jkiss.dbeaver.model.DBPDataSourceURLProvider)1 DBAAuthModel (org.jkiss.dbeaver.model.auth.DBAAuthModel)1 DBPDriver (org.jkiss.dbeaver.model.connection.DBPDriver)1