use of org.jkiss.dbeaver.model.connection.DBPDriver in project dbeaver by serge-rider.
the class DataTypeProviderRegistry method getDataTypeProvider.
////////////////////////////////////////////////////
// DataType providers
@Nullable
public DBDValueHandlerProvider getDataTypeProvider(@NotNull DBPDataSource dataSource, @NotNull DBSTypedObject typedObject) {
DBPDriver driver = dataSource.getContainer().getDriver();
if (!(driver instanceof DriverDescriptor)) {
log.warn("Bad datasource specified (driver is not recognized by registry) - " + dataSource);
return null;
}
DataSourceProviderDescriptor dsProvider = ((DriverDescriptor) driver).getProviderDescriptor();
// First try to find type provider for specific datasource type
for (ValueHandlerDescriptor dtProvider : dataTypeProviders) {
if (!dtProvider.isGlobal() && dtProvider.supportsDataSource(dataSource, dsProvider) && dtProvider.supportsType(typedObject)) {
return dtProvider.getInstance();
}
}
// Find in global providers
for (ValueHandlerDescriptor dtProvider : dataTypeProviders) {
if (dtProvider.isGlobal() && dtProvider.supportsType(typedObject)) {
return dtProvider.getInstance();
}
}
return null;
}
Aggregations