Class DefaultSchemaObjectRegistry<T extends SchemaObject>

    • Constructor Detail

      • DefaultSchemaObjectRegistry

        protected DefaultSchemaObjectRegistry​(SchemaObjectType schemaObjectType,
                                              OidRegistry<T> oidRegistry)
        Creates a new DefaultSchemaObjectRegistry instance.
        Parameters:
        schemaObjectType - The Schema Object type
        oidRegistry - The OID registry to use
    • Method Detail

      • isRelaxed

        public boolean isRelaxed()
        Tells if the Registry is permissive or if it must be checked against inconsistencies.
        Returns:
        True if SchemaObjects can be added even if they break the consistency
      • isStrict

        public boolean isStrict()
        Tells if the Registry is strict.
        Returns:
        True if SchemaObjects cannot be added if they break the consistency
      • setRelaxed

        public void setRelaxed()
        Change the Registry to a relaxed mode, where invalid SchemaObjects can be registered.
      • setStrict

        public void setStrict()
        Change the Registry to a strict mode, where invalid SchemaObjects cannot be registered.
      • contains

        public boolean contains​(String oid)
        Checks to see if an SchemaObject exists in the registry, by its OID or name.
        Specified by:
        contains in interface SchemaObjectRegistry<T extends SchemaObject>
        Parameters:
        oid - the object identifier or name of the SchemaObject
        Returns:
        true if a SchemaObject definition exists for the oid, false otherwise
      • renameSchema

        public void renameSchema​(String originalSchemaName,
                                 String newSchemaName)
        Modify all the SchemaObject using a schemaName when this name changes.
        Specified by:
        renameSchema in interface SchemaObjectRegistry<T extends SchemaObject>
        Parameters:
        originalSchemaName - The original Schema name
        newSchemaName - The new Schema name
      • lookup

        public T lookup​(String oid)
                 throws LdapException
        Looks up a SchemaObject by its unique Object Identifier or by name.
        Specified by:
        lookup in interface SchemaObjectRegistry<T extends SchemaObject>
        Parameters:
        oid - the object identifier or name
        Returns:
        the SchemaObject instance for the id
        Throws:
        LdapException - if the SchemaObject does not exist
      • register

        public void register​(T schemaObject)
                      throws LdapException
        Registers a new SchemaObject with this registry.
        Specified by:
        register in interface SchemaObjectRegistry<T extends SchemaObject>
        Parameters:
        schemaObject - the SchemaObject to register
        Throws:
        LdapException - if the SchemaObject is already registered or the registration operation is not supported
      • unregister

        public T unregister​(String numericOid)
                     throws LdapException
        Removes the SchemaObject registered with this registry, using its numeric OID.
        Specified by:
        unregister in interface SchemaObjectRegistry<T extends SchemaObject>
        Parameters:
        numericOid - the numeric identifier
        Returns:
        The unregistred schema object
        Throws:
        LdapException - if the numeric identifier is invalid
      • unregister

        public T unregister​(T schemaObject)
                     throws LdapException
        Removes the SchemaObject registered with this registry.
        Specified by:
        unregister in interface SchemaObjectRegistry<T extends SchemaObject>
        Parameters:
        schemaObject - the schemaObject to unregister
        Returns:
        The unregistred schema object
        Throws:
        LdapException - if the schemaObject can't be unregistered is invalid
      • unregisterSchemaElements

        public void unregisterSchemaElements​(String schemaName)
                                      throws LdapException
        Unregisters all SchemaObjects defined for a specific schema from this registry.
        Specified by:
        unregisterSchemaElements in interface SchemaObjectRegistry<T extends SchemaObject>
        Parameters:
        schemaName - the name of the schema whose SchemaObjects will be removed from
        Throws:
        LdapException - If we had a problem while unregistering the schema
      • getOidByName

        public String getOidByName​(String name)
                            throws LdapException
        Gets the numericOid for a name/alias if one is associated. To prevent lookup failures due to case variance in the name, a failure to lookup the OID, will trigger a lookup using a lower cased version of the name and the name that failed to match will automatically be associated with the OID.
        Specified by:
        getOidByName in interface SchemaObjectRegistry<T extends SchemaObject>
        Parameters:
        name - The name we are looking the oid for
        Returns:
        The numericOID associated with this name
        Throws:
        LdapException - If the OID can't be found
      • copy

        public SchemaObjectRegistry<T> copy​(SchemaObjectRegistry<T> original)
        Copy a SchemaObject registry
        Parameters:
        original - The SchemaObject registry to copy
        Returns:
        The copied ShcemaObject registry
      • get

        public T get​(String oid)
        Gets the SchemaObject associated with a given OID.
        Specified by:
        get in interface SchemaObjectRegistry<T extends SchemaObject>
        Parameters:
        oid - The SchemaObject's OID we are looking for
        Returns:
        The SchemaObject, if any. Null otherwise