Examples of AttributeTypeRegistry


Examples of org.apache.directory.shared.ldap.model.schema.registries.AttributeTypeRegistry

     * Build the Superior AttributeType reference for an AttributeType
     */
    private boolean buildSuperior( List<Throwable> errors, Registries registries )
    {
        AttributeType currentSuperior = null;
        AttributeTypeRegistry attributeTypeRegistry = registries.getAttributeTypeRegistry();

        if ( superiorOid != null )
        {
            // This AT has a superior
            try
            {
                currentSuperior = attributeTypeRegistry.lookup( superiorOid );
            }
            catch ( Exception e )
            {
                // Not allowed.
                String msg = I18n.err( I18n.ERR_04303, superiorOid, getName() );

                LdapSchemaException ldapSchemaException = new LdapSchemaException(
                    LdapSchemaExceptionCodes.AT_NONEXISTENT_SUPERIOR, msg );
                ldapSchemaException.setSourceObject( this );
                ldapSchemaException.setRelatedId( superiorOid );
                errors.add( ldapSchemaException );
                LOG.info( msg );

                // Get out now
                return false;
            }

            if ( currentSuperior != null )
            {
                // a special case : if the superior is collective, this is an error
                if ( currentSuperior.isCollective )
                {
                    String msg = I18n.err( I18n.ERR_04482_CANNOT_SUBTYPE_COLLECTIVE, currentSuperior, getName() );

                    LdapSchemaException ldapSchemaException = new LdapSchemaException(
                        LdapSchemaExceptionCodes.AT_CANNOT_SUBTYPE_COLLECTIVE_AT, msg );
                    ldapSchemaException.setSourceObject( this );
                    errors.add( ldapSchemaException );
                    LOG.info( msg );
                    return false;
                }

                this.superior = currentSuperior;

                // Recursively update the superior if not already done. We don't recurse
                // if the superior's superior is not null, as it means it has already been
                // handled.
                if ( currentSuperior.getSuperior() == null )
                {
                    registries.buildReference( errors, currentSuperior );
                }

                // Update the descendant MAP
                try
                {
                    attributeTypeRegistry.registerDescendants( this, currentSuperior );
                }
                catch ( LdapException ne )
                {
                    errors.add( ne );
                    LOG.info( ne.getMessage() );
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.schema.registries.AttributeTypeRegistry

     */
    public void addToRegistries( List<Throwable> errors, Registries registries ) throws LdapException
    {
        if ( registries != null )
        {
            AttributeTypeRegistry attributeTypeRegistry = registries.getAttributeTypeRegistry();

            // The superior
            if ( !buildSuperior( errors, registries ) )
            {
                // We have had errors, let's stop here as we need a correct superior to continue
                return;
            }

            // The Syntax
            buildSyntax( errors, registries );

            // The EQUALITY matching rule
            buildEquality( errors, registries );

            // The ORDERING matching rule
            buildOrdering( errors, registries );

            // The SUBSTR matching rule
            buildSubstring( errors, registries );

            // Check the USAGE
            checkUsage( errors );

            // Check the COLLECTIVE element
            checkCollective( errors );

            // Inject the attributeType into the oid/normalizer map
            attributeTypeRegistry.addMappingFor( this );

            // Register this AttributeType into the Descendant map
            attributeTypeRegistry.registerDescendants( this, superior );

            /**
             * Add the AT references (using and usedBy) :
             * AT -> MR (for EQUALITY, ORDERING and SUBSTR)
             * AT -> S
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.schema.registries.AttributeTypeRegistry

     */
    public void removeFromRegistries( List<Throwable> errors, Registries registries ) throws LdapException
    {
        if ( registries != null )
        {
            AttributeTypeRegistry attributeTypeRegistry = registries.getAttributeTypeRegistry();

            // Remove the attributeType from the oid/normalizer map
            attributeTypeRegistry.removeMappingFor( this );

            // Unregister this AttributeType into the Descendant map
            attributeTypeRegistry.unregisterDescendants( this, superior );

            /**
             * Remove the AT references (using and usedBy) :
             * AT -> MR (for EQUALITY, ORDERING and SUBSTR)
             * AT -> S
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.schema.registries.AttributeTypeRegistry

     */
    public void addToRegistries( Registries registries ) throws LdapException
    {
        if ( registries != null )
        {
            AttributeTypeRegistry atRegistry = registries.getAttributeTypeRegistry();
            ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();

            if ( mayAttributeTypeOids != null )
            {
                mayAttributeTypes = new ArrayList<AttributeType>( mayAttributeTypeOids.size() );

                for ( String oid : mayAttributeTypeOids )
                {
                    mayAttributeTypes.add( atRegistry.lookup( oid ) );
                }
            }

            if ( mustAttributeTypeOids != null )
            {
                mustAttributeTypes = new ArrayList<AttributeType>( mustAttributeTypeOids.size() );

                for ( String oid : mustAttributeTypeOids )
                {
                    mustAttributeTypes.add( atRegistry.lookup( oid ) );
                }
            }

            if ( notAttributeTypeOids != null )
            {
                notAttributeTypes = new ArrayList<AttributeType>( notAttributeTypeOids.size() );

                for ( String oid : notAttributeTypeOids )
                {
                    notAttributeTypes.add( atRegistry.lookup( oid ) );
                }
            }

            if ( auxObjectClassOids != null )
            {
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.schema.registries.AttributeTypeRegistry

            OpenLdapSchemaParser olsp = new OpenLdapSchemaParser();
            olsp.setQuirksMode( true );
            olsp.parse( schemaFile );

            List<AttributeType> atList = olsp.getAttributeTypes();
            AttributeTypeRegistry atRegistry = schemaManager.getRegistries().getAttributeTypeRegistry();
            for ( AttributeType atType : atList )
            {
                atRegistry.addMappingFor( atType );
            }

            List<ObjectClass> ocList = olsp.getObjectClassTypes();
            ObjectClassRegistry ocRegistry = schemaManager.getRegistries().getObjectClassRegistry();
            for ( ObjectClass oc : ocList )
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.schema.registries.AttributeTypeRegistry

    }


    private void buildMay( List<Throwable> errors, Registries registries )
    {
        AttributeTypeRegistry atRegistry = registries.getAttributeTypeRegistry();

        if ( mayAttributeTypeOids != null )
        {
            mayAttributeTypes = new ArrayList<AttributeType>( mayAttributeTypeOids.size() );

            for ( String mayAttributeTypeName : mayAttributeTypeOids )
            {
                try
                {
                    AttributeType attributeType = atRegistry.lookup( mayAttributeTypeName );

                    if ( attributeType.isCollective() )
                    {
                        // Collective Attributes are not allowed in MAY or MUST
                        String msg = I18n.err( I18n.ERR_04485_COLLECTIVE_NOT_ALLOWED_IN_MAY, mayAttributeTypeName, oid );
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.schema.registries.AttributeTypeRegistry

    }


    private void buildMust( List<Throwable> errors, Registries registries )
    {
        AttributeTypeRegistry atRegistry = registries.getAttributeTypeRegistry();

        if ( mustAttributeTypeOids != null )
        {
            mustAttributeTypes = new ArrayList<AttributeType>( mustAttributeTypeOids.size() );

            for ( String mustAttributeTypeName : mustAttributeTypeOids )
            {
                try
                {
                    AttributeType attributeType = atRegistry.lookup( mustAttributeTypeName );

                    if ( attributeType.isCollective() )
                    {
                        // Collective Attributes are not allowed in MAY or MUST
                        String msg = I18n.err( I18n.ERR_04484_COLLECTIVE_NOT_ALLOWED_IN_MUST, mustAttributeTypeName,
View Full Code Here

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

    }
   
   
    private void disableAT( CoreSession session, String schemaName )
    {
        AttributeTypeRegistry atRegistry = registries.getAttributeTypeRegistry();
       
        for ( AttributeType attributeType : atRegistry )
        {
            if ( schemaName.equalsIgnoreCase( attributeType.getSchemaName() ) )
            {
View Full Code Here

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

    private AttributeType getAttributeType(String attributeName)
            throws DirectoryServerException {
        if (this.service != null) {
            SchemaManager schemaManager = this.service.getSchemaManager();
            if (schemaManager != null) {
                AttributeTypeRegistry registry = schemaManager.getAttributeTypeRegistry();
                if (registry != null) {
                    try {
                        String oid = registry.getOidByName(attributeName);
                        return registry.lookup(oid);
                    } catch (LdapException e) {
                        String msg = "An error occurred while querying attribute " + attributeName +
                                     " from registry.";
                        logger.error(msg, e);
                        throw new DirectoryServerException(msg, e);
View Full Code Here

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

    }
   
   
    private void disableAT( CoreSession session, String schemaName )
    {
        AttributeTypeRegistry atRegistry = registries.getAttributeTypeRegistry();
       
        for ( AttributeType attributeType : atRegistry )
        {
            if ( schemaName.equalsIgnoreCase( attributeType.getSchemaName() ) )
            {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.