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

Examples of org.apache.directory.shared.ldap.model.schema.Normalizer


        s.setSyntaxChecker( new OctetStringSyntaxChecker() );
        mr = EntryUtils.matchingRuleFactory( "1.1.2.1" );
        mr.setSyntax( s );
       
        mr.setLdapComparator( new ByteArrayComparator( "1.1.1" ) );
        mr.setNormalizer( new Normalizer( "1.1.1" )
        {
            private static final long serialVersionUID = 1L;
           
            public Value<?> normalize( Value<?> value ) throws LdapException
            {
View Full Code Here


            return;
        }

        if ( attributeType != null )
        {
            Normalizer normalizer = getNormalizer();
            normalize( normalizer );
        }
        else
        {
            normalizedValue = wrappedValue;
View Full Code Here

                    ( o2 == null ? 0 : -1 ) :
                    ( o2 == null ? 1 : o1.compareTo( o2 ) ) );
            }
        } );
       
        Normalizer normalizer = new Normalizer( "1.1.1" )
        {
            private static final long serialVersionUID = 0L;

            public Value<?> normalize( Value<?> value ) throws LdapException
            {
View Full Code Here

        MatchingRule matchingRule = new MatchingRule( "1.2.2" );
        matchingRule.setSyntax( syntax );

        matchingRule.setLdapComparator( new ByteArrayComparator( "1.2.2" ) );
       
        matchingRule.setNormalizer( new Normalizer( "1.1.1" )
        {
            // The serial UID
            private static final long serialVersionUID = 1L;
           
            public Value<?> normalize( Value<?> value ) throws LdapException
View Full Code Here

            return;
        }
       
        if ( attributeType != null )
        {
            Normalizer normalizer = getNormalizer();
   
            if ( normalizer == null )
            {
                normalizedValue = wrappedValue;
            }
            else
            {
                normalizedValue = ( String ) normalizer.normalize( wrappedValue );
            }
   
            normalized = true;
        }
    }
View Full Code Here

                    {
                        return comparator.compare( getNormalizedValue(), other.getNormalizedValue() ) == 0;
                    }
                    else
                    {
                        Normalizer normalizer = attributeType.getEquality().getNormalizer();
                        return comparator.compare( normalizer.normalize( get() ), normalizer.normalize( other.get() ) ) == 0;
                    }
                }
            }
            catch ( LdapException ne )
            {
View Full Code Here

            return true;
        }

        MatchingRule matchingRule = type.getEquality();

        Normalizer normalizer = null;

        if ( matchingRule != null )
        {
            normalizer = matchingRule.getNormalizer();
        }
        else
        {
            normalizer = new NoOpNormalizer( type.getOid() );
        }

        if ( type.getSyntax().isHumanReadable() )
        {
            try
            {
                String comparedStr = normalizer.normalize( compared.getString() );

                for ( NamingEnumeration<?> values = attr.getAll(); values.hasMoreElements(); /**/)
                {
                    String value = ( String ) values.nextElement();
                    if ( comparedStr.equals( normalizer.normalize( value ) ) )
                    {
                        return true;
                    }
                }
            }
View Full Code Here

    private Normalizer classLoadNormalizer( SchemaManager schemaManager, String oid, String className,
        EntryAttribute byteCode ) throws Exception
    {
        // Try to class load the normalizer
        Class<?> clazz = null;
        Normalizer normalizer = null;
        String byteCodeStr = StringConstants.EMPTY;

        if ( byteCode == null )
        {
            clazz = Class.forName( className );
        }
        else
        {
            classLoader.setAttribute( byteCode );
            clazz = classLoader.loadClass( className );
            byteCodeStr = new String( Base64.encode( byteCode.getBytes() ) );
        }

        // Create the normalizer instance
        normalizer = ( Normalizer ) clazz.newInstance();

        // Update the common fields
        normalizer.setBytecode( byteCodeStr );
        normalizer.setFqcn( className );

        // Inject the new OID, as the loaded normalizer might have its own
        normalizer.setOid( oid );

        // Inject the SchemaManager for the normalizer who needs it
        normalizer.setSchemaManager( schemaManager );

        return normalizer;
    }
View Full Code Here

        // get the byteCode
        EntryAttribute byteCode = getByteCode( normalizerDescription, SchemaConstants.NORMALIZER );

        // Class load the normalizer
        Normalizer normalizer = classLoadNormalizer( schemaManager, oid, fqcn, byteCode );

        // Update the common fields
        setSchemaObjectProperties( normalizer, normalizerDescription, schema );

        return normalizer;
View Full Code Here

        EntryAttribute byteCode = entry.get( MetaSchemaConstants.M_BYTECODE_AT );

        try
        {
            // Class load the Normalizer
            Normalizer normalizer = classLoadNormalizer( schemaManager, oid, className, byteCode );
   
            // Update the common fields
            setSchemaObjectProperties( normalizer, entry, schema );
   
            // return the resulting Normalizer
View Full Code Here

TOP

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