| | |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | | import static org.opends.server.util.SchemaUtils.is02ConfigLdif; |
| | | |
| | | import static org.opends.server.util.SchemaUtils.parseSchemaFileFromElementDefinition; |
| | | import static org.forgerock.opendj.ldap.ModificationType.ADD; |
| | | import static org.forgerock.opendj.ldap.ModificationType.DELETE; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | |
| | | // so we don't re-find these same changes on the next startup. |
| | | writeConcatenatedSchema(); |
| | | } |
| | | return mods; |
| | | return filterOutConfigSchemaElementFromModifications(mods); |
| | | } |
| | | catch (InitializationException ie) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private List<Modification> filterOutConfigSchemaElementFromModifications(final List<Modification> mods) |
| | | throws DirectoryException |
| | | { |
| | | final List<Modification> filteredMods = new ArrayList<>(); |
| | | for (Modification modification : mods) |
| | | { |
| | | for (ByteString v : modification.getAttribute()) |
| | | { |
| | | String definition = v.toString(); |
| | | if (!isFrom02ConfigLdif(definition)) |
| | | { |
| | | filteredMods.add(modification); |
| | | } |
| | | } |
| | | } |
| | | return filteredMods; |
| | | } |
| | | |
| | | private boolean isFrom02ConfigLdif(String definition) throws DirectoryException |
| | | { |
| | | return is02ConfigLdif(parseSchemaFileFromElementDefinition(definition)); |
| | | } |
| | | |
| | | /** |
| | | * Writes a single file containing all schema element definitions, which can be used on startup to |
| | | * determine whether the schema files were edited with the server offline. |