Search in sources :

Example 11 with GenericConnectorException

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());
}
Also used : ConnectorInstance(com.evolveum.midpoint.provisioning.ucf.api.ConnectorInstance) GenericFrameworkException(com.evolveum.midpoint.provisioning.ucf.api.GenericFrameworkException) GenericConnectorException(com.evolveum.midpoint.provisioning.api.GenericConnectorException) CapabilityCollectionType(com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilityCollectionType) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) CachingMetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.CachingMetadataType)

Aggregations

GenericConnectorException (com.evolveum.midpoint.provisioning.api.GenericConnectorException)11 GenericFrameworkException (com.evolveum.midpoint.provisioning.ucf.api.GenericFrameworkException)5 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)5 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)4 ConnectorInstance (com.evolveum.midpoint.provisioning.ucf.api.ConnectorInstance)4 AsynchronousOperationResult (com.evolveum.midpoint.schema.result.AsynchronousOperationResult)4 QName (javax.xml.namespace.QName)4 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)3 ResourceObjectIdentification (com.evolveum.midpoint.schema.processor.ResourceObjectIdentification)3 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)3 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)2 PropertyDelta (com.evolveum.midpoint.prism.delta.PropertyDelta)2 AttributesToReturn (com.evolveum.midpoint.provisioning.ucf.api.AttributesToReturn)2 ResultHandler (com.evolveum.midpoint.provisioning.ucf.api.ResultHandler)2 ResourceAttributeContainer (com.evolveum.midpoint.schema.processor.ResourceAttributeContainer)2 SearchHierarchyConstraints (com.evolveum.midpoint.schema.processor.SearchHierarchyConstraints)2 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)2 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)2