From: <bes...@us...> - 2007-10-31 04:11:34
|
Revision: 3683 http://cruisecontrol.svn.sourceforge.net/cruisecontrol/?rev=3683&view=rev Author: bestfriendchris Date: 2007-10-30 21:11:31 -0700 (Tue, 30 Oct 2007) Log Message: ----------- [Chris & Hu Kai] Created BuildLiveDetail class to represent a currently running build. Modified Paths: -------------- branches/cce/cruisecontrol/reporting/dashboard/src/net/sourceforge/cruisecontrol/dashboard/service/BuildService.java Added Paths: ----------- branches/cce/cruisecontrol/reporting/dashboard/src/net/sourceforge/cruisecontrol/dashboard/BuildLiveDetail.java Added: branches/cce/cruisecontrol/reporting/dashboard/src/net/sourceforge/cruisecontrol/dashboard/BuildLiveDetail.java =================================================================== --- branches/cce/cruisecontrol/reporting/dashboard/src/net/sourceforge/cruisecontrol/dashboard/BuildLiveDetail.java (rev 0) +++ branches/cce/cruisecontrol/reporting/dashboard/src/net/sourceforge/cruisecontrol/dashboard/BuildLiveDetail.java 2007-10-31 04:11:31 UTC (rev 3683) @@ -0,0 +1,71 @@ +/******************************************************************************** + * CruiseControl, a Continuous Integration Toolkit + * Copyright (c) 2007, ThoughtWorks, Inc. + * 200 E. Randolph, 25th Floor + * Chicago, IL 60601 USA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * + Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * + Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * + Neither the name of ThoughtWorks, Inc., CruiseControl, nor the + * names of its contributors may be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ********************************************************************************/ +package net.sourceforge.cruisecontrol.dashboard; + +import org.joda.time.DateTime; +import net.sourceforge.cruisecontrol.dashboard.utils.CCDateFormatter; + +/** + * Understands a currently running build. + */ +public class BuildLiveDetail extends BuildDetail { + private final String projectName; + + public BuildLiveDetail(String projectName) { + super(logFile()); + this.projectName = projectName; + } + + private static LogFile logFile() { + String now = CCDateFormatter.yyyyMMddHHmmss(new DateTime()); + final String fileName = "log" + now + ".xml"; + return new LogFile(fileName); + } + + public ProjectBuildStatus getStatus() { + return ProjectBuildStatus.BUILDING; + } + + public String getProjectName() { + return projectName; + } + + public DateTime getBuildDate() { + return new DateTime(); + } + +} Modified: branches/cce/cruisecontrol/reporting/dashboard/src/net/sourceforge/cruisecontrol/dashboard/service/BuildService.java =================================================================== --- branches/cce/cruisecontrol/reporting/dashboard/src/net/sourceforge/cruisecontrol/dashboard/service/BuildService.java 2007-10-31 03:23:39 UTC (rev 3682) +++ branches/cce/cruisecontrol/reporting/dashboard/src/net/sourceforge/cruisecontrol/dashboard/service/BuildService.java 2007-10-31 04:11:31 UTC (rev 3683) @@ -50,6 +50,7 @@ import net.sourceforge.cruisecontrol.dashboard.BuildDetail; import net.sourceforge.cruisecontrol.dashboard.ProjectBuildStatus; import net.sourceforge.cruisecontrol.dashboard.LogFile; +import net.sourceforge.cruisecontrol.dashboard.BuildLiveDetail; import net.sourceforge.cruisecontrol.dashboard.exception.ShouldStopParsingException; import net.sourceforge.cruisecontrol.dashboard.saxhandler.BasicInfoExtractor; import net.sourceforge.cruisecontrol.dashboard.saxhandler.CompositeExtractor; @@ -73,25 +74,7 @@ } public Build getActiveBuild(final String projectName) { - String now = CCDateFormatter.yyyyMMddHHmmss(new DateTime()); - final String fileName = "log" + now + ".xml"; - return new BuildDetail(new LogFile(fileName)) { - public ProjectBuildStatus getStatus() { - return ProjectBuildStatus.BUILDING; - } - - public String getProjectName() { - return projectName; - } - - public String getBuildLogFilename() { - return fileName; - } - - public DateTime getBuildDate() { - return new DateTime(); - } - }; + return new BuildLiveDetail(projectName); } public Build getBuild(String projectName, String buildLogFilename) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |