| | |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.SchemaConfigManager; |
| | | import org.opends.server.core.SchemaHandler; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.schema.AttributeTypeSyntax; |
| | |
| | | |
| | | private ServerContext serverContext; |
| | | |
| | | private SchemaHandler schemaHandler; |
| | | |
| | | /** |
| | | * Creates a new backend with the provided information. All backend |
| | | * implementations must implement a default constructor that use |
| | |
| | | public SchemaBackend() |
| | | { |
| | | super(); |
| | | |
| | | // Perform all initialization in initializeBackend. |
| | | } |
| | | |
| | | @Override |
| | |
| | | userDefinedAttributes = new ArrayList<>(); |
| | | addAllNonSchemaConfigAttributes(userDefinedAttributes, configEntry.getAllAttributes()); |
| | | |
| | | schemaHandler = serverContext.getSchemaHandler(); |
| | | |
| | | currentConfig = cfg; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // Identify any differences that may exist between the concatenated schema |
| | | // file from the last online modification and the current schema files. If |
| | | // there are any differences, then they should be from making changes to the |
| | | // schema files with the server offline. |
| | | updateConcatenatedSchema(); |
| | | |
| | | // Register with the Directory Server as a configurable component. |
| | | currentConfig.addSchemaChangeListener(this); |
| | | } |
| | | |
| | | /** |
| | | * Updates the concatenated schema if changes are detected in the current schema files. |
| | | * <p> |
| | | * Identify any differences that may exist between the concatenated schema file from the last |
| | | * online modification and the current schema files. If there are any differences, then they |
| | | * should be from making changes to the schema files with the server offline. |
| | | */ |
| | | private void updateConcatenatedSchema() throws InitializationException |
| | | { |
| | | try |
| | | { |
| | | // First, generate lists of elements from the current schema. |
| | |
| | | |
| | | logger.error(ERR_SCHEMA_ERROR_DETERMINING_SCHEMA_CHANGES, getExceptionMessage(e)); |
| | | } |
| | | |
| | | // Register with the Directory Server as a configurable component. |
| | | currentConfig.addSchemaChangeListener(this); |
| | | } |
| | | |
| | | private File getConcatFile() throws InitializationException |
| | |
| | | } |
| | | |
| | | /* Add the schema definition attributes. */ |
| | | Schema schema = DirectoryServer.getSchema(); |
| | | org.forgerock.opendj.ldap.schema.Schema schema = serverContext.getSchemaNG(); |
| | | buildSchemaAttribute(schema.getAttributeTypes(), userAttrs, |
| | | operationalAttrs, attributeTypesType, includeSchemaFile, |
| | | AttributeTypeSyntax.isStripSyntaxMinimumUpperBound(), |
| | |
| | | operationalAttrs, nameFormsType, includeSchemaFile, false, true); |
| | | buildSchemaAttribute(schema.getDITContentRules(), userAttrs, |
| | | operationalAttrs, ditContentRulesType, includeSchemaFile, false, true); |
| | | buildSchemaAttribute(schema.getDITStructureRules(), userAttrs, |
| | | buildSchemaAttribute(schema.getDITStuctureRules(), userAttrs, |
| | | operationalAttrs, ditStructureRulesType, includeSchemaFile, false, true); |
| | | buildSchemaAttribute(schema.getMatchingRuleUses(), userAttrs, |
| | | operationalAttrs, matchingRuleUsesType, includeSchemaFile, false, true); |