net.sourceforge.cruisecontrol
Class Project

java.lang.Object
  extended bynet.sourceforge.cruisecontrol.Project
All Implemented Interfaces:
java.lang.Runnable, java.io.Serializable

public class Project
extends java.lang.Object
implements java.io.Serializable, java.lang.Runnable

Represents a single logical project consisting of source code that needs to be built. Project is associated with bootstrappers that run before builds and a Schedule that determines when builds occur.

See Also:
Serialized Form

Constructor Summary
Project()
           
 
Method Summary
 void addBuildProgressListener(BuildProgressListener listener)
           
 void addBuildResultListener(BuildResultListener listener)
           
protected  void bootstrap()
          Iterate over all of the registered Bootstrappers and call their respective bootstrap methods.
protected  void build()
          Unless paused, runs any bootstrappers and then the entire build.
protected  void createNewSchedulingThread()
           
 boolean equals(java.lang.Object arg0)
           
 void execute()
           
protected  void fireProgressEvent(BuildProgressEvent event)
           
protected  void fireResultEvent(BuildResultEvent event)
           
 void forceBuildWithTarget(java.lang.String buildTarget)
           
 boolean getBuildForced()
           
 long getBuildInterval()
          Returns the build interval.
 java.lang.String getBuildStartTime()
           
 java.lang.String getLabel()
           
 LabelIncrementer getLabelIncrementer()
           
 java.lang.String getLastBuild()
           
 java.util.Date getLastBuildDate()
           
 java.lang.String getLastSuccessfulBuild()
           
 Log getLog()
           
 java.lang.String getLogDir()
           
 java.lang.String getName()
           
 ProjectConfig getProjectConfig()
           
protected  org.jdom.Element getProjectPropertiesElement(java.util.Date now)
           
protected  java.util.Map getProjectPropertiesMap(java.util.Date now)
           
 ProjectState getState()
           
 java.lang.String getStatus()
           
 java.lang.String getStatusWithQueuePosition()
           
 int hashCode()
           
protected  void init()
          Initialize the project.
 boolean isLastBuildSuccessful()
           
 boolean isPaused()
           
 void overrideBuildInterval(long sleepMillis)
          Sets the build interval that this Project should use.
protected  void publish(Log buildLog)
          Iterate over all of the registered Publishers and call their respective publish methods.
 void register(javax.management.MBeanServer server)
           
 void run()
           
 void serializeProject()
          Serialize the project to allow resumption after a process bounce
 void setBuildAfterFailed(boolean rebuildEvenWithNoNewModifications)
           
 void setBuildForced(boolean forceNewBuildNow)
           
 void setBuildQueue(BuildQueue buildQueue)
           
 void setLabel(java.lang.String newLabel)
           
 void setLabelIncrementer(LabelIncrementer incrementer)
           
 void setLastBuild(java.lang.String newLastBuild)
           
 void setLastSuccessfulBuild(java.lang.String newLastSuccessfulBuild)
           
 void setName(java.lang.String projectName)
           
 void setPaused(boolean paused)
           
 void setProjectConfig(ProjectConfig projectConfig)
           
 void start()
           
 void stop()
           
 java.lang.String toString()
           
protected  void validateLabel(java.lang.String oldLabel, LabelIncrementer incrementer)
          Ensure that label is valid for the specified LabelIncrementer
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Project

public Project()
Method Detail

execute

public void execute()

build

protected void build()
              throws CruiseControlException
Unless paused, runs any bootstrappers and then the entire build.

Throws:
CruiseControlException - if an error occurs during the build

run

public void run()
Specified by:
run in interface java.lang.Runnable

forceBuildWithTarget

public void forceBuildWithTarget(java.lang.String buildTarget)

serializeProject

public void serializeProject()
Serialize the project to allow resumption after a process bounce


setLabelIncrementer

public void setLabelIncrementer(LabelIncrementer incrementer)
                         throws CruiseControlException
Throws:
CruiseControlException

getLabelIncrementer

public LabelIncrementer getLabelIncrementer()

setName

public void setName(java.lang.String projectName)

getName

public java.lang.String getName()

setLabel

public void setLabel(java.lang.String newLabel)

getLabel

public java.lang.String getLabel()

setLastBuild

public void setLastBuild(java.lang.String newLastBuild)
                  throws CruiseControlException
Parameters:
newLastBuild - string containing the build date in the format yyyyMMddHHmmss
Throws:
CruiseControlException - if the date cannot be extracted from the input string

setLastSuccessfulBuild

public void setLastSuccessfulBuild(java.lang.String newLastSuccessfulBuild)
                            throws CruiseControlException
Parameters:
newLastSuccessfulBuild - string containing the build date in the format yyyyMMddHHmmss
Throws:
CruiseControlException - if the date cannot be extracted from the input string

getLastBuild

public java.lang.String getLastBuild()

getBuildForced

public boolean getBuildForced()

setBuildForced

public void setBuildForced(boolean forceNewBuildNow)

getLastSuccessfulBuild

public java.lang.String getLastSuccessfulBuild()

getLogDir

public java.lang.String getLogDir()

getBuildInterval

public long getBuildInterval()
Returns the build interval. This value is initially specified on the schedule, but the user may override that value using the JMX interface. If the user hasn't override the Schedule, then this method will return the Schedule's interval, otherwise the overridden value will be returned.

Returns:
the build interval

overrideBuildInterval

public void overrideBuildInterval(long sleepMillis)
Sets the build interval that this Project should use. This method overrides the value initially specified in the Schedule attribute.

Parameters:
sleepMillis - the number of milliseconds to sleep between build attempts

isPaused

public boolean isPaused()

setPaused

public void setPaused(boolean paused)

setBuildAfterFailed

public void setBuildAfterFailed(boolean rebuildEvenWithNoNewModifications)

getStatus

public java.lang.String getStatus()

getStatusWithQueuePosition

public java.lang.String getStatusWithQueuePosition()

getState

public ProjectState getState()

setBuildQueue

public void setBuildQueue(BuildQueue buildQueue)

getBuildStartTime

public java.lang.String getBuildStartTime()

getLog

public Log getLog()

init

protected void init()
Initialize the project. Uses ProjectXMLHelper to parse a project file.


getProjectPropertiesElement

protected org.jdom.Element getProjectPropertiesElement(java.util.Date now)

getProjectPropertiesMap

protected java.util.Map getProjectPropertiesMap(java.util.Date now)

publish

protected void publish(Log buildLog)
                throws CruiseControlException
Iterate over all of the registered Publishers and call their respective publish methods.

Parameters:
buildLog -
Throws:
CruiseControlException - if an error occurs during publishing

bootstrap

protected void bootstrap()
                  throws CruiseControlException
Iterate over all of the registered Bootstrappers and call their respective bootstrap methods.

Throws:
CruiseControlException - if an error occurs during bootstrapping

validateLabel

protected void validateLabel(java.lang.String oldLabel,
                             LabelIncrementer incrementer)
                      throws CruiseControlException
Ensure that label is valid for the specified LabelIncrementer

Parameters:
oldLabel - target label
incrementer - target LabelIncrementer
Throws:
CruiseControlException - if label is not valid

isLastBuildSuccessful

public boolean isLastBuildSuccessful()

start

public void start()

createNewSchedulingThread

protected void createNewSchedulingThread()

stop

public void stop()

toString

public java.lang.String toString()

addBuildProgressListener

public void addBuildProgressListener(BuildProgressListener listener)

fireProgressEvent

protected void fireProgressEvent(BuildProgressEvent event)

addBuildResultListener

public void addBuildResultListener(BuildResultListener listener)

fireResultEvent

protected void fireResultEvent(BuildResultEvent event)

setProjectConfig

public void setProjectConfig(ProjectConfig projectConfig)
                      throws CruiseControlException
Throws:
CruiseControlException

equals

public boolean equals(java.lang.Object arg0)

hashCode

public int hashCode()

register

public void register(javax.management.MBeanServer server)
              throws javax.management.JMException
Throws:
javax.management.JMException

getProjectConfig

public ProjectConfig getProjectConfig()

getLastBuildDate

public java.util.Date getLastBuildDate()