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

Examples of org.apache.directory.shared.ldap.schema.MatchingRule


            {
                String oid = schemaManager.getAttributeTypeRegistry().getOidByName( index.getAttributeId() );
                AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( oid );

                // Check that the attributeType has an EQUALITY matchingRule
                MatchingRule mr = attributeType.getEquality();

                if ( mr != null )
                {
                    index.initialize( schemaManager.lookupAttributeTypeRegistry( oid ) );
                    tmp.put( oid, index );
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 = type.getOrdering();

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

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

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

     * @return the comparator for equality matching
     * @throws javax.naming.NamingException if there is a failure
     */
    private LdapComparator<? super Object> getComparator( String attrId ) throws NamingException
    {
        MatchingRule mrule = getMatchingRule( attrId, EQUALITY_MATCH );
        return mrule.getLdapComparator();
    }
View Full Code Here

     * @return the normalizer for equality matching
     * @throws javax.naming.NamingException if there is a failure
     */
    private Normalizer getNormalizer( String attrId ) throws NamingException
    {
        MatchingRule mrule = getMatchingRule( attrId, EQUALITY_MATCH );
        return mrule.getNormalizer();
    }
View Full Code Here

     * @return the matching rule
     * @throws javax.naming.NamingException if there is a failure
     */
    private MatchingRule getMatchingRule( String attrId, int matchType ) throws NamingException
    {
        MatchingRule mrule = null;
        AttributeType type = schemaManager.lookupAttributeTypeRegistry( attrId );

        switch ( matchType )
        {
            case ( EQUALITY_MATCH ):
View Full Code Here

    {
        Pattern regex = null;
        SubstringNode snode = (SubstringNode)node;
        String oid = schemaManager.getAttributeTypeRegistry().getOidByName( snode.getAttribute() );
        AttributeType type = schemaManager.lookupAttributeTypeRegistry( oid );
        MatchingRule matchingRule = type.getSubstring();
       
        if ( matchingRule == null )
        {
            matchingRule = type.getEquality();
        }
       
        Normalizer normalizer = matchingRule.getNormalizer();
       

        // get the attribute
        EntryAttribute attr = entry.get( snode.getAttribute() );
View Full Code Here

    public AttributeType lookup( final String id ) throws NamingException
    {
        Normalizer normalizer = new DeepTrimToLowerNormalizer( "1.1.1" );

        MatchingRule equality = new MatchingRule( "1.1.1" );
        equality.setNormalizer( normalizer );
       
        AttributeType attributeType = new AttributeType( id );
        attributeType.setEquality( equality );
        attributeType.setSingleValued( false );
        attributeType.setCollective( false );
View Full Code Here

        throws Exception
    {
        DN name = opContext.getDn();
        ServerEntry entry = opContext.getEntry();
        String schemaName = getSchemaName( name );
        MatchingRule mr = factory.getMatchingRule( schemaManager, targetEntry, schemaManager.getRegistries(),
            schemaName );

        String oldOid = getOid( entry );

        if ( isSchemaEnabled( schemaName ) )
View Full Code Here

        checkOidIsUnique( entry );

        // Build the new MatchingRule from the given entry
        String schemaName = getSchemaName( dn );

        MatchingRule matchingRule = factory.getMatchingRule( schemaManager, entry, schemaManager.getRegistries(),
            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

           
            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

TOP

Related Classes of org.apache.directory.shared.ldap.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.