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

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


                checkOcSuperior( addContext.getEntry() );

                next.add( addContext );

                // Update the structures now that the schema element has been added
                Schema schema = schemaManager.getLoadedSchema( schemaName );
               
                if ( ( schema != null ) && schema.isEnabled() )
                {
                    String ocName = entry.get( MetaSchemaConstants.M_NAME_AT ).getString();
                    ObjectClass addedOC = schemaManager.getObjectClassRegistry().lookup( ocName );
                    computeSuperior( addedOC );
                }
View Full Code Here


            schemaName );
       
        // At this point, the constructed MatchingRule 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 MatchingRule are both enabled.
        Schema schema = schemaManager.getLoadedSchema( schemaName );

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

        // Get the SchemaName
        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 MatchingRule {} cannot be removed from the disabled schema {}.",
                dn.getName(), schemaName );
           
            return;
        }

        // Test that the Oid exists
        MatchingRule matchingRule = ( MatchingRule ) checkOidExists( entry );

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

        Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(), schemaName );

        // At this point, the constructed Normalizer has not been checked against the
        // existing Registries. It will be checked there, if the schema and the
        // Normalizer are both enabled.
        Schema schema = schemaManager.getLoadedSchema( schemaName );
        List<Throwable> errors = new ArrayList<Throwable>();

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

         * fail.
         */

        if ( isEnabled )
        {
            Schema schema = factory.getSchema( entry );
            schemaManager.load( schema );
        }
    }
View Full Code Here

     * Disable a schema and update all of its schemaObject
     */
    private void disable( SchemaObject schemaObject, CoreSession session, Registries registries )
        throws Exception
    {
        Schema schema = registries.getLoadedSchema( schemaObject.getSchemaName() );
        List<Modification> modifications = new ArrayList<Modification>();
       
        // The m-disabled AT
        EntryAttribute disabledAttr = new DefaultServerAttribute( disabledAT, "FALSE" );
        Modification disabledMod = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, disabledAttr );
       
        modifications.add( disabledMod );
       
        // The modifiersName AT
        EntryAttribute modifiersNameAttr =
            new DefaultServerAttribute( modifiersNameAT, session.getEffectivePrincipal().getName() );
        Modification modifiersNameMod = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, modifiersNameAttr );
       
        modifications.add( modifiersNameMod );
       
        // The modifyTimestamp AT
        EntryAttribute modifyTimestampAttr =
            new DefaultServerAttribute( modifyTimestampAT, DateUtils.getGeneralizedTime() );
        Modification modifyTimestampMod = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, modifyTimestampAttr );
       
        modifications.add( modifyTimestampMod );
       
        // Call the modify operation
        DN dn = buildDn( schemaObject.getObjectType(), schemaObject.getName() );
       
        ModifyOperationContext modifyContext = new ModifyOperationContext( session, dn, modifications );
        modifyContext.setByPassed( ByPassConstants.BYPASS_ALL_COLLECTION );

        OperationManager operationManager =
            session.getDirectoryService().getOperationManager();
       
        operationManager.modify( modifyContext );
       
        // Now iterate on all the schemaObject under this schema
        for ( SchemaObjectWrapper schemaObjectWrapper : schema.getContent() )
        {
           
        }
    }
View Full Code Here

        }
    }

    private boolean disableSchema( CoreSession session, String schemaName ) throws Exception
    {
        Schema schema = registries.getLoadedSchema( schemaName );

        if ( schema == null )
        {
            // This is not possible. We can't enable a schema which is not loaded.
            String msg = I18n.err( I18n.ERR_85, schemaName );
View Full Code Here

     * Enabling a schema consist on switching all of its schema element to enable.
     * We have to do it on a temporary registries.
     */
    private boolean enableSchema( String schemaName ) throws Exception
    {
        Schema schema = registries.getLoadedSchema( schemaName );

        if ( schema == null )
        {
            // We have to load the schema before enabling it.
            schemaManager.loadDisabled( schemaName );
View Full Code Here

            schemaName );

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

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

        // Get the SchemaName
        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 Comparator {} cannot be deleted from the disabled schema {}", dn.getName(), schemaName );
           
            return;
        }

        // Test that the Oid exists
        LdapComparator<?> comparator = null;

        try
        {
            comparator = ( LdapComparator<?> ) checkComparatorOidExists( entry );
        }
        catch ( LdapSchemaViolationException lsve )
        {
            // The comparator does not exist
            comparator = factory.getLdapComparator( schemaManager, entry, schemaManager.getRegistries(), schemaName );

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

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

        List<Throwable> errors = new ArrayList<Throwable>();

        if ( schema.isEnabled() && comparator.isEnabled() )
        {
            if ( schemaManager.delete( comparator ) )
            {
                LOG.debug( "Deleted {} from 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.