Package org.apache.directory.api.ldap.codec.decorators

Examples of org.apache.directory.api.ldap.codec.decorators.SearchResultEntryDecorator


            case SEARCH_RESULT_DONE:
                decorator = new SearchResultDoneDecorator( codec, ( SearchResultDone ) decoratedMessage );
                break;

            case SEARCH_RESULT_ENTRY:
                decorator = new SearchResultEntryDecorator( codec, ( SearchResultEntry ) decoratedMessage );
                break;

            case SEARCH_RESULT_REFERENCE:
                decorator = new SearchResultReferenceDecorator( codec, ( SearchResultReference ) decoratedMessage );
                break;
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchResultEntryDecorator> container ) throws DecoderException
    {
        SearchResultEntryDecorator searchResultEntry = container.getMessage();

        TLV tlv = container.getCurrentTLV();

        String type = "";

        // Store the type
        if ( tlv.getLength() == 0 )
        {
            // The type can't be null
            String msg = I18n.err( I18n.ERR_04081 );
            LOG.error( msg );
            throw new DecoderException( msg );
        }
        else
        {
            type = Strings.utf8ToString( tlv.getValue().getData() );

            try
            {
                searchResultEntry.addAttribute( type );
            }
            catch ( LdapException ine )
            {
                // This is for the client side. We will never decode LdapResult on the server
                String msg = "The Attribute type " + type + "is invalid : " + ine.getMessage();
View Full Code Here

            case SEARCH_RESULT_DONE:
                decorator = new SearchResultDoneDecorator( codec, ( SearchResultDone ) decoratedMessage );
                break;

            case SEARCH_RESULT_ENTRY:
                decorator = new SearchResultEntryDecorator( codec, ( SearchResultEntry ) decoratedMessage );
                break;

            case SEARCH_RESULT_REFERENCE:
                decorator = new SearchResultReferenceDecorator( codec, ( SearchResultReference ) decoratedMessage );
                break;
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchResultEntryDecorator> container ) throws DecoderException
    {
        SearchResultEntryDecorator searchResultEntry = container.getMessage();

        TLV tlv = container.getCurrentTLV();

        // Store the type
        if ( tlv.getLength() == 0 )
        {
            // The type can't be null
            String msg = I18n.err( I18n.ERR_04081 );
            LOG.error( msg );
            throw new DecoderException( msg );
        }
        else
        {
            try
            {
                searchResultEntry.addAttribute( tlv.getValue().getData() );
            }
            catch ( LdapException ine )
            {
                String type = Strings.utf8ToString( tlv.getValue().getData() );
                // This is for the client side. We will never decode LdapResult on the server
View Full Code Here

     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchResultEntryDecorator> container )
    {
        // Now, we can allocate the SearchResultEntry Object
        SearchResultEntryDecorator searchResultEntry = new SearchResultEntryDecorator(
            container.getLdapCodecService(), new SearchResultEntryImpl( container.getMessageId() ) );
        container.setMessage( searchResultEntry );
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchResultEntryDecorator> container ) throws DecoderException
    {
        SearchResultEntryDecorator searchResultEntry = container.getMessage();

        TLV tlv = container.getCurrentTLV();

        Dn objectName = Dn.EMPTY_DN;

        // Store the value.
        if ( tlv.getLength() == 0 )
        {
            searchResultEntry.setObjectName( objectName );
        }
        else
        {
            byte[] dnBytes = tlv.getValue().getData();
            String dnStr = Strings.utf8ToString( dnBytes );

            try
            {
                objectName = new Dn( dnStr );
            }
            catch ( LdapInvalidDnException ine )
            {
                // This is for the client side. We will never decode LdapResult on the server
                String msg = "The Dn " + Strings.dumpBytes( dnBytes ) + "is invalid : "
                    + ine.getMessage();
                LOG.error( "{} : {}", msg, ine.getMessage() );
                throw new DecoderException( msg, ine );
            }

            searchResultEntry.setObjectName( objectName );
        }

        if ( IS_DEBUG )
        {
            LOG.debug( "Search Result Entry Dn found : {}", searchResultEntry.getObjectName() );
        }
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<SearchResultEntryDecorator> container )
    {
        SearchResultEntryDecorator searchResultEntry = container.getMessage();

        TLV tlv = container.getCurrentTLV();

        // Store the value
        Object value = null;

        try
        {
            if ( tlv.getLength() == 0 )
            {
                searchResultEntry.addAttributeValue( "" );

                LOG.debug( "The attribute value is null" );
            }
            else
            {
                if ( container.isBinary( searchResultEntry.getCurrentAttribute().getId() ) )
                {
                    value = tlv.getValue().getData();

                    if ( IS_DEBUG )
                    {
                        LOG.debug( "Attribute value {}", Strings.dumpBytes( ( byte[] ) value ) );
                    }
                }
                else
                {
                    value = Strings.utf8ToString( tlv.getValue().getData() );

                    LOG.debug( "Attribute value {}", value );
                }

                searchResultEntry.addAttributeValue( value );
            }
        }
        catch ( LdapException le )
        {
            // Just swallow the exception, it can't occur here
View Full Code Here

            case SEARCH_RESULT_DONE:
                decorator = new SearchResultDoneDecorator( codec, ( SearchResultDone ) decoratedMessage );
                break;

            case SEARCH_RESULT_ENTRY:
                decorator = new SearchResultEntryDecorator( codec, ( SearchResultEntry ) decoratedMessage );
                break;

            case SEARCH_RESULT_REFERENCE:
                decorator = new SearchResultReferenceDecorator( codec, ( SearchResultReference ) decoratedMessage );
                break;
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.codec.decorators.SearchResultEntryDecorator

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.