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;
}
Aggregations