Class DefaultCompressedSchema


  • public final class DefaultCompressedSchema
    extends CompressedSchema
    This class provides a default implementation of a compressed schema manager that will store the schema definitions in a binary file (config/schematokens.dat).
    • Constructor Detail

      • DefaultCompressedSchema

        public DefaultCompressedSchema​(ServerContext serverContext)
        Creates a new instance of this compressed schema manager.
        Parameters:
        serverContext - The server context.
    • Method Detail

      • storeAttribute

        protected void storeAttribute​(byte[] encodedAttribute,
                                      String attributeName,
                                      Iterable<String> attributeOptions)
                               throws DirectoryException
        Description copied from class: CompressedSchema
        Persists the provided encoded attribute. The default implementation is to do nothing. Calls to this method are synchronized, so implementations can assume that this method is not being called by other threads. Note that this method is not thread-safe with respect to CompressedSchema.storeObjectClasses(byte[], Collection).

        Called with the exclusive lock of this compressed schema held, and that lock is reentrant, so an implementation must re-enter neither the encode, the load nor the decode path of the compressed schema it belongs to. The registration being persisted has already been appended to the decode map - so that an implementation persisting the whole content rather than the element it is handed, as DefaultCompressedSchema does, has it - and is withdrawn from there if this method throws. Encoding or loading appends to the same decode map, and the withdrawal would take back whatever was appended last; decoding rebuilds the mappings when the schema has changed, and the withdrawal would then have to take the element out of a map that has already been replaced. Neither is withdrawn: the violation is reported and the registration is left behind, holding an id no definition was persisted under.

        Overrides:
        storeAttribute in class CompressedSchema
        Parameters:
        encodedAttribute - The encoded attribute description.
        attributeName - The user provided attribute type name.
        attributeOptions - The non-null but possibly empty set of attribute options.
        Throws:
        DirectoryException - If an error occurred while persisting the encoded attribute.
      • storeObjectClasses

        protected void storeObjectClasses​(byte[] encodedObjectClasses,
                                          Collection<String> objectClassNames)
                                   throws DirectoryException
        Description copied from class: CompressedSchema
        Persists the provided encoded object classes. The default implementation is to do nothing. Calls to this method are synchronized, so implementations can assume that this method is not being called by other threads. Note that this method is not thread-safe with respect to CompressedSchema.storeAttribute(byte[], String, Iterable).

        Called with the exclusive lock of this compressed schema held, and that lock is reentrant, so an implementation must re-enter neither the encode, the load nor the decode path of the compressed schema it belongs to. The registration being persisted has already been appended to the decode map - so that an implementation persisting the whole content rather than the element it is handed, as DefaultCompressedSchema does, has it - and is withdrawn from there if this method throws. Encoding or loading appends to the same decode map, and the withdrawal would take back whatever was appended last; decoding rebuilds the mappings when the schema has changed, and the withdrawal would then have to take the element out of a map that has already been replaced. Neither is withdrawn: the violation is reported and the registration is left behind, holding an id no definition was persisted under.

        Overrides:
        storeObjectClasses in class CompressedSchema
        Parameters:
        encodedObjectClasses - The encoded object classes.
        objectClassNames - The user provided set of object class names.
        Throws:
        DirectoryException - If an error occurred while persisting the encoded object classes.