You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by ce...@apache.org on 2016/06/16 16:02:53 UTC
[2/4] incubator-metron git commit: METRON-204: Field Transformation
Domain Specific Language. This closes apache/incubator-metron#142
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationBaseListener.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationBaseListener.java b/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationBaseListener.java
new file mode 100644
index 0000000..d5387b6
--- /dev/null
+++ b/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationBaseListener.java
@@ -0,0 +1,216 @@
+// Generated from org/apache/metron/common/transformation/generated/Transformation.g4 by ANTLR 4.5
+package org.apache.metron.common.transformation.generated;
+
+//CHECKSTYLE:OFF
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import org.antlr.v4.runtime.ParserRuleContext;
+import org.antlr.v4.runtime.misc.NotNull;
+import org.antlr.v4.runtime.tree.ErrorNode;
+import org.antlr.v4.runtime.tree.TerminalNode;
+
+/**
+ * This class provides an empty implementation of {@link TransformationListener},
+ * which can be extended to create a listener which only needs to handle a subset
+ * of the available methods.
+ */
+public class TransformationBaseListener implements TransformationListener {
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterTransformation(TransformationParser.TransformationContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitTransformation(TransformationParser.TransformationContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterTransformationExpr(TransformationParser.TransformationExprContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitTransformationExpr(TransformationParser.TransformationExprContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterTransformationEntity(TransformationParser.TransformationEntityContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitTransformationEntity(TransformationParser.TransformationEntityContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterTransformation_entity(TransformationParser.Transformation_entityContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitTransformation_entity(TransformationParser.Transformation_entityContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterFunc_args(TransformationParser.Func_argsContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitFunc_args(TransformationParser.Func_argsContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterOp_list(TransformationParser.Op_listContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitOp_list(TransformationParser.Op_listContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterList_entity(TransformationParser.List_entityContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitList_entity(TransformationParser.List_entityContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterStringLiteral(TransformationParser.StringLiteralContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitStringLiteral(TransformationParser.StringLiteralContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterIntegerLiteral(TransformationParser.IntegerLiteralContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitIntegerLiteral(TransformationParser.IntegerLiteralContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterDoubleLiteral(TransformationParser.DoubleLiteralContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitDoubleLiteral(TransformationParser.DoubleLiteralContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterVariable(TransformationParser.VariableContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitVariable(TransformationParser.VariableContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterTransformationFunc(TransformationParser.TransformationFuncContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitTransformationFunc(TransformationParser.TransformationFuncContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterList(TransformationParser.ListContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitList(TransformationParser.ListContext ctx) { }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void enterEveryRule(ParserRuleContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void exitEveryRule(ParserRuleContext ctx) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void visitTerminal(TerminalNode node) { }
+ /**
+ * {@inheritDoc}
+ *
+ * <p>The default implementation does nothing.</p>
+ */
+ @Override public void visitErrorNode(ErrorNode node) { }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationLexer.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationLexer.java b/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationLexer.java
new file mode 100644
index 0000000..ca48a83
--- /dev/null
+++ b/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationLexer.java
@@ -0,0 +1,148 @@
+// Generated from org/apache/metron/common/transformation/generated/Transformation.g4 by ANTLR 4.5
+package org.apache.metron.common.transformation.generated;
+
+//CHECKSTYLE:OFF
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.antlr.v4.runtime.Lexer;
+import org.antlr.v4.runtime.CharStream;
+import org.antlr.v4.runtime.Token;
+import org.antlr.v4.runtime.TokenStream;
+import org.antlr.v4.runtime.*;
+import org.antlr.v4.runtime.atn.*;
+import org.antlr.v4.runtime.dfa.DFA;
+import org.antlr.v4.runtime.misc.*;
+
+@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
+public class TransformationLexer extends Lexer {
+ static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); }
+
+ protected static final DFA[] _decisionToDFA;
+ protected static final PredictionContextCache _sharedContextCache =
+ new PredictionContextCache();
+ public static final int
+ COMMA=1, LBRACKET=2, RBRACKET=3, LPAREN=4, RPAREN=5, INT_LITERAL=6, DOUBLE_LITERAL=7,
+ IDENTIFIER=8, STRING_LITERAL=9, COMMENT=10, WS=11;
+ public static String[] modeNames = {
+ "DEFAULT_MODE"
+ };
+
+ public static final String[] ruleNames = {
+ "COMMA", "LBRACKET", "RBRACKET", "LPAREN", "RPAREN", "INT_LITERAL", "DOUBLE_LITERAL",
+ "IDENTIFIER", "SCHAR", "STRING_LITERAL", "COMMENT", "WS"
+ };
+
+ private static final String[] _LITERAL_NAMES = {
+ null, "','", "'['", "']'", "'('", "')'"
+ };
+ private static final String[] _SYMBOLIC_NAMES = {
+ null, "COMMA", "LBRACKET", "RBRACKET", "LPAREN", "RPAREN", "INT_LITERAL",
+ "DOUBLE_LITERAL", "IDENTIFIER", "STRING_LITERAL", "COMMENT", "WS"
+ };
+ public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
+
+ /**
+ * @deprecated Use {@link #VOCABULARY} instead.
+ */
+ @Deprecated
+ public static final String[] tokenNames;
+ static {
+ tokenNames = new String[_SYMBOLIC_NAMES.length];
+ for (int i = 0; i < tokenNames.length; i++) {
+ tokenNames[i] = VOCABULARY.getLiteralName(i);
+ if (tokenNames[i] == null) {
+ tokenNames[i] = VOCABULARY.getSymbolicName(i);
+ }
+
+ if (tokenNames[i] == null) {
+ tokenNames[i] = "<INVALID>";
+ }
+ }
+ }
+
+ @Override
+ @Deprecated
+ public String[] getTokenNames() {
+ return tokenNames;
+ }
+
+ @Override
+
+ public Vocabulary getVocabulary() {
+ return VOCABULARY;
+ }
+
+
+ public TransformationLexer(CharStream input) {
+ super(input);
+ _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
+ }
+
+ @Override
+ public String getGrammarFileName() { return "Transformation.g4"; }
+
+ @Override
+ public String[] getRuleNames() { return ruleNames; }
+
+ @Override
+ public String getSerializedATN() { return _serializedATN; }
+
+ @Override
+ public String[] getModeNames() { return modeNames; }
+
+ @Override
+ public ATN getATN() { return _ATN; }
+
+ public static final String _serializedATN =
+ "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2\rd\b\1\4\2\t\2\4"+
+ "\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t"+
+ "\13\4\f\t\f\4\r\t\r\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6\3\7\6\7\'"+
+ "\n\7\r\7\16\7(\3\b\6\b,\n\b\r\b\16\b-\3\b\3\b\6\b\62\n\b\r\b\16\b\63\3"+
+ "\t\3\t\7\t8\n\t\f\t\16\t;\13\t\3\n\3\n\3\13\3\13\7\13A\n\13\f\13\16\13"+
+ "D\13\13\3\13\3\13\3\13\7\13I\n\13\f\13\16\13L\13\13\3\13\5\13O\n\13\3"+
+ "\f\3\f\3\f\3\f\6\fU\n\f\r\f\16\fV\3\f\5\fZ\n\f\3\f\3\f\3\r\6\r_\n\r\r"+
+ "\r\16\r`\3\r\3\r\3V\2\16\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\2\25\13"+
+ "\27\f\31\r\3\2\7\5\2C\\aac|\b\2\60\60\62;C\\^^aac|\7\2\f\f\17\17$$))^"+
+ "^\3\3\f\f\5\2\13\f\16\17\"\"k\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t"+
+ "\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\25\3\2\2"+
+ "\2\2\27\3\2\2\2\2\31\3\2\2\2\3\33\3\2\2\2\5\35\3\2\2\2\7\37\3\2\2\2\t"+
+ "!\3\2\2\2\13#\3\2\2\2\r&\3\2\2\2\17+\3\2\2\2\21\65\3\2\2\2\23<\3\2\2\2"+
+ "\25N\3\2\2\2\27P\3\2\2\2\31^\3\2\2\2\33\34\7.\2\2\34\4\3\2\2\2\35\36\7"+
+ "]\2\2\36\6\3\2\2\2\37 \7_\2\2 \b\3\2\2\2!\"\7*\2\2\"\n\3\2\2\2#$\7+\2"+
+ "\2$\f\3\2\2\2%\'\4\62;\2&%\3\2\2\2\'(\3\2\2\2(&\3\2\2\2()\3\2\2\2)\16"+
+ "\3\2\2\2*,\4\62;\2+*\3\2\2\2,-\3\2\2\2-+\3\2\2\2-.\3\2\2\2./\3\2\2\2/"+
+ "\61\7\60\2\2\60\62\4\62;\2\61\60\3\2\2\2\62\63\3\2\2\2\63\61\3\2\2\2\63"+
+ "\64\3\2\2\2\64\20\3\2\2\2\659\t\2\2\2\668\t\3\2\2\67\66\3\2\2\28;\3\2"+
+ "\2\29\67\3\2\2\29:\3\2\2\2:\22\3\2\2\2;9\3\2\2\2<=\n\4\2\2=\24\3\2\2\2"+
+ ">B\7$\2\2?A\5\23\n\2@?\3\2\2\2AD\3\2\2\2B@\3\2\2\2BC\3\2\2\2CE\3\2\2\2"+
+ "DB\3\2\2\2EO\7$\2\2FJ\7)\2\2GI\5\23\n\2HG\3\2\2\2IL\3\2\2\2JH\3\2\2\2"+
+ "JK\3\2\2\2KM\3\2\2\2LJ\3\2\2\2MO\7)\2\2N>\3\2\2\2NF\3\2\2\2O\26\3\2\2"+
+ "\2PQ\7\61\2\2QR\7\61\2\2RT\3\2\2\2SU\13\2\2\2TS\3\2\2\2UV\3\2\2\2VW\3"+
+ "\2\2\2VT\3\2\2\2WY\3\2\2\2XZ\t\5\2\2YX\3\2\2\2Z[\3\2\2\2[\\\b\f\2\2\\"+
+ "\30\3\2\2\2]_\t\6\2\2^]\3\2\2\2_`\3\2\2\2`^\3\2\2\2`a\3\2\2\2ab\3\2\2"+
+ "\2bc\b\r\2\2c\32\3\2\2\2\r\2(-\639BJNVY`\3\b\2\2";
+ public static final ATN _ATN =
+ new ATNDeserializer().deserialize(_serializedATN.toCharArray());
+ static {
+ _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
+ for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
+ _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationListener.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationListener.java b/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationListener.java
new file mode 100644
index 0000000..c9673cb
--- /dev/null
+++ b/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationListener.java
@@ -0,0 +1,177 @@
+// Generated from org/apache/metron/common/transformation/generated/Transformation.g4 by ANTLR 4.5
+package org.apache.metron.common.transformation.generated;
+
+//CHECKSTYLE:OFF
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.antlr.v4.runtime.misc.NotNull;
+import org.antlr.v4.runtime.tree.ParseTreeListener;
+
+/**
+ * This interface defines a complete listener for a parse tree produced by
+ * {@link TransformationParser}.
+ */
+public interface TransformationListener extends ParseTreeListener {
+ /**
+ * Enter a parse tree produced by {@link TransformationParser#transformation}.
+ * @param ctx the parse tree
+ */
+ void enterTransformation(TransformationParser.TransformationContext ctx);
+ /**
+ * Exit a parse tree produced by {@link TransformationParser#transformation}.
+ * @param ctx the parse tree
+ */
+ void exitTransformation(TransformationParser.TransformationContext ctx);
+ /**
+ * Enter a parse tree produced by the {@code TransformationExpr}
+ * labeled alternative in {@link TransformationParser#transformation_expr}.
+ * @param ctx the parse tree
+ */
+ void enterTransformationExpr(TransformationParser.TransformationExprContext ctx);
+ /**
+ * Exit a parse tree produced by the {@code TransformationExpr}
+ * labeled alternative in {@link TransformationParser#transformation_expr}.
+ * @param ctx the parse tree
+ */
+ void exitTransformationExpr(TransformationParser.TransformationExprContext ctx);
+ /**
+ * Enter a parse tree produced by the {@code TransformationEntity}
+ * labeled alternative in {@link TransformationParser#transformation_expr}.
+ * @param ctx the parse tree
+ */
+ void enterTransformationEntity(TransformationParser.TransformationEntityContext ctx);
+ /**
+ * Exit a parse tree produced by the {@code TransformationEntity}
+ * labeled alternative in {@link TransformationParser#transformation_expr}.
+ * @param ctx the parse tree
+ */
+ void exitTransformationEntity(TransformationParser.TransformationEntityContext ctx);
+ /**
+ * Enter a parse tree produced by {@link TransformationParser#transformation_entity}.
+ * @param ctx the parse tree
+ */
+ void enterTransformation_entity(TransformationParser.Transformation_entityContext ctx);
+ /**
+ * Exit a parse tree produced by {@link TransformationParser#transformation_entity}.
+ * @param ctx the parse tree
+ */
+ void exitTransformation_entity(TransformationParser.Transformation_entityContext ctx);
+ /**
+ * Enter a parse tree produced by {@link TransformationParser#func_args}.
+ * @param ctx the parse tree
+ */
+ void enterFunc_args(TransformationParser.Func_argsContext ctx);
+ /**
+ * Exit a parse tree produced by {@link TransformationParser#func_args}.
+ * @param ctx the parse tree
+ */
+ void exitFunc_args(TransformationParser.Func_argsContext ctx);
+ /**
+ * Enter a parse tree produced by {@link TransformationParser#op_list}.
+ * @param ctx the parse tree
+ */
+ void enterOp_list(TransformationParser.Op_listContext ctx);
+ /**
+ * Exit a parse tree produced by {@link TransformationParser#op_list}.
+ * @param ctx the parse tree
+ */
+ void exitOp_list(TransformationParser.Op_listContext ctx);
+ /**
+ * Enter a parse tree produced by {@link TransformationParser#list_entity}.
+ * @param ctx the parse tree
+ */
+ void enterList_entity(TransformationParser.List_entityContext ctx);
+ /**
+ * Exit a parse tree produced by {@link TransformationParser#list_entity}.
+ * @param ctx the parse tree
+ */
+ void exitList_entity(TransformationParser.List_entityContext ctx);
+ /**
+ * Enter a parse tree produced by the {@code StringLiteral}
+ * labeled alternative in {@link TransformationParser#identifier_operand}.
+ * @param ctx the parse tree
+ */
+ void enterStringLiteral(TransformationParser.StringLiteralContext ctx);
+ /**
+ * Exit a parse tree produced by the {@code StringLiteral}
+ * labeled alternative in {@link TransformationParser#identifier_operand}.
+ * @param ctx the parse tree
+ */
+ void exitStringLiteral(TransformationParser.StringLiteralContext ctx);
+ /**
+ * Enter a parse tree produced by the {@code IntegerLiteral}
+ * labeled alternative in {@link TransformationParser#identifier_operand}.
+ * @param ctx the parse tree
+ */
+ void enterIntegerLiteral(TransformationParser.IntegerLiteralContext ctx);
+ /**
+ * Exit a parse tree produced by the {@code IntegerLiteral}
+ * labeled alternative in {@link TransformationParser#identifier_operand}.
+ * @param ctx the parse tree
+ */
+ void exitIntegerLiteral(TransformationParser.IntegerLiteralContext ctx);
+ /**
+ * Enter a parse tree produced by the {@code DoubleLiteral}
+ * labeled alternative in {@link TransformationParser#identifier_operand}.
+ * @param ctx the parse tree
+ */
+ void enterDoubleLiteral(TransformationParser.DoubleLiteralContext ctx);
+ /**
+ * Exit a parse tree produced by the {@code DoubleLiteral}
+ * labeled alternative in {@link TransformationParser#identifier_operand}.
+ * @param ctx the parse tree
+ */
+ void exitDoubleLiteral(TransformationParser.DoubleLiteralContext ctx);
+ /**
+ * Enter a parse tree produced by the {@code Variable}
+ * labeled alternative in {@link TransformationParser#identifier_operand}.
+ * @param ctx the parse tree
+ */
+ void enterVariable(TransformationParser.VariableContext ctx);
+ /**
+ * Exit a parse tree produced by the {@code Variable}
+ * labeled alternative in {@link TransformationParser#identifier_operand}.
+ * @param ctx the parse tree
+ */
+ void exitVariable(TransformationParser.VariableContext ctx);
+ /**
+ * Enter a parse tree produced by the {@code TransformationFunc}
+ * labeled alternative in {@link TransformationParser#identifier_operand}.
+ * @param ctx the parse tree
+ */
+ void enterTransformationFunc(TransformationParser.TransformationFuncContext ctx);
+ /**
+ * Exit a parse tree produced by the {@code TransformationFunc}
+ * labeled alternative in {@link TransformationParser#identifier_operand}.
+ * @param ctx the parse tree
+ */
+ void exitTransformationFunc(TransformationParser.TransformationFuncContext ctx);
+ /**
+ * Enter a parse tree produced by the {@code List}
+ * labeled alternative in {@link TransformationParser#identifier_operand}.
+ * @param ctx the parse tree
+ */
+ void enterList(TransformationParser.ListContext ctx);
+ /**
+ * Exit a parse tree produced by the {@code List}
+ * labeled alternative in {@link TransformationParser#identifier_operand}.
+ * @param ctx the parse tree
+ */
+ void exitList(TransformationParser.ListContext ctx);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationParser.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationParser.java b/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationParser.java
new file mode 100644
index 0000000..48fd820
--- /dev/null
+++ b/metron-platform/metron-common/src/main/java/org/apache/metron/common/transformation/generated/TransformationParser.java
@@ -0,0 +1,640 @@
+// Generated from org/apache/metron/common/transformation/generated/Transformation.g4 by ANTLR 4.5
+package org.apache.metron.common.transformation.generated;
+
+//CHECKSTYLE:OFF
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.antlr.v4.runtime.atn.*;
+import org.antlr.v4.runtime.dfa.DFA;
+import org.antlr.v4.runtime.*;
+import org.antlr.v4.runtime.misc.*;
+import org.antlr.v4.runtime.tree.*;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ArrayList;
+
+@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
+public class TransformationParser extends Parser {
+ static { RuntimeMetaData.checkVersion("4.5", RuntimeMetaData.VERSION); }
+
+ protected static final DFA[] _decisionToDFA;
+ protected static final PredictionContextCache _sharedContextCache =
+ new PredictionContextCache();
+ public static final int
+ COMMA=1, LBRACKET=2, RBRACKET=3, LPAREN=4, RPAREN=5, INT_LITERAL=6, DOUBLE_LITERAL=7,
+ IDENTIFIER=8, STRING_LITERAL=9, COMMENT=10, WS=11;
+ public static final int
+ RULE_transformation = 0, RULE_transformation_expr = 1, RULE_transformation_entity = 2,
+ RULE_func_args = 3, RULE_op_list = 4, RULE_list_entity = 5, RULE_identifier_operand = 6;
+ public static final String[] ruleNames = {
+ "transformation", "transformation_expr", "transformation_entity", "func_args",
+ "op_list", "list_entity", "identifier_operand"
+ };
+
+ private static final String[] _LITERAL_NAMES = {
+ null, "','", "'['", "']'", "'('", "')'"
+ };
+ private static final String[] _SYMBOLIC_NAMES = {
+ null, "COMMA", "LBRACKET", "RBRACKET", "LPAREN", "RPAREN", "INT_LITERAL",
+ "DOUBLE_LITERAL", "IDENTIFIER", "STRING_LITERAL", "COMMENT", "WS"
+ };
+ public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
+
+ /**
+ * @deprecated Use {@link #VOCABULARY} instead.
+ */
+ @Deprecated
+ public static final String[] tokenNames;
+ static {
+ tokenNames = new String[_SYMBOLIC_NAMES.length];
+ for (int i = 0; i < tokenNames.length; i++) {
+ tokenNames[i] = VOCABULARY.getLiteralName(i);
+ if (tokenNames[i] == null) {
+ tokenNames[i] = VOCABULARY.getSymbolicName(i);
+ }
+
+ if (tokenNames[i] == null) {
+ tokenNames[i] = "<INVALID>";
+ }
+ }
+ }
+
+ @Override
+ @Deprecated
+ public String[] getTokenNames() {
+ return tokenNames;
+ }
+
+ @Override
+
+ public Vocabulary getVocabulary() {
+ return VOCABULARY;
+ }
+
+ @Override
+ public String getGrammarFileName() { return "Transformation.g4"; }
+
+ @Override
+ public String[] getRuleNames() { return ruleNames; }
+
+ @Override
+ public String getSerializedATN() { return _serializedATN; }
+
+ @Override
+ public ATN getATN() { return _ATN; }
+
+ public TransformationParser(TokenStream input) {
+ super(input);
+ _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
+ }
+ public static class TransformationContext extends ParserRuleContext {
+ public Transformation_exprContext transformation_expr() {
+ return getRuleContext(Transformation_exprContext.class,0);
+ }
+ public TerminalNode EOF() { return getToken(TransformationParser.EOF, 0); }
+ public TransformationContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_transformation; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).enterTransformation(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).exitTransformation(this);
+ }
+ }
+
+ public final TransformationContext transformation() throws RecognitionException {
+ TransformationContext _localctx = new TransformationContext(_ctx, getState());
+ enterRule(_localctx, 0, RULE_transformation);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(14);
+ transformation_expr();
+ setState(15);
+ match(EOF);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class Transformation_exprContext extends ParserRuleContext {
+ public Transformation_exprContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_transformation_expr; }
+
+ public Transformation_exprContext() { }
+ public void copyFrom(Transformation_exprContext ctx) {
+ super.copyFrom(ctx);
+ }
+ }
+ public static class TransformationEntityContext extends Transformation_exprContext {
+ public Transformation_entityContext transformation_entity() {
+ return getRuleContext(Transformation_entityContext.class,0);
+ }
+ public TransformationEntityContext(Transformation_exprContext ctx) { copyFrom(ctx); }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).enterTransformationEntity(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).exitTransformationEntity(this);
+ }
+ }
+ public static class TransformationExprContext extends Transformation_exprContext {
+ public TerminalNode LPAREN() { return getToken(TransformationParser.LPAREN, 0); }
+ public Transformation_exprContext transformation_expr() {
+ return getRuleContext(Transformation_exprContext.class,0);
+ }
+ public TerminalNode RPAREN() { return getToken(TransformationParser.RPAREN, 0); }
+ public TransformationExprContext(Transformation_exprContext ctx) { copyFrom(ctx); }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).enterTransformationExpr(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).exitTransformationExpr(this);
+ }
+ }
+
+ public final Transformation_exprContext transformation_expr() throws RecognitionException {
+ Transformation_exprContext _localctx = new Transformation_exprContext(_ctx, getState());
+ enterRule(_localctx, 2, RULE_transformation_expr);
+ try {
+ setState(22);
+ switch (_input.LA(1)) {
+ case LPAREN:
+ _localctx = new TransformationExprContext(_localctx);
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(17);
+ match(LPAREN);
+ setState(18);
+ transformation_expr();
+ setState(19);
+ match(RPAREN);
+ }
+ break;
+ case LBRACKET:
+ case INT_LITERAL:
+ case DOUBLE_LITERAL:
+ case IDENTIFIER:
+ case STRING_LITERAL:
+ _localctx = new TransformationEntityContext(_localctx);
+ enterOuterAlt(_localctx, 2);
+ {
+ setState(21);
+ transformation_entity();
+ }
+ break;
+ default:
+ throw new NoViableAltException(this);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class Transformation_entityContext extends ParserRuleContext {
+ public Identifier_operandContext identifier_operand() {
+ return getRuleContext(Identifier_operandContext.class,0);
+ }
+ public Transformation_entityContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_transformation_entity; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).enterTransformation_entity(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).exitTransformation_entity(this);
+ }
+ }
+
+ public final Transformation_entityContext transformation_entity() throws RecognitionException {
+ Transformation_entityContext _localctx = new Transformation_entityContext(_ctx, getState());
+ enterRule(_localctx, 4, RULE_transformation_entity);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(24);
+ identifier_operand();
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class Func_argsContext extends ParserRuleContext {
+ public Op_listContext op_list() {
+ return getRuleContext(Op_listContext.class,0);
+ }
+ public Func_argsContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_func_args; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).enterFunc_args(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).exitFunc_args(this);
+ }
+ }
+
+ public final Func_argsContext func_args() throws RecognitionException {
+ Func_argsContext _localctx = new Func_argsContext(_ctx, getState());
+ enterRule(_localctx, 6, RULE_func_args);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(26);
+ op_list(0);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class Op_listContext extends ParserRuleContext {
+ public Identifier_operandContext identifier_operand() {
+ return getRuleContext(Identifier_operandContext.class,0);
+ }
+ public Op_listContext op_list() {
+ return getRuleContext(Op_listContext.class,0);
+ }
+ public TerminalNode COMMA() { return getToken(TransformationParser.COMMA, 0); }
+ public Op_listContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_op_list; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).enterOp_list(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).exitOp_list(this);
+ }
+ }
+
+ public final Op_listContext op_list() throws RecognitionException {
+ return op_list(0);
+ }
+
+ private Op_listContext op_list(int _p) throws RecognitionException {
+ ParserRuleContext _parentctx = _ctx;
+ int _parentState = getState();
+ Op_listContext _localctx = new Op_listContext(_ctx, _parentState);
+ Op_listContext _prevctx = _localctx;
+ int _startState = 8;
+ enterRecursionRule(_localctx, 8, RULE_op_list, _p);
+ try {
+ int _alt;
+ enterOuterAlt(_localctx, 1);
+ {
+ {
+ setState(29);
+ identifier_operand();
+ }
+ _ctx.stop = _input.LT(-1);
+ setState(36);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,1,_ctx);
+ while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
+ if ( _alt==1 ) {
+ if ( _parseListeners!=null ) triggerExitRuleEvent();
+ _prevctx = _localctx;
+ {
+ {
+ _localctx = new Op_listContext(_parentctx, _parentState);
+ pushNewRecursionContext(_localctx, _startState, RULE_op_list);
+ setState(31);
+ if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)");
+ setState(32);
+ match(COMMA);
+ setState(33);
+ identifier_operand();
+ }
+ }
+ }
+ setState(38);
+ _errHandler.sync(this);
+ _alt = getInterpreter().adaptivePredict(_input,1,_ctx);
+ }
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ unrollRecursionContexts(_parentctx);
+ }
+ return _localctx;
+ }
+
+ public static class List_entityContext extends ParserRuleContext {
+ public TerminalNode LBRACKET() { return getToken(TransformationParser.LBRACKET, 0); }
+ public Op_listContext op_list() {
+ return getRuleContext(Op_listContext.class,0);
+ }
+ public TerminalNode RBRACKET() { return getToken(TransformationParser.RBRACKET, 0); }
+ public List_entityContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_list_entity; }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).enterList_entity(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).exitList_entity(this);
+ }
+ }
+
+ public final List_entityContext list_entity() throws RecognitionException {
+ List_entityContext _localctx = new List_entityContext(_ctx, getState());
+ enterRule(_localctx, 10, RULE_list_entity);
+ try {
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(39);
+ match(LBRACKET);
+ setState(40);
+ op_list(0);
+ setState(41);
+ match(RBRACKET);
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public static class Identifier_operandContext extends ParserRuleContext {
+ public Identifier_operandContext(ParserRuleContext parent, int invokingState) {
+ super(parent, invokingState);
+ }
+ @Override public int getRuleIndex() { return RULE_identifier_operand; }
+
+ public Identifier_operandContext() { }
+ public void copyFrom(Identifier_operandContext ctx) {
+ super.copyFrom(ctx);
+ }
+ }
+ public static class VariableContext extends Identifier_operandContext {
+ public TerminalNode IDENTIFIER() { return getToken(TransformationParser.IDENTIFIER, 0); }
+ public VariableContext(Identifier_operandContext ctx) { copyFrom(ctx); }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).enterVariable(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).exitVariable(this);
+ }
+ }
+ public static class StringLiteralContext extends Identifier_operandContext {
+ public TerminalNode STRING_LITERAL() { return getToken(TransformationParser.STRING_LITERAL, 0); }
+ public StringLiteralContext(Identifier_operandContext ctx) { copyFrom(ctx); }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).enterStringLiteral(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).exitStringLiteral(this);
+ }
+ }
+ public static class TransformationFuncContext extends Identifier_operandContext {
+ public TerminalNode IDENTIFIER() { return getToken(TransformationParser.IDENTIFIER, 0); }
+ public TerminalNode LPAREN() { return getToken(TransformationParser.LPAREN, 0); }
+ public Func_argsContext func_args() {
+ return getRuleContext(Func_argsContext.class,0);
+ }
+ public TerminalNode RPAREN() { return getToken(TransformationParser.RPAREN, 0); }
+ public TransformationFuncContext(Identifier_operandContext ctx) { copyFrom(ctx); }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).enterTransformationFunc(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).exitTransformationFunc(this);
+ }
+ }
+ public static class ListContext extends Identifier_operandContext {
+ public List_entityContext list_entity() {
+ return getRuleContext(List_entityContext.class,0);
+ }
+ public ListContext(Identifier_operandContext ctx) { copyFrom(ctx); }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).enterList(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).exitList(this);
+ }
+ }
+ public static class DoubleLiteralContext extends Identifier_operandContext {
+ public TerminalNode DOUBLE_LITERAL() { return getToken(TransformationParser.DOUBLE_LITERAL, 0); }
+ public DoubleLiteralContext(Identifier_operandContext ctx) { copyFrom(ctx); }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).enterDoubleLiteral(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).exitDoubleLiteral(this);
+ }
+ }
+ public static class IntegerLiteralContext extends Identifier_operandContext {
+ public TerminalNode INT_LITERAL() { return getToken(TransformationParser.INT_LITERAL, 0); }
+ public IntegerLiteralContext(Identifier_operandContext ctx) { copyFrom(ctx); }
+ @Override
+ public void enterRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).enterIntegerLiteral(this);
+ }
+ @Override
+ public void exitRule(ParseTreeListener listener) {
+ if ( listener instanceof TransformationListener ) ((TransformationListener)listener).exitIntegerLiteral(this);
+ }
+ }
+
+ public final Identifier_operandContext identifier_operand() throws RecognitionException {
+ Identifier_operandContext _localctx = new Identifier_operandContext(_ctx, getState());
+ enterRule(_localctx, 12, RULE_identifier_operand);
+ try {
+ setState(53);
+ switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) {
+ case 1:
+ _localctx = new StringLiteralContext(_localctx);
+ enterOuterAlt(_localctx, 1);
+ {
+ setState(43);
+ match(STRING_LITERAL);
+ }
+ break;
+ case 2:
+ _localctx = new IntegerLiteralContext(_localctx);
+ enterOuterAlt(_localctx, 2);
+ {
+ setState(44);
+ match(INT_LITERAL);
+ }
+ break;
+ case 3:
+ _localctx = new DoubleLiteralContext(_localctx);
+ enterOuterAlt(_localctx, 3);
+ {
+ setState(45);
+ match(DOUBLE_LITERAL);
+ }
+ break;
+ case 4:
+ _localctx = new VariableContext(_localctx);
+ enterOuterAlt(_localctx, 4);
+ {
+ setState(46);
+ match(IDENTIFIER);
+ }
+ break;
+ case 5:
+ _localctx = new TransformationFuncContext(_localctx);
+ enterOuterAlt(_localctx, 5);
+ {
+ setState(47);
+ match(IDENTIFIER);
+ setState(48);
+ match(LPAREN);
+ setState(49);
+ func_args();
+ setState(50);
+ match(RPAREN);
+ }
+ break;
+ case 6:
+ _localctx = new ListContext(_localctx);
+ enterOuterAlt(_localctx, 6);
+ {
+ setState(52);
+ list_entity();
+ }
+ break;
+ }
+ }
+ catch (RecognitionException re) {
+ _localctx.exception = re;
+ _errHandler.reportError(this, re);
+ _errHandler.recover(this, re);
+ }
+ finally {
+ exitRule();
+ }
+ return _localctx;
+ }
+
+ public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
+ switch (ruleIndex) {
+ case 4:
+ return op_list_sempred((Op_listContext)_localctx, predIndex);
+ }
+ return true;
+ }
+ private boolean op_list_sempred(Op_listContext _localctx, int predIndex) {
+ switch (predIndex) {
+ case 0:
+ return precpred(_ctx, 1);
+ }
+ return true;
+ }
+
+ public static final String _serializedATN =
+ "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\r:\4\2\t\2\4\3\t"+
+ "\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\3\2\3\2\3\2\3\3\3\3\3\3\3\3"+
+ "\3\3\5\3\31\n\3\3\4\3\4\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\7\6%\n\6\f\6\16"+
+ "\6(\13\6\3\7\3\7\3\7\3\7\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\5\b8"+
+ "\n\b\3\b\2\3\n\t\2\4\6\b\n\f\16\2\29\2\20\3\2\2\2\4\30\3\2\2\2\6\32\3"+
+ "\2\2\2\b\34\3\2\2\2\n\36\3\2\2\2\f)\3\2\2\2\16\67\3\2\2\2\20\21\5\4\3"+
+ "\2\21\22\7\2\2\3\22\3\3\2\2\2\23\24\7\6\2\2\24\25\5\4\3\2\25\26\7\7\2"+
+ "\2\26\31\3\2\2\2\27\31\5\6\4\2\30\23\3\2\2\2\30\27\3\2\2\2\31\5\3\2\2"+
+ "\2\32\33\5\16\b\2\33\7\3\2\2\2\34\35\5\n\6\2\35\t\3\2\2\2\36\37\b\6\1"+
+ "\2\37 \5\16\b\2 &\3\2\2\2!\"\f\3\2\2\"#\7\3\2\2#%\5\16\b\2$!\3\2\2\2%"+
+ "(\3\2\2\2&$\3\2\2\2&\'\3\2\2\2\'\13\3\2\2\2(&\3\2\2\2)*\7\4\2\2*+\5\n"+
+ "\6\2+,\7\5\2\2,\r\3\2\2\2-8\7\13\2\2.8\7\b\2\2/8\7\t\2\2\608\7\n\2\2\61"+
+ "\62\7\n\2\2\62\63\7\6\2\2\63\64\5\b\5\2\64\65\7\7\2\2\658\3\2\2\2\668"+
+ "\5\f\7\2\67-\3\2\2\2\67.\3\2\2\2\67/\3\2\2\2\67\60\3\2\2\2\67\61\3\2\2"+
+ "\2\67\66\3\2\2\28\17\3\2\2\2\5\30&\67";
+ public static final ATN _ATN =
+ new ATNDeserializer().deserialize(_serializedATN.toCharArray());
+ static {
+ _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
+ for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
+ _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-common/src/test/java/org/apache/metron/common/AggregatorsTest.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/test/java/org/apache/metron/common/AggregatorsTest.java b/metron-platform/metron-common/src/test/java/org/apache/metron/common/AggregatorsTest.java
new file mode 100644
index 0000000..ab3eb1d
--- /dev/null
+++ b/metron-platform/metron-common/src/test/java/org/apache/metron/common/AggregatorsTest.java
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.metron.common;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.apache.metron.common.aggregator.Aggregators;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.HashMap;
+
+public class AggregatorsTest {
+ @Test
+ public void testMax() {
+ Assert.assertEquals(Double.NEGATIVE_INFINITY, Aggregators.MAX.aggregate(ImmutableList.of(1, 5, -1, 7), new HashMap<>()), 1e-7);
+ Assert.assertEquals(Double.NEGATIVE_INFINITY, Aggregators.MAX.aggregate(ImmutableList.of(1, 5, -1, -2), new HashMap<>()), 1e-7);
+ Assert.assertEquals(7d, Aggregators.MAX.aggregate(ImmutableList.of(1, 5, -1, 7, 0), ImmutableMap.of(Aggregators.NEGATIVE_VALUES_TRUMP_CONF, "false")), 1e-7);
+ }
+
+ @Test
+ public void testMin() {
+ Assert.assertEquals(Double.NEGATIVE_INFINITY, Aggregators.MIN.aggregate(ImmutableList.of(1, 5, -1, 7, 0), new HashMap<>()), 1e-7);
+ Assert.assertEquals(Double.NEGATIVE_INFINITY, Aggregators.MIN.aggregate(ImmutableList.of(1, 5, -1, -2, 0), new HashMap<>()), 1e-7);
+ Assert.assertEquals(-1d, Aggregators.MIN.aggregate(ImmutableList.of(1, 5, -1, 7, 0), ImmutableMap.of(Aggregators.NEGATIVE_VALUES_TRUMP_CONF, "false")), 1e-7);
+ }
+
+ @Test
+ public void testMean() {
+ Assert.assertEquals(Double.NEGATIVE_INFINITY, Aggregators.MEAN.aggregate(ImmutableList.of(1, 5, -1, 7, 0), new HashMap<>()), 1e-7);
+ Assert.assertEquals(12.0/5.0, Aggregators.MEAN.aggregate(ImmutableList.of(1, 5, -1, 7, 0), ImmutableMap.of(Aggregators.NEGATIVE_VALUES_TRUMP_CONF, "false")), 1e-7);
+ }
+ @Test
+ public void testPositiveMean() {
+ Assert.assertEquals(Double.NEGATIVE_INFINITY, Aggregators.POSITIVE_MEAN.aggregate(ImmutableList.of(1, 5, -1, 7, 0), new HashMap<>()), 1e-7);
+ Assert.assertEquals(13.0/3.0, Aggregators.POSITIVE_MEAN.aggregate(ImmutableList.of(1, 5, -1, 7, 0), ImmutableMap.of(Aggregators.NEGATIVE_VALUES_TRUMP_CONF, "false")), 1e-7);
+ }
+ @Test
+ public void testSum() {
+ Assert.assertEquals(Double.NEGATIVE_INFINITY, Aggregators.SUM.aggregate(ImmutableList.of(1, 5, -1, 7), new HashMap<>()), 1e-7);
+ Assert.assertEquals(1 + 5 + -1 + 7, Aggregators.SUM.aggregate(ImmutableList.of(1, 5, -1, 7), ImmutableMap.of(Aggregators.NEGATIVE_VALUES_TRUMP_CONF, "false")), 1e-7);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/transformation/MTLTransformationTest.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/transformation/MTLTransformationTest.java b/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/transformation/MTLTransformationTest.java
new file mode 100644
index 0000000..53373dd
--- /dev/null
+++ b/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/transformation/MTLTransformationTest.java
@@ -0,0 +1,167 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.metron.common.field.transformation;
+
+import com.google.common.collect.Iterables;
+import org.adrianwalker.multilinestring.Multiline;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.metron.common.configuration.FieldTransformer;
+import org.apache.metron.common.configuration.SensorParserConfig;
+import org.json.simple.JSONObject;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.HashMap;
+
+public class MTLTransformationTest {
+ /**
+ {
+ "fieldTransformations" : [
+ {
+ "transformation" : "MTL"
+ ,"output" : "utc_timestamp"
+ ,"config" : {
+ "utc_timestamp" : "TO_EPOCH_TIMESTAMP(timestamp, 'yyyy-MM-dd HH:mm:ss', 'UTC')"
+ }
+ }
+ ]
+ }
+ */
+ @Multiline
+ public static String mtlConfig;
+ /**
+ * Test the happy path. This ensures that a simple transformation, converting a timestamp in a yyyy-MM-dd HH:mm:ss
+ * format can be converted to the expected UTC MS since Epoch.
+ */
+ @Test
+ public void testMTL() throws Exception {
+
+ SensorParserConfig c = SensorParserConfig.fromBytes(Bytes.toBytes(mtlConfig));
+ FieldTransformer handler = Iterables.getFirst(c.getFieldTransformations(), null);
+ JSONObject input = new JSONObject(new HashMap<String, Object>() {{
+ put("timestamp", "2016-01-05 17:02:30");
+ }});
+ handler.transformAndUpdate(input, new HashMap<>());
+ long expected = 1452013350000L;
+ Assert.assertEquals(expected, input.get("utc_timestamp"));
+ Assert.assertTrue(input.containsKey("timestamp"));
+ }
+ /**
+ * Ensures that if we try to transform with a field which does not exist, it does not
+ * 1. throw an exception
+ * 2. do any transformation.
+ */
+ @Test
+ public void testMTL_negative() throws Exception {
+
+ SensorParserConfig c = SensorParserConfig.fromBytes(Bytes.toBytes(mtlConfig));
+ FieldTransformer handler = Iterables.getFirst(c.getFieldTransformations(), null);
+ //no input fields => no transformation
+ JSONObject input = new JSONObject(new HashMap<String, Object>() {{
+ }});
+ handler.transformAndUpdate(input, new HashMap<>());
+ Assert.assertFalse(input.containsKey("utc_timestamp"));
+ Assert.assertTrue(input.isEmpty());
+ }
+
+ /**
+ {
+ "fieldTransformations" : [
+ {
+ "transformation" : "MTL"
+ ,"output" : [ "utc_timestamp", "url_host", "url_protocol" ]
+ ,"config" : {
+ "utc_timestamp" : "TO_EPOCH_TIMESTAMP(timestamp, 'yyyy-MM-dd HH:mm:ss', MAP_GET(dc, dc2tz, 'UTC') )"
+ ,"url_host" : "TO_LOWER(URL_TO_HOST(url))"
+ ,"url_protocol" : "URL_TO_PROTOCOL(url)"
+ }
+ }
+ ]
+ ,"parserConfig" : {
+ "dc2tz" : {
+ "nyc" : "EST"
+ ,"la" : "PST"
+ ,"london" : "UTC"
+ }
+ }
+ }
+ */
+ @Multiline
+ public static String mtlConfig_multi;
+
+ /**
+ * A more complicated test where we are transforming multiple fields:
+ * 1. Convert a timestamp field in yyyy-MM-dd HH:mm:ss format to unix epoch while
+ * looking up the timezone based on a second field, dc, in a map being kept in the parser config.
+ * If the data center isn't in the map, then the default is UTC
+ * 2. Extract the host from a URL field and convert to lowercase
+ * 3. Extract the protocol of the URL field
+ **/
+ @Test
+ public void testMTL_multi() throws Exception {
+
+ SensorParserConfig c = SensorParserConfig.fromBytes(Bytes.toBytes(mtlConfig_multi));
+ FieldTransformer handler = Iterables.getFirst(c.getFieldTransformations(), null);
+ {
+ //We need a timestamp field, a URL field and a data center field
+ JSONObject input = new JSONObject(new HashMap<String, Object>() {{
+ put("timestamp", "2016-01-05 17:02:30");
+ put("url", "https://caseystella.com/blog");
+ //looking up the data center in portland, which doesn't exist in the map, so we default to UTC
+ put("dc", "portland");
+ }});
+ handler.transformAndUpdate(input, c.getParserConfig());
+ long expected = 1452013350000L;
+ Assert.assertEquals(expected, input.get("utc_timestamp"));
+ Assert.assertEquals("caseystella.com", input.get("url_host"));
+ Assert.assertEquals("https", input.get("url_protocol"));
+ Assert.assertTrue(input.containsKey("timestamp"));
+ Assert.assertTrue(input.containsKey("url"));
+ }
+ {
+ //now we see what happens when we change the data center to london, which is in the map
+ JSONObject input = new JSONObject(new HashMap<String, Object>() {{
+ put("timestamp", "2016-01-05 17:02:30");
+ put("url", "https://caseystella.com/blog");
+ put("dc", "london");
+ }});
+ handler.transformAndUpdate(input, c.getParserConfig());
+ long expected = 1452013350000L;
+ Assert.assertEquals(expected, input.get("utc_timestamp"));
+ Assert.assertEquals("caseystella.com", input.get("url_host"));
+ Assert.assertEquals("https", input.get("url_protocol"));
+ Assert.assertTrue(input.containsKey("timestamp"));
+ Assert.assertTrue(input.containsKey("url"));
+ }
+ //now we ensure that because we don't have a data center field at all, it's defaulted to UTC.
+ {
+ JSONObject input = new JSONObject(new HashMap<String, Object>() {{
+ put("timestamp", "2016-01-05 17:02:30");
+ put("url", "https://caseystella.com/blog");
+ }});
+ handler.transformAndUpdate(input, c.getParserConfig());
+ long expected = 1452013350000L;
+ Assert.assertEquals(expected, input.get("utc_timestamp"));
+ Assert.assertEquals("caseystella.com", input.get("url_host"));
+ Assert.assertEquals("https", input.get("url_protocol"));
+ Assert.assertTrue(input.containsKey("timestamp"));
+ Assert.assertTrue(input.containsKey("url"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/validation/QueryValidationTest.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/validation/QueryValidationTest.java b/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/validation/QueryValidationTest.java
index e658fc6..79162dd 100644
--- a/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/validation/QueryValidationTest.java
+++ b/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/validation/QueryValidationTest.java
@@ -74,12 +74,39 @@ public class QueryValidationTest extends BaseValidationTest{
*/
@Multiline
public static String invalidQueryConfig2;
+ /**
+ {
+ "fieldValidations" : [
+ {
+ "validation" : "MQL"
+ ,"config" : {
+ "condition" : "MAP_EXISTS(dc, dc2tz)"
+ ,"dc2tz" : {
+ "la" : "PST"
+ }
+ }
+ }
+ ]
+ }
+ */
+ @Multiline
+ public static String validQueryConfig_map;
+
@Test
public void testPositive() throws IOException {
Assert.assertTrue(execute(validQueryConfig, ImmutableMap.of("field1", "foo")));
}
@Test
+ public void testPositive_map() throws IOException {
+ Assert.assertTrue(execute(validQueryConfig_map, ImmutableMap.of("dc", "la")));
+ }
+ @Test
+ public void testNegative_map() throws IOException {
+ Assert.assertFalse(execute(validQueryConfig_map, ImmutableMap.of("dc", "nyc")));
+ Assert.assertFalse(execute(validQueryConfig_map, ImmutableMap.of("foo", "nyc")));
+ }
+ @Test
public void testNegative() throws IOException {
Assert.assertFalse(execute(validQueryConfig, ImmutableMap.of("field2", "foo")));
}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/validation/primitive/DateValidationTest.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/validation/primitive/DateValidationTest.java b/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/validation/primitive/DateValidationTest.java
index 60808a3..4df8cdb 100644
--- a/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/validation/primitive/DateValidationTest.java
+++ b/metron-platform/metron-common/src/test/java/org/apache/metron/common/field/validation/primitive/DateValidationTest.java
@@ -71,10 +71,10 @@ public class DateValidationTest extends BaseValidationTest{
}
@Test
public void negativeTest_single() throws IOException {
+ Assert.assertFalse(run(validWithSingleField_MQL, ImmutableMap.of("field1", 2.3f)));
Assert.assertFalse(execute(validWithSingleField, ImmutableMap.of("field1", "2014/05/01")));
Assert.assertFalse(run(validWithSingleField_MQL, ImmutableMap.of("field1", "2014/05/01")));
Assert.assertFalse(execute(validWithSingleField, ImmutableMap.of("field1", 2.3f)));
- Assert.assertFalse(run(validWithSingleField_MQL, ImmutableMap.of("field1", 2.3f)));
}
@Test
public void positiveTest_multiple() throws IOException {
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-common/src/test/java/org/apache/metron/common/query/QueryParserTest.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/test/java/org/apache/metron/common/query/QueryParserTest.java b/metron-platform/metron-common/src/test/java/org/apache/metron/common/query/QueryParserTest.java
index 1e5fbbf..94236dd 100644
--- a/metron-platform/metron-common/src/test/java/org/apache/metron/common/query/QueryParserTest.java
+++ b/metron-platform/metron-common/src/test/java/org/apache/metron/common/query/QueryParserTest.java
@@ -18,6 +18,11 @@
package org.apache.metron.common.query;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.apache.metron.common.dsl.MapVariableResolver;
+import org.apache.metron.common.dsl.ParseException;
+import org.apache.metron.common.dsl.VariableResolver;
import org.junit.Assert;
import org.junit.Test;
@@ -135,6 +140,59 @@ public class QueryParserTest {
}
@Test
+ public void testStringFunctions_advanced() throws Exception {
+ final Map<String, Object> variableMap = new HashMap<String, Object>() {{
+ put("foo", "casey");
+ put("bar", "bar.casey.grok");
+ put("ip", "192.168.0.1");
+ put("empty", "");
+ put("spaced", "metron is great");
+ put("myList", ImmutableList.of("casey", "apple", "orange"));
+ }};
+ Assert.assertTrue(run("foo in SPLIT(bar, '.')", v -> variableMap.get(v)));
+ Assert.assertFalse(run("foo in SPLIT(ip, '.')", v -> variableMap.get(v)));
+ Assert.assertTrue(run("foo in myList", v -> variableMap.get(v)));
+ Assert.assertFalse(run("foo not in myList", v -> variableMap.get(v)));
+ }
+
+ @Test
+ public void testMapFunctions_advanced() throws Exception {
+ final Map<String, Object> variableMap = new HashMap<String, Object>() {{
+ put("foo", "casey");
+ put("bar", "bar.casey.grok");
+ put("ip", "192.168.0.1");
+ put("empty", "");
+ put("spaced", "metron is great");
+ put("myMap", ImmutableMap.of("casey", "apple"));
+ }};
+ Assert.assertTrue(run("MAP_EXISTS(foo, myMap)", v -> variableMap.get(v)));
+ }
+
+ @Test
+ public void testNumericComparisonFunctions() throws Exception {
+ final Map<String, Object> variableMap = new HashMap<String, Object>() {{
+ put("foo", "casey");
+ put("bar", "bar.casey.grok");
+ put("ip", "192.168.0.1");
+ put("num", 7);
+ put("num2", 8.5);
+ put("num3", 7);
+ put("num4", "8.5");
+ put("empty", "");
+ put("spaced", "metron is great");
+ }};
+ Assert.assertTrue(run("num == 7", v -> variableMap.get(v)));
+ Assert.assertTrue(run("num < num2", v -> variableMap.get(v)));
+ Assert.assertTrue(run("num < TO_DOUBLE(num2)", v -> variableMap.get(v)));
+ Assert.assertTrue(run("num < TO_DOUBLE(num4)", v -> variableMap.get(v)));
+ Assert.assertTrue(run("num < 100", v -> variableMap.get(v)));
+ Assert.assertTrue(run("num == num3", v -> variableMap.get(v)));
+ Assert.assertFalse(run("num == num2", v -> variableMap.get(v)));
+ Assert.assertTrue(run("num == num2 || true", v -> variableMap.get(v)));
+ Assert.assertFalse(run("num > num2", v -> variableMap.get(v)));
+ Assert.assertTrue(run("num == 7 && num > 2", v -> variableMap.get(v)));
+ }
+ @Test
public void testLogicalFunctions() throws Exception {
final Map<String, String> variableMap = new HashMap<String, String>() {{
put("foo", "casey");
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-common/src/test/java/org/apache/metron/common/transformation/TransformationTest.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-common/src/test/java/org/apache/metron/common/transformation/TransformationTest.java b/metron-platform/metron-common/src/test/java/org/apache/metron/common/transformation/TransformationTest.java
new file mode 100644
index 0000000..7884098
--- /dev/null
+++ b/metron-platform/metron-common/src/test/java/org/apache/metron/common/transformation/TransformationTest.java
@@ -0,0 +1,151 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.metron.common.transformation;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.metron.common.utils.timestamp.TimestampConverters;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TransformationTest {
+
+ @Test
+ public void testHappyPath() {
+ String query = "TO_UPPER(TRIM(foo))";
+ Assert.assertEquals("CASEY", run(query, ImmutableMap.of("foo", "casey ")));
+ }
+
+ @Test
+ public void testJoin() {
+ String query = "JOIN( [ TO_UPPER(TRIM(foo)), 'bar' ], ',')";
+ Assert.assertEquals("CASEY,bar", run(query, ImmutableMap.of("foo", "casey ")));
+ }
+
+ @Test
+ public void testSplit() {
+ String query = "JOIN( SPLIT(foo, ':'), ',')";
+ Assert.assertEquals("casey,bar", run(query, ImmutableMap.of("foo", "casey:bar")));
+ }
+
+ @Test
+ public void testMapGet() {
+ String query = "MAP_GET(dc, dc2tz, 'UTC')";
+ Assert.assertEquals("UTC"
+ , run(query, ImmutableMap.of("dc", "nyc"
+ ,"dc2tz", ImmutableMap.of("la", "PST")
+ )
+ )
+ );
+ Assert.assertEquals("EST"
+ , run(query, ImmutableMap.of("dc", "nyc"
+ ,"dc2tz", ImmutableMap.of("nyc", "EST")
+ )
+ )
+ );
+ }
+ @Test
+ public void testTLDExtraction() {
+ String query = "DOMAIN_TO_TLD(foo)";
+ Assert.assertEquals("co.uk", run(query, ImmutableMap.of("foo", "www.google.co.uk")));
+ }
+
+ @Test
+ public void testTLDRemoval() {
+ String query = "DOMAIN_REMOVE_TLD(foo)";
+ Assert.assertEquals("www.google", run(query, ImmutableMap.of("foo", "www.google.co.uk")));
+ }
+
+ @Test
+ public void testSubdomainRemoval() {
+ String query = "DOMAIN_REMOVE_SUBDOMAINS(foo)";
+ Assert.assertEquals("google.co.uk", run(query, ImmutableMap.of("foo", "www.google.co.uk")));
+ Assert.assertEquals("google.com", run(query, ImmutableMap.of("foo", "www.google.com")));
+ }
+ @Test
+ public void testURLToHost() {
+ String query = "URL_TO_HOST(foo)";
+ Assert.assertEquals("www.google.co.uk", run(query, ImmutableMap.of("foo", "http://www.google.co.uk/my/path")));
+ }
+
+ @Test
+ public void testURLToPort() {
+ String query = "URL_TO_PORT(foo)";
+ Assert.assertEquals(80, run(query, ImmutableMap.of("foo", "http://www.google.co.uk/my/path")));
+ }
+
+ @Test
+ public void testURLToProtocol() {
+ String query = "URL_TO_PROTOCOL(foo)";
+ Assert.assertEquals("http", run(query, ImmutableMap.of("foo", "http://www.google.co.uk/my/path")));
+ }
+
+ @Test
+ public void testURLToPath() {
+ String query = "URL_TO_PATH(foo)";
+ Assert.assertEquals("/my/path", run(query, ImmutableMap.of("foo", "http://www.google.co.uk/my/path")));
+ }
+
+ @Test
+ public void testDateConversion() {
+ long expected =1452013350000L;
+ {
+ String query = "TO_EPOCH_TIMESTAMP(foo, 'yyyy-MM-dd HH:mm:ss', 'UTC')";
+ Assert.assertEquals(expected, run(query, ImmutableMap.of("foo", "2016-01-05 17:02:30")));
+ }
+ {
+ String query = "TO_EPOCH_TIMESTAMP(foo, 'yyyy-MM-dd HH:mm:ss')";
+ Long ts = (Long) run(query, ImmutableMap.of("foo", "2016-01-05 17:02:30"));
+ //is it within 24 hours of the UTC?
+ Assert.assertTrue(Math.abs(ts - expected) < 8.64e+7);
+ }
+ }
+
+ @Test
+ public void testToString() {
+ Assert.assertEquals("5", run("TO_STRING(foo)", ImmutableMap.of("foo", 5)));
+ }
+
+ @Test
+ public void testToInteger() {
+ Assert.assertEquals(5, run("TO_INTEGER(foo)", ImmutableMap.of("foo", "5")));
+ Assert.assertEquals(5, run("TO_INTEGER(foo)", ImmutableMap.of("foo", 5)));
+ }
+
+ @Test
+ public void testToDouble() {
+ Assert.assertEquals(new Double(5.1), run("TO_DOUBLE(foo)", ImmutableMap.of("foo", 5.1d)));
+ Assert.assertEquals(new Double(5.1), run("TO_DOUBLE(foo)", ImmutableMap.of("foo", "5.1")));
+ }
+ @Test
+ public void testGet() {
+ Map<String, Object> variables = ImmutableMap.of("foo", "www.google.co.uk");
+ Assert.assertEquals("www", run("GET_FIRST(SPLIT(DOMAIN_REMOVE_TLD(foo), '.'))", variables));
+ Assert.assertEquals("www", run("GET(SPLIT(DOMAIN_REMOVE_TLD(foo), '.'), 0)", variables));
+ Assert.assertEquals("google", run("GET_LAST(SPLIT(DOMAIN_REMOVE_TLD(foo), '.'))", variables));
+ Assert.assertEquals("google", run("GET(SPLIT(DOMAIN_REMOVE_TLD(foo), '.'), 1)", variables));
+ }
+ private static Object run(String rule, Map<String, Object> variables) {
+ TransformationProcessor processor = new TransformationProcessor();
+ Assert.assertTrue(rule + " not valid.", processor.validate(rule));
+ return processor.parse(rule, x -> variables.get(x));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-enrichment/src/main/java/org/apache/metron/enrichment/bolt/ThreatIntelJoinBolt.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-enrichment/src/main/java/org/apache/metron/enrichment/bolt/ThreatIntelJoinBolt.java b/metron-platform/metron-enrichment/src/main/java/org/apache/metron/enrichment/bolt/ThreatIntelJoinBolt.java
index ec1ce7a..55e9d92 100644
--- a/metron-platform/metron-enrichment/src/main/java/org/apache/metron/enrichment/bolt/ThreatIntelJoinBolt.java
+++ b/metron-platform/metron-enrichment/src/main/java/org/apache/metron/enrichment/bolt/ThreatIntelJoinBolt.java
@@ -86,7 +86,7 @@ public class ThreatIntelJoinBolt extends EnrichmentJoinBolt {
LOG.debug(sourceType + ": Empty rules!");
}
- ThreatTriageProcessor threatTriageProcessor = new ThreatTriageProcessor(triageConfig);
+ ThreatTriageProcessor threatTriageProcessor = new ThreatTriageProcessor(config);
Double triageLevel = threatTriageProcessor.apply(ret);
if(LOG.isDebugEnabled()) {
String rules = Joiner.on('\n').join(triageConfig.getRiskLevelRules().entrySet());
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-enrichment/src/main/java/org/apache/metron/threatintel/triage/ThreatTriageProcessor.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-enrichment/src/main/java/org/apache/metron/threatintel/triage/ThreatTriageProcessor.java b/metron-platform/metron-enrichment/src/main/java/org/apache/metron/threatintel/triage/ThreatTriageProcessor.java
index bb4d387..e12622c 100644
--- a/metron-platform/metron-enrichment/src/main/java/org/apache/metron/threatintel/triage/ThreatTriageProcessor.java
+++ b/metron-platform/metron-enrichment/src/main/java/org/apache/metron/threatintel/triage/ThreatTriageProcessor.java
@@ -19,10 +19,12 @@
package org.apache.metron.threatintel.triage;
import com.google.common.base.Function;
+import org.apache.metron.common.configuration.enrichment.SensorEnrichmentConfig;
+import org.apache.metron.common.configuration.enrichment.threatintel.ThreatIntelConfig;
import org.apache.metron.common.configuration.enrichment.threatintel.ThreatTriageConfig;
-import org.apache.metron.common.query.MapVariableResolver;
+import org.apache.metron.common.dsl.MapVariableResolver;
import org.apache.metron.common.query.PredicateProcessor;
-import org.apache.metron.common.query.VariableResolver;
+import org.apache.metron.common.dsl.VariableResolver;
import javax.annotation.Nullable;
import java.util.ArrayList;
@@ -30,9 +32,13 @@ import java.util.List;
import java.util.Map;
public class ThreatTriageProcessor implements Function<Map, Double> {
- private ThreatTriageConfig config;
- public ThreatTriageProcessor(ThreatTriageConfig config) {
- this.config = config;
+ private SensorEnrichmentConfig sensorConfig;
+ private ThreatIntelConfig threatIntelConfig;
+ private ThreatTriageConfig threatTriageConfig;
+ public ThreatTriageProcessor(SensorEnrichmentConfig config) {
+ this.threatIntelConfig = config.getThreatIntel();
+ this.sensorConfig = config;
+ this.threatTriageConfig = config.getThreatIntel().getTriageConfig();
}
@Nullable
@@ -40,12 +46,12 @@ public class ThreatTriageProcessor implements Function<Map, Double> {
public Double apply(@Nullable Map input) {
List<Number> scores = new ArrayList<>();
PredicateProcessor predicateProcessor = new PredicateProcessor();
- VariableResolver resolver = new MapVariableResolver(input);
- for(Map.Entry<String, Number> kv : config.getRiskLevelRules().entrySet()) {
+ VariableResolver resolver = new MapVariableResolver(input, sensorConfig.getConfiguration(), threatIntelConfig.getConfig());
+ for(Map.Entry<String, Number> kv : threatTriageConfig.getRiskLevelRules().entrySet()) {
if(predicateProcessor.parse(kv.getKey(), resolver)) {
scores.add(kv.getValue());
}
}
- return config.getAggregator().aggregate(scores, config.getAggregationConfig());
+ return threatTriageConfig.getAggregator().aggregate(scores, threatTriageConfig.getAggregationConfig());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-enrichment/src/test/java/org/apache/metron/threatintel/triage/ThreatTriageTest.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-enrichment/src/test/java/org/apache/metron/threatintel/triage/ThreatTriageTest.java b/metron-platform/metron-enrichment/src/test/java/org/apache/metron/threatintel/triage/ThreatTriageTest.java
index 90a4c9b..8ae74b3 100644
--- a/metron-platform/metron-enrichment/src/test/java/org/apache/metron/threatintel/triage/ThreatTriageTest.java
+++ b/metron-platform/metron-enrichment/src/test/java/org/apache/metron/threatintel/triage/ThreatTriageTest.java
@@ -19,6 +19,7 @@
package org.apache.metron.threatintel.triage;
import org.adrianwalker.multilinestring.Multiline;
+import org.apache.metron.common.configuration.enrichment.SensorEnrichmentConfig;
import org.apache.metron.common.configuration.enrichment.threatintel.ThreatTriageConfig;
import org.apache.metron.common.utils.JSONUtils;
import org.junit.Assert;
@@ -30,19 +31,28 @@ import java.util.HashMap;
public class ThreatTriageTest {
/**
{
- "riskLevelRules" : {
- "user.type in [ 'admin', 'power' ] and asset.type == 'web'" : 10
- ,"asset.type == 'web'" : 5
- ,"user.type == 'normal' and asset.type == 'web'" : 0
+ "threatIntel" : {
+ "triageConfig" :
+ {
+ "riskLevelRules" : {
+ "user.type in [ 'admin', 'power' ] and asset.type == 'web'" : 10
+ ,"asset.type == 'web'" : 5
+ ,"user.type == 'normal' and asset.type == 'web'" : 0
+ ,"user.type in whitelist" : -1
}
- ,"aggregator" : "MAX"
+ ,"aggregator" : "MAX"
+ },
+ "config" : {
+ "whitelist" : [ "abnormal" ]
+ }
+ }
}
*/
@Multiline
public static String smokeTestProcessorConfig;
private static ThreatTriageProcessor getProcessor(String config) throws IOException {
- ThreatTriageConfig c = JSONUtils.INSTANCE.load(config, ThreatTriageConfig.class);
+ SensorEnrichmentConfig c = JSONUtils.INSTANCE.load(config, SensorEnrichmentConfig.class);
return new ThreatTriageProcessor(c);
}
@@ -51,7 +61,7 @@ public class ThreatTriageTest {
ThreatTriageProcessor threatTriageProcessor = getProcessor(smokeTestProcessorConfig);
Assert.assertEquals("Expected a score of 0"
, 0d
- ,new ThreatTriageProcessor(new ThreatTriageConfig()).apply(new HashMap<Object, Object>() {{
+ ,new ThreatTriageProcessor(new SensorEnrichmentConfig()).apply(new HashMap<Object, Object>() {{
put("user.type", "admin");
put("asset.type", "web");
}}
@@ -85,16 +95,30 @@ public class ThreatTriageTest {
)
, 1e-10
);
+ Assert.assertEquals("Expected a score of -Inf"
+ , Double.NEGATIVE_INFINITY
+ , threatTriageProcessor.apply(new HashMap<Object, Object>() {{
+ put("user.type", "abnormal");
+ put("asset.type", "bar");
+ }}
+ )
+ , 1e-10
+ );
}
/**
{
- "riskLevelRules" : {
- "user.type in [ 'admin', 'power' ] and asset.type == 'web'" : 10
- ,"asset.type == 'web'" : 5
- ,"user.type == 'normal' and asset.type == 'web'" : 0
+ "threatIntel" : {
+ "triageConfig" :
+ {
+ "riskLevelRules" : {
+ "user.type in [ 'admin', 'power' ] and asset.type == 'web'" : 10
+ ,"asset.type == 'web'" : 5
+ ,"user.type == 'normal' and asset.type == 'web'" : 0
}
- ,"aggregator" : "POSITIVE_MEAN"
+ ,"aggregator" : "POSITIVE_MEAN"
+ }
+ }
}
*/
@Multiline
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-integration-test/src/main/sample/data/squid/parsed/SquidExampleParsed
----------------------------------------------------------------------
diff --git a/metron-platform/metron-integration-test/src/main/sample/data/squid/parsed/SquidExampleParsed b/metron-platform/metron-integration-test/src/main/sample/data/squid/parsed/SquidExampleParsed
index 9643c25..9a8b981 100644
--- a/metron-platform/metron-integration-test/src/main/sample/data/squid/parsed/SquidExampleParsed
+++ b/metron-platform/metron-integration-test/src/main/sample/data/squid/parsed/SquidExampleParsed
@@ -1,2 +1,2 @@
-{"elapsed":161,"code":200,"ip_dst_addr":"199.27.79.73","original_string":"1461576382.642 161 127.0.0.1 TCP_MISS\/200 103701 GET http:\/\/www.cnn.com\/ - DIRECT\/199.27.79.73 text\/html","method":"GET","bytes":103701,"action":"TCP_MISS","ip_src_addr":"127.0.0.1","url":"cnn.com","timestamp":1461576382642,"source.type":"squid"}
-{"elapsed":159,"code":200,"ip_dst_addr":"66.210.41.9","original_string":"1461576442.228 159 127.0.0.1 TCP_MISS\/200 137183 GET http:\/\/www.nba.com\/ - DIRECT\/66.210.41.9 text\/html","method":"GET","bytes":137183,"action":"TCP_MISS","ip_src_addr":"127.0.0.1","url":"nba.com","timestamp":1461576442228,"source.type":"squid"}
\ No newline at end of file
+{"elapsed":161,"code":200,"ip_dst_addr":"199.27.79.73","original_string":"1461576382.642 161 127.0.0.1 TCP_MISS\/200 103701 GET http:\/\/www.cnn.com\/ - DIRECT\/199.27.79.73 text\/html","method":"GET","bytes":103701,"action":"TCP_MISS","ip_src_addr":"127.0.0.1","url":"http://www.cnn.com/","full_hostname":"www.cnn.com", "domain_without_subdomains": "cnn.com", "timestamp":1461576382642,"source.type":"squid"}
+{"elapsed":159,"code":200,"ip_dst_addr":"66.210.41.9","original_string":"1461576442.228 159 127.0.0.1 TCP_MISS\/200 137183 GET http:\/\/www.nba.com\/ - DIRECT\/66.210.41.9 text\/html","method":"GET","bytes":137183,"action":"TCP_MISS","ip_src_addr":"127.0.0.1","url":"http://www.nba.com/", "full_hostname":"www.nba.com", "domain_without_subdomains" : "nba.com", "timestamp":1461576442228,"source.type":"squid"}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-parsers/README.md
----------------------------------------------------------------------
diff --git a/metron-platform/metron-parsers/README.md b/metron-platform/metron-parsers/README.md
index b78550b..76adfcc 100644
--- a/metron-platform/metron-parsers/README.md
+++ b/metron-platform/metron-parsers/README.md
@@ -84,7 +84,7 @@ unconditionally:
"fieldTransformations" : [
{
"input" : "field1"
- , "mapping" : "REMOVE"
+ , "transformation" : "REMOVE"
}
]
}
@@ -98,7 +98,7 @@ whenever `field2` exists and whose corresponding equal to 'foo':
"fieldTransformations" : [
{
"input" : "field1"
- , "mapping" : "REMOVE"
+ , "transformation" : "REMOVE"
, "config" : {
"condition" : "exists(field2) and field2 == 'foo'"
}
@@ -126,6 +126,42 @@ to a textual representation of the protocol:
This transformation would transform `{ "protocol" : 6, "source.type" : "bro", ... }`
into `{ "protocol" : "TCP", "source.type" : "bro", ...}`
+* `MTL` : This transformation executes a set of transformations expressed as [Metron Transformation Language](../metron-common) statements.
+
+Consider the following sensor parser config to add three new fields to a
+message:
+* `utc_timestamp` : The unix epoch timestamp based on the `timestamp` field, a `dc` field which is the data center the message comes from and a `dc2tz` map mapping data centers to timezones
+* `url_host` : The host associated with the url in the `url` field
+* `url_protocol` : The protocol associated with the url in the `url` field
+
+```
+{
+...
+ "fieldTransformations" : [
+ {
+ "transformation" : "MTL"
+ ,"output" : [ "utc_timestamp", "url_host", "url_protocol" ]
+ ,"config" : {
+ "utc_timestamp" : "TO_EPOCH_TIMESTAMP(timestamp, 'yyyy-MM-dd
+HH:mm:ss', MAP_GET(dc, dc2tz, 'UTC') )"
+ ,"url_host" : "URL_TO_HOST(url)"
+ ,"url_protocol" : "URL_TO_PROTOCOL(url)"
+ }
+ }
+ ]
+ ,"parserConfig" : {
+ "dc2tz" : {
+ "nyc" : "EST"
+ ,"la" : "PST"
+ ,"london" : "UTC"
+ }
+ }
+}
+```
+
+Note that the `dc2tz` map is in the parser config, so it is accessible
+in the functions.
+
###An Example Configuration for a Sensor
Consider the following example configuration for the `yaf` sensor:
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-parsers/src/main/config/zookeeper/parsers/squid.json
----------------------------------------------------------------------
diff --git a/metron-platform/metron-parsers/src/main/config/zookeeper/parsers/squid.json b/metron-platform/metron-parsers/src/main/config/zookeeper/parsers/squid.json
index 6c4a69b..3f6fde5 100644
--- a/metron-platform/metron-parsers/src/main/config/zookeeper/parsers/squid.json
+++ b/metron-platform/metron-parsers/src/main/config/zookeeper/parsers/squid.json
@@ -5,5 +5,15 @@
"grokPath": "/patterns/squid",
"patternLabel": "SQUID_DELIMITED",
"timestampField": "timestamp"
- }
+ },
+ "fieldTransformations" : [
+ {
+ "transformation" : "MTL"
+ ,"output" : [ "full_hostname", "domain_without_subdomains" ]
+ ,"config" : {
+ "full_hostname" : "URL_TO_HOST(url)"
+ ,"domain_without_subdomains" : "DOMAIN_REMOVE_SUBDOMAINS(full_hostname)"
+ }
+ }
+ ]
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/filters/QueryFilter.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/filters/QueryFilter.java b/metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/filters/QueryFilter.java
index ee64fb4..5ee5fcc 100644
--- a/metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/filters/QueryFilter.java
+++ b/metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/filters/QueryFilter.java
@@ -18,15 +18,12 @@
package org.apache.metron.parsers.filters;
-import com.google.common.collect.ImmutableList;
-import org.apache.metron.common.query.MapVariableResolver;
+import org.apache.metron.common.dsl.MapVariableResolver;
import org.apache.metron.common.query.PredicateProcessor;
-import org.apache.metron.common.query.VariableResolver;
+import org.apache.metron.common.dsl.VariableResolver;
import org.apache.metron.parsers.interfaces.MessageFilter;
import org.json.simple.JSONObject;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Map;
public class QueryFilter implements MessageFilter<JSONObject> {
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-parsers/src/main/resources/patterns/squid
----------------------------------------------------------------------
diff --git a/metron-platform/metron-parsers/src/main/resources/patterns/squid b/metron-platform/metron-parsers/src/main/resources/patterns/squid
index ba5bab8..d7312cc 100644
--- a/metron-platform/metron-parsers/src/main/resources/patterns/squid
+++ b/metron-platform/metron-parsers/src/main/resources/patterns/squid
@@ -1,2 +1 @@
-WDOM [^(?:http:\/\/|www\.|https:\/\/)]([^\/]+)
-SQUID_DELIMITED %{NUMBER:timestamp} %{SPACE:UNWANTED} %{INT:elapsed} %{IPV4:ip_src_addr} %{WORD:action}/%{NUMBER:code} %{NUMBER:bytes} %{WORD:method} http:\/\/\www.%{WDOM:url}\/ - %{WORD:UNWANTED}\/%{IPV4:ip_dst_addr} %{WORD:UNWANTED}\/%{WORD:UNWANTED}
\ No newline at end of file
+SQUID_DELIMITED %{NUMBER:timestamp} %{SPACE:UNWANTED} %{INT:elapsed} %{IPV4:ip_src_addr} %{WORD:action}/%{NUMBER:code} %{NUMBER:bytes} %{WORD:method} %{NOTSPACE:url} - %{WORD:UNWANTED}\/%{IPV4:ip_dst_addr} %{WORD:UNWANTED}\/%{WORD:UNWANTED}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/SquidParserTest.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/SquidParserTest.java b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/SquidParserTest.java
index d97025e..7f0abaf 100644
--- a/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/SquidParserTest.java
+++ b/metron-platform/metron-parsers/src/test/java/org/apache/metron/parsers/SquidParserTest.java
@@ -39,7 +39,7 @@ public class SquidParserTest extends GrokParserTest {
* "action":"TCP_MISS",
* "ip_src_addr":"127.0.0.1",
* "ip_dst_addr":"199.27.79.73",
- * "url":"cnn.com",
+ * "url":"http://www.cnn.com/",
* "timestamp":1461576382642
* }
*/
http://git-wip-us.apache.org/repos/asf/incubator-metron/blob/bdbf33a9/metron-platform/metron-pcap/src/main/java/org/apache/metron/pcap/filter/PcapFieldResolver.java
----------------------------------------------------------------------
diff --git a/metron-platform/metron-pcap/src/main/java/org/apache/metron/pcap/filter/PcapFieldResolver.java b/metron-platform/metron-pcap/src/main/java/org/apache/metron/pcap/filter/PcapFieldResolver.java
index 50537e1..0facfa8 100644
--- a/metron-platform/metron-pcap/src/main/java/org/apache/metron/pcap/filter/PcapFieldResolver.java
+++ b/metron-platform/metron-pcap/src/main/java/org/apache/metron/pcap/filter/PcapFieldResolver.java
@@ -19,7 +19,7 @@
package org.apache.metron.pcap.filter;
import org.apache.metron.common.Constants;
-import org.apache.metron.common.query.VariableResolver;
+import org.apache.metron.common.dsl.VariableResolver;
import java.util.EnumMap;