public Message compose(T inputFile) throws MessageDeliverException {
AssertArgument.isNotNull(inputFile, "inputFile");
if(!inputFile.exists()) {
throw new MessageDeliverException("Invalid File payload. File '" + inputFile.getAbsolutePath() + "' doesn't exist.");
}
Message message = MessageFactory.getInstance().getMessage();
try {
payloadProxy.setPayload(message, getPayload( inputFile ) );
} catch (IOException e) {
throw new MessageDeliverException("Error reading input file '" + inputFile.getAbsolutePath() + "'.", e);
} catch (MimeDecodeException e) {
throw new MessageDeliverException("Error decoding input file '" + inputFile.getAbsolutePath() + "' payload using '" + mimeDecoder.getClass().getName() + "'. Wrong MimeDecoder, or MimeDecoder may require additional configuration.", e);
}
// Add some metadata about the file....
message.getProperties().setProperty(PROP_FILE_OBJ, inputFile);
message.getProperties().setProperty(PROP_FILE_PATH, inputFile.getAbsolutePath());