net.sourceforge.cruisecontrol.jmx
Class ProjectController

java.lang.Object
  extended byjavax.management.NotificationBroadcasterSupport
      extended bynet.sourceforge.cruisecontrol.jmx.ProjectController
All Implemented Interfaces:
BuildProgressListener, BuildResultListener, java.util.EventListener, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, ProjectControllerMBean, ProjectMBean

public class ProjectController
extends javax.management.NotificationBroadcasterSupport
implements ProjectControllerMBean, BuildProgressListener, BuildResultListener

Author:
Niclas Olofsson, Jason Yip

Constructor Summary
ProjectController(Project project)
           
 
Method Summary
 void build()
          Runs a build now
 void buildWithTarget(java.lang.String buildTarget)
          Runs a build now, overriding the target of the used builder
 long getBuildInterval()
           
 java.lang.String[] getBuildOutput(java.lang.Integer firstLine)
          Ouptut from the build output buffer, after line specified (inclusive).
 java.lang.String getBuildStartTime()
           
 java.lang.String[][] getCommitMessages()
           
 java.lang.String getLabel()
           
 java.lang.String getLabelIncrementer()
           
 java.lang.String getLastBuild()
           
 java.lang.String getLastSuccessfulBuild()
           
 java.lang.String getLogDir()
           
 java.lang.String getProjectName()
           
 java.lang.String getStatus()
          Gets the human-readable version of the project status
 void handleBuildProgress(BuildProgressEvent event)
           
 void handleBuildResult(BuildResultEvent event)
           
 boolean isPaused()
          Is the project paused?
 void pause()
          Pauses the controlled project.
 void register(javax.management.MBeanServer server)
           
 void resume()
          Resumes the controlled project.
 void serialize()
          Serialize the project
 void setBuildInterval(long buildInterval)
          Change the interval between builds
 void setLabel(java.lang.String label)
          Change the Project label
 void setLabelIncrementer(java.lang.String classname)
          Change the Project label incrementer; will only succeed if the existing label is valid for the new label incrementer
 void setLastBuild(java.lang.String date)
          Change the last built date.
 void setLastSuccessfulBuild(java.lang.String date)
          Change the last built date.
 void setLogDir(java.lang.String logdir)
          Change the directory where CruiseControl logs are kept
 void setProjectName(java.lang.String name)
          Change the project name.
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProjectController

public ProjectController(Project project)
Method Detail

handleBuildProgress

public void handleBuildProgress(BuildProgressEvent event)
Specified by:
handleBuildProgress in interface BuildProgressListener

handleBuildResult

public void handleBuildResult(BuildResultEvent event)
Specified by:
handleBuildResult in interface BuildResultListener

pause

public void pause()
Description copied from interface: ProjectMBean
Pauses the controlled project.

Specified by:
pause in interface ProjectMBean

resume

public void resume()
Description copied from interface: ProjectMBean
Resumes the controlled project.

Specified by:
resume in interface ProjectMBean

build

public void build()
Description copied from interface: ProjectMBean
Runs a build now

Specified by:
build in interface ProjectMBean

buildWithTarget

public void buildWithTarget(java.lang.String buildTarget)
Description copied from interface: ProjectMBean
Runs a build now, overriding the target of the used builder

Specified by:
buildWithTarget in interface ProjectMBean

serialize

public void serialize()
Description copied from interface: ProjectMBean
Serialize the project

Specified by:
serialize in interface ProjectMBean

isPaused

public boolean isPaused()
Description copied from interface: ProjectMBean
Is the project paused?

Specified by:
isPaused in interface ProjectMBean
Returns:
Pause state

setLabel

public void setLabel(java.lang.String label)
Description copied from interface: ProjectMBean
Change the Project label

Specified by:
setLabel in interface ProjectMBean
Parameters:
label - a new label; should be valid for the current LabelIncrementer

getLabel

public java.lang.String getLabel()
Specified by:
getLabel in interface ProjectMBean

setLabelIncrementer

public void setLabelIncrementer(java.lang.String classname)
                         throws CruiseControlException
Description copied from interface: ProjectMBean
Change the Project label incrementer; will only succeed if the existing label is valid for the new label incrementer

Specified by:
setLabelIncrementer in interface ProjectMBean
Parameters:
classname - fully qualified class name of the new label incrementer
Throws:
CruiseControlException

getLabelIncrementer

public java.lang.String getLabelIncrementer()
Specified by:
getLabelIncrementer in interface ProjectMBean
Returns:
name of the current label incrementer

setLastBuild

public void setLastBuild(java.lang.String date)
                  throws CruiseControlException
Description copied from interface: ProjectMBean
Change the last built date. This can be used to manipulate whether builds will be initiated.

Specified by:
setLastBuild in interface ProjectMBean
Parameters:
date - date string in the form yyyyMMddHHmmss
Throws:
CruiseControlException

getLastBuild

public java.lang.String getLastBuild()
Specified by:
getLastBuild in interface ProjectMBean

setLastSuccessfulBuild

public void setLastSuccessfulBuild(java.lang.String date)
                            throws CruiseControlException
Description copied from interface: ProjectMBean
Change the last built date. This can be used to manipulate whether builds will be initiated.

Specified by:
setLastSuccessfulBuild in interface ProjectMBean
Parameters:
date - date string in the form yyyyMMddHHmmss
Throws:
CruiseControlException

getLastSuccessfulBuild

public java.lang.String getLastSuccessfulBuild()
Specified by:
getLastSuccessfulBuild in interface ProjectMBean

getBuildStartTime

public java.lang.String getBuildStartTime()
Specified by:
getBuildStartTime in interface ProjectMBean
Returns:
start time of the last build, using the format 'yyyyMMddHHmmss'

setLogDir

public void setLogDir(java.lang.String logdir)
               throws CruiseControlException
Description copied from interface: ProjectMBean
Change the directory where CruiseControl logs are kept

Specified by:
setLogDir in interface ProjectMBean
Parameters:
logdir - Relative or absolute path to the log directory
Throws:
CruiseControlException

getLogDir

public java.lang.String getLogDir()
Specified by:
getLogDir in interface ProjectMBean

setProjectName

public void setProjectName(java.lang.String name)
Description copied from interface: ProjectMBean
Change the project name. May cause problems if configuration file is not also changed

Specified by:
setProjectName in interface ProjectMBean

getProjectName

public java.lang.String getProjectName()
Specified by:
getProjectName in interface ProjectMBean

setBuildInterval

public void setBuildInterval(long buildInterval)
Description copied from interface: ProjectMBean
Change the interval between builds

Specified by:
setBuildInterval in interface ProjectMBean
Parameters:
buildInterval - Build interval in milliseconds

getBuildInterval

public long getBuildInterval()
Specified by:
getBuildInterval in interface ProjectMBean

getStatus

public java.lang.String getStatus()
Description copied from interface: ProjectMBean
Gets the human-readable version of the project status

Specified by:
getStatus in interface ProjectMBean

register

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

getCommitMessages

public java.lang.String[][] getCommitMessages()
Specified by:
getCommitMessages in interface ProjectMBean
Returns:
All the commit messages associated with the "current" modification set as string[user name][commit message].

getBuildOutput

public java.lang.String[] getBuildOutput(java.lang.Integer firstLine)
Ouptut from the build output buffer, after line specified (inclusive).

Specified by:
getBuildOutput in interface ProjectMBean
See Also:
BuildOutputBuffer