/** * Compute the AddResponse length * <br> * AddResponse : * <pre> * 0x69 L1 * | * +--> LdapResult * * L1 = Length(LdapResult) * * Length(AddResponse) = Length(0x69) + Length(L1) + L1 * </pre> */ @Override public int computeLength() { AddResponse addResponse = getAddResponse(); setLdapResult( new LdapResultDecorator( getCodecService(), addResponse.getLdapResult() ) ); addResponseLength = ( ( LdapResultDecorator ) getLdapResult() ).computeLength(); return 1 + TLV.getNbBytes( addResponseLength ) + addResponseLength; }
/** * @return The decorated AddResponse */ public AddResponse getAddResponse() { return getDecorated(); }
/** * {@inheritDoc} */ public void action( LdapMessageContainer<AddResponseDecorator> container ) throws DecoderException { // Now, we can allocate the AddResponse Object AddResponseDecorator addResponse = new AddResponseDecorator( container.getLdapCodecService(), new AddResponseImpl( container.getMessageId() ) ); container.setMessage( addResponse ); // We will check that the request is not null TLV tlv = container.getCurrentTLV(); int expectedLength = tlv.getLength(); if ( expectedLength == 0 ) { String msg = I18n.err( I18n.ERR_05146_NULL_ADD_RESPONSE ); LOG.error( msg ); throw new DecoderException( msg ); } if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_05167_ADD_RESPONSE ) ); } } }
/** * Encode the AddResponse message to a PDU. * * @param buffer The buffer where to put the PDU * @return The encoded response * @throws EncoderException If teh encoding failed */ @Override public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { try { // The AddResponse Tag buffer.put( LdapCodecConstants.ADD_RESPONSE_TAG ); buffer.put( TLV.getBytes( addResponseLength ) ); // The LdapResult ( ( LdapResultDecorator ) getLdapResult() ).encode( buffer ); return buffer; } catch ( BufferOverflowException boe ) { throw new EncoderException( I18n.err( I18n.ERR_08212_PDU_BUFFER_TOO_SMALL ), boe ); } } }
/** * {@inheritDoc} */ public void action( LdapMessageContainer<AddResponseDecorator> container ) throws DecoderException { // Now, we can allocate the AddResponse Object AddResponseDecorator addResponse = new AddResponseDecorator( container.getLdapCodecService(), new AddResponseImpl( container.getMessageId() ) ); container.setMessage( addResponse ); // We will check that the request is not null TLV tlv = container.getCurrentTLV(); int expectedLength = tlv.getLength(); if ( expectedLength == 0 ) { String msg = I18n.err( I18n.ERR_05146_NULL_ADD_RESPONSE ); LOG.error( msg ); throw new DecoderException( msg ); } if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_05167_ADD_RESPONSE ) ); } } }
/** * Encode the AddResponse message to a PDU. * * @param buffer The buffer where to put the PDU * @return The encoded response * @throws EncoderException If teh encoding failed */ @Override public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { try { // The AddResponse Tag buffer.put( LdapCodecConstants.ADD_RESPONSE_TAG ); buffer.put( TLV.getBytes( addResponseLength ) ); // The LdapResult ( ( LdapResultDecorator ) getLdapResult() ).encode( buffer ); return buffer; } catch ( BufferOverflowException boe ) { throw new EncoderException( I18n.err( I18n.ERR_08212_PDU_BUFFER_TOO_SMALL ), boe ); } } }
/** * Compute the AddResponse length * <br> * AddResponse : * <pre> * 0x69 L1 * | * +--> LdapResult * * L1 = Length(LdapResult) * * Length(AddResponse) = Length(0x69) + Length(L1) + L1 * </pre> */ @Override public int computeLength() { AddResponse addResponse = getAddResponse(); setLdapResult( new LdapResultDecorator( getCodecService(), addResponse.getLdapResult() ) ); addResponseLength = ( ( LdapResultDecorator ) getLdapResult() ).computeLength(); return 1 + TLV.getNbBytes( addResponseLength ) + addResponseLength; }
/** * {@inheritDoc} */ public void action( LdapMessageContainer<AddResponseDecorator> container ) throws DecoderException { // Now, we can allocate the AddResponse Object AddResponseDecorator addResponse = new AddResponseDecorator( container.getLdapCodecService(), new AddResponseImpl( container.getMessageId() ) ); container.setMessage( addResponse ); // We will check that the request is not null TLV tlv = container.getCurrentTLV(); int expectedLength = tlv.getLength(); if ( expectedLength == 0 ) { String msg = I18n.err( I18n.ERR_05146_NULL_ADD_RESPONSE ); LOG.error( msg ); throw new DecoderException( msg ); } if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_05167_ADD_RESPONSE ) ); } } }
/** * @return The decorated AddResponse */ public AddResponse getAddResponse() { return getDecorated(); }
/** * Encode the AddResponse message to a PDU. * * @param buffer The buffer where to put the PDU * @return The encoded response * @throws EncoderException If teh encoding failed */ @Override public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException { try { // The AddResponse Tag buffer.put( LdapCodecConstants.ADD_RESPONSE_TAG ); buffer.put( TLV.getBytes( addResponseLength ) ); // The LdapResult ( ( LdapResultDecorator ) getLdapResult() ).encode( buffer ); return buffer; } catch ( BufferOverflowException boe ) { throw new EncoderException( I18n.err( I18n.ERR_08212_PDU_BUFFER_TOO_SMALL ), boe ); } } }
/** * Compute the AddResponse length * <br> * AddResponse : * <pre> * 0x69 L1 * | * +--> LdapResult * * L1 = Length(LdapResult) * * Length(AddResponse) = Length(0x69) + Length(L1) + L1 * </pre> */ @Override public int computeLength() { AddResponse addResponse = getAddResponse(); setLdapResult( new LdapResultDecorator( getCodecService(), addResponse.getLdapResult() ) ); addResponseLength = ( ( LdapResultDecorator ) getLdapResult() ).computeLength(); return 1 + TLV.getNbBytes( addResponseLength ) + addResponseLength; }
decorator = new AddResponseDecorator( codec, ( AddResponse ) decoratedMessage ); break;
/** * @return The decorated AddResponse */ public AddResponse getAddResponse() { return getDecorated(); }
decorator = new AddResponseDecorator( codec, ( AddResponse ) decoratedMessage ); break;
decorator = new AddResponseDecorator( codec, ( AddResponse ) decoratedMessage ); break;