Package org.apache.directory.shared.ldap.codec.add

Examples of org.apache.directory.shared.ldap.codec.add.AddRequestCodec


     */
    public AddFuture addAsync( AddRequest addRequest ) throws LdapException
    {
        checkSession();

        AddRequestCodec addReqCodec = new AddRequestCodec();

        int newId = messageId.incrementAndGet();
       
        addRequest.setMessageId( newId );
        addReqCodec.setMessageId( newId );

        addReqCodec.setEntry( addRequest.getEntry() );
        addReqCodec.setEntryDn( addRequest.getEntry().getDn() );
        setControls( addRequest.getControls(), addReqCodec );

        AddFuture addFuture = new AddFuture( this, newId );
        addToFutureMap( newId, addFuture );

View Full Code Here


     *            message id number
     */
    private int addEntry( LdifEntry ldifEntry, int messageId ) throws IOException, DecoderException, LdapException,
        EncoderException
    {
        AddRequestCodec addRequest = new AddRequestCodec();

        String dn = ldifEntry.getDn().getName();

        if ( isDebugEnabled() )
        {
            System.out.println( "Adding entry " + dn );
        }

        Entry entry = ldifEntry.getEntry();

        addRequest.setEntryDn( new DN( dn ) );

        // Copy the attributes
        for ( EntryAttribute attribute:entry )
        {
            addRequest.addAttributeType( attribute.getId() );

            for ( Value<?> value: attribute )
            {
                addRequest.addAttributeValue( value );
            }
        }

        addRequest.setMessageId( messageId );

        // Encode and send the addRequest message
        ByteBuffer bb = addRequest.encode();
        bb.flip();

        sendMessage( bb );

        bb.clear();
View Full Code Here

     *            message id number
     */
    private int addEntry( LdifEntry ldifEntry, int messageId ) throws IOException, DecoderException, InvalidNameException,
        NamingException, EncoderException
    {
        AddRequestCodec addRequest = new AddRequestCodec();

        String dn = ldifEntry.getDn().getName();

        if ( isDebugEnabled() )
        {
            System.out.println( "Adding entry " + dn );
        }

        Entry entry = ldifEntry.getEntry();

        addRequest.setEntryDn( new DN( dn ) );

        // Copy the attributes
        for ( EntryAttribute attribute:entry )
        {
            addRequest.addAttributeType( attribute.getId() );

            for ( Value<?> value: attribute )
            {
                addRequest.addAttributeValue( value );
            }
        }

        addRequest.setMessageId( messageId );

        // Encode and send the addRequest message
        ByteBuffer bb = addRequest.encode();
        bb.flip();

        sendMessage( bb );

        bb.clear();
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.codec.add.AddRequestCodec

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.