Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion nifi-assembly/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ Apache Software License v2

The following binary components are provided under the Apache Software License v2

(ASLv2) Apache BVal Project
The following NOTICE information applies:
Apache BVal project
Copyright 2010-2016 The Apache Software Foundation.

This product includes software developed by
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove lines 52-56.

The Apache Software Foundation (http://www.apache.org/).

The following copyright notice(s) were affixed to portions of this code
with which this file is now or was at one time distributed.

This product includes software developed by Agimatec GmbH.
Copyright 2007-2010 Agimatec GmbH. All rights reserved.

(ASLv2) Apache Commons IO
The following NOTICE information applies:
Apache Commons IO
Expand Down Expand Up @@ -255,7 +269,7 @@ The following binary components are provided under the Apache Software License v
(ASLv2) Apache Commons Lang
The following NOTICE information applies:
Apache Commons Lang
Copyright 2001-2015 The Apache Software Foundation
Copyright 2001-2017 The Apache Software Foundation

This product includes software from the Spring Framework,
under the Apache License 2.0 (see: StringUtils.containsWhitespace())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ Apache Software License v2

The following binary components are provided under the Apache Software License v2

(ASLv2) Apache BVal Project
The following NOTICE information applies:
Apache BVal project
Copyright 2010-2016 The Apache Software Foundation.

This product includes software developed by
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove lines 34-38.

The Apache Software Foundation (http://www.apache.org/).

The following copyright notice(s) were affixed to portions of this code
with which this file is now or was at one time distributed.

This product includes software developed by Agimatec GmbH.
Copyright 2007-2010 Agimatec GmbH. All rights reserved.

(ASLv2) Apache Commons IO
The following NOTICE information applies:
Apache Commons IO
Expand All @@ -34,7 +48,7 @@ The following binary components are provided under the Apache Software License v
(ASLv2) Apache Commons Lang
The following NOTICE information applies:
Apache Commons Lang
Copyright 2001-2015 The Apache Software Foundation
Copyright 2001-2017 The Apache Software Foundation

This product includes software from the Spring Framework,
under the Apache License 2.0 (see: StringUtils.containsWhitespace())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,41 @@
<dependency>
<groupId>com.fluenda</groupId>
<artifactId>ParCEFone</artifactId>
<version>1.2.4</version>
<version>1.2.5</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.bval</groupId>
<artifactId>bval-jsr</artifactId>
<version>1.1.2</version>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-el-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-annotation_1.2_spec</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jcdi_1.1.spec</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0.spec</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.bval</groupId>
<artifactId>bval-xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.thekraken</groupId>
<artifactId>grok</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@
import com.fasterxml.jackson.databind.module.SimpleModule;

import com.fasterxml.jackson.databind.node.ObjectNode;

import com.fluenda.parcefone.event.CEFHandlingException;
import com.fluenda.parcefone.event.CommonEvent;
import com.fluenda.parcefone.parser.CEFParser;

import com.martiansoftware.macnificent.MacAddress;

import org.apache.bval.jsr.ApacheValidationProvider;

import org.apache.nifi.annotation.behavior.EventDriven;
import org.apache.nifi.annotation.behavior.InputRequirement;
import org.apache.nifi.annotation.behavior.InputRequirement.Requirement;
Expand Down Expand Up @@ -59,6 +62,8 @@
import org.apache.nifi.stream.io.BufferedOutputStream;
import org.apache.nifi.stream.io.StreamUtils;

import javax.validation.Validation;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
Expand Down Expand Up @@ -170,6 +175,9 @@ public class ParseCEF extends AbstractProcessor {
.description("Any FlowFile that is successfully parsed as a CEF message will be transferred to this Relationship.")
.build();

// Create a Bean validator to be shared by the parser instances.
final javax.validation.Validator validator = Validation.byProvider(ApacheValidationProvider.class).configure().buildValidatorFactory().getValidator();;

@Override
public List<PropertyDescriptor> getSupportedPropertyDescriptors() {
final List<PropertyDescriptor>properties = new ArrayList<>();
Expand Down Expand Up @@ -219,7 +227,8 @@ public void onTrigger(final ProcessContext context, final ProcessSession session
return;
}

final CEFParser parser = new CEFParser();
final CEFParser parser = new CEFParser(validator);

final byte[] buffer = new byte[(int) flowFile.getSize()];
session.read(flowFile, new InputStreamCallback() {
@Override
Expand Down Expand Up @@ -312,6 +321,8 @@ public void process(OutputStream out) throws IOException {
} catch (CEFHandlingException e) {
// The flowfile has failed parsing & validation, routing to failure and committing
getLogger().error("Failed to parse {} as a CEF message due to {}; routing to failure", new Object[] {flowFile, e});
// Create a provenance event recording the routing to failure
session.getProvenanceReporter().route(flowFile, REL_FAILURE);
session.transfer(flowFile, REL_FAILURE);
session.commit();
return;
Expand Down