Search in sources :

Example 1 with PostgreDataSourceProvider

use of org.jkiss.dbeaver.ext.postgresql.PostgreDataSourceProvider in project dbeaver by dbeaver.

the class PostgreDebugAdapterFactory method getAdapter.

@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
    if (adapterType == DBGController.class) {
        if (adaptableObject instanceof DBPDataSourceContainer) {
            DBPDataSourceContainer sourceContainer = (DBPDataSourceContainer) adaptableObject;
            DBPDriver driver = sourceContainer.getDriver();
            if (driver == null) {
                return null;
            }
            DBPDataSourceProvider dataSourceProvider = driver.getDataSourceProvider();
            if (dataSourceProvider instanceof PostgreDataSourceProvider) {
                PostgreDebugController postgreDebugController = new PostgreDebugController(sourceContainer);
                return (T) postgreDebugController;
            }
        }
    } else if (adapterType == DBGResolver.class) {
        if (adaptableObject instanceof DBPDataSourceContainer) {
            DBPDataSourceContainer sourceContainer = (DBPDataSourceContainer) adaptableObject;
            DBPDataSource dataSource = sourceContainer.getDataSource();
            if (dataSource instanceof PostgreDataSource) {
                PostgreDataSource postgeDataSource = (PostgreDataSource) dataSource;
                return (T) new PostgreResolver(postgeDataSource);
            }
        }
    }
    return null;
}
Also used : PostgreDataSource(org.jkiss.dbeaver.ext.postgresql.model.PostgreDataSource) DBGResolver(org.jkiss.dbeaver.debug.DBGResolver) DBPDriver(org.jkiss.dbeaver.model.connection.DBPDriver) PostgreDataSourceProvider(org.jkiss.dbeaver.ext.postgresql.PostgreDataSourceProvider) PostgreDebugController(org.jkiss.dbeaver.ext.postgresql.debug.internal.impl.PostgreDebugController) DBPDataSource(org.jkiss.dbeaver.model.DBPDataSource) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer) DBPDataSourceProvider(org.jkiss.dbeaver.model.DBPDataSourceProvider)

Aggregations

DBGResolver (org.jkiss.dbeaver.debug.DBGResolver)1 PostgreDataSourceProvider (org.jkiss.dbeaver.ext.postgresql.PostgreDataSourceProvider)1 PostgreDebugController (org.jkiss.dbeaver.ext.postgresql.debug.internal.impl.PostgreDebugController)1 PostgreDataSource (org.jkiss.dbeaver.ext.postgresql.model.PostgreDataSource)1 DBPDataSource (org.jkiss.dbeaver.model.DBPDataSource)1 DBPDataSourceContainer (org.jkiss.dbeaver.model.DBPDataSourceContainer)1 DBPDataSourceProvider (org.jkiss.dbeaver.model.DBPDataSourceProvider)1 DBPDriver (org.jkiss.dbeaver.model.connection.DBPDriver)1