Package org.apache.directory.shared.ldap.schema.registries

Examples of org.apache.directory.shared.ldap.schema.registries.Schema


     * @param schemaName The schema we want to check
     * @return true if the schema is loaded and enabled, false otherwise
     */
    protected boolean isSchemaEnabled( String schemaName )
    {
        Schema schema = schemaManager.getLoadedSchema( schemaName );
       
        return ( ( schema != null ) && schema.isEnabled() );
    }
View Full Code Here


            schemaName );

        // At this point, the constructed SyntaxChecker has not been checked against the
        // existing Registries. It will be checked there, if the schema and the
        // SyntaxChecker are both enabled.
        Schema schema = schemaManager.getLoadedSchema( schemaName );

        if ( schema.isEnabled() && syntaxChecker.isEnabled() )
        {
            if ( schemaManager.add( syntaxChecker ) )
            {
                LOG.debug( "Added {} into the enabled schema {}", dn.getName(), schemaName );
            }
View Full Code Here

        // Get the SyntaxChecker's instance
        String schemaName = getSchemaName( entry.getDn() );
       
        // Get the Schema
        Schema schema = schemaManager.getLoadedSchema( schemaName );

        if ( schema.isDisabled() )
        {
            // The schema is disabled, nothing to do.
            LOG.debug( "The SyntaxChecker {} cannot be deleted from the disabled schema {}", dn.getName(), schemaName );
           
            return;
        }

        // Test that the Oid exists
        SyntaxChecker syntaxChecker = null;

        try
        {
            syntaxChecker = ( SyntaxChecker ) checkSyntaxCheckerOidExists( entry );
        }
        catch ( LdapSchemaViolationException lsve )
        {
            // The syntaxChecker does not exist
            syntaxChecker = factory.getSyntaxChecker( schemaManager, entry, schemaManager.getRegistries(), schemaName );

            if ( schemaManager.getRegistries().contains( syntaxChecker ) )
            {
                // Remove the syntaxChecker from the schema/SchemaObject Map
                schemaManager.getRegistries().dissociateFromSchema( syntaxChecker );

                // Ok, we can exit.
                return;
            }
            else
            {
                // Ok, definitively an error
                String msg = I18n.err( I18n.ERR_387, entry.getDn().getName() );
                LOG.info( msg );
                throw new LdapSchemaViolationException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
            }
        }

        if ( schema.isEnabled() && syntaxChecker.isEnabled() )
        {
            if ( schemaManager.delete( syntaxChecker ) )
            {
                LOG.debug( "Deleted {} from the enabled schema {}", dn.getName(), schemaName );
            }
View Full Code Here

    /**
     * A helper method which tells if a schema is disabled.
     */
    public static boolean isDisabled( DirectoryService service, String schemaName )
    {
        Schema schema = service.getSchemaManager().getLoadedSchema( schemaName );
       
        return ( schema == null ) || schema.isDisabled();
    }
View Full Code Here

    /**
     * A helper method which tells if a schema is loaded.
     */
    public static boolean isLoaded( DirectoryService service, String schemaName )
    {
        Schema schema = service.getSchemaManager().getLoadedSchema( schemaName );
       
        return ( schema != null );
    }
View Full Code Here

     * A helper method which tells if a schema is enabled. A shema must be
     * loaded and enabled.
     */
    public static boolean isEnabled( DirectoryService service, String schemaName )
    {
        Schema schema = service.getSchemaManager().getLoadedSchema( schemaName );
       
        return ( schema != null ) && schema.isEnabled();
    }
View Full Code Here

            schemaName );

        // At this point, the constructed ObjectClass has not been checked against the
        // existing Registries. It may be broken (missing SUP, or such), it will be checked
        // there, if the schema and the ObjectClass are both enabled.
        Schema schema = schemaManager.getLoadedSchema( schemaName );

        if ( schema.isEnabled() && objectClass.isEnabled() )
        {
            if ( schemaManager.add( objectClass ) )
            {
                LOG.debug( "Added {} into the enabled schema {}", dn.getName(), schemaName );
            }
View Full Code Here

        // Get the ObjectClass from the given entry ( it has been grabbed from the server earlier)
        String schemaName = getSchemaName( entry.getDn() );
       
        // Get the schema
        Schema schema = schemaManager.getLoadedSchema( schemaName );

        if ( schema.isDisabled() )
        {
            // The schema is disabled, nothing to do.
            LOG.debug( "The ObjectClass {} cannot be removed from the disabled schema {}.",
                dn.getName(), schemaName );
           
            return;
        }
       
        // Test that the Oid exists
        ObjectClass objectClass = ( ObjectClass ) checkOidExists( entry );

        if ( schema.isEnabled() && objectClass.isEnabled() )
        {
            if ( schemaManager.delete( objectClass ) )
            {
                LOG.debug( "Removed {} from the schema {}", objectClass, schemaName );
            }
View Full Code Here

        EntryFilteringCursor list = listSchemas();

        while ( list.next() )
        {
            ServerEntry sr = list.get();
            Schema schema = factory.getSchema( sr );
            schemas.put( schema.getSchemaName(), schema );
        }

        return schemas;
    }
View Full Code Here

            schemaName );

        // At this point, the constructed AttributeType has not been checked against the
        // existing Registries. It may be broken (missing SUP, or such), it will be checked
        // there, if the schema and the AttributeType are both enabled.
        Schema schema = schemaManager.getLoadedSchema( schemaName );

        if ( schema.isEnabled() && attributeType.isEnabled() )
        {
            if ( schemaManager.add( attributeType ) )
            {
                LOG.debug( "Added {} into the enabled schema {}", dn.getName(), schemaName );
            }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.schema.registries.Schema

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.