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

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


            assertNotNull( attrs );
            SchemaEntityFactory factory = new SchemaEntityFactory();
           
            ServerEntry serverEntry = ServerEntryUtils.toServerEntry( attrs, DN.EMPTY_DN, service.getSchemaManager() );

            SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, serverEntry, service.getSchemaManager().getRegistries(), schemaName );
            assertEquals( oid, syntaxChecker.getOid() );
        }
        else
        {
            //noinspection EmptyCatchBlock
            try
View Full Code Here


    {
        // First, loop on all attributes
        for ( EntryAttribute 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.isValid() )
                {
                    // No need to validate something which is already ok
                    continue;
                }
               
                try
                {
                    syntaxChecker.assertSyntax( value.get() );
                }
                catch ( Exception ne )
                {
                    String message = I18n.err( I18n.ERR_280, value.getString(), attribute.getUpId() );
                    LOG.info( message );
View Full Code Here

    /* 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" )
        {
            private static final long serialVersionUID = 0L;

            public boolean isValidSyntax( Object value )
            {
View Full Code Here

    {
        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" )
        {
            private static final long serialVersionUID = 0L;

            public boolean isValidSyntax( Object value )
            {
View Full Code Here

    /* 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" )
        {
            private static final long serialVersionUID = 0L;

            public boolean isValidSyntax( Object value )
            {
View Full Code Here

        {
            ServerEntry result = list.get();
            LdapDN resultDN = result.getDn();
            resultDN.normalize( atRegistry.getNormalizerMapping() );
            ServerEntry attrs = lookupPartition( resultDN );
            SyntaxChecker sc = factory.getSyntaxChecker( attrs, targetRegistries );
            SyntaxCheckerDescription syntaxCheckerDescription =
                getSyntaxCheckerDescription( schema.getSchemaName(), attrs );
            targetRegistries.getSyntaxCheckerRegistry().register( syntaxCheckerDescription, sc );
        }
    }
View Full Code Here

   
    protected boolean modify( LdapDN name, ServerEntry entry, ServerEntry targetEntry, boolean cascade ) throws Exception
    {
        String oid = getOid( entry );
        SyntaxChecker syntaxChecker = factory.getSyntaxChecker( targetEntry, targetRegistries );
       
        Schema schema = getSchema( name );
       
        if ( ! schema.isDisabled() )
        {
View Full Code Here

        {
            throw new LdapNamingException( "Oid " + oid + " for new schema syntaxChecker is not unique.",
                ResultCodeEnum.OTHER );
        }
       
        SyntaxChecker syntaxChecker = factory.getSyntaxChecker( entry, targetRegistries );
        Schema schema = getSchema( name );
       
        if ( ! schema.isDisabled() )
        {
            SyntaxCheckerDescription syntaxCheckerDescription =
View Full Code Here

    }


    public void add( SyntaxCheckerDescription syntaxCheckerDescription ) throws Exception
    {
        SyntaxChecker syntaxChecker = factory.getSyntaxChecker( syntaxCheckerDescription, targetRegistries );
        String schemaName = MetaSchemaConstants.SCHEMA_OTHER;
       
        if ( syntaxCheckerDescription.getExtensions().get( MetaSchemaConstants.X_SCHEMA ) != null )
        {
            schemaName = syntaxCheckerDescription.getExtensions()
View Full Code Here

        }

        targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
        if ( ! schema.isDisabled() )
        {
            SyntaxChecker syntaxChecker = factory.getSyntaxChecker( targetEntry, targetRegistries );
            syntaxCheckerRegistry.unregister( oldOid );
            SyntaxCheckerDescription syntaxCheckerDescription =
                getSyntaxCheckerDescription( schema.getSchemaName(), entry );
            syntaxCheckerDescription.setNumericOid( newOid );
            syntaxCheckerRegistry.register( syntaxCheckerDescription, syntaxChecker );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.schema.SyntaxChecker

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.