protected Message valiateAndPrepMessage( Account account, String messageStoreBucket, Message message, int messageNumber, String messageId, List<MessageValidator> validators) throws Exception { for (MessageValidator validator : validators) { message = validator.validate(message, messageNumber, messageId); if (message == null) { validator.handleFailure(account, messageStoreBucket, messageId); return null; } } return message; }
public Object perform(URI sender, URI message, List args) { if (logOut_ != null) { String summary = new StringBuffer() .append(stringify(sender)) .append(": ") .append(stringify(message)) .append(stringify(args)) .toString(); logOut_.println(summary); } if (warnOut_ != null) { String[] warnings = validator_.validateRequest(sender, message, args); if (warnings.length > 0) { warnOut_.println("WARNINGS: "); for (int i = 0; i < warnings.length; i++) { warnOut_.println(" " + warnings[i]); } } } Object result = doPerform(sender, message, args); if (logOut_ != null) { logOut_.println( "\t->" + (result == null ? "null" : "(" + result.getClass().getName() + "): " + result)); } if (warnOut_ != null) { String[] warnings = validator_.validateResponse(message, result); if (warnings.length > 0) { warnOut_.println("WARNINGS: "); for (int i = 0; i < warnings.length; i++) { warnOut_.println(" " + warnings[i]); } } } return result; }