Pass original message to BDF validators and hooks.

This commit is contained in:
akwizgran
2016-03-08 17:03:22 +00:00
parent 9e40d0be16
commit 5bb8e95b26
6 changed files with 44 additions and 39 deletions

View File

@@ -29,8 +29,9 @@ public abstract class BdfIncomingMessageHook implements IncomingMessageHook,
this.metadataParser = metadataParser;
}
protected abstract void incomingMessage(Transaction txn, BdfList message,
BdfDictionary meta) throws DbException, FormatException;
protected abstract void incomingMessage(Transaction txn, Message m,
BdfList body, BdfDictionary meta) throws DbException,
FormatException;
@Override
public void incomingMessage(Transaction txn, Message m, Metadata meta)
@@ -48,10 +49,10 @@ public abstract class BdfIncomingMessageHook implements IncomingMessageHook,
int headerLength) throws DbException {
try {
byte[] raw = m.getRaw();
BdfList message = clientHelper.toList(raw, headerLength,
BdfList body = clientHelper.toList(raw, headerLength,
raw.length - headerLength);
BdfDictionary metaDictionary = metadataParser.parse(meta);
incomingMessage(txn, message, metaDictionary);
incomingMessage(txn, m, body, metaDictionary);
} catch (FormatException e) {
throw new DbException(e);
}

View File

@@ -37,8 +37,8 @@ public abstract class BdfMessageValidator implements MessageValidator,
this.clock = clock;
}
protected abstract BdfDictionary validateMessage(BdfList message, Group g,
long timestamp) throws FormatException;
protected abstract BdfDictionary validateMessage(Message m, Group g,
BdfList body) throws FormatException;
@Override
public Metadata validateMessage(Message m, Group g) {
@@ -63,9 +63,9 @@ public abstract class BdfMessageValidator implements MessageValidator,
return null;
}
try {
BdfList message = clientHelper.toList(raw, headerLength,
BdfList body = clientHelper.toList(raw, headerLength,
raw.length - headerLength);
BdfDictionary meta = validateMessage(message, g, m.getTimestamp());
BdfDictionary meta = validateMessage(m, g, body);
if (meta == null) {
LOG.info("Invalid message");
return null;