1 10 11 package org.mule.components.simple; 12 13 import org.apache.commons.logging.Log; 14 import org.apache.commons.logging.LogFactory; 15 import org.mule.umo.UMOEventContext; 16 import org.mule.umo.lifecycle.Callable; 17 import org.mule.util.StringMessageUtils; 18 19 26 public class LogComponent implements Callable, LogService 27 { 28 private static Log logger = LogFactory.getLog(LogComponent.class); 29 30 public Object onCall(UMOEventContext context) throws Exception 31 { 32 String contents = context.getMessageAsString(); 33 String msg = "Message received in component: " + context.getComponentDescriptor().getName(); 34 msg = StringMessageUtils.getBoilerPlate(msg + ". Content is: '" 35 + StringMessageUtils.truncate(contents, 100, true) + "'"); 36 log(msg); 37 return null; 38 } 39 40 public void log(String message) 41 { 42 logger.info(message); 43 } 44 } 45 | Popular Tags |