Package org.apache.directory.shared.asn1.util

Examples of org.apache.directory.shared.asn1.util.Oid


        assertEquals( "This is a response", Strings.utf8ToString( extendedResponse.getResponseValue() ) );

        try
        {
            assertEquals( new Oid( "1.2.3.4.5.6.7.8.9.0" ).toString(), extendedResponse.getResponseName().toString() );
        }
        catch ( DecoderException e )
        {
            fail();
        }
View Full Code Here


            LOG.error( msg );
            throw new DecoderException( msg );
        }
        else
        {
            String responseName = new Oid( Strings.asciiBytesToString( tlv.getValue().getData() ) )
                .toString();

            extendedResponse = LdapApiServiceFactory.getSingleton().newExtendedResponse( responseName,
                container.getMessageId(), null );
           
View Full Code Here

     */
    public ExtendedResponse extended( String oid, byte[] value ) throws LdapException
    {
        try
        {
            return extended( new Oid( oid ), value );
        }
        catch ( DecoderException e )
        {
            String msg = "Failed to decode the OID " + oid;
            LOG.error( msg );
View Full Code Here

     */
    public ExtendedResponse extended( String oid, byte[] value ) throws LdapException
    {
        try
        {
            return extended( new Oid( oid ), value );
        }
        catch ( DecoderException e )
        {
            String msg = "Failed to decode the OID " + oid;
            LOG.error( msg );
View Full Code Here

        catch ( BooleanDecoderException bde )
        {
            LOG.error( I18n
                .err( I18n.ERR_04110, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );

            throw new DecoderException( bde.getMessage() );
        }

        if ( IS_DEBUG )
        {
            LOG.debug( "Dn Attributes : {}", Boolean.valueOf( extensibleMatchFilter.isDnAttributes() ) );
View Full Code Here

                        }
                        catch ( IntegerDecoderException e )
                        {
                            String msg = I18n.err( I18n.ERR_04031, Strings.dumpBytes( value.getData() ) );
                            LOG.error( msg );
                            throw new DecoderException( msg );
                        }
                    }
                } );
    }
View Full Code Here

                        catch ( BooleanDecoderException bde )
                        {
                            LOG.error( I18n.err( I18n.ERR_04054, Strings.dumpBytes( value.getData() ), bde.getMessage() ) );

                            // This will generate a PROTOCOL_ERROR
                            throw new DecoderException( bde.getMessage() );
                        }
                    }
                } );
    }
View Full Code Here

                                    break;

                                default:
                                    String msg = I18n.err( I18n.ERR_04044 );
                                    LOG.error( msg );
                                    throw new DecoderException( msg );
                            }

                            // We can have an END transition
                            container.setGrammarEndAllowed( true );
                        }
                        catch ( IntegerDecoderException e )
                        {
                            String msg = I18n.err( I18n.ERR_04044 );
                            LOG.error( msg, e );
                            throw new DecoderException( msg );
                        }
                        catch ( IllegalArgumentException e )
                        {
                            throw new DecoderException( e.getLocalizedMessage() );
                        }
                    }
                } );

        // ============================================================================================
        // Transition from Change Type to Previous Dn
        // ============================================================================================
        // EntryChangeNotification ::= SEQUENCE {
        //     ...
        //     previousDN LDAPDN OPTIONAL,
        //     ...
        //
        // Set the previousDN into the structure. We first check that it's a
        // valid Dn
        super.transitions[EntryChangeStates.CHANGE_TYPE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
            new GrammarTransition<EntryChangeContainer>( EntryChangeStates.CHANGE_TYPE_STATE,
                EntryChangeStates.PREVIOUS_DN_STATE,
                UniversalTag.OCTET_STRING.getValue(),
                new GrammarAction<EntryChangeContainer>( "Set EntryChangeControl previousDN" )
                {
                    public void action( EntryChangeContainer container ) throws DecoderException
                    {
                        ChangeType changeType = container.getEntryChangeDecorator().getChangeType();

                        if ( changeType != ChangeType.MODDN )
                        {
                            LOG.error( I18n.err( I18n.ERR_04045 ) );
                            throw new DecoderException( I18n.err( I18n.ERR_04046 ) );
                        }
                        else
                        {
                            Value value = container.getCurrentTLV().getValue();
                            Dn previousDn;

                            try
                            {
                                previousDn = new Dn( Strings.utf8ToString( value.getData() ) );
                            }
                            catch ( LdapInvalidDnException ine )
                            {
                                LOG.error( I18n.err( I18n.ERR_04047, Strings.dumpBytes( value.getData() ) ) );
                                throw new DecoderException( I18n.err( I18n.ERR_04048 ) );
                            }

                            if ( IS_DEBUG )
                            {
                                LOG.debug( "previousDN = " + previousDn );
                            }

                            container.getEntryChangeDecorator().setPreviousDn( previousDn );

                            // We can have an END transition
                            container.setGrammarEndAllowed( true );
                        }
                    }
                } );

        // Change Number action
        GrammarAction<EntryChangeContainer> setChangeNumberAction = new GrammarAction<EntryChangeContainer>(
            "Set EntryChangeControl changeNumber" )
        {
            public void action( EntryChangeContainer container ) throws DecoderException
            {
                Value value = container.getCurrentTLV().getValue();

                try
                {
                    long changeNumber = LongDecoder.parse( value );

                    if ( IS_DEBUG )
                    {
                        LOG.debug( "changeNumber = " + changeNumber );
                    }

                    container.getEntryChangeDecorator().setChangeNumber( changeNumber );

                    // We can have an END transition
                    container.setGrammarEndAllowed( true );
                }
                catch ( LongDecoderException e )
                {
                    String msg = I18n.err( I18n.ERR_04049 );
                    LOG.error( msg, e );
                    throw new DecoderException( msg );
                }
            }
        };

        // ============================================================================================
View Full Code Here

            return buffer;
        }

        if ( buffer == null )
        {
            throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
        }

        if ( ( getResponse().getTimeBeforeExpiration() < 0 ) && ( getResponse().getGraceAuthNsRemaining() < 0 ) && (
            getResponse().getPasswordPolicyError() == null ) )
        {
View Full Code Here

                }
            }
        }
        catch ( BufferOverflowException boe )
        {
            throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
        }

        return bb;
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.asn1.util.Oid

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.