com.atlassian.bamboo.logger
Class DefaultErrorHandler

java.lang.Object
  extended by com.atlassian.bamboo.logger.AbstractErrorUpdateHandler
      extended by com.atlassian.bamboo.logger.DefaultErrorHandler
All Implemented Interfaces:
ErrorAccessor, ErrorHandler, ErrorUpdateHandler

public class DefaultErrorHandler
extends AbstractErrorUpdateHandler
implements ErrorHandler

This class keeps track of Bamboo build errors so they can get reported to the user.


Field Summary
static int BUILD_ERROR_LIMIT
           
 
Constructor Summary
DefaultErrorHandler()
           
 
Method Summary
 void clear()
          Remove all errors from the handler
 void createElasticError(java.lang.String context, java.lang.Long agentId, ThrowableDetails throwableDetails, java.lang.String instanceId)
          Create an error regarding Elastic Bamboo.
 void createError(java.lang.String planKey, java.lang.Integer buildNumber, java.lang.Long agentId, java.lang.String context, ThrowableDetails throwableDetails)
           
 java.util.Collection<ErrorDetails> getAllErrors()
          Get all the errors recorded against all builds
 java.util.Collection<ErrorDetails> getElasticErrors()
          Get all the errors recorded against elastic bamboo
 ErrorDetails getErrorDetails(java.lang.String buildKey, int errorNumber)
          Obtain the specifed error from the handler.
 java.util.Collection<ErrorDetails> getErrors(PlanKey planKey)
          Obtain all the errors recorded against a specific plan
 java.util.Collection<ErrorDetails> getErrors(PlanResultKey planResultKey)
          Obtain all the errors recorded against a specific result
 java.util.Collection<ErrorDetails> getErrors(java.lang.String buildKey)
          Obtain all the errors recorded against a specific build
 void removeBuildErrors(java.lang.String buildKey)
          Remove all the errors for a given build
 void removeError(java.lang.String buildKey, int errorNumber)
          Remove a specific error from the handler.
 void setBuildResultsSummaryManager(BuildResultsSummaryManager buildResultsSummaryManager)
           
 void setEventManager(com.atlassian.event.EventManager eventManager)
           
 void setLocalAgentManager(LocalAgentManager localAgentManager)
           
 void setMaxQueueSize(int queueSize)
           
 void setPlanManager(PlanManager planManager)
           
 
Methods inherited from class com.atlassian.bamboo.logger.AbstractErrorUpdateHandler
addErrorCollection, getCurrentAgentId, recordElasticError, recordError, recordError, recordError, recordError, recordError, recordError, recordError, recordError, setAgentContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.logger.ErrorUpdateHandler
addErrorCollection, recordElasticError, recordError, recordError, recordError, recordError, recordError, recordError, recordError, recordError
 

Field Detail

BUILD_ERROR_LIMIT

public static final int BUILD_ERROR_LIMIT
See Also:
Constant Field Values
Constructor Detail

DefaultErrorHandler

public DefaultErrorHandler()
Method Detail

createElasticError

public void createElasticError(java.lang.String context,
                               @Nullable
                               java.lang.Long agentId,
                               @Nullable
                               ThrowableDetails throwableDetails,
                               @Nullable
                               java.lang.String instanceId)
Description copied from interface: ErrorUpdateHandler
Create an error regarding Elastic Bamboo.

Specified by:
createElasticError in interface ErrorUpdateHandler

createError

public void createError(@Nullable
                        java.lang.String planKey,
                        java.lang.Integer buildNumber,
                        java.lang.Long agentId,
                        java.lang.String context,
                        ThrowableDetails throwableDetails)
Specified by:
createError in interface ErrorUpdateHandler

getErrors

public java.util.Collection<ErrorDetails> getErrors(java.lang.String buildKey)
Description copied from interface: ErrorHandler
Obtain all the errors recorded against a specific build

Specified by:
getErrors in interface ErrorHandler
Parameters:
buildKey - The build
Returns:
The collection ErrorDetails

getErrors

@NotNull
public java.util.Collection<ErrorDetails> getErrors(@NotNull
                                                            PlanResultKey planResultKey)
Description copied from interface: ErrorAccessor
Obtain all the errors recorded against a specific result

Specified by:
getErrors in interface ErrorAccessor
Returns:
The collection ErrorDetails

getErrors

@NotNull
public java.util.Collection<ErrorDetails> getErrors(@NotNull
                                                            PlanKey planKey)
Description copied from interface: ErrorAccessor
Obtain all the errors recorded against a specific plan

Specified by:
getErrors in interface ErrorAccessor
Returns:
The collection ErrorDetails

getAllErrors

@NotNull
public java.util.Collection<ErrorDetails> getAllErrors()
Description copied from interface: ErrorAccessor
Get all the errors recorded against all builds

Specified by:
getAllErrors in interface ErrorAccessor
Returns:
The collection ErrorDetails

getElasticErrors

@NotNull
public java.util.Collection<ErrorDetails> getElasticErrors()
Description copied from interface: ErrorAccessor
Get all the errors recorded against elastic bamboo

Specified by:
getElasticErrors in interface ErrorAccessor
Returns:
The collection ErrorDetails

clear

public void clear()
Description copied from interface: ErrorHandler
Remove all errors from the handler

Specified by:
clear in interface ErrorHandler

setMaxQueueSize

public void setMaxQueueSize(int queueSize)

removeError

public void removeError(java.lang.String buildKey,
                        int errorNumber)
Description copied from interface: ErrorHandler
Remove a specific error from the handler.

Specified by:
removeError in interface ErrorHandler
Parameters:
buildKey - The build containing the error
errorNumber - The errorIndex'th error to be associated with the build

getErrorDetails

public ErrorDetails getErrorDetails(java.lang.String buildKey,
                                    int errorNumber)
Description copied from interface: ErrorHandler
Obtain the specifed error from the handler.

Specified by:
getErrorDetails in interface ErrorHandler
Parameters:
buildKey - The build containing the error.
errorNumber - The errorIndex'th error to be associated with the build
Returns:
The error details

removeBuildErrors

public void removeBuildErrors(java.lang.String buildKey)
Description copied from interface: ErrorHandler
Remove all the errors for a given build

Specified by:
removeBuildErrors in interface ErrorHandler
Parameters:
buildKey - The key of the build

setPlanManager

public void setPlanManager(PlanManager planManager)

setLocalAgentManager

public void setLocalAgentManager(LocalAgentManager localAgentManager)

setBuildResultsSummaryManager

public void setBuildResultsSummaryManager(BuildResultsSummaryManager buildResultsSummaryManager)

setEventManager

public void setEventManager(com.atlassian.event.EventManager eventManager)


Copyright © 2010 Atlassian. All Rights Reserved.