| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | * Portions Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.guitools.controlpanel.util; |
| | | |
| | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.SchemaConfigManager; |
| | | import org.opends.server.schema.SchemaConstants; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.ObjectClass; |
| | |
| | | } |
| | | for (String name : ATTRIBUTES_TO_KEEP) |
| | | { |
| | | AttributeType attr = sc.getAttributeType(name.toLowerCase()); |
| | | if (attr != null) |
| | | if (sc.hasAttributeType(name)) |
| | | { |
| | | attributesToKeep.add(attr); |
| | | attributesToKeep.add(sc.getAttributeType(name)); |
| | | } |
| | | } |
| | | matchingRulesToKeep.addAll(sc.getMatchingRules().values()); |
| | | syntaxesToKeep.addAll(sc.getSyntaxes().values()); |
| | | matchingRulesToKeep.addAll(sc.getMatchingRules()); |
| | | syntaxesToKeep.addAll(sc.getSyntaxes()); |
| | | } |
| | | |
| | | private static String getSchemaDirectoryPath() |
| | |
| | | // initialize the server schema. |
| | | for (String schemaFile : fileNames) |
| | | { |
| | | // no server context to pass |
| | | SchemaConfigManager.loadSchemaFile(null, schema, schemaFile); |
| | | SchemaConfigManager.loadSchemaFile(schema, schemaFile); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | protected Schema getBaseSchema() throws DirectoryException |
| | | { |
| | | Schema schema = new Schema(); |
| | | // start from default schema |
| | | Schema schema = new Schema(org.forgerock.opendj.ldap.schema.Schema.getDefaultSchema()); |
| | | for (MatchingRule mr : matchingRulesToKeep) |
| | | { |
| | | schema.registerMatchingRule(mr, true); |