Examples of SyntaxChecker


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

    {
        // First, loop on all attributes
        for ( Attribute attribute : entry )
        {
            AttributeType attributeType = attribute.getAttributeType();
            SyntaxChecker syntaxChecker = attributeType.getSyntax().getSyntaxChecker();

            if ( syntaxChecker instanceof OctetStringSyntaxChecker )
            {
                // This is a speedup : no need to check the syntax of any value
                // if all the syntaxes are accepted...
                continue;
            }

            // Then loop on all values
            for ( Value<?> value : attribute )
            {
                if ( value.isSchemaAware() )
                {
                    // No need to validate something which is already ok
                    continue;
                }

                try
                {
                    syntaxChecker.assertSyntax( value.getValue() );
                }
                catch ( Exception ne )
                {
                    String message = I18n.err( I18n.ERR_280, value.getString(), attribute.getUpId() );
                    LOG.info( message );
View Full Code Here

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

        {
            Entry entry = connection.lookup( "m-oid=" + oid + ",ou=syntaxCheckers,cn=" + schemaName + ",ou=schema" );
            assertNotNull( entry );
            SchemaEntityFactory factory = new SchemaEntityFactory();

            SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, entry, getService()
                .getSchemaManager().getRegistries(), schemaName );
            assertEquals( oid, syntaxChecker.getOid() );
        }
        else
        {
            Entry entry = connection.lookup( "m-oid=" + oid + ",ou=syntaxCheckers,cn=" + schemaName + ",ou=schema" );
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 boolean isSyntaxCheckerPresent( SchemaManager schemaManager, String oid )
    {
        try
        {
            SyntaxChecker syntaxChecker = schemaManager.lookupSyntaxCheckerRegistry( oid );

            return syntaxChecker != null;
        }
        catch ( LdapException ne )
        {
View Full Code Here

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

        // Check that the S and SC are present
        assertTrue( isSyntaxCheckerPresent( schemaManager, OID ) );
        assertTrue( isSyntaxPresent( schemaManager, OID ) );

        // Now try to remove the SC
        SyntaxChecker sc = schemaManager.lookupSyntaxCheckerRegistry( OID );

        // shouldn't be deleted cause there is a S associated with it
        assertFalse( schemaManager.delete( sc ) );

        List<Throwable> errors = schemaManager.getErrors();
View Full Code Here

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

    {
        SchemaManager schemaManager = loadSchema( "system" );
        int scrSize = schemaManager.getSyntaxCheckerRegistry().size();
        int goidSize = schemaManager.getGlobalOidRegistry().size();

        SyntaxChecker sc = new BooleanSyntaxChecker();
        sc.setOid( "0.1.1" );
        assertTrue( schemaManager.add( sc ) );

        assertEquals( scrSize + 1, schemaManager.getSyntaxCheckerRegistry().size() );
        assertEquals( goidSize, schemaManager.getGlobalOidRegistry().size() );
View Full Code Here

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

    {
        SchemaManager schemaManager = loadSchema( "system" );
        int scrSize = schemaManager.getSyntaxCheckerRegistry().size();
        int goidSize = schemaManager.getGlobalOidRegistry().size();

        SyntaxChecker sc = new BooleanSyntaxChecker();
        sc.setOid( "0.0" );
        assertFalse( schemaManager.delete( sc ) );

        List<Throwable> errors = schemaManager.getErrors();
        assertFalse( errors.isEmpty() );
View Full Code Here

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

    {
        SchemaManager schemaManager = loadSchema( "system" );
        int scrSize = schemaManager.getSyntaxCheckerRegistry().size();
        int goidSize = schemaManager.getGlobalOidRegistry().size();

        SyntaxChecker sc = schemaManager.lookupSyntaxCheckerRegistry( "1.3.6.1.4.1.1466.115.121.1.1" );

        //FIXME should return false but is returning true
        assertFalse( schemaManager.delete( sc ) );

        List<Throwable> errors = schemaManager.getErrors();
View Full Code Here

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

        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.