use of com.evolveum.midpoint.provisioning.ucf.api.connectors.AbstractManualConnectorInstance in project midpoint by Evolveum.
the class ConnectorManager method configureConnector.
private void configureConnector(ConnectorInstance connector, ConnectorSpec connectorSpec, OperationResult result) throws SchemaException, CommunicationException, ConfigurationException {
PrismContainerValue<ConnectorConfigurationType> connectorConfigurationVal = connectorSpec.getConnectorConfiguration() != null ? connectorSpec.getConnectorConfiguration().getValue() : null;
if (connectorConfigurationVal == null) {
SchemaException e = new SchemaException("No connector configuration in " + connectorSpec);
if (connector instanceof AbstractManualConnectorInstance) {
result.recordWarning(e);
return;
}
result.recordFatalError(e);
throw e;
}
try {
InternalMonitor.recordCount(InternalCounters.CONNECTOR_INSTANCE_CONFIGURATION_COUNT);
connector.configure(connectorConfigurationVal, ResourceTypeUtil.getSchemaGenerationConstraints(connectorSpec.getResource()), result);
ResourceSchema resourceSchema = ResourceSchemaFactory.getRawSchema(connectorSpec.getResource());
Collection<Object> capabilities = ResourceTypeUtil.getNativeCapabilitiesCollection(connectorSpec.getResource().asObjectable());
connector.initialize(resourceSchema, capabilities, ResourceTypeUtil.isCaseIgnoreAttributeNames(connectorSpec.getResource().asObjectable()), result);
} catch (GenericFrameworkException e) {
// Not expected. Transform to system exception
result.recordFatalError("Generic provisioning framework error", e);
throw new SystemException("Generic provisioning framework error: " + e.getMessage(), e);
} catch (CommunicationException | ConfigurationException e) {
result.recordFatalError(e);
throw e;
}
}
Aggregations