Search in sources :

Example 11 with LDIFReader

use of org.opends.server.util.LDIFReader in project midpoint by Evolveum.

the class OpenDJController method addEntry.

public void addEntry(String ldif) throws IOException, LDIFException {
    LDIFImportConfig importConfig = new LDIFImportConfig(IOUtils.toInputStream(ldif, "utf-8"));
    LDIFReader ldifReader = new LDIFReader(importConfig);
    Entry ldifEntry = ldifReader.readEntry();
    addEntry(ldifEntry);
}
Also used : Entry(org.opends.server.types.Entry) ChangeRecordEntry(org.opends.server.util.ChangeRecordEntry) ModifyChangeRecordEntry(org.opends.server.util.ModifyChangeRecordEntry) SearchResultEntry(org.opends.server.types.SearchResultEntry) ModifyDNChangeRecordEntry(org.opends.server.util.ModifyDNChangeRecordEntry) JarEntry(java.util.jar.JarEntry) LDIFImportConfig(org.opends.server.types.LDIFImportConfig) LDIFReader(org.opends.server.util.LDIFReader)

Example 12 with LDIFReader

use of org.opends.server.util.LDIFReader in project midpoint by Evolveum.

the class OpenDJController method executeLdifChange.

public ChangeRecordEntry executeLdifChange(File file) throws IOException, LDIFException {
    LDIFImportConfig importConfig = new LDIFImportConfig(file.getPath());
    LDIFReader ldifReader = new LDIFReader(importConfig);
    ChangeRecordEntry entry = ldifReader.readChangeRecord(false);
    ModifyOperation modifyOperation = getInternalConnection().processModify((ModifyChangeRecordEntry) entry);
    if (ResultCode.SUCCESS != modifyOperation.getResultCode()) {
        throw new RuntimeException("LDAP operation error: " + modifyOperation.getResultCode() + ": " + modifyOperation.getErrorMessage());
    }
    return entry;
}
Also used : ChangeRecordEntry(org.opends.server.util.ChangeRecordEntry) ModifyChangeRecordEntry(org.opends.server.util.ModifyChangeRecordEntry) ModifyDNChangeRecordEntry(org.opends.server.util.ModifyDNChangeRecordEntry) LDIFImportConfig(org.opends.server.types.LDIFImportConfig) LDIFReader(org.opends.server.util.LDIFReader) ModifyOperation(org.opends.server.core.ModifyOperation)

Example 13 with LDIFReader

use of org.opends.server.util.LDIFReader in project midpoint by Evolveum.

the class OpenDJController method executeLdifChange.

public ChangeRecordEntry executeLdifChange(String ldif) throws IOException, LDIFException {
    InputStream ldifInputStream = IOUtils.toInputStream(ldif, "UTF-8");
    LDIFImportConfig importConfig = new LDIFImportConfig(ldifInputStream);
    LDIFReader ldifReader = new LDIFReader(importConfig);
    ChangeRecordEntry entry = ldifReader.readChangeRecord(false);
    ModifyOperation modifyOperation = getInternalConnection().processModify((ModifyChangeRecordEntry) entry);
    if (ResultCode.SUCCESS != modifyOperation.getResultCode()) {
        throw new RuntimeException("LDAP operation error: " + modifyOperation.getResultCode() + ": " + modifyOperation.getErrorMessage());
    }
    return entry;
}
Also used : ChangeRecordEntry(org.opends.server.util.ChangeRecordEntry) ModifyChangeRecordEntry(org.opends.server.util.ModifyChangeRecordEntry) ModifyDNChangeRecordEntry(org.opends.server.util.ModifyDNChangeRecordEntry) InputStream(java.io.InputStream) LDIFImportConfig(org.opends.server.types.LDIFImportConfig) LDIFReader(org.opends.server.util.LDIFReader) ModifyOperation(org.opends.server.core.ModifyOperation)

Aggregations

LDIFImportConfig (org.opends.server.types.LDIFImportConfig)13 LDIFReader (org.opends.server.util.LDIFReader)13 Entry (org.opends.server.types.Entry)10 ChangeRecordEntry (org.opends.server.util.ChangeRecordEntry)6 ModifyChangeRecordEntry (org.opends.server.util.ModifyChangeRecordEntry)6 ModifyDNChangeRecordEntry (org.opends.server.util.ModifyDNChangeRecordEntry)6 JarEntry (java.util.jar.JarEntry)3 SearchResultEntry (org.opends.server.types.SearchResultEntry)3 SynchornizationServiceMock (com.evolveum.midpoint.provisioning.impl.mock.SynchornizationServiceMock)2 ResourceShadowDiscriminator (com.evolveum.midpoint.schema.ResourceShadowDiscriminator)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 Task (com.evolveum.midpoint.task.api.Task)2 AbstractIntegrationTest (com.evolveum.midpoint.test.AbstractIntegrationTest)2 AddOperation (org.opends.server.core.AddOperation)2 ModifyOperation (org.opends.server.core.ModifyOperation)2 Test (org.testng.annotations.Test)2 ResourceObjectShadowChangeDescription (com.evolveum.midpoint.provisioning.api.ResourceObjectShadowChangeDescription)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 MessageBuilder (org.opends.messages.MessageBuilder)1