use of com.evolveum.midpoint.provisioning.api.GenericConnectorException in project midpoint by Evolveum.
the class ResourceManager method completeConnectorCapabilities.
private void completeConnectorCapabilities(ConnectorSpec connectorSpec, CapabilitiesType capType, ItemPath itemPath, boolean forceRefresh, Collection<Object> retrievedCapabilities, Collection<ItemDelta<?, ?>> modifications, OperationResult result) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException {
if (!forceRefresh && capType.getNative() != null && !capType.getNative().getAny().isEmpty()) {
return;
}
if (retrievedCapabilities == null) {
try {
InternalMonitor.recordConnectorCapabilitiesFetchCount();
ConnectorInstance connector = connectorManager.getConfiguredConnectorInstance(connectorSpec, false, result);
retrievedCapabilities = connector.fetchCapabilities(result);
} catch (GenericFrameworkException e) {
throw new GenericConnectorException("Generic error in connector " + connectorSpec + ": " + e.getMessage(), e);
}
}
CapabilityCollectionType nativeCapType = new CapabilityCollectionType();
capType.setNative(nativeCapType);
nativeCapType.getAny().addAll(retrievedCapabilities);
CachingMetadataType cachingMetadata = MiscSchemaUtil.generateCachingMetadata();
capType.setCachingMetadata(cachingMetadata);
ObjectDelta<ResourceType> capabilitiesReplaceDelta = ObjectDelta.createModificationReplaceContainer(ResourceType.class, connectorSpec.getResource().getOid(), itemPath, prismContext, capType.asPrismContainerValue().clone());
modifications.addAll(capabilitiesReplaceDelta.getModifications());
}
Aggregations