You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by al...@apache.org on 2018/05/30 16:29:54 UTC
nifi-minifi-cpp git commit: MINIFICPP-500 Incorporate
mutually-exclusive property metadata into agent information
Repository: nifi-minifi-cpp
Updated Branches:
refs/heads/master 44d0bcffd -> 049552439
MINIFICPP-500 Incorporate mutually-exclusive property metadata into agent information
This closes #340.
Signed-off-by: Aldrin Piri <al...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/commit/04955243
Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/04955243
Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/04955243
Branch: refs/heads/master
Commit: 049552439720d9521dfd373326899ad814e1f53a
Parents: 44d0bcf
Author: Andrew I. Christianson <an...@andyic.org>
Authored: Thu May 24 15:34:29 2018 -0400
Committer: Aldrin Piri <al...@apache.org>
Committed: Wed May 30 12:29:11 2018 -0400
----------------------------------------------------------------------
extensions/http-curl/processors/InvokeHTTP.cpp | 8 +++++++-
libminifi/include/core/Property.h | 14 ++++++--------
.../include/core/state/nodes/AgentInformation.h | 11 +++++++++++
libminifi/include/processors/PutFile.h | 9 ++-------
libminifi/src/core/ConfigurableComponent.cpp | 2 +-
libminifi/src/core/Property.cpp | 18 ++++++++++--------
libminifi/src/processors/GetFile.cpp | 2 +-
libminifi/src/processors/PutFile.cpp | 3 ++-
8 files changed, 40 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/04955243/extensions/http-curl/processors/InvokeHTTP.cpp
----------------------------------------------------------------------
diff --git a/extensions/http-curl/processors/InvokeHTTP.cpp b/extensions/http-curl/processors/InvokeHTTP.cpp
index feda511..f316c92 100644
--- a/extensions/http-curl/processors/InvokeHTTP.cpp
+++ b/extensions/http-curl/processors/InvokeHTTP.cpp
@@ -65,7 +65,13 @@ core::Property InvokeHTTP::FollowRedirects("Follow Redirects", "Follow HTTP redi
core::Property InvokeHTTP::AttributesToSend("Attributes to Send", "Regular expression that defines which attributes to send as HTTP"
" headers in the request. If not defined, no attributes are sent as headers.",
"");
-core::Property InvokeHTTP::SSLContext("SSL Context Service", "The SSL Context Service used to provide client certificate information for TLS/SSL (https) connections.", "");
+core::Property InvokeHTTP::SSLContext("SSL Context Service",
+ "The SSL Context Service used to provide client certificate "
+ "information for TLS/SSL (https) connections.",
+ "",
+ false,
+ {},
+ {{"Remote URL", "^http:.*$"}});
core::Property InvokeHTTP::ProxyHost("Proxy Host", "The fully qualified hostname or IP address of the proxy server", "");
core::Property InvokeHTTP::ProxyPort("Proxy Port", "The port of the proxy server", "");
core::Property InvokeHTTP::ProxyUser("invokehttp-proxy-user", "Username to set when authenticating against proxy", "");
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/04955243/libminifi/include/core/Property.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/Property.h b/libminifi/include/core/Property.h
index 9fb31fb..45ea09f 100644
--- a/libminifi/include/core/Property.h
+++ b/libminifi/include/core/Property.h
@@ -38,7 +38,6 @@ namespace nifi {
namespace minifi {
namespace core {
-// Time Unit
enum TimeUnit {
DAY,
HOUR,
@@ -48,11 +47,9 @@ enum TimeUnit {
NANOSECOND
};
-// Property Class
class Property {
public:
- // Constructor
/*!
* Create a new property
*/
@@ -60,11 +57,13 @@ class Property {
const std::string description,
const std::string value,
bool is_required,
- std::vector<std::string> &&dependent_properties)
+ std::vector<std::string> &&dependent_properties,
+ std::vector<std::pair<std::string, std::string>> &&exclusive_of_properties)
: name_(name),
description_(description),
is_required_(is_required),
dependent_properties_(std::move(dependent_properties)),
+ exclusive_of_properties_(std::move(exclusive_of_properties)),
is_collection_(false) {
values_.push_back(std::string(value.c_str()));
}
@@ -92,18 +91,16 @@ class Property {
}
- // Destructor
- virtual ~Property() {
- }
+ virtual ~Property() = default;
std::string getName() const;
std::string getDescription() const;
std::string getValue() const;
bool getRequired() const;
std::vector<std::string> getDependentProperties() const;
+ std::vector<std::pair<std::string, std::string>> getExclusiveOfProperties() const;
std::vector<std::string> &getValues();
- // Set value for the property
void setValue(std::string value);
/**
* Add value to the collection of values.
@@ -379,6 +376,7 @@ class Property {
std::string description_;
bool is_required_;
std::vector<std::string> dependent_properties_;
+ std::vector<std::pair<std::string, std::string>> exclusive_of_properties_;
bool is_collection_;
std::vector<std::string> values_;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/04955243/libminifi/include/core/state/nodes/AgentInformation.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/state/nodes/AgentInformation.h b/libminifi/include/core/state/nodes/AgentInformation.h
index f4704bd..8ca8954 100644
--- a/libminifi/include/core/state/nodes/AgentInformation.h
+++ b/libminifi/include/core/state/nodes/AgentInformation.h
@@ -306,10 +306,21 @@ class ComponentManifest : public DeviceInformation {
descriptorDependentProperties.children.push_back(descriptorDependentProperty);
}
+ SerializedResponseNode descriptorExclusiveOfProperties;
+ descriptorExclusiveOfProperties.name = "exclusiveOfProperties";
+
+ for (const auto &exclusiveProp : prop.second.getExclusiveOfProperties()) {
+ SerializedResponseNode descriptorExclusiveOfProperty;
+ descriptorExclusiveOfProperty.name = exclusiveProp.first;
+ descriptorExclusiveOfProperty.value = exclusiveProp.second;
+ descriptorExclusiveOfProperties.children.push_back(descriptorExclusiveOfProperty);
+ }
+
child.children.push_back(descriptorName);
child.children.push_back(descriptorDescription);
child.children.push_back(descriptorRequired);
child.children.push_back(descriptorDependentProperties);
+ child.children.push_back(descriptorExclusiveOfProperties);
props.children.push_back(child);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/04955243/libminifi/include/processors/PutFile.h
----------------------------------------------------------------------
diff --git a/libminifi/include/processors/PutFile.h b/libminifi/include/processors/PutFile.h
index c84ee87..ddcdac1 100644
--- a/libminifi/include/processors/PutFile.h
+++ b/libminifi/include/processors/PutFile.h
@@ -34,7 +34,6 @@ namespace nifi {
namespace minifi {
namespace processors {
-// PutFile Class
class PutFile : public core::Processor {
public:
@@ -44,7 +43,6 @@ class PutFile : public core::Processor {
static constexpr char const *ProcessorName = "PutFile";
- // Constructor
/*!
* Create a new processor
*/
@@ -52,9 +50,8 @@ class PutFile : public core::Processor {
: core::Processor(name, uuid),
logger_(logging::LoggerFactory<PutFile>::getLogger()) {
}
- // Destructor
- virtual ~PutFile() {
- }
+
+ virtual ~PutFile() = default;
// Supported Properties
static core::Property Directory;
@@ -73,9 +70,7 @@ class PutFile : public core::Processor {
*/
virtual void onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory);
- // OnTrigger method, implemented by NiFi PutFile
virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
- // Initialize, over write by NiFi PutFile
virtual void initialize(void);
class ReadCallback : public InputStreamCallback {
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/04955243/libminifi/src/core/ConfigurableComponent.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/ConfigurableComponent.cpp b/libminifi/src/core/ConfigurableComponent.cpp
index 2b89acc..05180fc 100644
--- a/libminifi/src/core/ConfigurableComponent.cpp
+++ b/libminifi/src/core/ConfigurableComponent.cpp
@@ -190,7 +190,7 @@ bool ConfigurableComponent::createDynamicProperty(const std::string &name, const
return false;
}
- Property new_property(name, DEFAULT_DYNAMIC_PROPERTY_DESC, value, false, {});
+ Property new_property(name, DEFAULT_DYNAMIC_PROPERTY_DESC, value, false, {}, {});
logger_->log_info("Processor %s dynamic property '%s' value '%s'", name.c_str(), new_property.getName().c_str(), value.c_str());
dynamic_properties_[new_property.getName()] = new_property;
onDynamicPropertyModified({}, new_property);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/04955243/libminifi/src/core/Property.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/Property.cpp b/libminifi/src/core/Property.cpp
index 635dca5..260d042 100644
--- a/libminifi/src/core/Property.cpp
+++ b/libminifi/src/core/Property.cpp
@@ -17,23 +17,20 @@
*/
#include "core/Property.h"
-#include <string>
-#include <vector>
namespace org {
namespace apache {
namespace nifi {
namespace minifi {
namespace core {
-// Get Name for the property
std::string Property::getName() const {
return name_;
}
-// Get Description for the property
+
std::string Property::getDescription() const {
return description_;
}
-// Get value for the property
+
std::string Property::getValue() const {
if (!values_.empty())
return values_.front();
@@ -48,7 +45,7 @@ bool Property::getRequired() const {
std::vector<std::string> &Property::getValues() {
return values_;
}
-// Set value for the property
+
void Property::setValue(std::string value) {
if (!is_collection_) {
values_.clear();
@@ -61,8 +58,8 @@ void Property::setValue(std::string value) {
void Property::addValue(const std::string &value) {
values_.push_back(std::string(value.c_str()));
}
-// Compare
-bool Property::operator <(const Property & right) const {
+
+bool Property::operator<(const Property &right) const {
return name_ < right.name_;
}
@@ -73,6 +70,7 @@ const Property &Property::operator=(const Property &other) {
is_collection_ = other.is_collection_;
is_required_ = other.is_required_;
dependent_properties_ = other.dependent_properties_;
+ exclusive_of_properties_ = other.exclusive_of_properties_;
return *this;
}
@@ -80,6 +78,10 @@ std::vector<std::string> Property::getDependentProperties() const {
return dependent_properties_;
}
+std::vector<std::pair<std::string, std::string>> Property::getExclusiveOfProperties() const {
+ return exclusive_of_properties_;
+}
+
} /* namespace core */
} /* namespace minifi */
} /* namespace nifi */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/04955243/libminifi/src/processors/GetFile.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/processors/GetFile.cpp b/libminifi/src/processors/GetFile.cpp
index 63b722e..68888cd 100644
--- a/libminifi/src/processors/GetFile.cpp
+++ b/libminifi/src/processors/GetFile.cpp
@@ -45,7 +45,7 @@ namespace minifi {
namespace processors {
core::Property GetFile::BatchSize("Batch Size", "The maximum number of files to pull in each iteration", "10");
-core::Property GetFile::Directory("Input Directory", "The input directory from which to pull files", ".", true, {});
+core::Property GetFile::Directory("Input Directory", "The input directory from which to pull files", ".", true, {}, {});
core::Property GetFile::IgnoreHiddenFile("Ignore Hidden Files", "Indicates whether or not hidden files should be ignored", "true");
core::Property GetFile::KeepSourceFile("Keep Source File", "If true, the file is not deleted after it has been copied to the Content Repository", "false");
core::Property GetFile::MaxAge("Maximum File Age", "The minimum age that a file must be in order to be pulled;"
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/04955243/libminifi/src/processors/PutFile.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/processors/PutFile.cpp b/libminifi/src/processors/PutFile.cpp
index 99bf998..ce747cd 100644
--- a/libminifi/src/processors/PutFile.cpp
+++ b/libminifi/src/processors/PutFile.cpp
@@ -53,7 +53,8 @@ core::Property PutFile::CreateDirs(
"If false, flowfiles are penalized and sent to failure.",
"true",
true,
- {"Directory"});
+ {"Directory"},
+ {});
core::Property PutFile::MaxDestFiles(
"Maximum File Count",
"Specifies the maximum number of files that can exist in the output directory",