Examples of SyntaxChecker


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

    /* No protection */static AttributeType getBytesAttributeType()
    {
        AttributeType attributeType = new AttributeType( "1.2" );
        LdapSyntax syntax = new LdapSyntax( "1.2.1", "", false );

        syntax.setSyntaxChecker( new SyntaxChecker( "1.2.1" )
        {
            public boolean isValidSyntax( Object value )
            {
                return ( value == null ) || ( ( ( byte[] ) value ).length < 5 );
            }
View Full Code Here

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

    /* no protection*/ static AttributeType getCaseIgnoringAttributeNoNumbersType()
    {
        AttributeType attributeType = new AttributeType( "1.1.3.1" );
        LdapSyntax syntax = new LdapSyntax( "1.1.1.1", "", true );

        syntax.setSyntaxChecker( new SyntaxChecker( "1.1.2.1" )
        {
            public boolean isValidSyntax( Object value )
            {
                if ( value == null )
                {
View Full Code Here

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

    {
        AttributeType attributeType = new AttributeType( "1.1" );
        attributeType.addName( "1.1" );
        LdapSyntax syntax = new LdapSyntax( "1.1.1", "", true );

        syntax.setSyntaxChecker( new SyntaxChecker( "1.1.2" )
        {
            public boolean isValidSyntax( Object value )
            {
                return ((String)value == null) || (((String)value).length() < 7) ;
            }
View Full Code Here

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

    /* No protection */ static AttributeType getBytesAttributeType()
    {
        AttributeType attributeType = new AttributeType( "1.2" );
        LdapSyntax syntax = new LdapSyntax( "1.2.1", "", false );

        syntax.setSyntaxChecker( new SyntaxChecker( "1.2.1" )
        {
            public boolean isValidSyntax( Object value )
            {
                return ( value == null ) || ( ((byte[])value).length < 5 );
            }
View Full Code Here

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

    static AttributeType getCaseIgnoringAttributeNoNumbersType()
    {
        AttributeType attributeType = new AttributeType( "1.1.3.1" );
        LdapSyntax syntax = new LdapSyntax( "1.1.1.1", "", true );

        syntax.setSyntaxChecker( new SyntaxChecker( "1.1.2.1" )
        {
            public boolean isValidSyntax( Object value )
            {
                if ( !( value instanceof String ) )
                {
View Full Code Here

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

    {
        AttributeType attributeType = new AttributeType( "1.1" );
        attributeType.addName( "1.1" );
        LdapSyntax syntax = new LdapSyntax( "1.1.1", "", true );

        syntax.setSyntaxChecker( new SyntaxChecker( "1.1.2" )
        {
            public boolean isValidSyntax( Object value )
            {
                return ((String)value == null) || (((String)value).length() < 7) ;
            }
View Full Code Here

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

    /* No protection */ static AttributeType getBytesAttributeType()
    {
        AttributeType attributeType = new AttributeType( "1.2" );
        LdapSyntax syntax = new LdapSyntax( "1.2.1", "", true );

        syntax.setSyntaxChecker( new SyntaxChecker( "1.2.1" )
        {
            public boolean isValidSyntax( Object value )
            {
                return ( value == null ) || ( ((byte[])value).length < 5 );
            }
View Full Code Here

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

        if ( syntax == null )
        {
            return false;
        }
       
        SyntaxChecker syntaxChecker = syntax.getSyntaxChecker();
       
        if ( syntaxChecker == null )
        {
            return false;
        }
       
       
        // Check that we can have no value for this attributeType
        if ( values.size() == 0 )
        {
            return syntaxChecker.isValidSyntax( null );
        }
       
        // Check that we can't have more than one value if the AT is single-value
        if ( attributeType.isSingleValued() )
        {
View Full Code Here

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

    private SyntaxChecker classLoadSyntaxChecker( SchemaManager schemaManager, String oid, String className, Attribute byteCode )
        throws Exception
    {
        // Try to class load the syntaxChecker
        Class<?> clazz = null;
        SyntaxChecker syntaxChecker = 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 syntaxChecker instance
        syntaxChecker = ( SyntaxChecker ) clazz.newInstance();

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

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

        // Inject the SchemaManager for the comparator who needs it
        syntaxChecker.setSchemaManager( schemaManager );
       
        return syntaxChecker;
    }
View Full Code Here

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

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

        try
        {
            // Class load the syntaxChecker
            SyntaxChecker syntaxChecker = classLoadSyntaxChecker( schemaManager, oid, className, byteCode );
   
            // Update the common fields
            setSchemaObjectProperties( syntaxChecker, entry, schema );
   
            // return the resulting syntaxChecker
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.