Search in sources :

Example 1 with APIOperation

use of org.identityconnectors.framework.api.operations.APIOperation in project midpoint by Evolveum.

the class ConnectorInstanceConnIdImpl method processOperationCapabilities.

private boolean processOperationCapabilities(OperationResult parentResult) {
    capabilities = new ArrayList<>();
    // Create capabilities from supported connector operations
    InternalMonitor.recordConnectorOperation("getSupportedOperations");
    Set<Class<? extends APIOperation>> supportedOperations = connIdConnectorFacade.getSupportedOperations();
    LOGGER.trace("Connector supported operations: {}", supportedOperations);
    boolean supportsSchema = false;
    if (supportedOperations.contains(SchemaApiOp.class)) {
        SchemaCapabilityType capSchema = new SchemaCapabilityType();
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createSchema(capSchema));
        supportsSchema = true;
    }
    if (supportedOperations.contains(SyncApiOp.class)) {
        LiveSyncCapabilityType capSync = new LiveSyncCapabilityType();
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createLiveSync(capSync));
    }
    if (supportedOperations.contains(TestApiOp.class)) {
        TestConnectionCapabilityType capTest = new TestConnectionCapabilityType();
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createTestConnection(capTest));
    }
    if (supportedOperations.contains(CreateApiOp.class)) {
        CreateCapabilityType capCreate = new CreateCapabilityType();
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createCreate(capCreate));
    }
    if (supportedOperations.contains(GetApiOp.class) || supportedOperations.contains(SearchApiOp.class)) {
        ReadCapabilityType capRead = new ReadCapabilityType();
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createRead(capRead));
    }
    if (supportedOperations.contains(UpdateApiOp.class)) {
        UpdateCapabilityType capUpdate = new UpdateCapabilityType();
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createUpdate(capUpdate));
    }
    if (supportedOperations.contains(DeleteApiOp.class)) {
        DeleteCapabilityType capDelete = new DeleteCapabilityType();
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createDelete(capDelete));
    }
    if (supportedOperations.contains(ScriptOnResourceApiOp.class) || supportedOperations.contains(ScriptOnConnectorApiOp.class)) {
        ScriptCapabilityType capScript = new ScriptCapabilityType();
        if (supportedOperations.contains(ScriptOnResourceApiOp.class)) {
            Host host = new Host();
            host.setType(ProvisioningScriptHostType.RESOURCE);
            capScript.getHost().add(host);
        // language is unknown here
        }
        if (supportedOperations.contains(ScriptOnConnectorApiOp.class)) {
            Host host = new Host();
            host.setType(ProvisioningScriptHostType.CONNECTOR);
            capScript.getHost().add(host);
        // language is unknown here
        }
        capabilities.add(CAPABILITY_OBJECT_FACTORY.createScript(capScript));
    }
    return supportsSchema;
}
Also used : UpdateCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.UpdateCapabilityType) ReadCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ReadCapabilityType) DeleteCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.DeleteCapabilityType) GetApiOp(org.identityconnectors.framework.api.operations.GetApiOp) SchemaCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.SchemaCapabilityType) ScriptOnConnectorApiOp(org.identityconnectors.framework.api.operations.ScriptOnConnectorApiOp) TestConnectionCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.TestConnectionCapabilityType) ScriptOnResourceApiOp(org.identityconnectors.framework.api.operations.ScriptOnResourceApiOp) Host(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host) CreateCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CreateCapabilityType) SearchApiOp(org.identityconnectors.framework.api.operations.SearchApiOp) ScriptCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType) LiveSyncCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.LiveSyncCapabilityType) ObjectClass(org.identityconnectors.framework.common.objects.ObjectClass) APIOperation(org.identityconnectors.framework.api.operations.APIOperation)

Example 2 with APIOperation

use of org.identityconnectors.framework.api.operations.APIOperation in project midpoint by Evolveum.

the class ConnIdConfigurationTransformer method transformConnectorTimeoutsConfiguration.

private void transformConnectorTimeoutsConfiguration(APIConfiguration apiConfig, PrismContainer<?> connectorTimeoutsContainer) throws SchemaException {
    if (connectorTimeoutsContainer == null || connectorTimeoutsContainer.getValue() == null) {
        return;
    }
    for (PrismProperty prismProperty : connectorTimeoutsContainer.getValue().getProperties()) {
        QName propertQName = prismProperty.getElementName();
        if (SchemaConstants.NS_ICF_CONFIGURATION.equals(propertQName.getNamespaceURI())) {
            String opName = propertQName.getLocalPart();
            Collection<Class<? extends APIOperation>> apiOpClasses = ConnectorFactoryConnIdImpl.resolveApiOpClass(opName);
            if (apiOpClasses != null) {
                for (Class<? extends APIOperation> apiOpClass : apiOpClasses) {
                    apiConfig.setTimeout(apiOpClass, parseInt(prismProperty));
                }
            } else {
                throw new SchemaException("Unknown operation name " + opName + " in " + ConnectorFactoryConnIdImpl.CONNECTOR_SCHEMA_TIMEOUTS_XML_ELEMENT_NAME);
            }
        }
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) PrismProperty(com.evolveum.midpoint.prism.PrismProperty) QName(javax.xml.namespace.QName) GuardedString(org.identityconnectors.common.security.GuardedString) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) APIOperation(org.identityconnectors.framework.api.operations.APIOperation)

Aggregations

APIOperation (org.identityconnectors.framework.api.operations.APIOperation)2 PrismProperty (com.evolveum.midpoint.prism.PrismProperty)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 CreateCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CreateCapabilityType)1 DeleteCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.DeleteCapabilityType)1 LiveSyncCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.LiveSyncCapabilityType)1 ReadCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ReadCapabilityType)1 SchemaCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.SchemaCapabilityType)1 ScriptCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType)1 Host (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host)1 TestConnectionCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.TestConnectionCapabilityType)1 UpdateCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.UpdateCapabilityType)1 QName (javax.xml.namespace.QName)1 GuardedString (org.identityconnectors.common.security.GuardedString)1 GetApiOp (org.identityconnectors.framework.api.operations.GetApiOp)1 ScriptOnConnectorApiOp (org.identityconnectors.framework.api.operations.ScriptOnConnectorApiOp)1 ScriptOnResourceApiOp (org.identityconnectors.framework.api.operations.ScriptOnResourceApiOp)1 SearchApiOp (org.identityconnectors.framework.api.operations.SearchApiOp)1 ObjectClass (org.identityconnectors.framework.common.objects.ObjectClass)1