Search in sources :

Example 1 with DBPInformationProvider

use of org.jkiss.dbeaver.model.DBPInformationProvider in project dbeaver by serge-rider.

the class DataSourceUtils method getDataSourceAddressText.

@NotNull
public static String getDataSourceAddressText(DBPDataSourceContainer dataSourceContainer) {
    DBPDataSourceProvider dataSourceProvider = dataSourceContainer.getDriver().getDataSourceProvider();
    if (dataSourceProvider instanceof DBPInformationProvider) {
        String objectInformation = ((DBPInformationProvider) dataSourceProvider).getObjectInformation(dataSourceContainer, DBPInformationProvider.INFO_TARGET_ADDRESS);
        if (!CommonUtils.isEmpty(objectInformation)) {
            return objectInformation;
        }
    }
    DBPConnectionConfiguration cfg = dataSourceContainer.getConnectionConfiguration();
    String hostText = getTargetTunnelHostName(cfg);
    String hostPort = cfg.getHostPort();
    if (!CommonUtils.isEmpty(hostPort)) {
        return hostText + ":" + hostPort;
    }
    return hostText;
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) DBPInformationProvider(org.jkiss.dbeaver.model.DBPInformationProvider) DBPDataSourceProvider(org.jkiss.dbeaver.model.DBPDataSourceProvider) NotNull(org.jkiss.code.NotNull)

Example 2 with DBPInformationProvider

use of org.jkiss.dbeaver.model.DBPInformationProvider in project dbeaver by dbeaver.

the class DataSourceUtils method getDataSourceAddressText.

@NotNull
public static String getDataSourceAddressText(DBPDataSourceContainer dataSourceContainer) {
    DBPDataSourceProvider dataSourceProvider = dataSourceContainer.getDriver().getDataSourceProvider();
    if (dataSourceProvider instanceof DBPInformationProvider) {
        String objectInformation = ((DBPInformationProvider) dataSourceProvider).getObjectInformation(dataSourceContainer, DBPInformationProvider.INFO_TARGET_ADDRESS);
        if (!CommonUtils.isEmpty(objectInformation)) {
            return objectInformation;
        }
    }
    DBPConnectionConfiguration cfg = dataSourceContainer.getConnectionConfiguration();
    String hostText = getTargetTunnelHostName(cfg);
    String hostPort = cfg.getHostPort();
    if (!CommonUtils.isEmpty(hostPort)) {
        return hostText + ":" + hostPort;
    }
    return hostText;
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) DBPInformationProvider(org.jkiss.dbeaver.model.DBPInformationProvider) DBPDataSourceProvider(org.jkiss.dbeaver.model.DBPDataSourceProvider) NotNull(org.jkiss.code.NotNull)

Aggregations

NotNull (org.jkiss.code.NotNull)2 DBPDataSourceProvider (org.jkiss.dbeaver.model.DBPDataSourceProvider)2 DBPInformationProvider (org.jkiss.dbeaver.model.DBPInformationProvider)2 DBPConnectionConfiguration (org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration)2