1 37 package net.sourceforge.cruisecontrol.publishers; 38 39 import net.sourceforge.cruisecontrol.CruiseControlException; 40 import net.sourceforge.cruisecontrol.util.ValidationHelper; 41 import net.sourceforge.cruisecontrol.util.XMLLogHelper; 42 import org.apache.log4j.Logger; 43 44 import java.io.File ; 45 46 52 public class LinkEmailPublisher extends EmailPublisher { 53 54 private static final Logger LOG = Logger.getLogger(LinkEmailPublisher.class); 55 56 62 protected String createMessage(XMLLogHelper logHelper) { 63 String logFileName = ""; 64 try { 65 logFileName = logHelper.getLogFileName(); 66 } catch (CruiseControlException e) { 67 LOG.error("", e); 68 } 69 String baseLogFileName = 70 logFileName.substring( 71 logFileName.lastIndexOf(File.separator) + 1, 72 logFileName.lastIndexOf(".")); 73 74 StringBuffer message = new StringBuffer (); 75 message.append("View results here -> "); 76 77 String buildResultsURL = getBuildResultsURL(); 78 message.append(buildResultsURL); 79 80 if (buildResultsURL.indexOf("?") == -1) { 81 message.append("?"); 82 } else { 83 message.append("&"); 84 } 85 86 message.append("log="); 87 message.append(baseLogFileName); 88 89 return message.toString(); 90 } 91 92 98 public void validate() throws CruiseControlException { 99 ValidationHelper.assertIsSet(getBuildResultsURL(), "buildresulturl", this.getClass()); 100 super.validate(); 101 } 102 103 } | Popular Tags |