1 37 package net.sourceforge.cruisecontrol.taglib; 38 39 import java.io.File ; 40 41 import javax.servlet.jsp.JspException ; 42 43 import net.sourceforge.cruisecontrol.BuildInfo; 44 45 46 50 public class NavigationCountTag extends CruiseControlBodyTagSupport { 51 public static final String LINK_TEXT_ATTR = "linktext"; 52 public static final String LOG_FILE_ATTR = "logfile"; 53 public static final String BUILD_INFO_ATTR = "buildinfo"; 54 55 private int startingBuildNumber = 0; 56 private int count; 57 58 public int doStartTag() throws JspException { 59 BuildInfo [] logFileNames = findLogFiles(); 60 61 count = logFileNames.length; 62 if (count > startingBuildNumber) { 66 return EVAL_BODY_INCLUDE; 67 } else { 68 return SKIP_BODY; 69 } 70 } 71 72 private BuildInfo[] findLogFiles() throws JspException { 73 File logDir = findLogDir(); 74 return BuildInfo.loadFromDir(logDir).asArray(); 75 } 76 77 public int getStartingBuildNumber() { 78 return startingBuildNumber; 79 } 80 81 public void setStartingBuildNumber(int startingBuildNumber) { 82 this.startingBuildNumber = startingBuildNumber; 83 } 84 } 85 | Popular Tags |