| | |
| | | deleteOperation.getEntryDN(), csn, modifiedEntryUUID); |
| | | replayOperations.put(csn, op); |
| | | } |
| | | |
| | | } |
| | | |
| | | return new SynchronizationProviderResult.ContinueProcessing(); |
| | |
| | | // Create the ECL domain object |
| | | eclDomain = new ExternalChangelogDomain(this, eclDomCfg); |
| | | } |
| | | |
| | | } |
| | | catch(Exception de) |
| | | catch (Exception de) |
| | | { |
| | | throw new ConfigException(NOTE_ERR_UNABLE_TO_ENABLE_ECL.get( |
| | | "Replication Domain on" + getBaseDNString(), |
| | | "Replication Domain on " + getBaseDNString(), |
| | | de.getMessage() + " " + de.getCause().getMessage()), de); |
| | | } |
| | | } |
| | | |
| | | private static String makeLdif(String... lines) |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | | final StringBuilder buffer = new StringBuilder(); |
| | | for (String line : lines) { |
| | | buffer.append(line).append(EOL); |
| | | } |
| | |
| | | if (wfe!=null) |
| | | wfe.getReplicationServer().enableECL(); |
| | | } |
| | | catch(DirectoryException de) |
| | | catch (DirectoryException de) |
| | | { |
| | | Message message = NOTE_ERR_UNABLE_TO_ENABLE_ECL.get( |
| | | "Replication Domain on" + getBaseDNString(), |
| | | "Replication Domain on " + getBaseDNString(), |
| | | de.getMessage() + " " + de.getCause().getMessage()); |
| | | logError(message); |
| | | // and go on |
| | |
| | | { |
| | | Message message = ERR_INVALID_IMPORT_SOURCE.get( |
| | | getBaseDNString(), Integer.toString(getServerId()), |
| | | Integer.toString(source),"Details:" + cause.getLocalizedMessage()); |
| | | Integer.toString(source), "Details: " + cause.getLocalizedMessage()); |
| | | throw new DirectoryException(resultCode, message, cause); |
| | | } |
| | | Message message = ERR_INVALID_IMPORT_SOURCE.get(getBaseDNString(), |
| | |
| | | { |
| | | if (op instanceof PostOperationDeleteOperation) |
| | | { |
| | | Set<String> names = getEclIncludesForDeletes(); |
| | | PostOperationDeleteOperation delOp = (PostOperationDeleteOperation) op; |
| | | final Set<String> names = getEclIncludesForDeletes(); |
| | | Entry entry = delOp.getEntryToDelete(); |
| | | ((DeleteMsg) msg).setEclIncludes(getIncludedAttributes(entry, names)); |
| | | final DeleteMsg deleteMsg = (DeleteMsg) msg; |
| | | deleteMsg.setEclIncludes(getIncludedAttributes(entry, names)); |
| | | |
| | | // For delete only, add the Authorized DN since it's required in the |
| | | // ECL entry but is not part of rest of the message. |
| | | DN deleterDN = delOp.getAuthorizationDN(); |
| | | if (deleterDN != null) |
| | | { |
| | | ((DeleteMsg) msg).setInitiatorsName(deleterDN.toString()); |
| | | deleteMsg.setInitiatorsName(deleterDN.toString()); |
| | | } |
| | | } |
| | | else if (op instanceof PostOperationModifyOperation) |
| | | { |
| | | Set<String> names = getEclIncludes(); |
| | | PostOperationModifyOperation modOp = (PostOperationModifyOperation) op; |
| | | Set<String> names = getEclIncludes(); |
| | | Entry entry = modOp.getCurrentEntry(); |
| | | ((ModifyMsg) msg).setEclIncludes(getIncludedAttributes(entry, names)); |
| | | } |
| | | else if (op instanceof PostOperationModifyDNOperation) |
| | | { |
| | | Set<String> names = getEclIncludes(); |
| | | PostOperationModifyDNOperation modDNOp = |
| | | (PostOperationModifyDNOperation) op; |
| | | Set<String> names = getEclIncludes(); |
| | | Entry entry = modDNOp.getOriginalEntry(); |
| | | ((ModifyDNMsg) msg).setEclIncludes(getIncludedAttributes(entry, names)); |
| | | } |
| | | else if (op instanceof PostOperationAddOperation) |
| | | { |
| | | Set<String> names = getEclIncludes(); |
| | | PostOperationAddOperation addOp = (PostOperationAddOperation) op; |
| | | Set<String> names = getEclIncludes(); |
| | | Entry entry = addOp.getEntryToAdd(); |
| | | ((AddMsg) msg).setEclIncludes(getIncludedAttributes(entry, names)); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private Collection<Attribute> getIncludedAttributes(Entry entry, |
| | | Set<String> names) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | // Expand @objectclass references in attribute list if needed. We |
| | | // do this now in order to take into account dynamic schema changes. |
| | | // Expand @objectclass references in attribute list if needed. |
| | | // We do this now in order to take into account dynamic schema changes. |
| | | Set<String> expandedNames = getExpandedNames(names); |
| | | |
| | | // Only rebuild the attribute set if necessary. |
| | | boolean needsExpanding = false; |
| | | for (String name : names) |
| | | { |
| | | if (name.startsWith("@")) |
| | | { |
| | | needsExpanding = true; |
| | | break; |
| | | } |
| | | } |
| | | Entry filteredEntry = |
| | | entry.filterEntry(expandedNames, false, false, false); |
| | | return filteredEntry.getAttributes(); |
| | | } |
| | | } |
| | | |
| | | Set<String> expandedNames; |
| | | if (needsExpanding) |
| | | private Set<String> getExpandedNames(Set<String> names) |
| | | { |
| | | // Only rebuild the attribute set if necessary. |
| | | if (!needsExpanding(names)) |
| | | { |
| | | return names; |
| | | } |
| | | |
| | | final Set<String> expandedNames = new HashSet<String>(names.size()); |
| | | for (String name : names) |
| | | { |
| | | if (name.startsWith("@")) |
| | | { |
| | | expandedNames = new HashSet<String>(names.size()); |
| | | for (String name : names) |
| | | String ocName = name.substring(1); |
| | | ObjectClass objectClass = |
| | | DirectoryServer.getObjectClass(toLowerCase(ocName)); |
| | | if (objectClass != null) |
| | | { |
| | | if (name.startsWith("@")) |
| | | for (AttributeType at : objectClass.getRequiredAttributeChain()) |
| | | { |
| | | String ocName = name.substring(1); |
| | | ObjectClass objectClass = DirectoryServer |
| | | .getObjectClass(toLowerCase(ocName)); |
| | | if (objectClass != null) |
| | | { |
| | | for (AttributeType at : objectClass.getRequiredAttributeChain()) |
| | | { |
| | | expandedNames.add(at.getNameOrOID()); |
| | | } |
| | | for (AttributeType at : objectClass.getOptionalAttributeChain()) |
| | | { |
| | | expandedNames.add(at.getNameOrOID()); |
| | | } |
| | | } |
| | | expandedNames.add(at.getNameOrOID()); |
| | | } |
| | | else |
| | | for (AttributeType at : objectClass.getOptionalAttributeChain()) |
| | | { |
| | | expandedNames.add(name); |
| | | expandedNames.add(at.getNameOrOID()); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | expandedNames = names; |
| | | expandedNames.add(name); |
| | | } |
| | | |
| | | Entry filteredEntry = entry.filterEntry(expandedNames, false, |
| | | false, false); |
| | | return filteredEntry.getAttributes(); |
| | | } |
| | | return expandedNames; |
| | | } |
| | | |
| | | |
| | | private boolean needsExpanding(Set<String> names) |
| | | { |
| | | for (String name : names) |
| | | { |
| | | if (name.startsWith("@")) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Gets the fractional configuration of this domain. |
| | |
| | | * Constructs a new fractional configuration object. |
| | | * @param baseDN The base DN the object is for. |
| | | */ |
| | | FractionalConfig(DN baseDN) |
| | | private FractionalConfig(DN baseDN) |
| | | { |
| | | this.baseDN = baseDN; |
| | | } |
| | |
| | | * Getter for fractional. |
| | | * @return True if the configuration has fractional enabled |
| | | */ |
| | | boolean isFractional() |
| | | private boolean isFractional() |
| | | { |
| | | return fractional; |
| | | } |
| | |
| | | * Set the fractional parameter. |
| | | * @param fractional The fractional parameter |
| | | */ |
| | | void setFractional(boolean fractional) |
| | | private void setFractional(boolean fractional) |
| | | { |
| | | this.fractional = fractional; |
| | | } |
| | |
| | | * Getter for fractionalExclusive. |
| | | * @return True if the configuration has fractional exclusive enabled |
| | | */ |
| | | boolean isFractionalExclusive() |
| | | private boolean isFractionalExclusive() |
| | | { |
| | | return fractionalExclusive; |
| | | } |
| | |
| | | * Set the fractionalExclusive parameter. |
| | | * @param fractionalExclusive The fractionalExclusive parameter |
| | | */ |
| | | void setFractionalExclusive(boolean fractionalExclusive) |
| | | private void setFractionalExclusive(boolean fractionalExclusive) |
| | | { |
| | | this.fractionalExclusive = fractionalExclusive; |
| | | } |
| | |
| | | * Getter for fractionalSpecificClassesAttributes attribute. |
| | | * @return The fractionalSpecificClassesAttributes attribute. |
| | | */ |
| | | Map<String, Set<String>> getFractionalSpecificClassesAttributes() |
| | | private Map<String, Set<String>> getFractionalSpecificClassesAttributes() |
| | | { |
| | | return fractionalSpecificClassesAttributes; |
| | | } |
| | |
| | | * @param fractionalSpecificClassesAttributes The |
| | | * fractionalSpecificClassesAttributes parameter to set. |
| | | */ |
| | | void setFractionalSpecificClassesAttributes( |
| | | private void setFractionalSpecificClassesAttributes( |
| | | Map<String, Set<String>> fractionalSpecificClassesAttributes) |
| | | { |
| | | this.fractionalSpecificClassesAttributes = |
| | |
| | | * Getter for fractionalSpecificClassesAttributes attribute. |
| | | * @return The fractionalSpecificClassesAttributes attribute. |
| | | */ |
| | | Set<String> getFractionalAllClassesAttributes() |
| | | private Set<String> getFractionalAllClassesAttributes() |
| | | { |
| | | return fractionalAllClassesAttributes; |
| | | } |
| | |
| | | * @param fractionalAllClassesAttributes The |
| | | * fractionalSpecificClassesAttributes parameter to set. |
| | | */ |
| | | void setFractionalAllClassesAttributes( |
| | | private void setFractionalAllClassesAttributes( |
| | | Set<String> fractionalAllClassesAttributes) |
| | | { |
| | | this.fractionalAllClassesAttributes = fractionalAllClassesAttributes; |
| | |
| | | * Getter for the base baseDN. |
| | | * @return The baseDN attribute. |
| | | */ |
| | | DN getBaseDn() |
| | | private DN getBaseDn() |
| | | { |
| | | return baseDN; |
| | | } |
| | |
| | | * @return The fractional replication configuration. |
| | | * @throws ConfigException If an error occurred. |
| | | */ |
| | | static FractionalConfig toFractionalConfig( |
| | | private static FractionalConfig toFractionalConfig( |
| | | ReplicationDomainCfg configuration) throws ConfigException |
| | | { |
| | | // Prepare fractional configuration variables to parse |
| | | Iterator<String> exclIt = null; |
| | | Set<String> fractionalExclude = configuration.getFractionalExclude(); |
| | | if (fractionalExclude != null) |
| | | { |
| | | exclIt = fractionalExclude.iterator(); |
| | | } |
| | | |
| | | Iterator<String> inclIt = null; |
| | | Set<String> fractionalInclude = configuration.getFractionalInclude(); |
| | | if (fractionalInclude != null) |
| | | { |
| | | inclIt = fractionalInclude.iterator(); |
| | | } |
| | | Iterator<String> exclIt = configuration.getFractionalExclude().iterator(); |
| | | Iterator<String> inclIt = configuration.getFractionalInclude().iterator(); |
| | | |
| | | // Get potentially new fractional configuration |
| | | Map<String, Set<String>> newFractionalSpecificClassesAttributes = |
| | |
| | | Iterator<String> iterator; |
| | | |
| | | // Deduce the wished fractional mode |
| | | if (exclIt != null && exclIt.hasNext()) |
| | | if (exclIt.hasNext()) |
| | | { |
| | | if (inclIt != null && inclIt.hasNext()) |
| | | if (inclIt.hasNext()) |
| | | { |
| | | throw new ConfigException( |
| | | NOTE_ERR_FRACTIONAL_CONFIG_BOTH_MODES.get()); |
| | |
| | | } |
| | | else |
| | | { |
| | | if (inclIt != null && inclIt.hasNext()) |
| | | if (inclIt.hasNext()) |
| | | { |
| | | fractionalMode = INCLUSIVE_FRACTIONAL; |
| | | iterator = inclIt; |