[ 
https://issues.apache.org/jira/browse/MINIFICPP-681?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16701793#comment-16701793
 ] 

ASF GitHub Bot commented on MINIFICPP-681:
------------------------------------------

Github user phrocker commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/445#discussion_r237057728
  
    --- Diff: libminifi/src/processors/HashContent.cpp ---
    @@ -0,0 +1,100 @@
    +/**
    + * @file HashContent.cpp
    + * HashContent class implementation
    + *
    + * 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.
    + */
    +
    +#ifdef OPENSSL_SUPPORT
    +
    +#include <algorithm>
    +#include <iostream>
    +#include <memory>
    +#include <string>
    +#include "processors/HashContent.h"
    +#include "core/ProcessContext.h"
    +#include "core/ProcessSession.h"
    +#include "core/FlowFile.h"
    +
    +namespace org {
    +namespace apache {
    +namespace nifi {
    +namespace minifi {
    +namespace processors {
    +
    +core::Property HashContent::HashAttribute("Hash Attribute", "Attribute to 
store checksum to", "Checksum");
    +core::Property HashContent::HashAlgorithm("Hash Algorithm", "Name of the 
algorithm used to generate checksum", "MD5");
    +core::Relationship HashContent::Success("success", "success operational on 
the flow record");
    +
    +void HashContent::initialize() {
    +  //! Set the supported properties
    +  std::set<core::Property> properties;
    +  properties.insert(HashAttribute);
    +  properties.insert(HashAlgorithm);
    +  setSupportedProperties(properties);
    +  //! Set the supported relationships
    +  std::set<core::Relationship> relationships;
    +  relationships.insert(Success);
    +  setSupportedRelationships(relationships);
    +}
    +
    +void HashContent::onSchedule(core::ProcessContext *context, 
core::ProcessSessionFactory *sessionFactory) {
    +  std::string value;
    +
    +  attrKey_ = (context->getProperty(HashAttribute.getName(), value)) ? 
value : "Checksum";
    +  algoName_ = (context->getProperty(HashAlgorithm.getName(), value)) ? 
value : "MD5";
    --- End diff --
    
    I'm not sure that's "low power friendly," but they can deal with that 
through configuration. 


> Add content hash processor
> --------------------------
>
>                 Key: MINIFICPP-681
>                 URL: https://issues.apache.org/jira/browse/MINIFICPP-681
>             Project: NiFi MiNiFi C++
>          Issue Type: Improvement
>            Reporter: Arpad Boda
>            Assignee: Arpad Boda
>            Priority: Major
>             Fix For: 0.6.0
>
>
> Add a new processor that supports hashing content and add the checksum to the 
> flowfile as an attribute.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to