Package org.apache.ldap.common.schema

Examples of org.apache.ldap.common.schema.Normalizer


            ( 2.5.13.12 NAME 'caseIgnoreListSubstringsMatch'
              SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )
        */

        Normalizer normalizer;

        normalizer = new CachingNormalizer( new DeepTrimNormalizer() );
        cb.schemaObjectProduced( this, "2.5.13.5", normalizer );

        normalizer = new CachingNormalizer( new DeepTrimNormalizer() );
View Full Code Here


       
        /*
         * We need to iterate through all values and for each value we normalize
         * and use the comparator to determine if a match exists.
         */
        Normalizer normalizer = getNormalizer( attrId );
        Comparator comparator = getComparator( attrId );
        Object filterValue = normalizer.normalize( node.getValue() );
        NamingEnumeration list = attr.getAll();
       
        /*
         * Cheaper to not check isGreater in one loop - better to separate
         * out into two loops which you choose to execute based on isGreater
         */
        if ( isGreater )
        {
            while ( list.hasMore() )
            {
                Object value = normalizer.normalize( list.next() );
           
                // Found a value that is greater than or equal to the ava value
                if ( 0 >= comparator.compare( value, filterValue ) )
                {
                    return true;
                }
            }
        }
        else
        {   
            while ( list.hasMore() )
            {
                Object value = normalizer.normalize( list.next() );
           
                // Found a value that is less than or equal to the ava value
                if ( 0 <= comparator.compare( value, filterValue ) )
                {
                    return true;
View Full Code Here

     * @throws javax.naming.NamingException if there is a database access failure
     */
    private boolean evalEquality( SimpleNode node, Attributes entry )
        throws NamingException
    {
        Normalizer normalizer = getNormalizer( node.getAttribute() );
        Comparator comparator = getComparator( node.getAttribute() );

        // get the attribute associated with the node
        Attribute attr = entry.get( node.getAttribute() );

        // If we do not have the attribute just return false
        if ( null == attr )
        {
            return false;
        }
       
        // check if AVA value exists in attribute
        if ( attr.contains( node.getValue() ) )
        {
            return true;
        }

        // get the normalized AVA filter value
        Object filterValue = normalizer.normalize( node.getValue() );

        // check if the normalized value is present
        if ( attr.contains( filterValue ) )
        {
            return true;
        }
       
        /*
         * We need to now iterate through all values because we could not get
         * a lookup to work.  For each value we normalize and use the comparator
         * to determine if a match exists.
         */
        NamingEnumeration list = attr.getAll();
        while ( list.hasMore() )
        {
            Object value = normalizer.normalize( list.next() );
           
            if ( 0 == comparator.compare( value, filterValue ) )
            {
                return true;
            }
View Full Code Here

    {
        RE regex = null;
        SubstringNode snode = ( SubstringNode ) node;
        String oid = oidRegistry.getOid( snode.getAttribute() );
        AttributeType type = attributeTypeRegistry.lookup( oid );
        Normalizer normalizer = type.getSubstr().getNormalizer();

        // get the attribute
        Attribute attr = entry.get( snode.getAttribute() );
       
        // if the attribute does not exist just return false
        if ( null == attr )
        {
            return false;
        }

        // compile the regular expression to search for a matching attribute
        try
        {
            regex = snode.getRegex( normalizer );
        }
        catch ( RESyntaxException e )
        {
            NamingException ne = new NamingException( "SubstringNode '"
                + node + "' had " + "incorrect syntax" );
            ne.setRootCause( e );
            throw ne;
        }
       
        /*
         * Cycle through the attribute values testing normalized version
         * obtained from using the substring matching rule's normalizer.
         * The test uses the comparator obtained from the appropriate
         * substring matching rule.
         */
        NamingEnumeration list = attr.getAll();
        while ( list.hasMore() )
        {
            String value = ( String )
                normalizer.normalize( list.next() );
           
            // Once match is found cleanup and return true
            if ( regex.match( value ) )
            {
                list.close();
View Full Code Here

        /*
         * Get ahold of the normalizer for the attribute and normalize the request
         * assertion value for comparisons with normalized attribute values.  Loop
         * through all values looking for a match.
         */
        Normalizer normalizer = attrType.getEquality().getNormalizer();
        String reqVal = ( String ) normalizer.normalize( value );
        for ( int ii = 0; ii < attr.size(); ii++ )
        {
            String attrVal = ( String ) normalizer.normalize( attr.get( ii ) );
            if ( attrVal.equals( reqVal ) )
            {
                return true;
            }
        }
View Full Code Here

        BootstrapRegistries registries = ( BootstrapRegistries ) this.registries.get();

        switch( type.getValue() )
        {
            case( ProducerTypeEnum.NORMALIZER_PRODUCER_VAL ):
                Normalizer normalizer = ( Normalizer ) schemaObject;
                NormalizerRegistry normalizerRegistry;
                normalizerRegistry = registries.getNormalizerRegistry();
                normalizerRegistry.register( schema.getSchemaName(), id, normalizer );
                break;
            case( ProducerTypeEnum.COMPARATOR_PRODUCER_VAL ):
View Full Code Here

       
        /*
         * We need to iterate through all values and for each value we normalize
         * and use the comparator to determine if a match exists.
         */
        Normalizer normalizer = getNormalizer( attrId );
        Comparator comparator = getComparator( attrId );
        Object filterValue = normalizer.normalize( node.getValue() );
        NamingEnumeration list = attr.getAll();
       
        /*
         * Cheaper to not check isGreater in one loop - better to separate
         * out into two loops which you choose to execute based on isGreater
         */
        if ( isGreater )
        {
            while ( list.hasMore() )
            {
                Object value = normalizer.normalize( list.next() );
           
                // Found a value that is greater than or equal to the ava value
                if ( 0 >= comparator.compare( value, filterValue ) )
                {
                    return true;
                }
            }
        }
        else
        {   
            while ( list.hasMore() )
            {
                Object value = normalizer.normalize( list.next() );
           
                // Found a value that is less than or equal to the ava value
                if ( 0 <= comparator.compare( value, filterValue ) )
                {
                    return true;
View Full Code Here

        {
            Index idx = db.getUserIndex( node.getAttribute() );
            return idx.hasValue( node.getValue(), rec.getEntryId() );
        }

        Normalizer normalizer = getNormalizer( node.getAttribute() );
        Comparator comparator = getComparator( node.getAttribute() );

        /*
         * Get the attribute and if it is not set in rec then resusitate it
         * from the master table and set it in rec for use later if at all.
         * Before iterating through all values for a match check to see if the
         * AVA value is contained or the normalized form of the AVA value is
         * contained.
         */
       
        // resusitate entry if need be
        if ( null == rec.getAttributes() )
        {
            rec.setAttributes( db.lookup( rec.getEntryId() ) );
        }
       
        // get the attribute associated with the node
        Attribute attr = rec.getAttributes().get( node.getAttribute() );
       
        // If we do not have the attribute just return false
        if ( null == attr )
        {
            return false;
        }
       
        // check if AVA value exists in attribute
        if ( attr.contains( node.getValue() ) )
        {
            return true;
        }

        // get the normalized AVA filter value
        Object filterValue = normalizer.normalize( node.getValue() );

        // check if the normalized value is present
        if ( attr.contains( filterValue ) )
        {
            return true;
        }
       
        /*
         * We need to now iterate through all values because we could not get
         * a lookup to work.  For each value we normalize and use the comparator
         * to determine if a match exists.
         */
        NamingEnumeration list = attr.getAll();
        while ( list.hasMore() )
        {
            Object value = normalizer.normalize( list.next() );
           
            if ( 0 == comparator.compare( value, filterValue ) )
            {
                return true;
            }
View Full Code Here


    public void produce( BootstrapRegistries registries, ProducerCallback cb )
            throws NamingException
    {
        Normalizer normalizer;

        /*
         * Straight out of RFC 2252: Section 8
         * =======================================

 
View Full Code Here

     * @see org.apache.ldap.server.schema.bootstrap.BootstrapProducer#produce(org.apache.ldap.server.schema.bootstrap.BootstrapRegistries, org.apache.ldap.server.schema.bootstrap.ProducerCallback)
     */
    public void produce( BootstrapRegistries registries, ProducerCallback cb )
        throws NamingException
    {
        Normalizer normalizer;

        // For exactDnAsStringMatch -> 1.2.6.1.4.1.18060.1.1.1.2.1
        normalizer = new NoOpNormalizer();
        cb.schemaObjectProduced( this, "1.2.6.1.4.1.18060.1.1.1.2.1", normalizer );

View Full Code Here

TOP

Related Classes of org.apache.ldap.common.schema.Normalizer

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.