net.sourceforge.cruisecontrol
Class Log

java.lang.Object
  extended bynet.sourceforge.cruisecontrol.Log
All Implemented Interfaces:
java.io.Serializable

public class Log
extends java.lang.Object
implements java.io.Serializable

Handles the Log element, and subelements, of the CruiseControl configuration file. Also represents the Build Log used by the CruiseControl build process.

See Also:
Serialized Form

Field Summary
static int BEFORE_LENGTH
           
 
Constructor Summary
Log()
          Log instances created this way must have their projectName set.
 
Method Summary
 void add(BuildLogger logger)
          Adds a BuildLogger that will be called to manipulate the project log just prior to writing the log.
 void add(Manipulator manipulator)
          Adds a Manipulator that will handle old log-files
 void addContent(org.jdom.Content newContent)
           
protected  void callManipulators()
          Calls all Manipulators to already existing logfiles.
static java.lang.String formatLogFileName(java.util.Date date)
           
static java.lang.String formatLogFileName(java.util.Date date, java.lang.String label)
           
 org.jdom.Element getContent()
           
 java.lang.String getLogDir()
           
 BuildLogger[] getLoggers()
           
 java.lang.String getLogXmlEncoding()
           
 java.lang.String getProjectName()
           
static java.util.Date parseDateFromLogFileName(java.lang.String filename)
           
static java.lang.String parseLabelFromLogFileName(java.lang.String filename)
           
 void reset()
          Resets the build log.
 void setDir(java.lang.String logDir)
           
 void setEncoding(java.lang.String logXmlEncoding)
           
 void setLogDir(java.lang.String logDir)
          Deprecated. use setDir(String)
 void setLogXmlEncoding(java.lang.String logXmlEncoding)
          Deprecated. use setEncoding(String)
 void validate()
          Validate the log.
 boolean wasBuildSuccessful()
           
static boolean wasSuccessfulBuild(java.lang.String filename)
           
 void writeLogFile(java.util.Date now)
          Writes the current build log to the appropriate directory and filename.
protected  void writeLogFile(java.io.File file, org.jdom.Element element)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BEFORE_LENGTH

public static final int BEFORE_LENGTH
Constructor Detail

Log

public Log()
Log instances created this way must have their projectName set.

Method Detail

validate

public void validate()
              throws CruiseControlException
Validate the log. Also creates the log directory if it doesn't exist.

Throws:
java.lang.IllegalStateException - if projectName wasn't set
CruiseControlException

add

public void add(BuildLogger logger)
Adds a BuildLogger that will be called to manipulate the project log just prior to writing the log.


add

public void add(Manipulator manipulator)
Adds a Manipulator that will handle old log-files


getLoggers

public BuildLogger[] getLoggers()

getLogXmlEncoding

public java.lang.String getLogXmlEncoding()

getProjectName

public java.lang.String getProjectName()

setLogDir

public void setLogDir(java.lang.String logDir)
               throws CruiseControlException
Deprecated. use setDir(String)

Parameters:
logDir -
Throws:
CruiseControlException

setDir

public void setDir(java.lang.String logDir)
            throws CruiseControlException
Throws:
CruiseControlException

setLogXmlEncoding

public void setLogXmlEncoding(java.lang.String logXmlEncoding)
Deprecated. use setEncoding(String)

Parameters:
logXmlEncoding -

setEncoding

public void setEncoding(java.lang.String logXmlEncoding)

getLogDir

public java.lang.String getLogDir()

writeLogFile

public void writeLogFile(java.util.Date now)
                  throws CruiseControlException
Writes the current build log to the appropriate directory and filename.

Throws:
CruiseControlException

writeLogFile

protected void writeLogFile(java.io.File file,
                            org.jdom.Element element)
                     throws CruiseControlException
Throws:
CruiseControlException

callManipulators

protected void callManipulators()
Calls all Manipulators to already existing logfiles.


formatLogFileName

public static java.lang.String formatLogFileName(java.util.Date date)

formatLogFileName

public static java.lang.String formatLogFileName(java.util.Date date,
                                                 java.lang.String label)

addContent

public void addContent(org.jdom.Content newContent)

getContent

public org.jdom.Element getContent()

wasBuildSuccessful

public boolean wasBuildSuccessful()

reset

public void reset()
Resets the build log. After calling this method a fresh build log will exist, ready for adding new content.


wasSuccessfulBuild

public static boolean wasSuccessfulBuild(java.lang.String filename)

parseDateFromLogFileName

public static java.util.Date parseDateFromLogFileName(java.lang.String filename)
                                               throws java.text.ParseException
Throws:
java.text.ParseException

parseLabelFromLogFileName

public static java.lang.String parseLabelFromLogFileName(java.lang.String filename)