Package org.apache.directory.api.ldap.model.schema

Examples of org.apache.directory.api.ldap.model.schema.MatchingRule


     * @return the comparator for equality matching
     * @throws LdapException if there is a failure
     */
    private LdapComparator<? super Object> getComparator( AttributeType attributeType ) throws LdapException
    {
        MatchingRule mrule = getMatchingRule( attributeType, EQUALITY_MATCH );

        return mrule.getLdapComparator();
    }
View Full Code Here


     * @return the normalizer for equality matching
     * @throws LdapException if there is a failure
     */
    private Normalizer getNormalizer( AttributeType attributeType ) throws LdapException
    {
        MatchingRule mrule = getMatchingRule( attributeType, EQUALITY_MATCH );

        return mrule.getNormalizer();
    }
View Full Code Here

     * @return the matching rule
     * @throws LdapException if there is a failure
     */
    private MatchingRule getMatchingRule( AttributeType attributeType, int matchType ) throws LdapException
    {
        MatchingRule mrule = null;

        switch ( matchType )
        {
            case ( EQUALITY_MATCH ):
                mrule = attributeType.getEquality();
View Full Code Here

    }


    public static MatchingRule matchingRuleFactory( String oid )
    {
        MatchingRule matchingRule = new MutableMatchingRule( oid );

        return matchingRule;
    }
View Full Code Here

        this.db = db;
        this.node = node;
        this.schemaManager = schemaManager;
        this.attributeType = node.getAttributeType();

        MatchingRule rule = attributeType.getSubstring();

        if ( rule == null )
        {
            rule = attributeType.getEquality();
        }

        if ( rule != null )
        {
            normalizer = rule.getNormalizer();
        }
        else
        {
            normalizer = new NoOpNormalizer( attributeType.getSyntaxOid() );
        }
View Full Code Here

         * We prefer matching using the Normalizer and Comparator pair from
         * the ordering matchingRule if one is available.  It may very well
         * not be.  If so then we resort to using the Normalizer and
         * Comparator from the equality matchingRule as a last resort.
         */
        MatchingRule mr = attributeType.getOrdering();

        if ( mr == null )
        {
            mr = attributeType.getEquality();
        }

        if ( mr == null )
        {
            throw new IllegalStateException( I18n.err( I18n.ERR_715, node ) );
        }

        normalizer = mr.getNormalizer();
        ldapComparator = mr.getLdapComparator();
    }
View Full Code Here

            indexEntry.setKey( node.getInitial() );

            cursor.before( indexEntry );
            int nbResults = 0;

            MatchingRule rule = attributeType.getSubstring();

            if ( rule == null )
            {
                rule = attributeType.getEquality();
            }

            Normalizer normalizer;
            Pattern regexp;

            if ( rule != null )
            {
                normalizer = rule.getNormalizer();
            }
            else
            {
                normalizer = new NoOpNormalizer( attributeType.getSyntaxOid() );
            }
View Full Code Here

        int pos = 0;

        for ( Value<?> value : attr )
        {
            MatchingRule matchingRule = null;

            try
            {
                matchingRule = matchingRuleParser.parseMatchingRuleDescription( value.getString() );
                matchingRule.setSpecification( value.getString() );
            }
            catch ( ParseException e )
            {
                LdapInvalidAttributeValueException iave = new LdapInvalidAttributeValueException(
                    ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err( I18n.ERR_424,
                        value.getString() ) );
                iave.initCause( e );
                throw iave;
            }

            if ( !schemaManager.getLdapSyntaxRegistry().contains( matchingRule.getSyntaxOid() ) )
            {
                throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM,
                    I18n.err( I18n.ERR_425, matchingRule.getSyntaxOid() ) );
            }

            matchingRules[pos++] = matchingRule;
        }
View Full Code Here

        // -------------------------------------------------------------------
        // get the subschemaSubentry again
        updateSSSE();

        Attribute attrTypes = subschemaSubentry.get( "matchingRules" );
        MatchingRule matchingRule = null;

        for ( Value<?> value : attrTypes )
        {
            String desc = value.getString();

            if ( desc.indexOf( oid ) != -1 )
            {
                matchingRule = matchingRuleDescriptionSchemaParser.parseMatchingRuleDescription( desc );
                break;
            }
        }

        if ( isPresent )
        {
            assertNotNull( matchingRule );
            assertEquals( oid, matchingRule.getOid() );
        }
        else
        {
            assertNull( matchingRule );
        }
View Full Code Here

    public boolean evaluate( ExprNode node, Dn dn, Entry entry ) throws LdapException
    {
        Pattern regex = null;
        SubstringNode snode = ( SubstringNode ) node;
        AttributeType attributeType = snode.getAttributeType();
        MatchingRule matchingRule = attributeType.getSubstring();

        if ( matchingRule == null )
        {
            matchingRule = attributeType.getEquality();
        }

        Normalizer normalizer = matchingRule.getNormalizer();

        // get the attribute
        Attribute attr = entry.get( snode.getAttribute() );

        // if the attribute does not exist just return false
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.schema.MatchingRule

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.