diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/distribution/grib.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/distribution/grib.xml
index 1d7e1d9943..3647f1c151 100644
--- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/distribution/grib.xml
+++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/distribution/grib.xml
@@ -22,6 +22,8 @@
^[EHLMOYZ][A-Z]{3}\d{2}
+
+ ^LZ[ABC][ABC]9[123] KWBC
ecmwf_decrypted
diff --git a/edexOsgi/com.raytheon.uf.edex.distribution/src/com/raytheon/uf/edex/distribution/RequestPatterns.java b/edexOsgi/com.raytheon.uf.edex.distribution/src/com/raytheon/uf/edex/distribution/RequestPatterns.java
index e18765ffba..b3f647d4cd 100644
--- a/edexOsgi/com.raytheon.uf.edex.distribution/src/com/raytheon/uf/edex/distribution/RequestPatterns.java
+++ b/edexOsgi/com.raytheon.uf.edex.distribution/src/com/raytheon/uf/edex/distribution/RequestPatterns.java
@@ -52,6 +52,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* for PatternSyntaxException.
* Mar 19, 2013 1794 djohnson Add toString() for debugging.
* Sep 10, 2013 2327 rjpeter Sized ArrayList declarations.
+ * Nov 21, 2013 2541 bgonzale Exclusion patterns.
*
*
* @author brockwoo
@@ -68,8 +69,17 @@ public class RequestPatterns implements ISerializableObject {
@XmlElements({ @XmlElement(name = "regex", type = String.class) })
private List patterns = new ArrayList(0);
+ /**
+ * List of patterns excluded by a plugin. Excludes takes precedence over
+ * acceptance and is applied first.
+ */
+ @XmlElements({ @XmlElement(name = "regexExclude", type = String.class) })
+ private List exclusionPatterns = new ArrayList(0);
+
private List compiledPatterns = new ArrayList(0);
+ private List compiledExclusionPatterns = new ArrayList(0);
+
protected Log patternFailedLogger = LogFactory.getLog("PatternFailedLog");
/**
@@ -112,7 +122,13 @@ public class RequestPatterns implements ISerializableObject {
*
*/
public void compilePatterns() {
- compiledPatterns = new ArrayList(patterns.size());
+ compiledPatterns = compilePatterns(patterns);
+ compiledExclusionPatterns = compilePatterns(exclusionPatterns);
+ }
+
+ private List compilePatterns(List patterns) {
+ List compiledPatterns = new ArrayList(patterns.size());
+
for (String pattern : patterns) {
try {
compiledPatterns.add(Pattern.compile(pattern));
@@ -123,24 +139,37 @@ public class RequestPatterns implements ISerializableObject {
patternFailedLogger.error(sb.toString(), e);
}
}
+ return compiledPatterns;
}
/**
* Takes a string and compares against the patterns in this container. The
* first one that matches breaks the search and returns true.
*
+ * Check for exclusion first. It takes precedence over acceptance.
+ *
* @param header
* The string to search for
* @return a boolean indicating success
*/
public boolean isDesiredHeader(String header) {
boolean isFound = false;
- for (Pattern headerPattern : compiledPatterns) {
+ boolean isExcluded = false;
+
+ for (Pattern headerPattern : compiledExclusionPatterns) {
if (headerPattern.matcher(header).find()) {
- isFound = true;
+ isExcluded = true;
break;
}
}
+ if (!isExcluded) {
+ for (Pattern headerPattern : compiledPatterns) {
+ if (headerPattern.matcher(header).find()) {
+ isFound = true;
+ break;
+ }
+ }
+ }
return isFound;
}