com.atlassian.bamboo.build.logger.interceptors
Class ContentMatchingInterceptor

java.lang.Object
  extended by com.atlassian.bamboo.build.logger.interceptors.ContentMatchingInterceptor
All Implemented Interfaces:
LogInterceptor, java.io.Serializable
Direct Known Subclasses:
StringMatchingInterceptor

public abstract class ContentMatchingInterceptor
extends java.lang.Object
implements LogInterceptor

This is an abstract base class for interceptors handling matching of log content with support for match age.

See Also:
Serialized Form

Field Summary
protected  java.lang.String stringToMatch
           
 
Constructor Summary
ContentMatchingInterceptor(java.lang.String stringToMatch, boolean matchErrorMessages)
           
 
Method Summary
 int getMatchAge()
           
 java.lang.String getStringToMatch()
           
 boolean hasMatched()
           
 void intercept(LogEntry logEntry)
          Method invoked whenever a new log entry is logged
 void interceptError(LogEntry logEntry)
          Method invoked whenever a new error log entry is logged
 boolean isMatchRecentEnough(int maximumAge)
          Returns true if content has been matched and occurred less than maximumAge lines from the end of log.
protected abstract  boolean matches(LogEntry logEntry)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stringToMatch

protected final java.lang.String stringToMatch
Constructor Detail

ContentMatchingInterceptor

public ContentMatchingInterceptor(java.lang.String stringToMatch,
                                  boolean matchErrorMessages)
Method Detail

intercept

public void intercept(@NotNull
                      LogEntry logEntry)
Description copied from interface: LogInterceptor
Method invoked whenever a new log entry is logged

Specified by:
intercept in interface LogInterceptor

interceptError

public void interceptError(@NotNull
                           LogEntry logEntry)
Description copied from interface: LogInterceptor
Method invoked whenever a new error log entry is logged

Specified by:
interceptError in interface LogInterceptor

matches

protected abstract boolean matches(LogEntry logEntry)

hasMatched

public boolean hasMatched()

getMatchAge

public int getMatchAge()

isMatchRecentEnough

public boolean isMatchRecentEnough(int maximumAge)
Returns true if content has been matched and occurred less than maximumAge lines from the end of log.

Parameters:
maximumAge - the maximum age (distance in lines between occurrence and end of log) for the match to be recent enough. If set to -1, any match will be valid.

getStringToMatch

public java.lang.String getStringToMatch()


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.