http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/300952a9/commons/flowfile-packager/src/main/java/org/apache/nifi/util/Unpackage.java ---------------------------------------------------------------------- diff --git a/commons/flowfile-packager/src/main/java/org/apache/nifi/util/Unpackage.java b/commons/flowfile-packager/src/main/java/org/apache/nifi/util/Unpackage.java deleted file mode 100644 index 19f702c..0000000 --- a/commons/flowfile-packager/src/main/java/org/apache/nifi/util/Unpackage.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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.nifi.util; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Map; -import java.util.UUID; - -public class Unpackage { - - private static void printUsage() { - System.out.println("java " + Unpackage.class.getCanonicalName() + " <version> <input file 1> [<input file 2> <input file 3> ... <input file N>]"); - System.out.println("<version> : The version of the FlowFile Package format. Valid values are 1, 2, 3"); - System.out.println("<input file X> : The FlowFile package to unpack"); - System.out.println(); - } - - public static void main(final String[] args) throws IOException { - if (args.length < 2) { - printUsage(); - return; - } - - final String version = args[0]; - - int inputFileCount = 0; - int outputFileCount = 0; - - for (int i = 1; i < args.length; i++) { - final String filename = args[i]; - final File inFile = new File(filename); - - if (inFile.isDirectory()) { - System.out.println("WARNING: input file " + inFile + " is a directory; skipping"); - continue; - } - - if (!inFile.exists() || !inFile.canRead()) { - System.out.println("ERROR: unable to read file " + inFile); - continue; - } - - final File outputDir = new File(inFile.getAbsolutePath() + ".unpacked"); - if (!outputDir.exists() && !outputDir.mkdir()) { - System.out.println("ERROR: Unable to create directory " + outputDir); - continue; - } - - final File tempFile = new File(outputDir, ".temp." + UUID.randomUUID().toString() + ".unpackage"); - inputFileCount++; - try (final FileInputStream fis = new FileInputStream(inFile); - final BufferedInputStream bufferedIn = new BufferedInputStream(fis)) { - - final FlowFileUnpackager unpackager = createUnpackager(version); - while (unpackager.hasMoreData()) { - outputFileCount++; - final Map<String, String> attributes; - - try (final FileOutputStream fos = new FileOutputStream(tempFile); - final BufferedOutputStream bufferedOut = new BufferedOutputStream(fos)) { - attributes = unpackager.unpackageFlowFile(bufferedIn, bufferedOut); - } - - String outputFilename = attributes.get("filename"); - if (outputFilename == null) { - outputFilename = attributes.get("nf.file.name"); - } - - final File outputFile = new File(outputDir, outputFilename); - tempFile.renameTo(outputFile); - - final File attributeFilename = new File(outputDir, outputFilename + ".attributes"); - try (final FileOutputStream fos = new FileOutputStream(attributeFilename); - final BufferedOutputStream bufferedOut = new BufferedOutputStream(fos)) { - - for (final Map.Entry<String, String> entry : attributes.entrySet()) { - bufferedOut.write((entry.getKey() + "=" + entry.getValue() + "\n").getBytes("UTF-8")); - } - } - } - } - } - - System.out.println("Unpacked " + inputFileCount + " packages into " + outputFileCount + " files"); - } - - public static FlowFileUnpackager createUnpackager(final String version) { - switch (version) { - case "1": - return new FlowFileUnpackagerV1(); - case "2": - return new FlowFileUnpackagerV2(); - case "3": - return new FlowFileUnpackagerV3(); - default: - System.out.println("ERROR: Invalid version: " + version + "; must be 1, 2, or 3"); - return null; - } - } -}
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/300952a9/commons/flowfile-packager/src/test/java/org/apache/nifi/util/TestPackageUnpackageV3.java ---------------------------------------------------------------------- diff --git a/commons/flowfile-packager/src/test/java/org/apache/nifi/util/TestPackageUnpackageV3.java b/commons/flowfile-packager/src/test/java/org/apache/nifi/util/TestPackageUnpackageV3.java deleted file mode 100644 index 24cd374..0000000 --- a/commons/flowfile-packager/src/test/java/org/apache/nifi/util/TestPackageUnpackageV3.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.nifi.util; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; - -public class TestPackageUnpackageV3 { - - @Test - public void test() throws IOException { - final FlowFilePackager packager = new FlowFilePackagerV3(); - final FlowFileUnpackager unpackager = new FlowFileUnpackagerV3(); - - final byte[] data = "Hello, World!".getBytes("UTF-8"); - final Map<String, String> map = new HashMap<>(); - map.put("abc", "cba"); - - final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - final ByteArrayInputStream in = new ByteArrayInputStream(data); - packager.packageFlowFile(in, baos, map, data.length); - - final byte[] encoded = baos.toByteArray(); - final ByteArrayInputStream encodedIn = new ByteArrayInputStream(encoded); - final ByteArrayOutputStream decodedOut = new ByteArrayOutputStream(); - final Map<String, String> unpackagedAttributes = unpackager.unpackageFlowFile(encodedIn, decodedOut); - final byte[] decoded = decodedOut.toByteArray(); - - assertEquals(map, unpackagedAttributes); - assertTrue(Arrays.equals(data, decoded)); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/300952a9/commons/nifi-expression-language/pom.xml ---------------------------------------------------------------------- diff --git a/commons/nifi-expression-language/pom.xml b/commons/nifi-expression-language/pom.xml deleted file mode 100644 index 196c048..0000000 --- a/commons/nifi-expression-language/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <!-- - 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. - --> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-commons-parent</artifactId> - <version>0.0.1-SNAPSHOT</version> - </parent> - - <artifactId>nifi-expression-language</artifactId> - <version>0.0.1-SNAPSHOT</version> - - <packaging>jar</packaging> - <name>NiFi Expression Language</name> - - <build> - <plugins> - <plugin> - <groupId>org.antlr</groupId> - <artifactId>antlr3-maven-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>antlr</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <dependencies> - <dependency> - <groupId>org.antlr</groupId> - <artifactId>antlr-runtime</artifactId> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-api</artifactId> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/300952a9/commons/nifi-expression-language/src/main/antlr3/org/apache/nifi/attribute/expression/language/antlr/AttributeExpressionLexer.g ---------------------------------------------------------------------- diff --git a/commons/nifi-expression-language/src/main/antlr3/org/apache/nifi/attribute/expression/language/antlr/AttributeExpressionLexer.g b/commons/nifi-expression-language/src/main/antlr3/org/apache/nifi/attribute/expression/language/antlr/AttributeExpressionLexer.g deleted file mode 100644 index 10394b9..0000000 --- a/commons/nifi-expression-language/src/main/antlr3/org/apache/nifi/attribute/expression/language/antlr/AttributeExpressionLexer.g +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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. - */ -lexer grammar AttributeExpressionLexer; - -@header { - package org.apache.nifi.attribute.expression.language.antlr; - import org.apache.nifi.attribute.expression.language.exception.AttributeExpressionLanguageParsingException; -} - -@rulecatch { - catch(final Exception e) { - throw new AttributeExpressionLanguageParsingException(e); - } -} - -@members { - public void displayRecognitionError(String[] tokenNames, RecognitionException e) { - final StringBuilder sb = new StringBuilder(); - if ( e.token == null ) { - sb.append("Unrecognized token "); - } else { - sb.append("Unexpected token '").append(e.token.getText()).append("' "); - } - sb.append("at line ").append(e.line); - if ( e.approximateLineInfo ) { - sb.append(" (approximately)"); - } - sb.append(", column ").append(e.charPositionInLine); - sb.append(". Query: ").append(e.input.toString()); - - throw new AttributeExpressionLanguageParsingException(sb.toString()); - } - - public void recover(RecognitionException e) { - final StringBuilder sb = new StringBuilder(); - if ( e.token == null ) { - sb.append("Unrecognized token "); - } else { - sb.append("Unexpected token '").append(e.token.getText()).append("' "); - } - sb.append("at line ").append(e.line); - if ( e.approximateLineInfo ) { - sb.append(" (approximately)"); - } - sb.append(", column ").append(e.charPositionInLine); - sb.append(". Query: ").append(e.input.toString()); - - throw new AttributeExpressionLanguageParsingException(sb.toString()); - } -} - - -// PUNCTUATION & SPECIAL CHARACTERS -WHITESPACE : (' '|'\t'|'\n'|'\r')+ { $channel = HIDDEN; }; -COMMENT : '#' ( ~('\n') )* '\n' { $channel = HIDDEN; }; - -DOLLAR : '$'; -LPAREN : '('; -RPAREN : ')'; -LBRACE : '{'; -RBRACE : '}'; -COLON : ':'; -COMMA : ','; -DOT : '.'; -SEMICOLON : ';'; -NUMBER : ('0'..'9')+; - -TRUE : 'true'; -FALSE : 'false'; - -// -// FUNCTION NAMES -// - -// ATTRIBUTE KEY SELECTION FUNCTIONS -ANY_ATTRIBUTE : 'anyAttribute'; -ANY_MATCHING_ATTRIBUTE : 'anyMatchingAttribute'; -ALL_ATTRIBUTES : 'allAttributes'; -ALL_MATCHING_ATTRIBUTES : 'allMatchingAttributes'; -ANY_DELINEATED_VALUE : 'anyDelineatedValue'; -ALL_DELINEATED_VALUES : 'allDelineatedValues'; - -// NO-SUBJECT FUNCTIONS -NEXT_INT : 'nextInt'; -IP : 'ip'; -UUID : 'UUID'; -HOSTNAME : 'hostname'; // requires boolean arg: prefer FQDN -NOW : 'now'; - - -// 0 arg functions -TO_UPPER : 'toUpper'; -TO_LOWER : 'toLower'; -TO_STRING : 'toString'; -LENGTH : 'length'; -TRIM : 'trim'; -IS_NULL : 'isNull'; -IS_EMPTY : 'isEmpty'; -NOT_NULL : 'notNull'; -TO_NUMBER : 'toNumber'; -URL_ENCODE : 'urlEncode'; -URL_DECODE : 'urlDecode'; -NOT : 'not'; -COUNT : 'count'; - -// 1 arg functions -SUBSTRING_AFTER : 'substringAfter'; -SUBSTRING_BEFORE : 'substringBefore'; -SUBSTRING_AFTER_LAST : 'substringAfterLast'; -SUBSTRING_BEFORE_LAST : 'substringBeforeLast'; -STARTS_WITH : 'startsWith'; -ENDS_WITH : 'endsWith'; -CONTAINS : 'contains'; -PREPEND : 'prepend'; -APPEND : 'append'; -INDEX_OF : 'indexOf'; -LAST_INDEX_OF : 'lastIndexOf'; -REPLACE_NULL : 'replaceNull'; -REPLACE_EMPTY : 'replaceEmpty'; -FIND : 'find'; // regex -MATCHES : 'matches'; // regex -EQUALS : 'equals'; -EQUALS_IGNORE_CASE : 'equalsIgnoreCase'; -GREATER_THAN : 'gt'; -LESS_THAN : 'lt'; -GREATER_THAN_OR_EQUAL : 'ge'; -LESS_THAN_OR_EQUAL : 'le'; -FORMAT : 'format'; // takes string date format; uses SimpleDateFormat -TO_DATE : 'toDate'; // takes string date format; converts the subject to a Long based on the date format -MOD : 'mod'; -PLUS : 'plus'; -MINUS : 'minus'; -MULTIPLY : 'multiply'; -DIVIDE : 'divide'; -TO_RADIX : 'toRadix'; -OR : 'or'; -AND : 'and'; -JOIN : 'join'; - -// 2 arg functions -SUBSTRING : 'substring'; -REPLACE : 'replace'; -REPLACE_ALL : 'replaceAll'; - - -// STRINGS -STRING_LITERAL -@init{StringBuilder lBuf = new StringBuilder();} - : - ( - '"' - ( - escaped=ESC {lBuf.append(getText());} | - normal = ~( '"' | '\\' | '\n' | '\r' | '\t' ) { lBuf.appendCodePoint(normal);} - )* - '"' - ) - { - setText(lBuf.toString()); - } - | - ( - '\'' - ( - escaped=ESC {lBuf.append(getText());} | - normal = ~( '\'' | '\\' | '\n' | '\r' | '\t' ) { lBuf.appendCodePoint(normal);} - )* - '\'' - ) - { - setText(lBuf.toString()); - } - ; - - -fragment -ESC - : '\\' - ( - '"' { setText("\""); } - | '\'' { setText("\'"); } - | 'r' { setText("\r"); } - | 'n' { setText("\n"); } - | 't' { setText("\t"); } - | '\\' { setText("\\\\"); } - | nextChar = ~('"' | '\'' | 'r' | 'n' | 't' | '\\') - { - StringBuilder lBuf = new StringBuilder(); lBuf.append("\\\\").appendCodePoint(nextChar); setText(lBuf.toString()); - } - ) - ; - -ATTRIBUTE_NAME : ( - ~('$' | '{' | '}' | '(' | ')' | '[' | ']' | ',' | ':' | ';' | '/' | '*' | '\'' | ' ' | '\t' | '\r' | '\n' | '0'..'9') - ~('$' | '{' | '}' | '(' | ')' | '[' | ']' | ',' | ':' | ';' | '/' | '*' | '\'' | ' ' | '\t' | '\r' | '\n')* - ); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/300952a9/commons/nifi-expression-language/src/main/antlr3/org/apache/nifi/attribute/expression/language/antlr/AttributeExpressionParser.g ---------------------------------------------------------------------- diff --git a/commons/nifi-expression-language/src/main/antlr3/org/apache/nifi/attribute/expression/language/antlr/AttributeExpressionParser.g b/commons/nifi-expression-language/src/main/antlr3/org/apache/nifi/attribute/expression/language/antlr/AttributeExpressionParser.g deleted file mode 100644 index f6a87dd..0000000 --- a/commons/nifi-expression-language/src/main/antlr3/org/apache/nifi/attribute/expression/language/antlr/AttributeExpressionParser.g +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - */ -parser grammar AttributeExpressionParser; - -options { - output=AST; - tokenVocab=AttributeExpressionLexer; -} - -tokens { - QUERY; - ATTRIBUTE_REFERENCE; - ATTR_NAME; - FUNCTION_CALL; - EXPRESSION; - MULTI_ATTRIBUTE_REFERENCE; - QUOTED_ATTR_NAME; -} - -@header { - package org.apache.nifi.attribute.expression.language.antlr; - import org.apache.nifi.attribute.expression.language.exception.AttributeExpressionLanguageParsingException; -} - -@members { - public void displayRecognitionError(String[] tokenNames, RecognitionException e) { - final StringBuilder sb = new StringBuilder(); - if ( e.token == null ) { - sb.append("Unrecognized token "); - } else { - sb.append("Unexpected token '").append(e.token.getText()).append("' "); - } - sb.append("at line ").append(e.line); - if ( e.approximateLineInfo ) { - sb.append(" (approximately)"); - } - sb.append(", column ").append(e.charPositionInLine); - sb.append(". Query: ").append(e.input.toString()); - - throw new AttributeExpressionLanguageParsingException(sb.toString()); - } - - public void recover(final RecognitionException e) { - final StringBuilder sb = new StringBuilder(); - if ( e.token == null ) { - sb.append("Unrecognized token "); - } else { - sb.append("Unexpected token '").append(e.token.getText()).append("' "); - } - sb.append("at line ").append(e.line); - if ( e.approximateLineInfo ) { - sb.append(" (approximately)"); - } - sb.append(", column ").append(e.charPositionInLine); - sb.append(". Query: ").append(e.input.toString()); - - throw new AttributeExpressionLanguageParsingException(sb.toString()); - } -} - -// functions that return Strings -zeroArgString : (TO_UPPER | TO_LOWER | TRIM | TO_STRING | URL_ENCODE | URL_DECODE) LPAREN! RPAREN!; -oneArgString : ((SUBSTRING_BEFORE | SUBSTRING_BEFORE_LAST | SUBSTRING_AFTER | SUBSTRING_AFTER_LAST | REPLACE_NULL | REPLACE_EMPTY | - PREPEND | APPEND | FORMAT | STARTS_WITH | ENDS_WITH | CONTAINS | JOIN) LPAREN! anyArg RPAREN!) | - (TO_RADIX LPAREN! anyArg (COMMA! anyArg)? RPAREN!); -twoArgString : ((REPLACE | REPLACE_ALL) LPAREN! anyArg COMMA! anyArg RPAREN!) | - (SUBSTRING LPAREN! anyArg (COMMA! anyArg)? RPAREN!); - - -// functions that return Booleans -zeroArgBool : (IS_NULL | NOT_NULL | IS_EMPTY | NOT) LPAREN! RPAREN!; -oneArgBool : ((FIND | MATCHES | EQUALS_IGNORE_CASE) LPAREN! anyArg RPAREN!) | - (GREATER_THAN | LESS_THAN | GREATER_THAN_OR_EQUAL | LESS_THAN_OR_EQUAL) LPAREN! anyArg RPAREN! | - (EQUALS) LPAREN! anyArg RPAREN! | - (AND | OR) LPAREN! anyArg RPAREN!; - - -// functions that return Numbers -zeroArgNum : (LENGTH | TO_NUMBER | COUNT) LPAREN! RPAREN!; -oneArgNum : ((INDEX_OF | LAST_INDEX_OF) LPAREN! anyArg RPAREN!) | - (TO_DATE LPAREN! anyArg? RPAREN!) | - ((MOD | PLUS | MINUS | MULTIPLY | DIVIDE) LPAREN! anyArg RPAREN!); - -stringFunctionRef : zeroArgString | oneArgString | twoArgString; -booleanFunctionRef : zeroArgBool | oneArgBool; -numberFunctionRef : zeroArgNum | oneArgNum; - -anyArg : NUMBER | numberFunctionRef | STRING_LITERAL | zeroArgString | oneArgString | twoArgString | booleanLiteral | zeroArgBool | oneArgBool | expression; -stringArg : STRING_LITERAL | zeroArgString | oneArgString | twoArgString | expression; -functionRef : stringFunctionRef | booleanFunctionRef | numberFunctionRef; - - - -// Attribute Reference -subject : attrName | expression; -attrName : singleAttrName | multiAttrName; - -singleAttrRef : ATTRIBUTE_NAME | STRING_LITERAL; -singleAttrName : singleAttrRef -> - ^(ATTR_NAME singleAttrRef); - - -multiAttrFunction : ANY_ATTRIBUTE | ANY_MATCHING_ATTRIBUTE | ALL_ATTRIBUTES | ALL_MATCHING_ATTRIBUTES | ANY_DELINEATED_VALUE | ALL_DELINEATED_VALUES; -multiAttrName : multiAttrFunction LPAREN stringArg (COMMA stringArg)* RPAREN -> - ^(MULTI_ATTRIBUTE_REFERENCE multiAttrFunction stringArg*); - -attributeRef : subject -> - ^(ATTRIBUTE_REFERENCE subject); - - -functionCall : functionRef -> - ^(FUNCTION_CALL functionRef); - -booleanLiteral : TRUE | FALSE; -zeroArgStandaloneFunction : (IP | UUID | NOW | NEXT_INT | HOSTNAME) LPAREN! RPAREN!; -oneArgStandaloneFunction : HOSTNAME^ LPAREN! booleanLiteral RPAREN!; -standaloneFunction : zeroArgStandaloneFunction | oneArgStandaloneFunction; - -attributeRefOrFunctionCall : (attributeRef | standaloneFunction); - -expression : DOLLAR LBRACE attributeRefOrFunctionCall (COLON functionCall)* RBRACE -> - ^(EXPRESSION attributeRefOrFunctionCall functionCall*); - -query : expression EOF -> - ^(QUERY expression); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/300952a9/commons/nifi-expression-language/src/main/antlr3/org/apache/nifi/attribute/expression/language/antlr/output/AttributeExpressionLexer.tokens ---------------------------------------------------------------------- diff --git a/commons/nifi-expression-language/src/main/antlr3/org/apache/nifi/attribute/expression/language/antlr/output/AttributeExpressionLexer.tokens b/commons/nifi-expression-language/src/main/antlr3/org/apache/nifi/attribute/expression/language/antlr/output/AttributeExpressionLexer.tokens deleted file mode 100755 index 0265bfb..0000000 --- a/commons/nifi-expression-language/src/main/antlr3/org/apache/nifi/attribute/expression/language/antlr/output/AttributeExpressionLexer.tokens +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ -ALL_ATTRIBUTES=4 -ALL_DELINEATED_VALUES=5 -ALL_MATCHING_ATTRIBUTES=6 -AND=7 -ANY_ATTRIBUTE=8 -ANY_DELINEATED_VALUE=9 -ANY_MATCHING_ATTRIBUTE=10 -APPEND=11 -ATTRIBUTE_NAME=12 -CEIL=13 -COLON=14 -COMMA=15 -CONTAINS=16 -DIVIDE=17 -DOLLAR=18 -DOT=19 -ENDS_WITH=20 -EQUALS=21 -EQUALS_IGNORE_CASE=22 -FALSE=23 -FIND=24 -FLOOR=25 -FORMAT=26 -GREATER_THAN=27 -GREATER_THAN_OR_EQUAL=28 -HOSTNAME=29 -INDEX_OF=30 -IP=31 -IS_NULL=32 -LAST_INDEX_OF=33 -LBRACE=34 -LENGTH=35 -LESS_THAN=36 -LESS_THAN_OR_EQUAL=37 -LPAREN=38 -MATCHES=39 -MINUS=40 -MOD=41 -MULTIPLY=42 -NEXT_INT=43 -NOT=44 -NOT_NULL=45 -NOW=46 -NUMBER=47 -OR=48 -PLUS=49 -PREPEND=50 -RBRACE=51 -REPLACE=52 -REPLACE_ALL=53 -REPLACE_NULL=54 -RPAREN=55 -SEMICOLON=56 -STARTS_WITH=57 -STRING_LITERAL=58 -SUBSTRING=59 -SUBSTRING_AFTER=60 -SUBSTRING_AFTER_LAST=61 -SUBSTRING_BEFORE=62 -SUBSTRING_BEFORE_LAST=63 -TO_DATE=64 -TO_LOWER=65 -TO_NUMBER=66 -TO_RADIX=67 -TO_STRING=68 -TO_UPPER=69 -TRIM=70 -TRUE=71 -URL_DECODE=72 -URL_ENCODE=73 -UUID=74 -WHITESPACE=75 http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/300952a9/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/EmptyPreparedQuery.java ---------------------------------------------------------------------- diff --git a/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/EmptyPreparedQuery.java b/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/EmptyPreparedQuery.java deleted file mode 100644 index 81da47e..0000000 --- a/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/EmptyPreparedQuery.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.nifi.attribute.expression.language; - -import java.util.Map; - -import org.apache.nifi.expression.AttributeValueDecorator; -import org.apache.nifi.flowfile.FlowFile; -import org.apache.nifi.processor.exception.ProcessException; - -public class EmptyPreparedQuery implements PreparedQuery { - - private final String value; - - EmptyPreparedQuery(final String value) { - this.value = value; - } - - @Override - public String evaluateExpressions(final FlowFile flowFile, final AttributeValueDecorator decorator) throws ProcessException { - return value; - } - - @Override - public String evaluateExpressions() throws ProcessException { - return value; - } - - @Override - public String evaluateExpressions(final AttributeValueDecorator decorator) throws ProcessException { - return value; - } - - @Override - public String evaluateExpressions(final FlowFile flowFile) throws ProcessException { - return value; - } - - @Override - public String evaluateExpressions(Map<String, String> attributes) throws ProcessException { - return value; - } - - @Override - public String evaluateExpressions(Map<String, String> attributes, AttributeValueDecorator decorator) throws ProcessException { - return value; - } -} http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/300952a9/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/InvalidPreparedQuery.java ---------------------------------------------------------------------- diff --git a/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/InvalidPreparedQuery.java b/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/InvalidPreparedQuery.java deleted file mode 100644 index e23bcc0..0000000 --- a/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/InvalidPreparedQuery.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.nifi.attribute.expression.language; - -import java.util.Map; - -import org.apache.nifi.attribute.expression.language.exception.AttributeExpressionLanguageException; -import org.apache.nifi.expression.AttributeValueDecorator; -import org.apache.nifi.flowfile.FlowFile; -import org.apache.nifi.processor.exception.ProcessException; - - -/** - * An implementation of PreparedQuery that throws an {@link AttributeExpressionLanguageException} when attempting - * to evaluate the query. This allows a PreparedQuery to be created, even though it can't - * be evaluated. - */ -public class InvalidPreparedQuery implements PreparedQuery { - private final String query; - private final String explanation; - - public InvalidPreparedQuery(final String query, final String explanation) { - this.query = query; - this.explanation = explanation; - } - - @Override - public String evaluateExpressions(final FlowFile flowFile, final AttributeValueDecorator decorator) throws ProcessException { - throw new AttributeExpressionLanguageException("Invalid Expression: " + query + " due to " + explanation); - } - - @Override - public String evaluateExpressions() throws ProcessException { - throw new AttributeExpressionLanguageException("Invalid Expression: " + query + " due to " + explanation); - } - - @Override - public String evaluateExpressions(final AttributeValueDecorator decorator) throws ProcessException { - throw new AttributeExpressionLanguageException("Invalid Expression: " + query + " due to " + explanation); - } - - @Override - public String evaluateExpressions(final FlowFile flowFile) throws ProcessException { - throw new AttributeExpressionLanguageException("Invalid Expression: " + query + " due to " + explanation); - } - - @Override - public String evaluateExpressions(final Map<String, String> attributes) throws ProcessException { - throw new AttributeExpressionLanguageException("Invalid Expression: " + query + " due to " + explanation); - } - - @Override - public String evaluateExpressions(final Map<String, String> attributes, final AttributeValueDecorator decorator) throws ProcessException { - throw new AttributeExpressionLanguageException("Invalid Expression: " + query + " due to " + explanation); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/300952a9/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/PreparedQuery.java ---------------------------------------------------------------------- diff --git a/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/PreparedQuery.java b/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/PreparedQuery.java deleted file mode 100644 index 0d1b2c7..0000000 --- a/commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/PreparedQuery.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.nifi.attribute.expression.language; - -import java.util.Map; - -import org.apache.nifi.expression.AttributeValueDecorator; -import org.apache.nifi.flowfile.FlowFile; -import org.apache.nifi.processor.exception.ProcessException; - -public interface PreparedQuery { - - String evaluateExpressions(FlowFile flowFile, AttributeValueDecorator decorator) throws ProcessException; - - String evaluateExpressions() throws ProcessException; - - String evaluateExpressions(AttributeValueDecorator decorator) throws ProcessException; - - String evaluateExpressions(FlowFile flowFile) throws ProcessException; - - String evaluateExpressions(Map<String, String> attributes) throws ProcessException; - - String evaluateExpressions(Map<String, String> attributes, AttributeValueDecorator decorator) throws ProcessException; - -}