Search in sources :

Example 1 with DeleteCapabilityType

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.DeleteCapabilityType 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 DeleteCapabilityType

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.DeleteCapabilityType in project midpoint by Evolveum.

the class TestOpenDj method test005Capabilities.

@Test
public void test005Capabilities() throws Exception {
    final String TEST_NAME = "test005Capabilities";
    TestUtil.displayTestTile(TEST_NAME);
    // GIVEN
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    // WHEN
    ResourceType resource = provisioningService.getObject(ResourceType.class, RESOURCE_OPENDJ_OID, null, task, result).asObjectable();
    // THEN
    display("Resource from provisioninig", resource);
    display("Resource from provisioninig (XML)", PrismTestUtil.serializeObjectToString(resource.asPrismObject(), PrismContext.LANG_XML));
    CapabilityCollectionType nativeCapabilities = resource.getCapabilities().getNative();
    List<Object> nativeCapabilitiesList = nativeCapabilities.getAny();
    assertFalse("Empty capabilities returned", nativeCapabilitiesList.isEmpty());
    CredentialsCapabilityType capCred = CapabilityUtil.getCapability(nativeCapabilitiesList, CredentialsCapabilityType.class);
    assertNotNull("credentials capability not found", capCred);
    PasswordCapabilityType capPassword = capCred.getPassword();
    assertNotNull("password capability not present", capPassword);
    assertPasswordCapability(capPassword);
    // Connector cannot do activation, this should be null
    ActivationCapabilityType capAct = CapabilityUtil.getCapability(nativeCapabilitiesList, ActivationCapabilityType.class);
    assertNull("Found activation capability while not expecting it", capAct);
    ScriptCapabilityType capScript = CapabilityUtil.getCapability(nativeCapabilitiesList, ScriptCapabilityType.class);
    assertNotNull("No script capability", capScript);
    List<Host> scriptHosts = capScript.getHost();
    assertEquals("Wrong number of script hosts", 1, scriptHosts.size());
    Host scriptHost = scriptHosts.get(0);
    assertEquals("Wrong script host type", ProvisioningScriptHostType.CONNECTOR, scriptHost.getType());
    //        assertEquals("Wrong script host language", ....., scriptHost.getLanguage());
    CreateCapabilityType capCreate = CapabilityUtil.getCapability(nativeCapabilitiesList, CreateCapabilityType.class);
    assertNotNull("No create capability", capCreate);
    ReadCapabilityType capRead = CapabilityUtil.getCapability(nativeCapabilitiesList, ReadCapabilityType.class);
    assertNotNull("No read capability", capRead);
    UpdateCapabilityType capUpdate = CapabilityUtil.getCapability(nativeCapabilitiesList, UpdateCapabilityType.class);
    assertNotNull("No update capability", capUpdate);
    DeleteCapabilityType capDelete = CapabilityUtil.getCapability(nativeCapabilitiesList, DeleteCapabilityType.class);
    assertNotNull("No delete capability", capDelete);
    List<Object> effectiveCapabilities = ResourceTypeUtil.getEffectiveCapabilities(resource);
    for (Object capability : effectiveCapabilities) {
        System.out.println("Capability: " + CapabilityUtil.getCapabilityDisplayName(capability) + " : " + capability);
    }
    capCred = ResourceTypeUtil.getEffectiveCapability(resource, CredentialsCapabilityType.class);
    assertNotNull("credentials effective capability not found", capCred);
    assertNotNull("password effective capability not found", capCred.getPassword());
    // Although connector does not support activation, the resource specifies a way how to simulate it.
    // Therefore the following should succeed
    capAct = ResourceTypeUtil.getEffectiveCapability(resource, ActivationCapabilityType.class);
    assertNotNull("activation capability not found", capAct);
    PagedSearchCapabilityType capPage = ResourceTypeUtil.getEffectiveCapability(resource, PagedSearchCapabilityType.class);
    assertNotNull("paged search capability not present", capPage);
    assertShadows(1);
}
Also used : UpdateCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.UpdateCapabilityType) Task(com.evolveum.midpoint.task.api.Task) ReadCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ReadCapabilityType) DeleteCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.DeleteCapabilityType) PasswordCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.PasswordCapabilityType) CapabilityCollectionType(com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilityCollectionType) ActivationCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) Host(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host) CreateCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CreateCapabilityType) PagedSearchCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.PagedSearchCapabilityType) ScriptCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType) CredentialsCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CredentialsCapabilityType) PrismObject(com.evolveum.midpoint.prism.PrismObject) Test(org.testng.annotations.Test)

Example 3 with DeleteCapabilityType

use of com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.DeleteCapabilityType in project midpoint by Evolveum.

the class AbstractManualConnectorInstance method fetchCapabilities.

@Override
public Collection<Object> fetchCapabilities(OperationResult parentResult) throws CommunicationException, GenericFrameworkException, ConfigurationException {
    Collection<Object> capabilities = new ArrayList<>();
    // caching-only read capabilities
    ReadCapabilityType readCap = new ReadCapabilityType();
    readCap.setCachingOnly(true);
    capabilities.add(CAPABILITY_OBJECT_FACTORY.createRead(readCap));
    CreateCapabilityType createCap = new CreateCapabilityType();
    setManual(createCap);
    capabilities.add(CAPABILITY_OBJECT_FACTORY.createCreate(createCap));
    UpdateCapabilityType updateCap = new UpdateCapabilityType();
    setManual(updateCap);
    capabilities.add(CAPABILITY_OBJECT_FACTORY.createUpdate(updateCap));
    DeleteCapabilityType deleteCap = new DeleteCapabilityType();
    setManual(deleteCap);
    capabilities.add(CAPABILITY_OBJECT_FACTORY.createDelete(deleteCap));
    ActivationCapabilityType activationCap = new ActivationCapabilityType();
    ActivationStatusCapabilityType activationStatusCap = new ActivationStatusCapabilityType();
    activationCap.setStatus(activationStatusCap);
    capabilities.add(CAPABILITY_OBJECT_FACTORY.createActivation(activationCap));
    CredentialsCapabilityType credentialsCap = new CredentialsCapabilityType();
    PasswordCapabilityType passwordCapabilityType = new PasswordCapabilityType();
    credentialsCap.setPassword(passwordCapabilityType);
    capabilities.add(CAPABILITY_OBJECT_FACTORY.createCredentials(credentialsCap));
    return capabilities;
}
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) PasswordCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.PasswordCapabilityType) ActivationCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType) CredentialsCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CredentialsCapabilityType) ArrayList(java.util.ArrayList) PrismObject(com.evolveum.midpoint.prism.PrismObject) ActivationStatusCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationStatusCapabilityType) CreateCapabilityType(com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CreateCapabilityType)

Aggregations

CreateCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CreateCapabilityType)3 DeleteCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.DeleteCapabilityType)3 ReadCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ReadCapabilityType)3 UpdateCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.UpdateCapabilityType)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 ActivationCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)2 CredentialsCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CredentialsCapabilityType)2 PasswordCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.PasswordCapabilityType)2 ScriptCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType)2 Host (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 Task (com.evolveum.midpoint.task.api.Task)1 CapabilityCollectionType (com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilityCollectionType)1 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)1 ActivationStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationStatusCapabilityType)1 LiveSyncCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.LiveSyncCapabilityType)1 PagedSearchCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.PagedSearchCapabilityType)1 SchemaCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.SchemaCapabilityType)1 TestConnectionCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.TestConnectionCapabilityType)1 ArrayList (java.util.ArrayList)1