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 43 import java.io.File ; 44 45 54 public class LinkJabberPublisher extends JabberPublisher { 55 56 private String buildResultsURL; 57 58 public void setBuildResultsURL(String buildResultsURL) { 59 this.buildResultsURL = buildResultsURL; 60 } 61 62 69 public void validate() throws CruiseControlException { 70 71 super.validate(); 72 73 ValidationHelper.assertIsSet(buildResultsURL, "buildresulturl", this.getClass()); 74 } 75 76 83 protected String createMessage(XMLLogHelper logHelper) throws CruiseControlException { 84 String logFileName = logHelper.getLogFileName(); 85 String baseLogFileName = 86 logFileName.substring( 87 logFileName.lastIndexOf(File.separator) + 1, 88 logFileName.lastIndexOf(".")); 89 90 StringBuffer message = new StringBuffer (); 91 message.append("Build results for "); 92 message.append(logHelper.isBuildSuccessful() ? "successful" : "failed"); 93 message.append(" build of project "); 94 message.append(logHelper.getProjectName()); 95 message.append(": "); 96 97 message.append(buildResultsURL); 98 99 if (buildResultsURL.indexOf("?") == -1) { 100 message.append("?"); 101 } else { 102 message.append("&"); 103 } 104 105 message.append("log="); 106 message.append(baseLogFileName); 107 108 return message.toString(); 109 } 110 111 } 112 | Popular Tags |