use of org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor in project dbeaver by serge-rider.
the class ConnectionPropertiesControl method loadCustomProperties.
private void loadCustomProperties(DBPDriver driver, Map<Object, Object> properties) {
// Collect all driver (and all other) properties
Set<String> propNames = new TreeSet<>();
List<DBPPropertyDescriptor> allProperties = getAllProperties(driver, false);
for (DBPPropertyDescriptor prop : allProperties) {
propNames.add(CommonUtils.toString(prop.getId()));
}
customProperties = new ArrayList<>();
// Find prop values which are not from driver
for (Object propId : properties.keySet()) {
final String propName = propId.toString();
if (!propNames.contains(propName)) {
customProperties.add(new PropertyDescriptor(USER_PROPERTIES_CATEGORY, propName, propName, null, String.class, false, null, null, true));
}
}
Collections.sort(customProperties, PROPERTIES_COMPARATOR);
}
use of org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor in project dbeaver by serge-rider.
the class JDBCDataSourceProvider method readDriverProperties.
private Collection<DBPPropertyDescriptor> readDriverProperties(DBPConnectionConfiguration connectionInfo, Driver driver) throws DBException {
Properties driverProps = new Properties();
//driverProps.putAll(connectionInfo.getProperties());
DriverPropertyInfo[] propDescs;
try {
propDescs = driver.getPropertyInfo(connectionInfo.getUrl(), driverProps);
} catch (Throwable e) {
//$NON-NLS-1$
log.debug("Cannot obtain driver's properties", e);
return null;
}
if (propDescs == null) {
return null;
}
List<DBPPropertyDescriptor> properties = new ArrayList<>();
for (DriverPropertyInfo desc : propDescs) {
if (desc == null || DBConstants.DATA_SOURCE_PROPERTY_USER.equals(desc.name) || DBConstants.DATA_SOURCE_PROPERTY_PASSWORD.equals(desc.name)) {
// Skip user/password properties
continue;
}
desc.value = getConnectionPropertyDefaultValue(desc.name, desc.value);
properties.add(new PropertyDescriptor(ModelMessages.model_jdbc_driver_properties, desc.name, desc.name, desc.description, String.class, desc.required, desc.value, desc.choices, true));
}
return properties;
}
use of org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor in project dbeaver by serge-rider.
the class DriverDescriptor method setDriverParameter.
public void setDriverParameter(String name, String value, boolean setDefault) {
DBPPropertyDescriptor prop = getProviderDescriptor().getDriverProperty(name);
Object valueObject = prop == null ? value : GeneralUtils.convertString(value, prop.getDataType());
customParameters.put(name, valueObject);
if (setDefault) {
defaultParameters.put(name, valueObject);
}
}
use of org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor in project dbeaver by serge-rider.
the class DataFormatterProfile method initDefaultPreferences.
public static void initDefaultPreferences(DBPPreferenceStore store, Locale locale) {
for (DataFormatterDescriptor formatter : DataFormatterRegistry.getInstance().getDataFormatters()) {
Map<Object, Object> defaultProperties = formatter.getSample().getDefaultProperties(locale);
Map<Object, Object> formatterProps = new HashMap<>();
for (DBPPropertyDescriptor prop : formatter.getProperties()) {
Object defaultValue = defaultProperties.get(prop.getId());
if (defaultValue != null) {
PrefUtils.setPreferenceDefaultValue(store, DATAFORMAT_TYPE_PREFIX + formatter.getId() + "." + prop.getId(), defaultValue);
}
}
}
}
use of org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor in project dbeaver by serge-rider.
the class PostgrePlanNode method getPropertyDescriptors2.
@Override
public DBPPropertyDescriptor[] getPropertyDescriptors2() {
DBPPropertyDescriptor[] props = new DBPPropertyDescriptor[attributes.size()];
int index = 0;
for (Map.Entry<String, String> attr : attributes.entrySet()) {
props[index++] = new PropertyDescriptor("Source", attr.getKey(), attr.getKey(), null, String.class, false, null, null, false);
}
return props;
}
Aggregations