Class ContentMatchingInterceptor
- java.lang.Object
-
- com.atlassian.bamboo.build.logger.interceptors.ContentMatchingInterceptor
-
- All Implemented Interfaces:
LogInterceptor
,Serializable
- Direct Known Subclasses:
StringMatchingInterceptor
public abstract class ContentMatchingInterceptor extends 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
Fields Modifier and Type Field Description protected String
stringToMatch
-
Constructor Summary
Constructors Constructor Description ContentMatchingInterceptor(String stringToMatch, boolean matchErrorMessages)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
getMatchAge()
String
getStringToMatch()
boolean
hasMatched()
void
intercept(@NotNull LogEntry logEntry)
Method invoked whenever a new log entry is loggedvoid
interceptError(@NotNull LogEntry logEntry)
Method invoked whenever a new error log entry is loggedboolean
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)
-
-
-
Field Detail
-
stringToMatch
protected final String stringToMatch
-
-
Constructor Detail
-
ContentMatchingInterceptor
public ContentMatchingInterceptor(String stringToMatch, boolean matchErrorMessages)
-
-
Method Detail
-
intercept
public void intercept(@NotNull @NotNull LogEntry logEntry)
Description copied from interface:LogInterceptor
Method invoked whenever a new log entry is logged- Specified by:
intercept
in interfaceLogInterceptor
-
interceptError
public void interceptError(@NotNull @NotNull LogEntry logEntry)
Description copied from interface:LogInterceptor
Method invoked whenever a new error log entry is logged- Specified by:
interceptError
in interfaceLogInterceptor
-
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 String getStringToMatch()
-
-