|
|
|
|
@ -150,8 +150,8 @@ public abstract class YamlProcessor {
@@ -150,8 +150,8 @@ public abstract class YamlProcessor {
|
|
|
|
|
private boolean process(MatchCallback callback, Yaml yaml, Resource resource) { |
|
|
|
|
int count = 0; |
|
|
|
|
try { |
|
|
|
|
if (this.logger.isDebugEnabled()) { |
|
|
|
|
this.logger.debug("Loading from YAML: " + resource); |
|
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
|
logger.debug("Loading from YAML: " + resource); |
|
|
|
|
} |
|
|
|
|
Reader reader = new UnicodeReader(resource.getInputStream()); |
|
|
|
|
try { |
|
|
|
|
@ -163,8 +163,8 @@ public abstract class YamlProcessor {
@@ -163,8 +163,8 @@ public abstract class YamlProcessor {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (this.logger.isDebugEnabled()) { |
|
|
|
|
this.logger.debug("Loaded " + count + " document" + (count > 1 ? "s" : "") + |
|
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
|
logger.debug("Loaded " + count + " document" + (count > 1 ? "s" : "") + |
|
|
|
|
" from YAML resource: " + resource); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -183,8 +183,8 @@ public abstract class YamlProcessor {
@@ -183,8 +183,8 @@ public abstract class YamlProcessor {
|
|
|
|
|
this.resolutionMethod != ResolutionMethod.OVERRIDE_AND_IGNORE) { |
|
|
|
|
throw new IllegalStateException(ex); |
|
|
|
|
} |
|
|
|
|
if (this.logger.isWarnEnabled()) { |
|
|
|
|
this.logger.warn("Could not load map from " + resource + ": " + ex.getMessage()); |
|
|
|
|
if (logger.isWarnEnabled()) { |
|
|
|
|
logger.warn("Could not load map from " + resource + ": " + ex.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -221,8 +221,8 @@ public abstract class YamlProcessor {
@@ -221,8 +221,8 @@ public abstract class YamlProcessor {
|
|
|
|
|
properties.putAll(getFlattenedMap(map)); |
|
|
|
|
|
|
|
|
|
if (this.documentMatchers.isEmpty()) { |
|
|
|
|
if (this.logger.isDebugEnabled()) { |
|
|
|
|
this.logger.debug("Merging document (no matchers set)" + map); |
|
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
|
logger.debug("Merging document (no matchers set): " + map); |
|
|
|
|
} |
|
|
|
|
callback.process(properties, map); |
|
|
|
|
return true; |
|
|
|
|
@ -233,8 +233,8 @@ public abstract class YamlProcessor {
@@ -233,8 +233,8 @@ public abstract class YamlProcessor {
|
|
|
|
|
MatchStatus match = matcher.matches(properties); |
|
|
|
|
result = MatchStatus.getMostSpecific(match, result); |
|
|
|
|
if (match == MatchStatus.FOUND) { |
|
|
|
|
if (this.logger.isDebugEnabled()) { |
|
|
|
|
this.logger.debug("Matched document with document matcher: " + properties); |
|
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
|
logger.debug("Matched document with document matcher: " + properties); |
|
|
|
|
} |
|
|
|
|
callback.process(properties, map); |
|
|
|
|
return true; |
|
|
|
|
@ -242,14 +242,16 @@ public abstract class YamlProcessor {
@@ -242,14 +242,16 @@ public abstract class YamlProcessor {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (result == MatchStatus.ABSTAIN && this.matchDefault) { |
|
|
|
|
if (this.logger.isDebugEnabled()) { |
|
|
|
|
this.logger.debug("Matched document with default matcher: " + map); |
|
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
|
logger.debug("Matched document with default matcher: " + map); |
|
|
|
|
} |
|
|
|
|
callback.process(properties, map); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.logger.debug("Unmatched document"); |
|
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
|
logger.debug("Unmatched document: " + map); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -300,7 +302,7 @@ public abstract class YamlProcessor {
@@ -300,7 +302,7 @@ public abstract class YamlProcessor {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
result.put(key, value == null ? "" : value); |
|
|
|
|
result.put(key, value != null ? value : ""); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -328,7 +330,7 @@ public abstract class YamlProcessor {
@@ -328,7 +330,7 @@ public abstract class YamlProcessor {
|
|
|
|
|
/** |
|
|
|
|
* Test if the given properties match. |
|
|
|
|
* @param properties the properties to test |
|
|
|
|
* @return the status of the match. |
|
|
|
|
* @return the status of the match |
|
|
|
|
*/ |
|
|
|
|
MatchStatus matches(Properties properties); |
|
|
|
|
} |
|
|
|
|
|