Skip to content

Commit

Permalink
[LDAP-41] Add generic sync strategy (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylinsic authored Feb 1, 2024
1 parent 6b33cf7 commit 8c324a0
Show file tree
Hide file tree
Showing 18 changed files with 778 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ public enum SearchScope {

private String changeNumberAttribute = "changeNumber";

private String changeLogContext = "cn=changelog";

private boolean filterWithOrInsteadOfAnd;

private boolean removeLogEntryObjectClassFromFilter = true;
Expand Down Expand Up @@ -359,6 +361,8 @@ public void validate() {
failValidation("changeLogBlockSize.legalValue");
}

checkNotBlank(changeLogContext, "changeLogContext.notBlank");

if (synchronizePasswords) {
checkNotBlank(passwordAttributeToSynchronize, "passwordAttributeToSynchronize.notBlank");
checkNotBlank(passwordDecryptionKey, "decryptionKey.notBlank");
Expand Down Expand Up @@ -888,6 +892,17 @@ public void setChangeNumberAttribute(String changeNumberAttribute) {
this.changeNumberAttribute = changeNumberAttribute;
}

@ConfigurationProperty(order = 39, operations = { SyncOp.class },
displayMessageKey = "changeLogContext.display",
helpMessageKey = "changeNumberAttribute.help")
public String getChangeLogContext() {
return changeLogContext;
}

public void setChangeLogContext(String changeLogContext) {
this.changeLogContext = changeLogContext;
}

@ConfigurationProperty(order = 39, operations = { SyncOp.class },
displayMessageKey = "filterWithOrInsteadOfAnd.display",
helpMessageKey = "filterWithOrInsteadOfAnd.help")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
/*
* ====================
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
*
* Copyright 2008-2009 Sun Microsystems, Inc. All rights reserved.
*
*
* The contents of this file are subject to the terms of the Common Development
* and Distribution License("CDDL") (the "License"). You may not use this file
* except in compliance with the License.
*
*
* You can obtain a copy of the License at
* http://opensource.org/licenses/cddl1.php
* See the License for the specific language governing permissions and limitations
* under the License.
*
*
* When distributing the Covered Code, include this CDDL Header Notice in each file
* and include the License file at http://opensource.org/licenses/cddl1.php.
* If applicable, add the following below this CDDL Header, with the fields
Expand All @@ -21,7 +21,7 @@
* ====================
* Portions Copyrighted 2011 ConnId.
*/
package net.tirasa.connid.bundles.ldap.sync.sunds;
package net.tirasa.connid.bundles.ldap.commons;

import java.util.ArrayList;
import java.util.Iterator;
Expand All @@ -36,13 +36,14 @@ public LdifParser(String ldif) {
this.ldif = ldif;
}

@Override
public Iterator<Line> iterator() {
return new LineIterator(getUnfoldedLines());
}

private List<String> getUnfoldedLines() {
String[] lines = ldif.split("\n", -1);
ArrayList<String> result = new ArrayList<String>(lines.length);
ArrayList<String> result = new ArrayList<>(lines.length);
StringBuilder builder = null;
for (String line : lines) {
if (line.startsWith(" ")) {
Expand All @@ -68,20 +69,24 @@ private List<String> getUnfoldedLines() {
private static final class LineIterator implements Iterator<Line> {

private final Iterator<String> rawLines;

private Line lastLine;

private Line next;

public LineIterator(List<String> rawLines) {
this.rawLines = rawLines.iterator();
}

@Override
public boolean hasNext() {
if (next == null) {
next = getNext();
}
return next != null;
}

@Override
public Line next() {
if (next == null) {
next = getNext();
Expand Down Expand Up @@ -119,18 +124,19 @@ private Line getNext() {
return result;
}

@Override
public void remove() {
throw new UnsupportedOperationException();
}
}

public abstract static class Line {

}

public final static class NameValue extends Line {

private final String name;

private final String value;

public NameValue(String name, String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* ====================
* Portions Copyrighted 2011 ConnId.
*/
package net.tirasa.connid.bundles.ldap.sync.sunds;
package net.tirasa.connid.bundles.ldap.commons;

import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
Expand Down
Loading

0 comments on commit 8c324a0

Please sign in to comment.