use of org.identityconnectors.framework.api.ConfigurationProperty in project midpoint by Evolveum.
the class ConnIdConfigurationTransformer method transformConnectorConfigurationProperties.
private void transformConnectorConfigurationProperties(ConfigurationProperties configProps, PrismContainer<?> configurationPropertiesContainer, String connectorConfNs) throws ConfigurationException, SchemaException {
if (configurationPropertiesContainer == null || configurationPropertiesContainer.getValue() == null) {
throw new SchemaException("No configuration properties container in " + connectorType);
}
int numConfingProperties = 0;
List<QName> wrongNamespaceProperties = new ArrayList<>();
for (PrismProperty prismProperty : configurationPropertiesContainer.getValue().getProperties()) {
QName propertyQName = prismProperty.getElementName();
// namespace.
if (propertyQName.getNamespaceURI() == null || !propertyQName.getNamespaceURI().equals(connectorConfNs)) {
LOGGER.warn("Found element with a wrong namespace ({}) in {}", propertyQName.getNamespaceURI(), connectorType);
wrongNamespaceProperties.add(propertyQName);
} else {
numConfingProperties++;
// Local name of the element is the same as the name
// of ConnId configuration property
String propertyName = propertyQName.getLocalPart();
ConfigurationProperty property = configProps.getProperty(propertyName);
if (property == null) {
throw new ConfigurationException("Unknown configuration property " + propertyName);
}
Class<?> type = property.getType();
if (type.isArray()) {
Object[] connIdArray = convertToConnIdArray(prismProperty, type.getComponentType());
if (connIdArray != null && connIdArray.length != 0) {
property.setValue(connIdArray);
}
} else {
Object connIdValue = convertToConnIdSingle(prismProperty, type);
if (connIdValue != null) {
property.setValue(connIdValue);
}
}
}
}
// empty configuration is OK e.g. when creating a new resource using wizard
if (numConfingProperties == 0 && !wrongNamespaceProperties.isEmpty()) {
throw new SchemaException("No configuration properties found. Wrong namespace? (expected: " + connectorConfNs + ", present e.g. " + wrongNamespaceProperties.get(0) + ")");
}
}
use of org.identityconnectors.framework.api.ConfigurationProperty in project CzechIdMng by bcvsolutions.
the class ConnIdIcConvertUtil method convertConnIdConnectorConfiguration.
public static IcConnectorConfiguration convertConnIdConnectorConfiguration(APIConfiguration conf) {
if (conf == null) {
return null;
}
IcConnectorConfigurationImpl dto = new IcConnectorConfigurationImpl();
dto.setConnectorPoolingSupported(conf.isConnectorPoolingSupported());
dto.setProducerBufferSize(conf.getProducerBufferSize());
ConfigurationProperties properties = conf.getConfigurationProperties();
IcConfigurationPropertiesImpl propertiesDto = new IcConfigurationPropertiesImpl();
if (properties != null && properties.getPropertyNames() != null) {
List<String> propertyNames = properties.getPropertyNames();
for (String name : propertyNames) {
ConfigurationProperty property = properties.getProperty(name);
IcConfigurationPropertyImpl propertyDto = (IcConfigurationPropertyImpl) convertConnIdConfigurationProperty(property);
if (propertiesDto != null) {
propertiesDto.getProperties().add(propertyDto);
}
}
}
dto.setConfigurationProperties(propertiesDto);
IcObjectPoolConfigurationImpl connectorPoolConfiguration = (IcObjectPoolConfigurationImpl) convertConnIdPoolConfiguration(conf.getConnectorPoolConfiguration());
dto.setConnectorPoolConfiguration(connectorPoolConfiguration);
dto.setOperationOptions(Collections.emptyMap());
return dto;
}
Aggregations