use of org.jkiss.dbeaver.model.impl.PropertyDescriptor 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.impl.PropertyDescriptor 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.impl.PropertyDescriptor 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;
}
use of org.jkiss.dbeaver.model.impl.PropertyDescriptor in project dbeaver by serge-rider.
the class WMIPropertySource method getPropertyDescriptors2.
@Override
public DBPPropertyDescriptor[] getPropertyDescriptors2() {
try {
WMIQualifiedObject qualifiedObject = getQualifiedObject();
if (qualifiedObject == null) {
return EMPTY_PROPERTIES;
}
Collection<WMIQualifier> qualifiers = qualifiedObject.getQualifiers();
DBPPropertyDescriptor[] result = new DBPPropertyDescriptor[qualifiers.size()];
int index = 0;
for (WMIQualifier qualifier : qualifiers) {
String name = qualifier.getName();
PropertyDescriptor prop = new PropertyDescriptor("WMI", name, name, null, null, false, null, null, false);
result[index++] = prop;
}
return result;
} catch (WMIException e) {
log.error(e);
return EMPTY_PROPERTIES;
}
}
use of org.jkiss.dbeaver.model.impl.PropertyDescriptor in project dbeaver by serge-rider.
the class PropertySourceAbstract method addProperty.
public synchronized void addProperty(@Nullable String category, Object id, String name, Object value) {
props.add(new PropertyDescriptor(category, id, name, null, value == null ? null : value.getClass(), false, null, null, false));
propValues.put(id, value);
}
Aggregations