Interface SchemaManager

    • Method Detail

      • load

        boolean load​(Schema... schemas)
              throws LdapException
        Load some Schemas into the registries. The Registries is checked after the schemas have been loaded, and if there is an error, the method returns false and the registries is kept intact.
        The Schemas must be enabled, and only enabled SchemaObject will be loaded.
        If any error was met, the getErrors() method will contain them
        Parameters:
        schemas - the Schemas to load
        Returns:
        true if the schemas have been loaded and the registries is consistent
        Throws:
        LdapException - If something went wrong
      • load

        boolean load​(String... schemas)
              throws LdapException
        Load some Schemas into the registries. The Registries is checked after the schemas have been loaded, and if there is an error, the method returns false and the registries is kept intact.
        The Schemas must be enabled, and only enabled SchemaObject will be loaded.
        If any error was met, the getErrors() method will contain them
        Parameters:
        schemas - the Schemas' name to load
        Returns:
        true if the schemas have been loaded and the registries is consistent
        Throws:
        LdapException - If something went wrong
      • loadWithDeps

        boolean loadWithDeps​(Schema... schemas)
                      throws LdapException
        Load some Schemas into the registries, and loads all of the schemas they depend on. The Registries is checked after the schemas have been loaded, and if there is an error, the method returns false and the registries is kept intact.
        The Schemas must be enabled, and only enabled SchemaObject will be loaded.
        If any error was met, the getErrors() method will contain them
        Parameters:
        schemas - the Schemas to load
        Returns:
        true if the schemas have been loaded and the registries is consistent
        Throws:
        LdapException - If something went wrong
      • loadWithDeps

        boolean loadWithDeps​(String... schemas)
                      throws LdapException
        Load some Schemas into the registries, and loads all of the schemas they depend on. The Registries is checked after the schemas have been loaded, and if there is an error, the method returns false and the registries is kept intact.
        The Schemas must be enabled, and only enabled SchemaObject will be loaded.
        If any error was met, the getErrors() method will contain them
        Parameters:
        schemas - the Schemas' name to load
        Returns:
        true if the schemas have been loaded and the registries is consistent
        Throws:
        LdapException - If something went wrong
      • loadRelaxed

        boolean loadRelaxed​(Schema... schemas)
                     throws LdapException
        Load Schemas into the registries, even if there are some errors in the schemas. The Registries is checked after the schemas have been loaded. Even if we have errors, the registries will be updated.
        The Schemas must be enabled, and only enabled SchemaObject will be loaded.
        If any error was met, the getErrors() method will contain them
        Parameters:
        schemas - the Schemas to load, if enabled
        Returns:
        true if the schemas have been loaded
        Throws:
        LdapException - If something went wrong
      • loadRelaxed

        boolean loadRelaxed​(String... schemas)
                     throws LdapException
        Load Schemas into the registries, even if there are some errors in the schemas. The Registries is checked after the schemas have been loaded. Even if we have errors, the registries will be updated.
        The Schemas must be enabled, and only enabled SchemaObject will be loaded.
        If any error was met, the getErrors() method will contain them
        Parameters:
        schemas - the Schemas' name to load, if enabled
        Returns:
        true if the schemas have been loaded and the registries is consistent
        Throws:
        LdapException - If something went wrong
      • loadWithDepsRelaxed

        boolean loadWithDepsRelaxed​(Schema... schemas)
                             throws LdapException
        Load some Schemas into the registries, and loads all of the schemas they depend on. The Registries is checked after the schemas have been loaded. Even if we have errors, the registries will be updated.
        The Schemas must be enabled, and only enabled SchemaObject will be loaded.
        If any error was met, the getErrors() method will contain them
        Parameters:
        schemas - the Schemas to load
        Returns:
        true if the schemas have been loaded
        Throws:
        LdapException - If something went wrong
      • loadWithDepsRelaxed

        boolean loadWithDepsRelaxed​(String... schemas)
                             throws LdapException
        Load some Schemas into the registries, and loads all of the schemas they depend on. The Registries is checked after the schemas have been loaded. Even if we have errors, the registries will be updated.
        The Schemas must be enabled, and only enabled SchemaObject will be loaded.
        If any error was met, the getErrors() method will contain them
        Parameters:
        schemas - the Schemas' name to load
        Returns:
        true if the schemas have been loaded
        Throws:
        LdapException - If something went wrong
      • loadDisabled

        boolean loadDisabled​(Schema... schemas)
                      throws LdapException
        Load Schemas into the Registries, even if they are disabled. The disabled SchemaObject from an enabled schema will also be loaded. The Registries will be checked after the schemas have been loaded. Even if we have errors, the Registries will be updated.
        If any error was met, the getErrors() method will contain them
        Parameters:
        schemas - The Schemas to load
        Returns:
        true if the schemas have been loaded
        Throws:
        LdapException - If something went wrong
      • loadDisabled

        boolean loadDisabled​(String... schemas)
                      throws LdapException
        Load Schemas into the Registries, even if they are disabled. The disabled SchemaObject from an enabled schema will also be loaded. The Registries will be checked after the schemas have been loaded. Even if we have errors, the Registries will be updated.
        If any error was met, the getErrors() method will contain them
        Parameters:
        schemas - The Schemas' name to load
        Returns:
        true if the schemas have been loaded
        Throws:
        LdapException - If something went wrong
      • loadAllEnabled

        boolean loadAllEnabled()
                        throws LdapException
        Load all the enabled schema into the Registries. The Registries is strict, any inconsistent schema will be rejected.
        Returns:
        true if the schemas have been loaded
        Throws:
        LdapException - If something went wrong
      • loadAllEnabledRelaxed

        boolean loadAllEnabledRelaxed()
                               throws LdapException
        Load all the enabled schema into the Registries. The Registries is relaxed, even inconsistent schema will be loaded.
        Returns:
        true if the schemas have been loaded
        Throws:
        LdapException - If something went wrong
      • unload

        boolean unload​(Schema... schemas)
                throws LdapException
        Unload the given set of Schemas
        Parameters:
        schemas - The list of Schema to unload
        Returns:
        True if all the schemas have been unloaded
        Throws:
        LdapException - If something went wrong
      • unload

        boolean unload​(String... schemas)
                throws LdapException
        Unload the given set of Schemas
        Parameters:
        schemas - The list of Schema to unload
        Returns:
        True if all the schemas have been unloaded
        Throws:
        LdapException - If something went wrong
      • enable

        boolean enable​(Schema... schemas)
                throws LdapException
        Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas, and if the registries is still consistent. If the modification is ok, the Registries will be updated.
        Parameters:
        schemas - The list of schemas to enable
        Returns:
        true if the Registries is still consistent, false otherwise.
        Throws:
        LdapException - If something went wrong
      • enable

        boolean enable​(String... schemas)
                throws LdapException
        Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas, and if the registries is still consistent. If the modification is ok, the Registries will be updated.
        Parameters:
        schemas - The list of schema name to enable
        Returns:
        true if the Registries is still consistent, false otherwise.
        Throws:
        LdapException - If something went wrong
      • enableRelaxed

        boolean enableRelaxed​(Schema... schemas)
        Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas. No check is done, the Registries might become inconsistent after this operation.
        Parameters:
        schemas - The list of schemas to enable
        Returns:
        true if all the schemas have been enabled
      • enableRelaxed

        boolean enableRelaxed​(String... schemas)
        Enables a set of Schemas, and returns true if all the schema have been enabled, with all the dependent schemas. No check is done, the Registries might become inconsistent after this operation.
        Parameters:
        schemas - The list of schema names to enable
        Returns:
        true if all the schemas have been enabled
      • isEnabled

        boolean isEnabled​(String schemaName)
        Tells if the given Schema is enabled
        Parameters:
        schemaName - The schema name
        Returns:
        true if the schema is enabled
      • isEnabled

        boolean isEnabled​(Schema schema)
        Tells if the given Schema is enabled
        Parameters:
        schema - The schema
        Returns:
        true if the schema is enabled
      • disable

        boolean disable​(Schema... schemas)
                 throws LdapException
        Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas, and if the registries is still consistent. If the modification is ok, the Registries will be updated.
        Parameters:
        schemas - The list of schemas to disable
        Returns:
        true if the Registries is still consistent, false otherwise.
        Throws:
        LdapException - If something went wrong
      • disable

        boolean disable​(String... schemas)
                 throws LdapException
        Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas, and if the registries is still consistent. If the modification is ok, the Registries will be updated.
        Parameters:
        schemas - The list of schema names to disable
        Returns:
        true if the Registries is still consistent, false otherwise.
        Throws:
        LdapException - If something went wrong
      • disabledRelaxed

        boolean disabledRelaxed​(Schema... schemas)
        Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas. The Registries is not checked and can be inconsistent after this operation If the modification is ok, the Registries will be updated.
        Parameters:
        schemas - The list of schemas to disable
        Returns:
        true if all the schemas have been disabled
      • disabledRelaxed

        boolean disabledRelaxed​(String... schemas)
        Disables a set of Schemas, and returns true if all the schema have been disabled, with all the dependent schemas. The Registries is not checked and can be inconsistent after this operation If the modification is ok, the Registries will be updated.
        Parameters:
        schemas - The list of schema names to disable
        Returns:
        true if all the schemas have been disabled
      • isDisabled

        boolean isDisabled​(String schemaName)
        Tells if the given Schema is disabled
        Parameters:
        schemaName - The schema name
        Returns:
        true if the schema is disabled
      • isDisabled

        boolean isDisabled​(Schema schema)
        Tells if the given Schema is disabled
        Parameters:
        schema - The schema
        Returns:
        true if the schema is disabled
      • isRelaxed

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

        void setRelaxed()
        Set the SchemaManager to a RELAXED mode
      • isStrict

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

        void setStrict()
        Set the SchemaManager to a STRICT mode
      • verify

        boolean verify​(Schema... schemas)
                throws LdapException
        Check that the Schemas are consistent regarding the current Registries.
        Parameters:
        schemas - The schemas to check
        Returns:
        true if the schemas can be loaded in the registries
        Throws:
        LdapException - if something went wrong
      • verify

        boolean verify​(String... schemas)
                throws LdapException
        Check that the Schemas are consistent regarding the current Registries.
        Parameters:
        schemas - The schema names to check
        Returns:
        true if the schemas can be loaded in the registries
        Throws:
        LdapException - if something went wrong
      • getAttributeType

        AttributeType getAttributeType​(String oid)
        Get an AttributeType in the AttributeType registry. This method won't throw an exception if the AttributeTyp is not found, it will just return null.
        Parameters:
        oid - the OID we are looking for
        Returns:
        The found AttributeType, or null if not found
      • setRegistries

        void setRegistries​(Registries registries)
        Associate a new Registries to the SchemaManager
        Parameters:
        registries - The new Registries
      • add

        boolean add​(SchemaObject schemaObject)
             throws LdapException
        Registers a new SchemaObject. The registries will be updated only if it's consistent after this addition, if the SchemaManager is in Strict mode. If something went wrong during this operation, the SchemaManager.getErrors() will give the list of generated errors.
        Parameters:
        schemaObject - the SchemaObject to register
        Returns:
        true if the addition has been made, false if there were some errors
        Throws:
        LdapException - if the SchemaObject is already registered or the registration operation is not supported
      • delete

        boolean delete​(SchemaObject schemaObject)
                throws LdapException
        Unregisters a new SchemaObject. The registries will be updated only if it's consistent after this deletion, if the SchemaManager is in Strict mode. If something went wrong during this operation, the SchemaManager.getErrors() will give the list of generated errors.
        Parameters:
        schemaObject - the SchemaObject to unregister
        Returns:
        true if the deletion has been made, false if there were some errors
        Throws:
        LdapException - if the SchemaObject is not registered or the deletion operation is not supported
      • unregisterAttributeType

        SchemaObject unregisterAttributeType​(String attributeTypeOid)
                                      throws LdapException
        Removes the registered attributeType from the attributeTypeRegistry
        Parameters:
        attributeTypeOid - the attributeType OID to unregister
        Returns:
        the unregistred AtttributeType
        Throws:
        LdapException - if the attributeType is invalid
      • unregisterDitControlRule

        SchemaObject unregisterDitControlRule​(String ditControlRuleOid)
                                       throws LdapException
        Removes the registered DitControlRule from the DitControlRuleRegistry
        Parameters:
        ditControlRuleOid - the DitControlRule OID to unregister
        Returns:
        the unregistred DitControlRule
        Throws:
        LdapException - if the DitControlRule is invalid
      • unregisterDitStructureRule

        SchemaObject unregisterDitStructureRule​(String ditStructureRuleOid)
                                         throws LdapException
        Removes the registered DitStructureRule from the DitStructureRuleRegistry
        Parameters:
        ditStructureRuleOid - the DitStructureRule OID to unregister
        Returns:
        the unregistred DitStructureRule
        Throws:
        LdapException - if the DitStructureRule is invalid
      • unregisterMatchingRule

        SchemaObject unregisterMatchingRule​(String matchingRuleOid)
                                     throws LdapException
        Removes the registered MatchingRule from the MatchingRuleRegistry
        Parameters:
        matchingRuleOid - the MatchingRuleRule OID to unregister
        Returns:
        the unregistred MatchingRule
        Throws:
        LdapException - if the MatchingRule is invalid
      • unregisterMatchingRuleUse

        SchemaObject unregisterMatchingRuleUse​(String matchingRuleUseOid)
                                        throws LdapException
        Removes the registered MatchingRuleUse from the MatchingRuleUseRegistry
        Parameters:
        matchingRuleUseOid - the MatchingRuleUse OID to unregister
        Returns:
        the unregistred MatchingRuleUse
        Throws:
        LdapException - if the MatchingRuleUse is invalid
      • unregisterObjectClass

        SchemaObject unregisterObjectClass​(String objectClassOid)
                                    throws LdapException
        Removes the registered ObjectClass from the ObjectClassRegistry
        Parameters:
        objectClassOid - the ObjectClass OID to unregister
        Returns:
        the unregistred ObjectClass
        Throws:
        LdapException - if the ObjectClass is invalid
      • unregisterSyntaxChecker

        SchemaObject unregisterSyntaxChecker​(String syntaxCheckerOid)
                                      throws LdapException
        Removes the registered SyntaxChecker from the SyntaxCheckerRegistry
        Parameters:
        syntaxCheckerOid - the SyntaxChecker OID to unregister
        Returns:
        the unregistred SyntaxChecker
        Throws:
        LdapException - if the SyntaxChecker is invalid
      • getLoadedSchema

        Schema getLoadedSchema​(String schemaName)
        Gets a schema that has been loaded into these Registries.
        Parameters:
        schemaName - the name of the schema to lookup
        Returns:
        the loaded Schema if one corresponding to the name exists
      • isSchemaLoaded

        boolean isSchemaLoaded​(String schemaName)
        Tells if the specific schema is loaded
        Parameters:
        schemaName - The schema we want to check
        Returns:
        true if the schema is laoded
      • listDependentSchemaNames

        Set<StringlistDependentSchemaNames​(String schemaName)
        Get the list of Schema names which has the given schema name as a dependence
        Parameters:
        schemaName - The Schema name for which we want to get the list of dependent schemas
        Returns:
        The list of dependent schemas