/**
* {@inheritDoc}
*/
public void action( LdapMessageContainer<ExtendedRequestDecorator<?>> container ) throws DecoderException
{
ExtendedRequest req;
// Get the Value and store it in the ExtendedRequest
TLV tlv = container.getCurrentTLV();
// We have to handle the special case of a 0 length matched
// OID
if ( tlv.getLength() == 0 )
{
String msg = I18n.err( I18n.ERR_04095 );
LOG.error( msg );
// This will generate a PROTOCOL_ERROR
throw new DecoderException( msg );
}
else
{
byte[] requestNameBytes = tlv.getValue().getData();
try
{
String requestName = Strings.utf8ToString( requestNameBytes );
if ( !Oid.isOid( requestName ) )
{
String msg = "The Request name is not a valid OID : "
+ Strings.utf8ToString( requestNameBytes ) + " ("
+ Strings.dumpBytes( requestNameBytes ) + ") is invalid";
LOG.error( msg );
// throw an exception, we will get a PROTOCOL_ERROR
throw new DecoderException( msg );
}
req = LdapApiServiceFactory.getSingleton().newExtendedRequest( requestName, null );
req.setMessageId( container.getMessageId() );
container.setMessage( LdapApiServiceFactory.getSingleton().decorate( req ) );
}
catch ( DecoderException de )
{
String msg = "The Request name is not a valid OID : "
+ Strings.utf8ToString( requestNameBytes ) + " ("
+ Strings.dumpBytes( requestNameBytes ) + ") is invalid";
LOG.error( "{} : {}", msg, de.getMessage() );
// Rethrow the exception, we will get a PROTOCOL_ERROR
throw de;
}
}
// We can have an END transition
container.setGrammarEndAllowed( true );
if ( IS_DEBUG )
{
LOG.debug( "OID read : {}", req.getRequestName() );
}
}