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 2017/06/06 16:33:04 UTC
[1/9] nifi-minifi-cpp git commit: MINIFI-331: Apply formatter with
increased line length to source
Repository: nifi-minifi-cpp
Updated Branches:
refs/heads/master feec4ea77 -> 77a20dbe3
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/StringUtilsTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/StringUtilsTests.cpp b/libminifi/test/unit/StringUtilsTests.cpp
index 7c78c98..c071ef7 100644
--- a/libminifi/test/unit/StringUtilsTests.cpp
+++ b/libminifi/test/unit/StringUtilsTests.cpp
@@ -25,22 +25,21 @@
#include "utils/StringUtils.h"
TEST_CASE("TestStringUtils::split", "[test split no delimiter]") {
- std::vector<std::string> expected = {"hello"};
+ std::vector<std::string> expected = { "hello" };
REQUIRE(expected == org::apache::nifi::minifi::utils::StringUtils::split("hello", ","));
}
TEST_CASE("TestStringUtils::split2", "[test split single delimiter]") {
- std::vector<std::string> expected = {"hello", "world"};
+ std::vector<std::string> expected = { "hello", "world" };
REQUIRE(expected == org::apache::nifi::minifi::utils::StringUtils::split("hello world", " "));
}
TEST_CASE("TestStringUtils::split3", "[test split multiple delimiter]") {
- std::vector<std::string> expected = {"hello", "world", "I'm", "a", "unit", "test"};
+ std::vector<std::string> expected = { "hello", "world", "I'm", "a", "unit", "test" };
REQUIRE(expected == org::apache::nifi::minifi::utils::StringUtils::split("hello world I'm a unit test", " "));
}
TEST_CASE("TestStringUtils::split4", "[test split classname]") {
- std::vector<std::string> expected = {"org", "apache", "nifi", "minifi", "utils", "StringUtils"};
- REQUIRE(expected == org::apache::nifi::minifi::utils::StringUtils::split(
- org::apache::nifi::minifi::core::getClassName<org::apache::nifi::minifi::utils::StringUtils>(), "::"));
+ std::vector<std::string> expected = { "org", "apache", "nifi", "minifi", "utils", "StringUtils" };
+ REQUIRE(expected == org::apache::nifi::minifi::utils::StringUtils::split(org::apache::nifi::minifi::core::getClassName<org::apache::nifi::minifi::utils::StringUtils>(), "::"));
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/YamlConfigurationTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/YamlConfigurationTests.cpp b/libminifi/test/unit/YamlConfigurationTests.cpp
index 76ddcac..660ff53 100644
--- a/libminifi/test/unit/YamlConfigurationTests.cpp
+++ b/libminifi/test/unit/YamlConfigurationTests.cpp
@@ -27,16 +27,11 @@
TEST_CASE("Test YAML Config Processing", "[YamlConfiguration]") {
TestController test_controller;
- std::shared_ptr<core::Repository> testProvRepo = core::createRepository(
- "provenancerepository", true);
- std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository(
- "flowfilerepository", true);
- std::shared_ptr<minifi::Configure> configuration = std::make_shared<
- minifi::Configure>();
- std::shared_ptr<minifi::io::StreamFactory> streamFactory = std::make_shared<
- minifi::io::StreamFactory>(configuration);
- core::YamlConfiguration *yamlConfig = new core::YamlConfiguration(
- testProvRepo, testFlowFileRepo, streamFactory, configuration);
+ std::shared_ptr<core::Repository> testProvRepo = core::createRepository("provenancerepository", true);
+ std::shared_ptr<core::Repository> testFlowFileRepo = core::createRepository("flowfilerepository", true);
+ std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
+ std::shared_ptr<minifi::io::StreamFactory> streamFactory = std::make_shared<minifi::io::StreamFactory>(configuration);
+ core::YamlConfiguration *yamlConfig = new core::YamlConfiguration(testProvRepo, testFlowFileRepo, streamFactory, configuration);
SECTION("loading YAML without optional component IDs works") {
static const std::string CONFIG_YAML_WITHOUT_IDS = ""
[3/9] nifi-minifi-cpp git commit: MINIFI-331: Apply formatter with
increased line length to source
Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/processors/InvokeHTTP.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/processors/InvokeHTTP.cpp b/libminifi/src/processors/InvokeHTTP.cpp
index 295560f..fd39a64 100644
--- a/libminifi/src/processors/InvokeHTTP.cpp
+++ b/libminifi/src/processors/InvokeHTTP.cpp
@@ -51,73 +51,37 @@ namespace processors {
const char *InvokeHTTP::ProcessorName = "InvokeHTTP";
-core::Property InvokeHTTP::Method(
- "HTTP Method",
- "HTTP request method (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS). "
- "Arbitrary methods are also supported. Methods other than POST, PUT and PATCH will be sent without a message body.",
- "GET");
-core::Property InvokeHTTP::URL(
- "Remote URL",
- "Remote URL which will be connected to, including scheme, host, port, path.",
- "");
-core::Property InvokeHTTP::ConnectTimeout(
- "Connection Timeout", "Max wait time for connection to remote service.",
- "5 secs");
-core::Property InvokeHTTP::ReadTimeout(
- "Read Timeout", "Max wait time for response from remote service.",
- "15 secs");
-core::Property InvokeHTTP::DateHeader(
- "Include Date Header", "Include an RFC-2616 Date header in the request.",
- "True");
-core::Property InvokeHTTP::FollowRedirects(
- "Follow Redirects", "Follow HTTP redirects issued by remote server.",
- "True");
-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::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", "");
-core::Property InvokeHTTP::ProxyPassword(
- "invokehttp-proxy-password",
- "Password to set when authenticating against proxy", "");
-core::Property InvokeHTTP::ContentType(
- "Content-type",
- "The Content-Type to specify for when content is being transmitted through a PUT, "
- "POST or PATCH. In the case of an empty value after evaluating an expression language expression, "
- "Content-Type defaults to",
- "application/octet-stream");
-core::Property InvokeHTTP::SendBody(
- "send-message-body",
- "If true, sends the HTTP message body on POST/PUT/PATCH requests (default). "
- "If false, suppresses the message body and content-type header for these requests.",
- "true");
-
-core::Property InvokeHTTP::PropPutOutputAttributes(
- "Put Response Body in Attribute",
- "If set, the response body received back will be put into an attribute of the original "
- "FlowFile instead of a separate FlowFile. The attribute key to put to is determined by evaluating value of this property. ",
- "");
-core::Property InvokeHTTP::AlwaysOutputResponse(
- "Always Output Response",
- "Will force a response FlowFile to be generated and routed to the 'Response' relationship "
- "regardless of what the server status code received is ",
- "false");
-core::Property InvokeHTTP::PenalizeOnNoRetry(
- "Penalize on \"No Retry\"",
- "Enabling this property will penalize FlowFiles that are routed to the \"No Retry\" relationship.",
- "false");
+core::Property InvokeHTTP::Method("HTTP Method", "HTTP request method (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS). "
+ "Arbitrary methods are also supported. Methods other than POST, PUT and PATCH will be sent without a message body.",
+ "GET");
+core::Property InvokeHTTP::URL("Remote URL", "Remote URL which will be connected to, including scheme, host, port, path.", "");
+core::Property InvokeHTTP::ConnectTimeout("Connection Timeout", "Max wait time for connection to remote service.", "5 secs");
+core::Property InvokeHTTP::ReadTimeout("Read Timeout", "Max wait time for response from remote service.", "15 secs");
+core::Property InvokeHTTP::DateHeader("Include Date Header", "Include an RFC-2616 Date header in the request.", "True");
+core::Property InvokeHTTP::FollowRedirects("Follow Redirects", "Follow HTTP redirects issued by remote server.", "True");
+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::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", "");
+core::Property InvokeHTTP::ProxyPassword("invokehttp-proxy-password", "Password to set when authenticating against proxy", "");
+core::Property InvokeHTTP::ContentType("Content-type", "The Content-Type to specify for when content is being transmitted through a PUT, "
+ "POST or PATCH. In the case of an empty value after evaluating an expression language expression, "
+ "Content-Type defaults to",
+ "application/octet-stream");
+core::Property InvokeHTTP::SendBody("send-message-body", "If true, sends the HTTP message body on POST/PUT/PATCH requests (default). "
+ "If false, suppresses the message body and content-type header for these requests.",
+ "true");
+
+core::Property InvokeHTTP::PropPutOutputAttributes("Put Response Body in Attribute", "If set, the response body received back will be put into an attribute of the original "
+ "FlowFile instead of a separate FlowFile. The attribute key to put to is determined by evaluating value of this property. ",
+ "");
+core::Property InvokeHTTP::AlwaysOutputResponse("Always Output Response", "Will force a response FlowFile to be generated and routed to the 'Response' relationship "
+ "regardless of what the server status code received is ",
+ "false");
+core::Property InvokeHTTP::PenalizeOnNoRetry("Penalize on \"No Retry\"", "Enabling this property will penalize FlowFiles that are routed to the \"No Retry\" relationship.", "false");
const char* InvokeHTTP::STATUS_CODE = "invokehttp.status.code";
const char* InvokeHTTP::STATUS_MESSAGE = "invokehttp.status.message";
@@ -128,31 +92,22 @@ const char* InvokeHTTP::REMOTE_DN = "invokehttp.remote.dn";
const char* InvokeHTTP::EXCEPTION_CLASS = "invokehttp.java.exception.class";
const char* InvokeHTTP::EXCEPTION_MESSAGE = "invokehttp.java.exception.message";
-core::Relationship InvokeHTTP::Success("success",
- "All files are routed to success");
+core::Relationship InvokeHTTP::Success("success", "All files are routed to success");
-core::Relationship InvokeHTTP::RelResponse("response",
- "Represents a response flowfile");
+core::Relationship InvokeHTTP::RelResponse("response", "Represents a response flowfile");
-core::Relationship InvokeHTTP::RelRetry(
- "retry",
- "The original FlowFile will be routed on any status code that can be retried "
- "(5xx status codes). It will have new attributes detailing the request.");
+core::Relationship InvokeHTTP::RelRetry("retry", "The original FlowFile will be routed on any status code that can be retried "
+ "(5xx status codes). It will have new attributes detailing the request.");
-core::Relationship InvokeHTTP::RelNoRetry(
- "no retry",
- "The original FlowFile will be routed on any status code that should NOT "
- "be retried (1xx, 3xx, 4xx status codes). It will have new attributes detailing the request.");
+core::Relationship InvokeHTTP::RelNoRetry("no retry", "The original FlowFile will be routed on any status code that should NOT "
+ "be retried (1xx, 3xx, 4xx status codes). It will have new attributes detailing the request.");
-core::Relationship InvokeHTTP::RelFailure(
- "failure",
- "The original FlowFile will be routed on any type of connection failure, "
- "timeout or general exception. It will have new attributes detailing the request.");
+core::Relationship InvokeHTTP::RelFailure("failure", "The original FlowFile will be routed on any type of connection failure, "
+ "timeout or general exception. It will have new attributes detailing the request.");
void InvokeHTTP::set_request_method(CURL *curl, const std::string &method) {
std::string my_method = method;
- std::transform(my_method.begin(), my_method.end(), my_method.begin(),
- ::toupper);
+ std::transform(my_method.begin(), my_method.end(), my_method.begin(), ::toupper);
if (my_method == "POST") {
curl_easy_setopt(curl, CURLOPT_POST, 1);
} else if (my_method == "PUT") {
@@ -190,19 +145,14 @@ void InvokeHTTP::initialize() {
setSupportedRelationships(relationships);
}
-void InvokeHTTP::onSchedule(core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory) {
+void InvokeHTTP::onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory) {
if (!context->getProperty(Method.getName(), method_)) {
- logger_->log_info(
- "%s attribute is missing, so default value of %s will be used",
- Method.getName().c_str(), Method.getValue().c_str());
+ logger_->log_info("%s attribute is missing, so default value of %s will be used", Method.getName().c_str(), Method.getValue().c_str());
return;
}
if (!context->getProperty(URL.getName(), url_)) {
- logger_->log_info(
- "%s attribute is missing, so default value of %s will be used",
- URL.getName().c_str(), URL.getValue().c_str());
+ logger_->log_info("%s attribute is missing, so default value of %s will be used", URL.getName().c_str(), URL.getValue().c_str());
return;
}
@@ -213,9 +163,7 @@ void InvokeHTTP::onSchedule(core::ProcessContext *context,
// set the timeout in curl options.
} else {
- logger_->log_info(
- "%s attribute is missing, so default value of %s will be used",
- ConnectTimeout.getName().c_str(), ConnectTimeout.getValue().c_str());
+ logger_->log_info("%s attribute is missing, so default value of %s will be used", ConnectTimeout.getName().c_str(), ConnectTimeout.getValue().c_str());
return;
}
@@ -224,67 +172,43 @@ void InvokeHTTP::onSchedule(core::ProcessContext *context,
core::Property::StringToInt(timeoutStr, read_timeout_);
} else {
- logger_->log_info(
- "%s attribute is missing, so default value of %s will be used",
- ReadTimeout.getName().c_str(), ReadTimeout.getValue().c_str());
+ logger_->log_info("%s attribute is missing, so default value of %s will be used", ReadTimeout.getName().c_str(), ReadTimeout.getValue().c_str());
}
std::string dateHeaderStr;
if (!context->getProperty(DateHeader.getName(), dateHeaderStr)) {
- logger_->log_info(
- "%s attribute is missing, so default value of %s will be used",
- DateHeader.getName().c_str(), DateHeader.getValue().c_str());
+ logger_->log_info("%s attribute is missing, so default value of %s will be used", DateHeader.getName().c_str(), DateHeader.getValue().c_str());
}
- date_header_include_ = utils::StringUtils::StringToBool(dateHeaderStr,
- date_header_include_);
+ date_header_include_ = utils::StringUtils::StringToBool(dateHeaderStr, date_header_include_);
- if (!context->getProperty(PropPutOutputAttributes.getName(),
- put_attribute_name_)) {
- logger_->log_info(
- "%s attribute is missing, so default value of %s will be used",
- PropPutOutputAttributes.getName().c_str(),
- PropPutOutputAttributes.getValue().c_str());
+ if (!context->getProperty(PropPutOutputAttributes.getName(), put_attribute_name_)) {
+ logger_->log_info("%s attribute is missing, so default value of %s will be used", PropPutOutputAttributes.getName().c_str(), PropPutOutputAttributes.getValue().c_str());
}
- if (!context->getProperty(AttributesToSend.getName(),
- attribute_to_send_regex_)) {
- logger_->log_info(
- "%s attribute is missing, so default value of %s will be used",
- AttributesToSend.getName().c_str(),
- AttributesToSend.getValue().c_str());
+ if (!context->getProperty(AttributesToSend.getName(), attribute_to_send_regex_)) {
+ logger_->log_info("%s attribute is missing, so default value of %s will be used", AttributesToSend.getName().c_str(), AttributesToSend.getValue().c_str());
}
std::string always_output_response = "false";
- if (!context->getProperty(AlwaysOutputResponse.getName(),
- always_output_response)) {
- logger_->log_info(
- "%s attribute is missing, so default value of %s will be used",
- AttributesToSend.getName().c_str(),
- AttributesToSend.getValue().c_str());
+ if (!context->getProperty(AlwaysOutputResponse.getName(), always_output_response)) {
+ logger_->log_info("%s attribute is missing, so default value of %s will be used", AttributesToSend.getName().c_str(), AttributesToSend.getValue().c_str());
}
- utils::StringUtils::StringToBool(always_output_response,
- always_output_response_);
+ utils::StringUtils::StringToBool(always_output_response, always_output_response_);
std::string penalize_no_retry = "false";
if (!context->getProperty(PenalizeOnNoRetry.getName(), penalize_no_retry)) {
- logger_->log_info(
- "%s attribute is missing, so default value of %s will be used",
- AttributesToSend.getName().c_str(),
- AttributesToSend.getValue().c_str());
+ logger_->log_info("%s attribute is missing, so default value of %s will be used", AttributesToSend.getName().c_str(), AttributesToSend.getValue().c_str());
}
utils::StringUtils::StringToBool(penalize_no_retry, penalize_no_retry_);
std::string context_name;
- if (context->getProperty(SSLContext.getName(), context_name)
- && !IsNullOrEmpty(context_name)) {
- std::shared_ptr<core::controller::ControllerService> service = context
- ->getControllerService(context_name);
+ if (context->getProperty(SSLContext.getName(), context_name) && !IsNullOrEmpty(context_name)) {
+ std::shared_ptr<core::controller::ControllerService> service = context->getControllerService(context_name);
if (nullptr != service) {
- ssl_context_service_ = std::static_pointer_cast<
- minifi::controllers::SSLContextService>(service);
+ ssl_context_service_ = std::static_pointer_cast<minifi::controllers::SSLContextService>(service);
}
}
}
@@ -293,8 +217,7 @@ InvokeHTTP::~InvokeHTTP() {
curl_global_cleanup();
}
-inline bool InvokeHTTP::matches(const std::string &value,
- const std::string &sregex) {
+inline bool InvokeHTTP::matches(const std::string &value, const std::string &sregex) {
if (sregex == ".*")
return true;
@@ -322,9 +245,7 @@ bool InvokeHTTP::emitFlowFile(const std::string &method) {
return ("POST" == method || "PUT" == method || "PATCH" == method);
}
-struct curl_slist *InvokeHTTP::build_header_list(
- CURL *curl, std::string regex,
- const std::map<std::string, std::string> &attributes) {
+struct curl_slist *InvokeHTTP::build_header_list(CURL *curl, std::string regex, const std::map<std::string, std::string> &attributes) {
struct curl_slist *list = NULL;
if (curl) {
for (auto attribute : attributes) {
@@ -345,8 +266,7 @@ bool InvokeHTTP::isSecure(const std::string &url) {
}
CURLcode InvokeHTTP::configure_ssl_context(CURL *curl, void *ctx, void *param) {
- minifi::controllers::SSLContextService *ssl_context_service =
- static_cast<minifi::controllers::SSLContextService*>(param);
+ minifi::controllers::SSLContextService *ssl_context_service = static_cast<minifi::controllers::SSLContextService*>(param);
if (!ssl_context_service->configure_ssl_context(static_cast<SSL_CTX*>(ctx))) {
return CURLE_FAILED_INIT;
}
@@ -354,26 +274,20 @@ CURLcode InvokeHTTP::configure_ssl_context(CURL *curl, void *ctx, void *param) {
}
void InvokeHTTP::configure_secure_connection(CURL *http_session) {
- logger_->log_debug("InvokeHTTP -- Using certificate file %s",
- ssl_context_service_->getCertificateFile());
+ logger_->log_debug("InvokeHTTP -- Using certificate file %s", ssl_context_service_->getCertificateFile());
curl_easy_setopt(http_session, CURLOPT_VERBOSE, 1L);
- curl_easy_setopt(http_session, CURLOPT_SSL_CTX_FUNCTION,
- &InvokeHTTP::configure_ssl_context);
- curl_easy_setopt(http_session, CURLOPT_SSL_CTX_DATA,
- static_cast<void*>(ssl_context_service_.get()));
+ curl_easy_setopt(http_session, CURLOPT_SSL_CTX_FUNCTION, &InvokeHTTP::configure_ssl_context);
+ curl_easy_setopt(http_session, CURLOPT_SSL_CTX_DATA, static_cast<void*>(ssl_context_service_.get()));
}
-void InvokeHTTP::onTrigger(core::ProcessContext *context,
- core::ProcessSession *session) {
- std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<
- FlowFileRecord>(session->get());
+void InvokeHTTP::onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
+ std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<FlowFileRecord>(session->get());
logger_->log_info("onTrigger InvokeHTTP with %s", method_.c_str());
if (flowFile == nullptr) {
if (!emitFlowFile(method_)) {
- logger_->log_info("InvokeHTTP -- create flow file with %s",
- method_.c_str());
+ logger_->log_info("InvokeHTTP -- create flow file with %s", method_.c_str());
flowFile = std::static_pointer_cast<FlowFileRecord>(session->create());
} else {
logger_->log_info("exiting because method is %s", method_.c_str());
@@ -402,11 +316,9 @@ void InvokeHTTP::onTrigger(core::ProcessContext *context,
curl_easy_setopt(http_session, CURLOPT_TIMEOUT, read_timeout_);
}
HTTPRequestResponse content;
- curl_easy_setopt(http_session, CURLOPT_WRITEFUNCTION,
- &HTTPRequestResponse::recieve_write);
+ curl_easy_setopt(http_session, CURLOPT_WRITEFUNCTION, &HTTPRequestResponse::recieve_write);
- curl_easy_setopt(http_session, CURLOPT_WRITEDATA,
- static_cast<void*>(&content));
+ curl_easy_setopt(http_session, CURLOPT_WRITEDATA, static_cast<void*>(&content));
if (emitFlowFile(method_)) {
logger_->log_info("InvokeHTTP -- reading flowfile");
@@ -419,12 +331,9 @@ void InvokeHTTP::onTrigger(core::ProcessContext *context,
callbackObj->pos = 0;
logger_->log_info("InvokeHTTP -- Setting callback");
curl_easy_setopt(http_session, CURLOPT_UPLOAD, 1L);
- curl_easy_setopt(http_session, CURLOPT_INFILESIZE_LARGE,
- (curl_off_t)callback->getBufferSize());
- curl_easy_setopt(http_session, CURLOPT_READFUNCTION,
- &HTTPRequestResponse::send_write);
- curl_easy_setopt(http_session, CURLOPT_READDATA,
- static_cast<void*>(callbackObj));
+ curl_easy_setopt(http_session, CURLOPT_INFILESIZE_LARGE, (curl_off_t)callback->getBufferSize());
+ curl_easy_setopt(http_session, CURLOPT_READFUNCTION, &HTTPRequestResponse::send_write);
+ curl_easy_setopt(http_session, CURLOPT_READDATA, static_cast<void*>(callbackObj));
} else {
logger_->log_error("InvokeHTTP -- no resource claim");
}
@@ -434,9 +343,7 @@ void InvokeHTTP::onTrigger(core::ProcessContext *context,
}
// append all headers
- struct curl_slist *headers = build_header_list(http_session,
- attribute_to_send_regex_,
- flowFile->getAttributes());
+ struct curl_slist *headers = build_header_list(http_session, attribute_to_send_regex_, flowFile->getAttributes());
curl_easy_setopt(http_session, CURLOPT_HTTPHEADER, headers);
logger_->log_info("InvokeHTTP -- curl performed");
@@ -459,10 +366,8 @@ void InvokeHTTP::onTrigger(core::ProcessContext *context,
flowFile->addAttribute(REQUEST_URL, url_);
flowFile->addAttribute(TRANSACTION_ID, tx_id);
- bool isSuccess = ((int32_t) (http_code / 100)) == 2
- && res != CURLE_ABORTED_BY_CALLBACK;
- bool output_body_to_requestAttr = (!isSuccess || putToAttribute)
- && flowFile != nullptr;
+ bool isSuccess = ((int32_t) (http_code / 100)) == 2 && res != CURLE_ABORTED_BY_CALLBACK;
+ bool output_body_to_requestAttr = (!isSuccess || putToAttribute) && flowFile != nullptr;
bool output_body_to_content = isSuccess && !putToAttribute;
bool body_empty = IsNullOrEmpty(content.data);
@@ -471,11 +376,9 @@ void InvokeHTTP::onTrigger(core::ProcessContext *context,
if (output_body_to_content) {
if (flowFile != nullptr) {
- response_flow = std::static_pointer_cast<FlowFileRecord>(
- session->create(flowFile));
+ response_flow = std::static_pointer_cast<FlowFileRecord>(session->create(flowFile));
} else {
- response_flow = std::static_pointer_cast<FlowFileRecord>(
- session->create());
+ response_flow = std::static_pointer_cast<FlowFileRecord>(session->create());
}
std::string ct = content_type;
@@ -484,28 +387,22 @@ void InvokeHTTP::onTrigger(core::ProcessContext *context,
response_flow->addAttribute(STATUS_MESSAGE, response_body);
response_flow->addAttribute(REQUEST_URL, url_);
response_flow->addAttribute(TRANSACTION_ID, tx_id);
- io::DataStream stream((const uint8_t*) content.data.data(),
- content.data.size());
+ io::DataStream stream((const uint8_t*) content.data.data(), content.data.size());
// need an import from the data stream.
session->importFrom(stream, response_flow);
} else {
logger_->log_info("Cannot output body to content");
- response_flow = std::static_pointer_cast<FlowFileRecord>(
- session->create());
+ response_flow = std::static_pointer_cast<FlowFileRecord>(session->create());
}
route(flowFile, response_flow, session, context, isSuccess, http_code);
} else {
- logger_->log_error("InvokeHTTP -- curl_easy_perform() failed %s\n",
- curl_easy_strerror(res));
+ logger_->log_error("InvokeHTTP -- curl_easy_perform() failed %s\n", curl_easy_strerror(res));
}
curl_slist_free_all(headers);
curl_easy_cleanup(http_session);
}
-void InvokeHTTP::route(std::shared_ptr<FlowFileRecord> &request,
- std::shared_ptr<FlowFileRecord> &response,
- core::ProcessSession *session,
- core::ProcessContext *context, bool isSuccess,
+void InvokeHTTP::route(std::shared_ptr<FlowFileRecord> &request, std::shared_ptr<FlowFileRecord> &response, core::ProcessSession *session, core::ProcessContext *context, bool isSuccess,
int statusCode) {
// check if we should yield the processor
if (!isSuccess && request == nullptr) {
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/processors/ListenHTTP.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/processors/ListenHTTP.cpp b/libminifi/src/processors/ListenHTTP.cpp
index 9fce69a..c26b41d 100644
--- a/libminifi/src/processors/ListenHTTP.cpp
+++ b/libminifi/src/processors/ListenHTTP.cpp
@@ -42,38 +42,20 @@ namespace nifi {
namespace minifi {
namespace processors {
-core::Property ListenHTTP::BasePath("Base Path",
- "Base path for incoming connections",
- "contentListener");
-core::Property ListenHTTP::Port(
- "Listening Port", "The Port to listen on for incoming connections", "");
-core::Property ListenHTTP::AuthorizedDNPattern(
- "Authorized DN Pattern",
- "A Regular Expression to apply against the Distinguished Name of incoming"
- " connections. If the Pattern does not match the DN, the connection will be refused.",
- ".*");
-core::Property ListenHTTP::SSLCertificate(
- "SSL Certificate",
- "File containing PEM-formatted file including TLS/SSL certificate and key",
- "");
-core::Property ListenHTTP::SSLCertificateAuthority(
- "SSL Certificate Authority",
- "File containing trusted PEM-formatted certificates", "");
-core::Property ListenHTTP::SSLVerifyPeer(
- "SSL Verify Peer",
- "Whether or not to verify the client's certificate (yes/no)", "no");
-core::Property ListenHTTP::SSLMinimumVersion(
- "SSL Minimum Version",
- "Minimum TLS/SSL version allowed (SSL2, SSL3, TLS1.0, TLS1.1, TLS1.2)",
- "SSL2");
-core::Property ListenHTTP::HeadersAsAttributesRegex(
- "HTTP Headers to receive as Attributes (Regex)",
- "Specifies the Regular Expression that determines the names of HTTP Headers that"
- " should be passed along as FlowFile attributes",
- "");
-
-core::Relationship ListenHTTP::Success("success",
- "All files are routed to success");
+core::Property ListenHTTP::BasePath("Base Path", "Base path for incoming connections", "contentListener");
+core::Property ListenHTTP::Port("Listening Port", "The Port to listen on for incoming connections", "");
+core::Property ListenHTTP::AuthorizedDNPattern("Authorized DN Pattern", "A Regular Expression to apply against the Distinguished Name of incoming"
+ " connections. If the Pattern does not match the DN, the connection will be refused.",
+ ".*");
+core::Property ListenHTTP::SSLCertificate("SSL Certificate", "File containing PEM-formatted file including TLS/SSL certificate and key", "");
+core::Property ListenHTTP::SSLCertificateAuthority("SSL Certificate Authority", "File containing trusted PEM-formatted certificates", "");
+core::Property ListenHTTP::SSLVerifyPeer("SSL Verify Peer", "Whether or not to verify the client's certificate (yes/no)", "no");
+core::Property ListenHTTP::SSLMinimumVersion("SSL Minimum Version", "Minimum TLS/SSL version allowed (SSL2, SSL3, TLS1.0, TLS1.1, TLS1.2)", "SSL2");
+core::Property ListenHTTP::HeadersAsAttributesRegex("HTTP Headers to receive as Attributes (Regex)", "Specifies the Regular Expression that determines the names of HTTP Headers that"
+ " should be passed along as FlowFile attributes",
+ "");
+
+core::Relationship ListenHTTP::Success("success", "All files are routed to success");
void ListenHTTP::initialize() {
logger_->log_info("Initializing ListenHTTP");
@@ -95,14 +77,11 @@ void ListenHTTP::initialize() {
setSupportedRelationships(relationships);
}
-void ListenHTTP::onSchedule(core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory) {
+void ListenHTTP::onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory) {
std::string basePath;
if (!context->getProperty(BasePath.getName(), basePath)) {
- logger_->log_info(
- "%s attribute is missing, so default value of %s will be used",
- BasePath.getName().c_str(), BasePath.getValue().c_str());
+ logger_->log_info("%s attribute is missing, so default value of %s will be used", BasePath.getName().c_str(), BasePath.getValue().c_str());
basePath = BasePath.getValue();
}
@@ -111,26 +90,20 @@ void ListenHTTP::onSchedule(core::ProcessContext *context,
std::string listeningPort;
if (!context->getProperty(Port.getName(), listeningPort)) {
- logger_->log_error("%s attribute is missing or invalid",
- Port.getName().c_str());
+ logger_->log_error("%s attribute is missing or invalid", Port.getName().c_str());
return;
}
std::string authDNPattern;
- if (context->getProperty(AuthorizedDNPattern.getName(), authDNPattern)
- && !authDNPattern.empty()) {
- logger_->log_info("ListenHTTP using %s: %s",
- AuthorizedDNPattern.getName().c_str(),
- authDNPattern.c_str());
+ if (context->getProperty(AuthorizedDNPattern.getName(), authDNPattern) && !authDNPattern.empty()) {
+ logger_->log_info("ListenHTTP using %s: %s", AuthorizedDNPattern.getName().c_str(), authDNPattern.c_str());
}
std::string sslCertFile;
- if (context->getProperty(SSLCertificate.getName(), sslCertFile)
- && !sslCertFile.empty()) {
- logger_->log_info("ListenHTTP using %s: %s",
- SSLCertificate.getName().c_str(), sslCertFile.c_str());
+ if (context->getProperty(SSLCertificate.getName(), sslCertFile) && !sslCertFile.empty()) {
+ logger_->log_info("ListenHTTP using %s: %s", SSLCertificate.getName().c_str(), sslCertFile.c_str());
}
// Read further TLS/SSL options only if TLS/SSL usage is implied by virtue of certificate value being set
@@ -139,12 +112,8 @@ void ListenHTTP::onSchedule(core::ProcessContext *context,
std::string sslMinVer;
if (!sslCertFile.empty()) {
- if (context->getProperty(SSLCertificateAuthority.getName(),
- sslCertAuthorityFile)
- && !sslCertAuthorityFile.empty()) {
- logger_->log_info("ListenHTTP using %s: %s",
- SSLCertificateAuthority.getName().c_str(),
- sslCertAuthorityFile.c_str());
+ if (context->getProperty(SSLCertificateAuthority.getName(), sslCertAuthorityFile) && !sslCertAuthorityFile.empty()) {
+ logger_->log_info("ListenHTTP using %s: %s", SSLCertificateAuthority.getName().c_str(), sslCertAuthorityFile.c_str());
}
if (context->getProperty(SSLVerifyPeer.getName(), sslVerifyPeer)) {
@@ -158,26 +127,19 @@ void ListenHTTP::onSchedule(core::ProcessContext *context,
}
if (context->getProperty(SSLMinimumVersion.getName(), sslMinVer)) {
- logger_->log_info("ListenHTTP using %s: %s",
- SSLMinimumVersion.getName().c_str(), sslMinVer.c_str());
+ logger_->log_info("ListenHTTP using %s: %s", SSLMinimumVersion.getName().c_str(), sslMinVer.c_str());
}
}
std::string headersAsAttributesPattern;
- if (context->getProperty(HeadersAsAttributesRegex.getName(),
- headersAsAttributesPattern)
- && !headersAsAttributesPattern.empty()) {
- logger_->log_info("ListenHTTP using %s: %s",
- HeadersAsAttributesRegex.getName().c_str(),
- headersAsAttributesPattern.c_str());
+ if (context->getProperty(HeadersAsAttributesRegex.getName(), headersAsAttributesPattern) && !headersAsAttributesPattern.empty()) {
+ logger_->log_info("ListenHTTP using %s: %s", HeadersAsAttributesRegex.getName().c_str(), headersAsAttributesPattern.c_str());
}
auto numThreads = getMaxConcurrentTasks();
- logger_->log_info(
- "ListenHTTP starting HTTP server on port %s and path %s with %d threads",
- listeningPort.c_str(), basePath.c_str(), numThreads);
+ logger_->log_info("ListenHTTP starting HTTP server on port %s and path %s with %d threads", listeningPort.c_str(), basePath.c_str(), numThreads);
// Initialize web server
std::vector<std::string> options;
@@ -231,19 +193,15 @@ void ListenHTTP::onSchedule(core::ProcessContext *context,
}
_server.reset(new CivetServer(options));
- _handler.reset(
- new Handler(context, sessionFactory, std::move(authDNPattern),
- std::move(headersAsAttributesPattern)));
+ _handler.reset(new Handler(context, sessionFactory, std::move(authDNPattern), std::move(headersAsAttributesPattern)));
_server->addHandler(basePath, _handler.get());
}
ListenHTTP::~ListenHTTP() {
}
-void ListenHTTP::onTrigger(core::ProcessContext *context,
- core::ProcessSession *session) {
- std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<
- FlowFileRecord>(session->get());
+void ListenHTTP::onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
+ std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<FlowFileRecord>(session->get());
// Do nothing if there are no incoming files
if (!flowFile) {
@@ -251,10 +209,7 @@ void ListenHTTP::onTrigger(core::ProcessContext *context,
}
}
-ListenHTTP::Handler::Handler(core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory,
- std::string &&authDNPattern,
- std::string &&headersAsAttributesPattern)
+ListenHTTP::Handler::Handler(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory, std::string &&authDNPattern, std::string &&headersAsAttributesPattern)
: _authDNRegex(std::move(authDNPattern)),
_headersAsAttributesRegex(std::move(headersAsAttributesPattern)),
logger_(logging::LoggerFactory<ListenHTTP::Handler>::getLogger()) {
@@ -268,11 +223,9 @@ void ListenHTTP::Handler::sendErrorResponse(struct mg_connection *conn) {
"Content-Length: 0\r\n\r\n");
}
-bool ListenHTTP::Handler::handlePost(CivetServer *server,
- struct mg_connection *conn) {
+bool ListenHTTP::Handler::handlePost(CivetServer *server, struct mg_connection *conn) {
auto req_info = mg_get_request_info(conn);
- logger_->log_info("ListenHTTP handling POST request of length %d",
- req_info->content_length);
+ logger_->log_info("ListenHTTP handling POST request of length %d", req_info->content_length);
// If this is a two-way TLS connection, authorize the peer against the configured pattern
if (req_info->is_ssl && req_info->client_cert != nullptr) {
@@ -280,8 +233,7 @@ bool ListenHTTP::Handler::handlePost(CivetServer *server,
mg_printf(conn, "HTTP/1.1 403 Forbidden\r\n"
"Content-Type: text/html\r\n"
"Content-Length: 0\r\n\r\n");
- logger_->log_warn("ListenHTTP client DN not authorized: %s",
- req_info->client_cert->subject);
+ logger_->log_warn("ListenHTTP client DN not authorized: %s", req_info->client_cert->subject);
return true;
}
}
@@ -337,8 +289,8 @@ bool ListenHTTP::Handler::handlePost(CivetServer *server,
return true;
}
-ListenHTTP::WriteCallback::WriteCallback(struct mg_connection *conn, const struct mg_request_info *reqInfo) :
- logger_(logging::LoggerFactory<ListenHTTP::WriteCallback>::getLogger()) {
+ListenHTTP::WriteCallback::WriteCallback(struct mg_connection *conn, const struct mg_request_info *reqInfo)
+ : logger_(logging::LoggerFactory<ListenHTTP::WriteCallback>::getLogger()) {
_conn = conn;
_reqInfo = reqInfo;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/processors/ListenSyslog.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/processors/ListenSyslog.cpp b/libminifi/src/processors/ListenSyslog.cpp
index e7d2e7b..054d585 100644
--- a/libminifi/src/processors/ListenSyslog.cpp
+++ b/libminifi/src/processors/ListenSyslog.cpp
@@ -35,37 +35,18 @@ namespace nifi {
namespace minifi {
namespace processors {
-core::Property ListenSyslog::RecvBufSize(
- "Receive Buffer Size",
- "The size of each buffer used to receive Syslog messages.", "65507 B");
-core::Property ListenSyslog::MaxSocketBufSize(
- "Max Size of Socket Buffer",
- "The maximum size of the socket buffer that should be used.", "1 MB");
-core::Property ListenSyslog::MaxConnections(
- "Max Number of TCP Connections",
- "The maximum number of concurrent connections to accept Syslog messages in TCP mode.",
- "2");
-core::Property ListenSyslog::MaxBatchSize(
- "Max Batch Size",
- "The maximum number of Syslog events to add to a single FlowFile.", "1");
-core::Property ListenSyslog::MessageDelimiter(
- "Message Delimiter",
- "Specifies the delimiter to place between Syslog messages when multiple "
- "messages are bundled together (see <Max Batch Size> core::Property).",
- "\n");
-core::Property ListenSyslog::ParseMessages(
- "Parse Messages",
- "Indicates if the processor should parse the Syslog messages. If set to false, each outgoing FlowFile will only.",
- "false");
-core::Property ListenSyslog::Protocol("Protocol",
- "The protocol for Syslog communication.",
- "UDP");
-core::Property ListenSyslog::Port("Port", "The port for Syslog communication.",
- "514");
-core::Relationship ListenSyslog::Success("success",
- "All files are routed to success");
-core::Relationship ListenSyslog::Invalid("invalid",
- "SysLog message format invalid");
+core::Property ListenSyslog::RecvBufSize("Receive Buffer Size", "The size of each buffer used to receive Syslog messages.", "65507 B");
+core::Property ListenSyslog::MaxSocketBufSize("Max Size of Socket Buffer", "The maximum size of the socket buffer that should be used.", "1 MB");
+core::Property ListenSyslog::MaxConnections("Max Number of TCP Connections", "The maximum number of concurrent connections to accept Syslog messages in TCP mode.", "2");
+core::Property ListenSyslog::MaxBatchSize("Max Batch Size", "The maximum number of Syslog events to add to a single FlowFile.", "1");
+core::Property ListenSyslog::MessageDelimiter("Message Delimiter", "Specifies the delimiter to place between Syslog messages when multiple "
+ "messages are bundled together (see <Max Batch Size> core::Property).",
+ "\n");
+core::Property ListenSyslog::ParseMessages("Parse Messages", "Indicates if the processor should parse the Syslog messages. If set to false, each outgoing FlowFile will only.", "false");
+core::Property ListenSyslog::Protocol("Protocol", "The protocol for Syslog communication.", "UDP");
+core::Property ListenSyslog::Port("Port", "The port for Syslog communication.", "514");
+core::Relationship ListenSyslog::Success("success", "All files are routed to success");
+core::Relationship ListenSyslog::Invalid("invalid", "SysLog message format invalid");
void ListenSyslog::initialize() {
// Set the supported properties
@@ -140,8 +121,7 @@ void ListenSyslog::runThread() {
if (_protocol == "TCP")
listen(sockfd, 5);
_serverSocket = sockfd;
- logger_->log_error("ListenSysLog Server socket %d bind OK to port %d",
- _serverSocket, portno);
+ logger_->log_error("ListenSysLog Server socket %d bind OK to port %d", _serverSocket, portno);
}
FD_ZERO(&_readfds);
FD_SET(_serverSocket, &_readfds);
@@ -171,14 +151,11 @@ void ListenSyslog::runThread() {
socklen_t clilen;
struct sockaddr_in cli_addr;
clilen = sizeof(cli_addr);
- int newsockfd = accept(_serverSocket,
- reinterpret_cast<struct sockaddr *>(&cli_addr),
- &clilen);
+ int newsockfd = accept(_serverSocket, reinterpret_cast<struct sockaddr *>(&cli_addr), &clilen);
if (newsockfd > 0) {
if (_clientSockets.size() < _maxConnections) {
_clientSockets.push_back(newsockfd);
- logger_->log_info("ListenSysLog new client socket %d connection",
- newsockfd);
+ logger_->log_info("ListenSysLog new client socket %d connection", newsockfd);
continue;
} else {
close(newsockfd);
@@ -188,10 +165,8 @@ void ListenSyslog::runThread() {
socklen_t clilen;
struct sockaddr_in cli_addr;
clilen = sizeof(cli_addr);
- int recvlen = recvfrom(_serverSocket, _buffer, sizeof(_buffer), 0,
- (struct sockaddr *) &cli_addr, &clilen);
- if (recvlen > 0
- && (recvlen + getEventQueueByteSize()) <= _recvBufSize) {
+ int recvlen = recvfrom(_serverSocket, _buffer, sizeof(_buffer), 0, (struct sockaddr *) &cli_addr, &clilen);
+ if (recvlen > 0 && (recvlen + getEventQueueByteSize()) <= _recvBufSize) {
uint8_t *payload = new uint8_t[recvlen];
memcpy(payload, _buffer, recvlen);
putEvent(payload, recvlen);
@@ -205,8 +180,7 @@ void ListenSyslog::runThread() {
int recvlen = readline(clientSocket, _buffer, sizeof(_buffer));
if (recvlen <= 0) {
close(clientSocket);
- logger_->log_info("ListenSysLog client socket %d close",
- clientSocket);
+ logger_->log_info("ListenSysLog client socket %d close", clientSocket);
it = _clientSockets.erase(it);
} else {
if ((recvlen + getEventQueueByteSize()) <= _recvBufSize) {
@@ -253,8 +227,7 @@ int ListenSyslog::readline(int fd, char *bufptr, size_t len) {
return -1;
}
-void ListenSyslog::onTrigger(core::ProcessContext *context,
- core::ProcessSession *session) {
+void ListenSyslog::onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
std::string value;
bool needResetServerSocket = false;
if (context->getProperty(Protocol.getName(), value)) {
@@ -275,8 +248,7 @@ void ListenSyslog::onTrigger(core::ProcessContext *context,
_messageDelimiter = value;
}
if (context->getProperty(ParseMessages.getName(), value)) {
- org::apache::nifi::minifi::utils::StringUtils::StringToBool(value,
- _parseMessages);
+ org::apache::nifi::minifi::utils::StringUtils::StringToBool(value, _parseMessages);
}
if (context->getProperty(Port.getName(), value)) {
int64_t oldPort = _port;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/processors/LogAttribute.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/processors/LogAttribute.cpp b/libminifi/src/processors/LogAttribute.cpp
index d2dcd10..e308901 100644
--- a/libminifi/src/processors/LogAttribute.cpp
+++ b/libminifi/src/processors/LogAttribute.cpp
@@ -39,27 +39,14 @@ namespace apache {
namespace nifi {
namespace minifi {
namespace processors {
-core::Property LogAttribute::LogLevel(
- "Log Level", "The Log Level to use when logging the Attributes", "info");
-core::Property LogAttribute::AttributesToLog(
- "Attributes to Log",
- "A comma-separated list of Attributes to Log. If not specified, all attributes will be logged.",
- "");
-core::Property LogAttribute::AttributesToIgnore(
- "Attributes to Ignore",
- "A comma-separated list of Attributes to ignore. If not specified, no attributes will be ignored.",
- "");
-core::Property LogAttribute::LogPayload(
- "Log Payload",
- "If true, the FlowFile's payload will be logged, in addition to its attributes;"
- "otherwise, just the Attributes will be logged.",
- "false");
-core::Property LogAttribute::LogPrefix(
- "Log prefix",
- "Log prefix appended to the log lines. It helps to distinguish the output of multiple LogAttribute processors.",
- "");
-core::Relationship LogAttribute::Success(
- "success", "success operational on the flow record");
+core::Property LogAttribute::LogLevel("Log Level", "The Log Level to use when logging the Attributes", "info");
+core::Property LogAttribute::AttributesToLog("Attributes to Log", "A comma-separated list of Attributes to Log. If not specified, all attributes will be logged.", "");
+core::Property LogAttribute::AttributesToIgnore("Attributes to Ignore", "A comma-separated list of Attributes to ignore. If not specified, no attributes will be ignored.", "");
+core::Property LogAttribute::LogPayload("Log Payload", "If true, the FlowFile's payload will be logged, in addition to its attributes;"
+ "otherwise, just the Attributes will be logged.",
+ "false");
+core::Property LogAttribute::LogPrefix("Log prefix", "Log prefix appended to the log lines. It helps to distinguish the output of multiple LogAttribute processors.", "");
+core::Relationship LogAttribute::Success("success", "success operational on the flow record");
void LogAttribute::initialize() {
// Set the supported properties
@@ -76,8 +63,7 @@ void LogAttribute::initialize() {
setSupportedRelationships(relationships);
}
-void LogAttribute::onTrigger(core::ProcessContext *context,
- core::ProcessSession *session) {
+void LogAttribute::onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
std::string dashLine = "--------------------------------------------------";
LogAttrLevel level = LogAttrLevelInfo;
bool logPayload = false;
@@ -96,8 +82,7 @@ void LogAttribute::onTrigger(core::ProcessContext *context,
dashLine = "-----" + value + "-----";
}
if (context->getProperty(LogPayload.getName(), value)) {
- org::apache::nifi::minifi::utils::StringUtils::StringToBool(value,
- logPayload);
+ org::apache::nifi::minifi::utils::StringUtils::StringToBool(value, logPayload);
}
message << "Logging for flow file " << "\n";
@@ -105,10 +90,8 @@ void LogAttribute::onTrigger(core::ProcessContext *context,
message << "\nStandard FlowFile Attributes";
message << "\n" << "UUID:" << flow->getUUIDStr();
message << "\n" << "EntryDate:" << getTimeStr(flow->getEntryDate());
- message << "\n" << "lineageStartDate:"
- << getTimeStr(flow->getlineageStartDate());
- message << "\n" << "Size:" << flow->getSize() << " Offset:"
- << flow->getOffset();
+ message << "\n" << "lineageStartDate:" << getTimeStr(flow->getlineageStartDate());
+ message << "\n" << "Size:" << flow->getSize() << " Offset:" << flow->getOffset();
message << "\nFlowFile Attributes Map Content";
std::map<std::string, std::string> attrs = flow->getAttributes();
std::map<std::string, std::string>::iterator it;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/processors/PutFile.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/processors/PutFile.cpp b/libminifi/src/processors/PutFile.cpp
index d8832c7..0aba3d7 100644
--- a/libminifi/src/processors/PutFile.cpp
+++ b/libminifi/src/processors/PutFile.cpp
@@ -38,19 +38,12 @@ namespace nifi {
namespace minifi {
namespace processors {
-core::Property PutFile::Directory("Output Directory",
- "The output directory to which to put files",
- ".");
-core::Property PutFile::ConflictResolution(
- "Conflict Resolution Strategy",
- "Indicates what should happen when a file with the same name already exists in the output directory",
- CONFLICT_RESOLUTION_STRATEGY_FAIL);
-
-core::Relationship PutFile::Success("success",
- "All files are routed to success");
-core::Relationship PutFile::Failure(
- "failure",
- "Failed files (conflict, write failure, etc.) are transferred to failure");
+core::Property PutFile::Directory("Output Directory", "The output directory to which to put files", ".");
+core::Property PutFile::ConflictResolution("Conflict Resolution Strategy", "Indicates what should happen when a file with the same name already exists in the output directory",
+ CONFLICT_RESOLUTION_STRATEGY_FAIL);
+
+core::Relationship PutFile::Success("success", "All files are routed to success");
+core::Relationship PutFile::Failure("failure", "Failed files (conflict, write failure, etc.) are transferred to failure");
void PutFile::initialize() {
// Set the supported properties
@@ -65,28 +58,23 @@ void PutFile::initialize() {
setSupportedRelationships(relationships);
}
-void PutFile::onSchedule(core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory) {
+void PutFile::onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory) {
if (!context->getProperty(Directory.getName(), directory_)) {
logger_->log_error("Directory attribute is missing or invalid");
}
- if (!context->getProperty(ConflictResolution.getName(),
- conflict_resolution_)) {
- logger_->log_error(
- "Conflict Resolution Strategy attribute is missing or invalid");
+ if (!context->getProperty(ConflictResolution.getName(), conflict_resolution_)) {
+ logger_->log_error("Conflict Resolution Strategy attribute is missing or invalid");
}
}
-void PutFile::onTrigger(core::ProcessContext *context,
- core::ProcessSession *session) {
+void PutFile::onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
if (IsNullOrEmpty(directory_) || IsNullOrEmpty(conflict_resolution_)) {
context->yield();
return;
}
- std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<
- FlowFileRecord>(session->get());
+ std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<FlowFileRecord>(session->get());
// Do nothing if there are no incoming files
if (!flowFile) {
@@ -111,16 +99,13 @@ void PutFile::onTrigger(core::ProcessContext *context,
destFileSs << directory_ << "/" << filename;
std::string destFile = destFileSs.str();
- logger_->log_info("PutFile writing file %s into directory %s",
- filename.c_str(), directory_.c_str());
+ logger_->log_info("PutFile writing file %s into directory %s", filename.c_str(), directory_.c_str());
// If file exists, apply conflict resolution strategy
struct stat statResult;
if (stat(destFile.c_str(), &statResult) == 0) {
- logger_->log_info(
- "Destination file %s exists; applying Conflict Resolution Strategy: %s",
- destFile.c_str(), conflict_resolution_.c_str());
+ logger_->log_info("Destination file %s exists; applying Conflict Resolution Strategy: %s", destFile.c_str(), conflict_resolution_.c_str());
if (conflict_resolution_ == CONFLICT_RESOLUTION_STRATEGY_REPLACE) {
putFile(session, flowFile, tmpFile, destFile);
@@ -134,9 +119,7 @@ void PutFile::onTrigger(core::ProcessContext *context,
}
}
-bool PutFile::putFile(core::ProcessSession *session,
- std::shared_ptr<FlowFileRecord> flowFile,
- const std::string &tmpFile, const std::string &destFile) {
+bool PutFile::putFile(core::ProcessSession *session, std::shared_ptr<FlowFileRecord> flowFile, const std::string &tmpFile, const std::string &destFile) {
ReadCallback cb(tmpFile, destFile);
session->read(flowFile, &cb);
@@ -149,8 +132,7 @@ bool PutFile::putFile(core::ProcessSession *session,
return false;
}
-PutFile::ReadCallback::ReadCallback(const std::string &tmpFile,
- const std::string &destFile)
+PutFile::ReadCallback::ReadCallback(const std::string &tmpFile, const std::string &destFile)
: _tmpFile(tmpFile),
_tmpFileOs(tmpFile),
_destFile(destFile),
@@ -170,25 +152,19 @@ void PutFile::ReadCallback::process(std::ifstream *stream) {
bool PutFile::ReadCallback::commit() {
bool success = false;
- logger_->log_info("PutFile committing put file operation to %s",
- _destFile.c_str());
+ logger_->log_info("PutFile committing put file operation to %s", _destFile.c_str());
if (_writeSucceeded) {
_tmpFileOs.close();
if (rename(_tmpFile.c_str(), _destFile.c_str())) {
- logger_->log_info(
- "PutFile commit put file operation to %s failed because rename() call failed",
- _destFile.c_str());
+ logger_->log_info("PutFile commit put file operation to %s failed because rename() call failed", _destFile.c_str());
} else {
success = true;
- logger_->log_info("PutFile commit put file operation to %s succeeded",
- _destFile.c_str());
+ logger_->log_info("PutFile commit put file operation to %s succeeded", _destFile.c_str());
}
} else {
- logger_->log_error(
- "PutFile commit put file operation to %s failed because write failed",
- _destFile.c_str());
+ logger_->log_error("PutFile commit put file operation to %s failed because write failed", _destFile.c_str());
}
return success;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/processors/TailFile.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/processors/TailFile.cpp b/libminifi/src/processors/TailFile.cpp
index abb02ca..d4f1b80 100644
--- a/libminifi/src/processors/TailFile.cpp
+++ b/libminifi/src/processors/TailFile.cpp
@@ -46,16 +46,11 @@ namespace nifi {
namespace minifi {
namespace processors {
-core::Property TailFile::FileName(
- "File to Tail",
- "Fully-qualified filename of the file that should be tailed", "");
-core::Property TailFile::StateFile(
- "State File",
- "Specifies the file that should be used for storing state about"
- " what data has been ingested so that upon restart NiFi can resume from where it left off",
- "TailFileState");
-core::Relationship TailFile::Success("success",
- "All files are routed to success");
+core::Property TailFile::FileName("File to Tail", "Fully-qualified filename of the file that should be tailed", "");
+core::Property TailFile::StateFile("State File", "Specifies the file that should be used for storing state about"
+ " what data has been ingested so that upon restart NiFi can resume from where it left off",
+ "TailFileState");
+core::Relationship TailFile::Success("success", "All files are routed to success");
void TailFile::initialize() {
// Set the supported properties
@@ -84,8 +79,7 @@ void TailFile::parseStateFileLine(char *buf) {
++line;
char first = line[0];
- if ((first == '\0') || (first == '#') || (first == '\r') || (first == '\n')
- || (first == '=')) {
+ if ((first == '\0') || (first == '#') || (first == '\r') || (first == '\n') || (first == '=')) {
return;
}
@@ -125,8 +119,7 @@ void TailFile::recoverState() {
return;
}
char buf[BUFFER_SIZE];
- for (file.getline(buf, BUFFER_SIZE); file.good();
- file.getline(buf, BUFFER_SIZE)) {
+ for (file.getline(buf, BUFFER_SIZE); file.good(); file.getline(buf, BUFFER_SIZE)) {
parseStateFileLine(buf);
}
}
@@ -142,12 +135,10 @@ void TailFile::storeState() {
file.close();
}
-static bool sortTailMatchedFileItem(TailMatchedFileItem i,
- TailMatchedFileItem j) {
+static bool sortTailMatchedFileItem(TailMatchedFileItem i, TailMatchedFileItem j) {
return (i.modifiedTime < j.modifiedTime);
}
-void TailFile::checkRollOver(const std::string &fileLocation,
- const std::string &fileName) {
+void TailFile::checkRollOver(const std::string &fileLocation, const std::string &fileName) {
struct stat statbuf;
std::vector<TailMatchedFileItem> matchedFiles;
std::string fullPath = fileLocation + "/" + _currentTailFileName;
@@ -157,8 +148,7 @@ void TailFile::checkRollOver(const std::string &fileLocation,
// there are new input for the current tail file
return;
- uint64_t modifiedTimeCurrentTailFile =
- ((uint64_t) (statbuf.st_mtime) * 1000);
+ uint64_t modifiedTimeCurrentTailFile = ((uint64_t) (statbuf.st_mtime) * 1000);
std::string pattern = fileName;
std::size_t found = fileName.find_last_of(".");
if (found != std::string::npos)
@@ -176,10 +166,8 @@ void TailFile::checkRollOver(const std::string &fileLocation,
if (!(entry->d_type & DT_DIR)) {
std::string fileName = d_name;
std::string fileFullName = fileLocation + "/" + d_name;
- if (fileFullName.find(pattern) != std::string::npos
- && stat(fileFullName.c_str(), &statbuf) == 0) {
- if (((uint64_t) (statbuf.st_mtime) * 1000)
- >= modifiedTimeCurrentTailFile) {
+ if (fileFullName.find(pattern) != std::string::npos && stat(fileFullName.c_str(), &statbuf) == 0) {
+ if (((uint64_t) (statbuf.st_mtime) * 1000) >= modifiedTimeCurrentTailFile) {
TailMatchedFileItem item;
item.fileName = fileName;
item.modifiedTime = ((uint64_t) (statbuf.st_mtime) * 1000);
@@ -191,18 +179,14 @@ void TailFile::checkRollOver(const std::string &fileLocation,
closedir(d);
// Sort the list based on modified time
- std::sort(matchedFiles.begin(), matchedFiles.end(),
- sortTailMatchedFileItem);
- for (std::vector<TailMatchedFileItem>::iterator it = matchedFiles.begin();
- it != matchedFiles.end(); ++it) {
+ std::sort(matchedFiles.begin(), matchedFiles.end(), sortTailMatchedFileItem);
+ for (std::vector<TailMatchedFileItem>::iterator it = matchedFiles.begin(); it != matchedFiles.end(); ++it) {
TailMatchedFileItem item = *it;
if (item.fileName == _currentTailFileName) {
++it;
if (it != matchedFiles.end()) {
TailMatchedFileItem nextItem = *it;
- logger_->log_info("TailFile File Roll Over from %s to %s",
- _currentTailFileName.c_str(),
- nextItem.fileName.c_str());
+ logger_->log_info("TailFile File Roll Over from %s to %s", _currentTailFileName.c_str(), nextItem.fileName.c_str());
_currentTailFileName = nextItem.fileName;
_currentTailFilePosition = 0;
storeState();
@@ -215,8 +199,7 @@ void TailFile::checkRollOver(const std::string &fileLocation,
}
}
-void TailFile::onTrigger(core::ProcessContext *context,
- core::ProcessSession *session) {
+void TailFile::onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
std::lock_guard<std::mutex> tail_lock(tail_file_mutex_);
std::string value;
std::string fileLocation = "";
@@ -245,8 +228,7 @@ void TailFile::onTrigger(core::ProcessContext *context,
context->yield();
return;
}
- std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<
- FlowFileRecord>(session->create());
+ std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<FlowFileRecord>(session->create());
if (!flowFile)
return;
std::size_t found = _currentTailFileName.find_last_of(".");
@@ -256,12 +238,8 @@ void TailFile::onTrigger(core::ProcessContext *context,
flowFile->addKeyedAttribute(ABSOLUTE_PATH, fullPath);
session->import(fullPath, flowFile, true, this->_currentTailFilePosition);
session->transfer(flowFile, Success);
- logger_->log_info("TailFile %s for %d bytes", _currentTailFileName.c_str(),
- flowFile->getSize());
- std::string logName = baseName + "."
- + std::to_string(_currentTailFilePosition) + "-"
- + std::to_string(_currentTailFilePosition + flowFile->getSize()) + "."
- + extension;
+ logger_->log_info("TailFile %s for %d bytes", _currentTailFileName.c_str(), flowFile->getSize());
+ std::string logName = baseName + "." + std::to_string(_currentTailFilePosition) + "-" + std::to_string(_currentTailFilePosition + flowFile->getSize()) + "." + extension;
flowFile->updateKeyedAttribute(FILENAME, logName);
this->_currentTailFilePosition += flowFile->getSize();
storeState();
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/provenance/Provenance.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/provenance/Provenance.cpp b/libminifi/src/provenance/Provenance.cpp
index 083d0b2..ff6a149 100644
--- a/libminifi/src/provenance/Provenance.cpp
+++ b/libminifi/src/provenance/Provenance.cpp
@@ -34,49 +34,37 @@ namespace nifi {
namespace minifi {
namespace provenance {
-const char *ProvenanceEventRecord::ProvenanceEventTypeStr[REPLAY+1] =
-{ "CREATE", "RECEIVE", "FETCH", "SEND", "DOWNLOAD", "DROP", "EXPIRE", "FORK",
- "JOIN", "CLONE", "CONTENT_MODIFIED", "ATTRIBUTES_MODIFIED", "ROUTE",
- "ADDINFO", "REPLAY"};
+const char *ProvenanceEventRecord::ProvenanceEventTypeStr[REPLAY + 1] = { "CREATE", "RECEIVE", "FETCH", "SEND", "DOWNLOAD", "DROP", "EXPIRE", "FORK", "JOIN", "CLONE", "CONTENT_MODIFIED",
+ "ATTRIBUTES_MODIFIED", "ROUTE", "ADDINFO", "REPLAY" };
// DeSerialize
-bool ProvenanceEventRecord::DeSerialize(
- const std::shared_ptr<core::Repository> &repo, std::string key) {
+bool ProvenanceEventRecord::DeSerialize(const std::shared_ptr<core::Repository> &repo, std::string key) {
std::string value;
bool ret;
ret = repo->Get(key, value);
if (!ret) {
- logger_->log_error("NiFi Provenance Store event %s can not found",
- key.c_str());
+ logger_->log_error("NiFi Provenance Store event %s can not found", key.c_str());
return false;
} else {
- logger_->log_debug("NiFi Provenance Read event %s length %d", key.c_str(),
- value.length());
+ logger_->log_debug("NiFi Provenance Read event %s length %d", key.c_str(), value.length());
}
- org::apache::nifi::minifi::io::DataStream stream(
- (const uint8_t*) value.data(), value.length());
+ org::apache::nifi::minifi::io::DataStream stream((const uint8_t*) value.data(), value.length());
ret = DeSerialize(stream);
if (ret) {
- logger_->log_debug(
- "NiFi Provenance retrieve event %s size %d eventType %d success",
- _eventIdStr.c_str(), stream.getSize(), _eventType);
+ logger_->log_debug("NiFi Provenance retrieve event %s size %d eventType %d success", _eventIdStr.c_str(), stream.getSize(), _eventType);
} else {
- logger_->log_debug(
- "NiFi Provenance retrieve event %s size %d eventType %d fail",
- _eventIdStr.c_str(), stream.getSize(), _eventType);
+ logger_->log_debug("NiFi Provenance retrieve event %s size %d eventType %d fail", _eventIdStr.c_str(), stream.getSize(), _eventType);
}
return ret;
}
-bool ProvenanceEventRecord::Serialize(
- const std::shared_ptr<core::Repository> &repo) {
-
+bool ProvenanceEventRecord::Serialize(const std::shared_ptr<core::Repository> &repo) {
org::apache::nifi::minifi::io::DataStream outStream;
int ret;
@@ -170,9 +158,7 @@ bool ProvenanceEventRecord::Serialize(
return false;
}
- if (this->_eventType == ProvenanceEventRecord::FORK
- || this->_eventType == ProvenanceEventRecord::CLONE
- || this->_eventType == ProvenanceEventRecord::JOIN) {
+ if (this->_eventType == ProvenanceEventRecord::FORK || this->_eventType == ProvenanceEventRecord::CLONE || this->_eventType == ProvenanceEventRecord::JOIN) {
// write UUIDs
uint32_t number = this->_parentUuids.size();
ret = write(number, &outStream);
@@ -196,8 +182,7 @@ bool ProvenanceEventRecord::Serialize(
return false;
}
}
- } else if (this->_eventType == ProvenanceEventRecord::SEND
- || this->_eventType == ProvenanceEventRecord::FETCH) {
+ } else if (this->_eventType == ProvenanceEventRecord::SEND || this->_eventType == ProvenanceEventRecord::FETCH) {
ret = writeUTF(this->_transitUri, &outStream);
if (ret <= 0) {
return false;
@@ -213,19 +198,15 @@ bool ProvenanceEventRecord::Serialize(
}
}
// Persistent to the DB
- if (repo->Put(_eventIdStr, const_cast<uint8_t*>(outStream.getBuffer()),
- outStream.getSize())) {
- logger_->log_debug("NiFi Provenance Store event %s size %d success",
- _eventIdStr.c_str(), outStream.getSize());
+ if (repo->Put(_eventIdStr, const_cast<uint8_t*>(outStream.getBuffer()), outStream.getSize())) {
+ logger_->log_debug("NiFi Provenance Store event %s size %d success", _eventIdStr.c_str(), outStream.getSize());
} else {
- logger_->log_error("NiFi Provenance Store event %s size %d fail",
- _eventIdStr.c_str(), outStream.getSize());
+ logger_->log_error("NiFi Provenance Store event %s size %d fail", _eventIdStr.c_str(), outStream.getSize());
}
return true;
}
-bool ProvenanceEventRecord::DeSerialize(const uint8_t *buffer,
- const int bufferSize) {
+bool ProvenanceEventRecord::DeSerialize(const uint8_t *buffer, const int bufferSize) {
int ret;
org::apache::nifi::minifi::io::DataStream outStream(buffer, bufferSize);
@@ -325,9 +306,7 @@ bool ProvenanceEventRecord::DeSerialize(const uint8_t *buffer,
return false;
}
- if (this->_eventType == ProvenanceEventRecord::FORK
- || this->_eventType == ProvenanceEventRecord::CLONE
- || this->_eventType == ProvenanceEventRecord::JOIN) {
+ if (this->_eventType == ProvenanceEventRecord::FORK || this->_eventType == ProvenanceEventRecord::CLONE || this->_eventType == ProvenanceEventRecord::JOIN) {
// read UUIDs
uint32_t number = 0;
ret = read(number, &outStream);
@@ -356,8 +335,7 @@ bool ProvenanceEventRecord::DeSerialize(const uint8_t *buffer,
}
this->addChildUuid(childUUID);
}
- } else if (this->_eventType == ProvenanceEventRecord::SEND
- || this->_eventType == ProvenanceEventRecord::FETCH) {
+ } else if (this->_eventType == ProvenanceEventRecord::SEND || this->_eventType == ProvenanceEventRecord::FETCH) {
ret = readUTF(this->_transitUri, &outStream);
if (ret <= 0) {
return false;
@@ -386,8 +364,7 @@ void ProvenanceReporter::commit() {
}
}
-void ProvenanceReporter::create(std::shared_ptr<core::FlowFile> flow,
- std::string detail) {
+void ProvenanceReporter::create(std::shared_ptr<core::FlowFile> flow, std::string detail) {
ProvenanceEventRecord *event = allocate(ProvenanceEventRecord::CREATE, flow);
if (event) {
@@ -396,9 +373,7 @@ void ProvenanceReporter::create(std::shared_ptr<core::FlowFile> flow,
}
}
-void ProvenanceReporter::route(std::shared_ptr<core::FlowFile> flow,
- core::Relationship relation, std::string detail,
- uint64_t processingDuration) {
+void ProvenanceReporter::route(std::shared_ptr<core::FlowFile> flow, core::Relationship relation, std::string detail, uint64_t processingDuration) {
ProvenanceEventRecord *event = allocate(ProvenanceEventRecord::ROUTE, flow);
if (event) {
@@ -409,10 +384,8 @@ void ProvenanceReporter::route(std::shared_ptr<core::FlowFile> flow,
}
}
-void ProvenanceReporter::modifyAttributes(std::shared_ptr<core::FlowFile> flow,
- std::string detail) {
- ProvenanceEventRecord *event = allocate(
- ProvenanceEventRecord::ATTRIBUTES_MODIFIED, flow);
+void ProvenanceReporter::modifyAttributes(std::shared_ptr<core::FlowFile> flow, std::string detail) {
+ ProvenanceEventRecord *event = allocate(ProvenanceEventRecord::ATTRIBUTES_MODIFIED, flow);
if (event) {
event->setDetails(detail);
@@ -420,11 +393,8 @@ void ProvenanceReporter::modifyAttributes(std::shared_ptr<core::FlowFile> flow,
}
}
-void ProvenanceReporter::modifyContent(std::shared_ptr<core::FlowFile> flow,
- std::string detail,
- uint64_t processingDuration) {
- ProvenanceEventRecord *event = allocate(
- ProvenanceEventRecord::CONTENT_MODIFIED, flow);
+void ProvenanceReporter::modifyContent(std::shared_ptr<core::FlowFile> flow, std::string detail, uint64_t processingDuration) {
+ ProvenanceEventRecord *event = allocate(ProvenanceEventRecord::CONTENT_MODIFIED, flow);
if (event) {
event->setDetails(detail);
@@ -433,8 +403,7 @@ void ProvenanceReporter::modifyContent(std::shared_ptr<core::FlowFile> flow,
}
}
-void ProvenanceReporter::clone(std::shared_ptr<core::FlowFile> parent,
- std::shared_ptr<core::FlowFile> child) {
+void ProvenanceReporter::clone(std::shared_ptr<core::FlowFile> parent, std::shared_ptr<core::FlowFile> child) {
ProvenanceEventRecord *event = allocate(ProvenanceEventRecord::CLONE, parent);
if (event) {
@@ -444,10 +413,7 @@ void ProvenanceReporter::clone(std::shared_ptr<core::FlowFile> parent,
}
}
-void ProvenanceReporter::join(
- std::vector<std::shared_ptr<core::FlowFile> > parents,
- std::shared_ptr<core::FlowFile> child, std::string detail,
- uint64_t processingDuration) {
+void ProvenanceReporter::join(std::vector<std::shared_ptr<core::FlowFile> > parents, std::shared_ptr<core::FlowFile> child, std::string detail, uint64_t processingDuration) {
ProvenanceEventRecord *event = allocate(ProvenanceEventRecord::JOIN, child);
if (event) {
@@ -463,10 +429,7 @@ void ProvenanceReporter::join(
}
}
-void ProvenanceReporter::fork(
- std::vector<std::shared_ptr<core::FlowFile> > child,
- std::shared_ptr<core::FlowFile> parent, std::string detail,
- uint64_t processingDuration) {
+void ProvenanceReporter::fork(std::vector<std::shared_ptr<core::FlowFile> > child, std::shared_ptr<core::FlowFile> parent, std::string detail, uint64_t processingDuration) {
ProvenanceEventRecord *event = allocate(ProvenanceEventRecord::FORK, parent);
if (event) {
@@ -482,8 +445,7 @@ void ProvenanceReporter::fork(
}
}
-void ProvenanceReporter::expire(std::shared_ptr<core::FlowFile> flow,
- std::string detail) {
+void ProvenanceReporter::expire(std::shared_ptr<core::FlowFile> flow, std::string detail) {
ProvenanceEventRecord *event = allocate(ProvenanceEventRecord::EXPIRE, flow);
if (event) {
@@ -492,8 +454,7 @@ void ProvenanceReporter::expire(std::shared_ptr<core::FlowFile> flow,
}
}
-void ProvenanceReporter::drop(std::shared_ptr<core::FlowFile> flow,
- std::string reason) {
+void ProvenanceReporter::drop(std::shared_ptr<core::FlowFile> flow, std::string reason) {
ProvenanceEventRecord *event = allocate(ProvenanceEventRecord::DROP, flow);
if (event) {
@@ -503,9 +464,7 @@ void ProvenanceReporter::drop(std::shared_ptr<core::FlowFile> flow,
}
}
-void ProvenanceReporter::send(std::shared_ptr<core::FlowFile> flow,
- std::string transitUri, std::string detail,
- uint64_t processingDuration, bool force) {
+void ProvenanceReporter::send(std::shared_ptr<core::FlowFile> flow, std::string transitUri, std::string detail, uint64_t processingDuration, bool force) {
ProvenanceEventRecord *event = allocate(ProvenanceEventRecord::SEND, flow);
if (event) {
@@ -522,11 +481,7 @@ void ProvenanceReporter::send(std::shared_ptr<core::FlowFile> flow,
}
}
-void ProvenanceReporter::receive(std::shared_ptr<core::FlowFile> flow,
- std::string transitUri,
- std::string sourceSystemFlowFileIdentifier,
- std::string detail,
- uint64_t processingDuration) {
+void ProvenanceReporter::receive(std::shared_ptr<core::FlowFile> flow, std::string transitUri, std::string sourceSystemFlowFileIdentifier, std::string detail, uint64_t processingDuration) {
ProvenanceEventRecord *event = allocate(ProvenanceEventRecord::RECEIVE, flow);
if (event) {
@@ -538,9 +493,7 @@ void ProvenanceReporter::receive(std::shared_ptr<core::FlowFile> flow,
}
}
-void ProvenanceReporter::fetch(std::shared_ptr<core::FlowFile> flow,
- std::string transitUri, std::string detail,
- uint64_t processingDuration) {
+void ProvenanceReporter::fetch(std::shared_ptr<core::FlowFile> flow, std::string transitUri, std::string detail, uint64_t processingDuration) {
ProvenanceEventRecord *event = allocate(ProvenanceEventRecord::FETCH, flow);
if (event) {
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/provenance/ProvenanceRepository.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/provenance/ProvenanceRepository.cpp b/libminifi/src/provenance/ProvenanceRepository.cpp
index 77de5ba..e4a8ffa 100644
--- a/libminifi/src/provenance/ProvenanceRepository.cpp
+++ b/libminifi/src/provenance/ProvenanceRepository.cpp
@@ -40,14 +40,11 @@ void ProvenanceRepository::run() {
for (it->SeekToFirst(); it->Valid(); it->Next()) {
ProvenanceEventRecord eventRead;
std::string key = it->key().ToString();
- if (eventRead.DeSerialize(
- reinterpret_cast<uint8_t*>(const_cast<char*>(it->value().data())),
- it->value().size())) {
+ if (eventRead.DeSerialize(reinterpret_cast<uint8_t*>(const_cast<char*>(it->value().data())), it->value().size())) {
if ((curTime - eventRead.getEventTime()) > max_partition_millis_)
purgeList.push_back(key);
} else {
- logger_->log_debug("NiFi Provenance retrieve event %s fail",
- key.c_str());
+ logger_->log_debug("NiFi Provenance retrieve event %s fail", key.c_str());
purgeList.push_back(key);
}
}
@@ -56,8 +53,7 @@ void ProvenanceRepository::run() {
for (itPurge = purgeList.begin(); itPurge != purgeList.end(); itPurge++) {
std::string eventId = *itPurge;
- logger_->log_info("ProvenanceRepository Repo Purge %s",
- eventId.c_str());
+ logger_->log_info("ProvenanceRepository Repo Purge %s", eventId.c_str());
Delete(eventId);
}
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/Server.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/Server.cpp b/libminifi/test/Server.cpp
index bb3e682..39efb12 100644
--- a/libminifi/test/Server.cpp
+++ b/libminifi/test/Server.cpp
@@ -50,8 +50,7 @@ typedef enum {
} FlowControlMsgType;
// FlowControl Protocol Msg Type String
-static const char *FlowControlMsgTypeStr[MAX_FLOW_CONTROL_MSG_TYPE] = {
- "REGISTER_REQ", "REGISTER_RESP", "REPORT_REQ", "REPORT_RESP" };
+static const char *FlowControlMsgTypeStr[MAX_FLOW_CONTROL_MSG_TYPE] = { "REGISTER_REQ", "REGISTER_RESP", "REPORT_REQ", "REPORT_RESP" };
// Flow Control Msg Type to String
inline const char *FlowControlMsgTypeToStr(FlowControlMsgType type) {
@@ -83,10 +82,8 @@ typedef enum {
} FlowControlMsgID;
// FlowControl Protocol Msg ID String
-static const char *FlowControlMsgIDStr[MAX_FLOW_MSG_ID] = {
- "FLOW_SERIAL_NUMBER", "FLOW_YAML_NAME", "FLOW_YAML_CONTENT",
- "REPORT_INTERVAL", "PROCESSOR_NAME"
- "PROPERTY_NAME", "PROPERTY_VALUE", "REPORT_BLOB" };
+static const char *FlowControlMsgIDStr[MAX_FLOW_MSG_ID] = { "FLOW_SERIAL_NUMBER", "FLOW_YAML_NAME", "FLOW_YAML_CONTENT", "REPORT_INTERVAL", "PROCESSOR_NAME"
+ "PROPERTY_NAME", "PROPERTY_VALUE", "REPORT_BLOB" };
#define TYPE_HDR_LEN 4 // Fix Hdr Type
#define TLV_HDR_LEN 8 // Type 4 bytes and Len 4 bytes
@@ -122,9 +119,7 @@ typedef enum {
} FlowControlRespCode;
// FlowControl Resp Code str
-static const char *FlowControlRespCodeStr[MAX_RESP_CODE] = { "RESP_SUCCESS",
- "RESP_TRIGGER_REGISTER", "RESP_START_FLOW_CONTROLLER",
- "RESP_STOP_FLOW_CONTROLLER", "RESP_FAILURE" };
+static const char *FlowControlRespCodeStr[MAX_RESP_CODE] = { "RESP_SUCCESS", "RESP_TRIGGER_REGISTER", "RESP_START_FLOW_CONTROLLER", "RESP_STOP_FLOW_CONTROLLER", "RESP_FAILURE" };
// Flow Control Resp Code to String
inline const char *FlowControlRespCodeToStr(FlowControlRespCode code) {
@@ -332,8 +327,7 @@ int main(int argc, char *argv[]) {
exit(1);
}
- if (signal(SIGINT, sigHandler) == SIG_ERR
- || signal(SIGTERM, sigHandler) == SIG_ERR) {
+ if (signal(SIGINT, sigHandler) == SIG_ERR || signal(SIGTERM, sigHandler) == SIG_ERR) {
return -1;
}
@@ -360,13 +354,10 @@ int main(int argc, char *argv[]) {
FlowControlProtocolHeader hdr;
int status = readHdr(newsockfd, &hdr);
if (status > 0) {
- printf("Flow Control Protocol receive MsgType %s\n",
- FlowControlMsgTypeToStr((FlowControlMsgType) hdr.msgType));
+ printf("Flow Control Protocol receive MsgType %s\n", FlowControlMsgTypeToStr((FlowControlMsgType) hdr.msgType));
printf("Flow Control Protocol receive Seq Num %d\n", hdr.seqNumber);
- printf("Flow Control Protocol receive Resp Code %s\n",
- FlowControlRespCodeToStr((FlowControlRespCode) hdr.status));
- printf("Flow Control Protocol receive Payload len %d\n",
- hdr.payloadLen);
+ printf("Flow Control Protocol receive Resp Code %s\n", FlowControlRespCodeToStr((FlowControlRespCode) hdr.status));
+ printf("Flow Control Protocol receive Payload len %d\n", hdr.payloadLen);
if (((FlowControlMsgType) hdr.msgType) == REGISTER_REQ) {
printf("Flow Control Protocol Register Req receive\n");
uint8_t *payload = new uint8_t[hdr.payloadLen];
@@ -384,12 +375,10 @@ int main(int argc, char *argv[]) {
} else if (((FlowControlMsgID) msgID) == FLOW_YAML_NAME) {
uint32_t len;
payloadPtr = decode(payloadPtr, len);
- printf("Flow Control Protocol receive YAML name length %d\n",
- len);
+ printf("Flow Control Protocol receive YAML name length %d\n", len);
std::string flowName = (const char *) payloadPtr;
payloadPtr += len;
- printf("Flow Control Protocol receive YAML name %s\n",
- flowName.c_str());
+ printf("Flow Control Protocol receive YAML name %s\n", flowName.c_str());
} else {
break;
}
@@ -399,11 +388,9 @@ int main(int argc, char *argv[]) {
// Calculate the total payload msg size
char *ymlContent;
uint32_t yamlLen = readYAML(&ymlContent);
- uint32_t payloadSize = FlowControlMsgIDEncodingLen(REPORT_INTERVAL,
- 0);
+ uint32_t payloadSize = FlowControlMsgIDEncodingLen(REPORT_INTERVAL, 0);
if (yamlLen > 0)
- payloadSize += FlowControlMsgIDEncodingLen(FLOW_YAML_CONTENT,
- yamlLen);
+ payloadSize += FlowControlMsgIDEncodingLen(FLOW_YAML_CONTENT, yamlLen);
uint32_t size = sizeof(FlowControlProtocolHeader) + payloadSize;
uint8_t *data = new uint8_t[size];
@@ -444,12 +431,10 @@ int main(int argc, char *argv[]) {
if (((FlowControlMsgID) msgID) == FLOW_YAML_NAME) {
uint32_t len;
payloadPtr = decode(payloadPtr, len);
- printf("Flow Control Protocol receive YAML name length %d\n",
- len);
+ printf("Flow Control Protocol receive YAML name length %d\n", len);
std::string flowName = (const char *) payloadPtr;
payloadPtr += len;
- printf("Flow Control Protocol receive YAML name %s\n",
- flowName.c_str());
+ printf("Flow Control Protocol receive YAML name %s\n", flowName.c_str());
} else {
break;
}
@@ -475,16 +460,11 @@ int main(int argc, char *argv[]) {
propertyValue2 = "41";
flag = 0;
}
- uint32_t payloadSize = FlowControlMsgIDEncodingLen(
- PROCESSOR_NAME, processor.size() + 1);
- payloadSize += FlowControlMsgIDEncodingLen(PROPERTY_NAME,
- propertyName1.size() + 1);
- payloadSize += FlowControlMsgIDEncodingLen(PROPERTY_VALUE,
- propertyValue1.size() + 1);
- payloadSize += FlowControlMsgIDEncodingLen(PROPERTY_NAME,
- propertyName2.size() + 1);
- payloadSize += FlowControlMsgIDEncodingLen(PROPERTY_VALUE,
- propertyValue2.size() + 1);
+ uint32_t payloadSize = FlowControlMsgIDEncodingLen(PROCESSOR_NAME, processor.size() + 1);
+ payloadSize += FlowControlMsgIDEncodingLen(PROPERTY_NAME, propertyName1.size() + 1);
+ payloadSize += FlowControlMsgIDEncodingLen(PROPERTY_VALUE, propertyValue1.size() + 1);
+ payloadSize += FlowControlMsgIDEncodingLen(PROPERTY_NAME, propertyName2.size() + 1);
+ payloadSize += FlowControlMsgIDEncodingLen(PROPERTY_VALUE, propertyValue2.size() + 1);
uint32_t size = sizeof(FlowControlProtocolHeader) + payloadSize;
uint8_t *data = new uint8_t[size];
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/TestBase.h
----------------------------------------------------------------------
diff --git a/libminifi/test/TestBase.h b/libminifi/test/TestBase.h
index 7b1ac6b..e675043 100644
--- a/libminifi/test/TestBase.h
+++ b/libminifi/test/TestBase.h
@@ -36,40 +36,40 @@
class LogTestController {
public:
static LogTestController& getInstance() {
- static LogTestController instance;
- return instance;
+ static LogTestController instance;
+ return instance;
}
-
+
template<typename T>
void setTrace() {
setLevel<T>(spdlog::level::trace);
}
-
+
template<typename T>
void setDebug() {
setLevel<T>(spdlog::level::debug);
}
-
+
template<typename T>
void setInfo() {
setLevel<T>(spdlog::level::info);
}
-
+
template<typename T>
void setWarn() {
setLevel<T>(spdlog::level::warn);
}
-
+
template<typename T>
void setError() {
setLevel<T>(spdlog::level::err);
}
-
+
template<typename T>
void setOff() {
setLevel<T>(spdlog::level::off);
}
-
+
template<typename T>
void setLevel(spdlog::level::level_enum level) {
logging::LoggerFactory<T>::getLogger();
@@ -77,17 +77,17 @@ class LogTestController {
modified_loggers.push_back(name);
setLevel(name, level);
}
-
+
bool contains(const std::string &ending) {
- return contains(log_output, ending);
+ return contains(log_output, ending);
}
-
+
bool contains(const std::ostringstream &stream, const std::string &ending) {
std::string str = stream.str();
logger_->log_info("Looking for %s in %s.", ending, str);
return (ending.length() > 0 && str.find(ending) != std::string::npos);
}
-
+
void reset() {
for (auto const & name : modified_loggers) {
setLevel(name, spdlog::level::err);
@@ -95,35 +95,40 @@ class LogTestController {
modified_loggers = std::vector<std::string>();
resetStream(log_output);
}
-
+
inline void resetStream(std::ostringstream &stream) {
stream.str("");
stream.clear();
}
-
+
std::ostringstream log_output;
-
+
std::shared_ptr<logging::Logger> logger_;
private:
- class TestBootstrapLogger: public logging::Logger {
- public:
- TestBootstrapLogger(std::shared_ptr<spdlog::logger> logger):Logger(logger){};
- };
+ class TestBootstrapLogger : public logging::Logger {
+ public:
+ TestBootstrapLogger(std::shared_ptr<spdlog::logger> logger)
+ : Logger(logger) {
+ }
+ ;
+ };
LogTestController() {
- std::shared_ptr<logging::LoggerProperties> logger_properties = std::make_shared<logging::LoggerProperties>();
- logger_properties->set("logger.root", "ERROR,ostream");
- logger_properties->set("logger." + core::getClassName<LogTestController>(), "INFO");
- logger_properties->set("logger." + core::getClassName<logging::LoggerConfiguration>(), "DEBUG");
- std::shared_ptr<spdlog::sinks::dist_sink_mt> dist_sink = std::make_shared<spdlog::sinks::dist_sink_mt>();
- dist_sink->add_sink(std::make_shared<spdlog::sinks::ostream_sink_mt>(log_output, true));
- dist_sink->add_sink(spdlog::sinks::stderr_sink_mt::instance());
- logger_properties->add_sink("ostream", dist_sink);
- logging::LoggerConfiguration::getConfiguration().initialize(logger_properties);
- logger_ = logging::LoggerFactory<LogTestController>::getLogger();
+ std::shared_ptr<logging::LoggerProperties> logger_properties = std::make_shared<logging::LoggerProperties>();
+ logger_properties->set("logger.root", "ERROR,ostream");
+ logger_properties->set("logger." + core::getClassName<LogTestController>(), "INFO");
+ logger_properties->set("logger." + core::getClassName<logging::LoggerConfiguration>(), "DEBUG");
+ std::shared_ptr<spdlog::sinks::dist_sink_mt> dist_sink = std::make_shared<spdlog::sinks::dist_sink_mt>();
+ dist_sink->add_sink(std::make_shared<spdlog::sinks::ostream_sink_mt>(log_output, true));
+ dist_sink->add_sink(spdlog::sinks::stderr_sink_mt::instance());
+ logger_properties->add_sink("ostream", dist_sink);
+ logging::LoggerConfiguration::getConfiguration().initialize(logger_properties);
+ logger_ = logging::LoggerFactory<LogTestController>::getLogger();
}
LogTestController(LogTestController const&);
LogTestController& operator=(LogTestController const&);
- ~LogTestController() {};
+ ~LogTestController() {
+ }
+ ;
void setLevel(const std::string name, spdlog::level::level_enum level) {
logger_->log_info("Setting log level for %s to %s", name, spdlog::level::to_str(level));
[2/9] nifi-minifi-cpp git commit: MINIFI-331: Apply formatter with
increased line length to source
Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/integration/ControllerServiceIntegrationTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/integration/ControllerServiceIntegrationTests.cpp b/libminifi/test/integration/ControllerServiceIntegrationTests.cpp
index f1376e0..3f27b66 100644
--- a/libminifi/test/integration/ControllerServiceIntegrationTests.cpp
+++ b/libminifi/test/integration/ControllerServiceIntegrationTests.cpp
@@ -43,14 +43,10 @@
REGISTER_RESOURCE(MockControllerService);
REGISTER_RESOURCE(MockProcessor);
-std::shared_ptr<core::controller::StandardControllerServiceNode> newCsNode(
- std::shared_ptr<core::controller::ControllerServiceProvider> provider,
- const std::string id) {
- std::shared_ptr<core::controller::ControllerService> service =
- std::make_shared<MockControllerService>();
- std::shared_ptr<core::controller::StandardControllerServiceNode> testNode =
- std::make_shared<core::controller::StandardControllerServiceNode>(
- service, provider, id, std::make_shared<minifi::Configure>());
+std::shared_ptr<core::controller::StandardControllerServiceNode> newCsNode(std::shared_ptr<core::controller::ControllerServiceProvider> provider, const std::string id) {
+ std::shared_ptr<core::controller::ControllerService> service = std::make_shared<MockControllerService>();
+ std::shared_ptr<core::controller::StandardControllerServiceNode> testNode = std::make_shared<core::controller::StandardControllerServiceNode>(service, provider, id,
+ std::make_shared<minifi::Configure>());
return testNode;
}
@@ -59,7 +55,6 @@ void waitToVerifyProcessor() {
std::this_thread::sleep_for(std::chrono::seconds(2));
}
-
int main(int argc, char **argv) {
std::string test_file_location;
std::string key_dir;
@@ -69,87 +64,60 @@ int main(int argc, char **argv) {
key_dir = argv[1];
}
- std::shared_ptr<minifi::Configure> configuration = std::make_shared<
- minifi::Configure>();
+ std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
- std::shared_ptr<core::Repository> test_repo =
- std::make_shared<TestRepository>();
- std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<
- TestFlowRepository>();
+ std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>();
+ std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<TestFlowRepository>();
- configuration->set(minifi::Configure::nifi_flow_configuration_file,
- test_file_location);
+ configuration->set(minifi::Configure::nifi_flow_configuration_file, test_file_location);
std::string client_cert = "cn.crt.pem";
std::string priv_key_file = "cn.ckey.pem";
std::string passphrase = "cn.pass";
std::string ca_cert = "nifi-cert.pem";
- configuration->set(minifi::Configure::nifi_security_client_certificate,
- test_file_location);
- configuration->set(minifi::Configure::nifi_security_client_private_key,
- priv_key_file);
- configuration->set(minifi::Configure::nifi_security_client_pass_phrase,
- passphrase);
+ configuration->set(minifi::Configure::nifi_security_client_certificate, test_file_location);
+ configuration->set(minifi::Configure::nifi_security_client_private_key, priv_key_file);
+ configuration->set(minifi::Configure::nifi_security_client_pass_phrase, passphrase);
configuration->set(minifi::Configure::nifi_default_directory, key_dir);
- std::shared_ptr<minifi::io::StreamFactory> stream_factory = std::make_shared<
- minifi::io::StreamFactory>(configuration);
+ std::shared_ptr<minifi::io::StreamFactory> stream_factory = std::make_shared<minifi::io::StreamFactory>(configuration);
- std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<
- core::YamlConfiguration>(
- new core::YamlConfiguration(test_repo, test_repo, stream_factory,
- configuration, test_file_location));
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
+ std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<core::YamlConfiguration>(new core::YamlConfiguration(test_repo, test_repo, stream_factory, configuration, test_file_location));
+ std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo);
- std::shared_ptr<minifi::FlowController> controller = std::make_shared<
- minifi::FlowController>(test_repo, test_flow_repo, configuration,
- std::move(yaml_ptr),
- DEFAULT_ROOT_GROUP_NAME,
- true);
+ std::shared_ptr<minifi::FlowController> controller = std::make_shared<minifi::FlowController>(test_repo, test_flow_repo, configuration, std::move(yaml_ptr),
+ DEFAULT_ROOT_GROUP_NAME,
+ true);
disabled = false;
- std::shared_ptr<core::controller::ControllerServiceMap> map =
- std::make_shared<core::controller::ControllerServiceMap>();
+ std::shared_ptr<core::controller::ControllerServiceMap> map = std::make_shared<core::controller::ControllerServiceMap>();
- core::YamlConfiguration yaml_config(test_repo, test_repo, stream_factory,
- configuration, test_file_location);
+ core::YamlConfiguration yaml_config(test_repo, test_repo, stream_factory, configuration, test_file_location);
- std::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(
- test_file_location);
- std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(
- ptr.get());
+ std::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(test_file_location);
+ std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(ptr.get());
ptr.release();
- std::shared_ptr<core::controller::StandardControllerServiceProvider> provider =
- std::make_shared<core::controller::StandardControllerServiceProvider>(
- map, pg, std::make_shared<minifi::Configure>());
- std::shared_ptr<core::controller::ControllerServiceNode> mockNode = pg
- ->findControllerService("MockItLikeIts1995");
+ std::shared_ptr<core::controller::StandardControllerServiceProvider> provider = std::make_shared<core::controller::StandardControllerServiceProvider>(map, pg, std::make_shared<minifi::Configure>());
+ std::shared_ptr<core::controller::ControllerServiceNode> mockNode = pg->findControllerService("MockItLikeIts1995");
assert(mockNode != nullptr);
mockNode->enable();
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode> > linkedNodes =
- mockNode->getLinkedControllerServices();
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode> > linkedNodes = mockNode->getLinkedControllerServices();
assert(linkedNodes.size() == 1);
- std::shared_ptr<core::controller::ControllerServiceNode> notexistNode = pg
- ->findControllerService("MockItLikeItsWrong");
+ std::shared_ptr<core::controller::ControllerServiceNode> notexistNode = pg->findControllerService("MockItLikeItsWrong");
assert(notexistNode == nullptr);
controller->load();
controller->start();
- std::shared_ptr<core::controller::ControllerServiceNode> ssl_client_cont =
- controller->getControllerServiceNode("SSLClientServiceTest");
+ std::shared_ptr<core::controller::ControllerServiceNode> ssl_client_cont = controller->getControllerServiceNode("SSLClientServiceTest");
ssl_client_cont->enable();
assert(ssl_client_cont != nullptr);
assert(ssl_client_cont->getControllerServiceImplementation() != nullptr);
- std::shared_ptr<minifi::controllers::SSLContextService> ssl_client =
- std::static_pointer_cast<minifi::controllers::SSLContextService>(
- ssl_client_cont->getControllerServiceImplementation());
+ std::shared_ptr<minifi::controllers::SSLContextService> ssl_client = std::static_pointer_cast<minifi::controllers::SSLContextService>(ssl_client_cont->getControllerServiceImplementation());
assert(ssl_client->getCACertificate().length() > 0);
// now let's disable one of the controller services.
- std::shared_ptr<core::controller::ControllerServiceNode> cs_id = controller
- ->getControllerServiceNode("ID");
+ std::shared_ptr<core::controller::ControllerServiceNode> cs_id = controller->getControllerServiceNode("ID");
assert(cs_id != nullptr);
{
std::lock_guard<std::mutex> lock(control_mutex);
@@ -163,8 +131,7 @@ int main(int argc, char **argv) {
disabled = false;
waitToVerifyProcessor();
}
- std::shared_ptr<core::controller::ControllerServiceNode> mock_cont =
- controller->getControllerServiceNode("MockItLikeIts1995");
+ std::shared_ptr<core::controller::ControllerServiceNode> mock_cont = controller->getControllerServiceNode("MockItLikeIts1995");
assert(cs_id->enabled());
{
std::lock_guard<std::mutex> lock(control_mutex);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/integration/HttpGetIntegrationTest.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/integration/HttpGetIntegrationTest.cpp b/libminifi/test/integration/HttpGetIntegrationTest.cpp
index 018ab59..ae60dc1 100644
--- a/libminifi/test/integration/HttpGetIntegrationTest.cpp
+++ b/libminifi/test/integration/HttpGetIntegrationTest.cpp
@@ -49,40 +49,26 @@ int main(int argc, char **argv) {
test_file_location = argv[1];
key_dir = argv[2];
}
- std::shared_ptr<minifi::Configure> configuration = std::make_shared<
- minifi::Configure>();
+ std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
configuration->set(minifi::Configure::nifi_default_directory, key_dir);
mkdir("content_repository", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
- std::shared_ptr<core::Repository> test_repo =
- std::make_shared<TestRepository>();
- std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<
- TestFlowRepository>();
+ std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>();
+ std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<TestFlowRepository>();
- configuration->set(minifi::Configure::nifi_flow_configuration_file,
- test_file_location);
+ configuration->set(minifi::Configure::nifi_flow_configuration_file, test_file_location);
- std::shared_ptr<minifi::io::StreamFactory> stream_factory = std::make_shared<
- minifi::io::StreamFactory>(configuration);
- std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<
- core::YamlConfiguration>(
- new core::YamlConfiguration(test_repo, test_repo, stream_factory,
- configuration, test_file_location));
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
+ std::shared_ptr<minifi::io::StreamFactory> stream_factory = std::make_shared<minifi::io::StreamFactory>(configuration);
+ std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<core::YamlConfiguration>(new core::YamlConfiguration(test_repo, test_repo, stream_factory, configuration, test_file_location));
+ std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo);
- std::shared_ptr<minifi::FlowController> controller = std::make_shared<
- minifi::FlowController>(test_repo, test_flow_repo, configuration,
- std::move(yaml_ptr), DEFAULT_ROOT_GROUP_NAME,
- true);
+ std::shared_ptr<minifi::FlowController> controller = std::make_shared<minifi::FlowController>(test_repo, test_flow_repo, configuration, std::move(yaml_ptr), DEFAULT_ROOT_GROUP_NAME,
+ true);
- core::YamlConfiguration yaml_config(test_repo, test_repo, stream_factory,
- configuration, test_file_location);
+ core::YamlConfiguration yaml_config(test_repo, test_repo, stream_factory, configuration, test_file_location);
- std::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(
- test_file_location);
- std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(
- ptr.get());
+ std::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(test_file_location);
+ std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(ptr.get());
ptr.release();
controller->load();
@@ -92,13 +78,9 @@ int main(int argc, char **argv) {
controller->waitUnload(60000);
std::string logs = LogTestController::getInstance().log_output.str();
assert(logs.find("key:filename value:") != std::string::npos);
- assert(
- logs.find(
- "key:invokehttp.request.url value:https://raw.githubusercontent.com/curl/curl/master/docs/examples/httpput.c")
- != std::string::npos);
+ assert(logs.find("key:invokehttp.request.url value:https://raw.githubusercontent.com/curl/curl/master/docs/examples/httpput.c") != std::string::npos);
assert(logs.find("Size:3734 Offset:0") != std::string::npos);
- assert(
- logs.find("key:invokehttp.status.code value:200") != std::string::npos);
+ assert(logs.find("key:invokehttp.status.code value:200") != std::string::npos);
std::string stringtofind = "Resource Claim created ./content_repository/";
size_t loc = logs.find(stringtofind);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/integration/HttpPostIntegrationTest.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/integration/HttpPostIntegrationTest.cpp b/libminifi/test/integration/HttpPostIntegrationTest.cpp
index e88fc57..dfa284f 100644
--- a/libminifi/test/integration/HttpPostIntegrationTest.cpp
+++ b/libminifi/test/integration/HttpPostIntegrationTest.cpp
@@ -37,7 +37,6 @@
#include "io/StreamFactory.h"
#include "../TestBase.h"
-
void waitToVerifyProcessor() {
std::this_thread::sleep_for(std::chrono::seconds(2));
}
@@ -56,39 +55,25 @@ int main(int argc, char **argv) {
myfile.close();
mkdir("content_repository", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
- std::shared_ptr<minifi::Configure> configuration = std::make_shared<
- minifi::Configure>();
+ std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
- std::shared_ptr<core::Repository> test_repo =
- std::make_shared<TestRepository>();
- std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<
- TestFlowRepository>();
+ std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>();
+ std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<TestFlowRepository>();
- configuration->set(minifi::Configure::nifi_flow_configuration_file,
- test_file_location);
- std::shared_ptr<minifi::io::StreamFactory> stream_factory = std::make_shared<
- minifi::io::StreamFactory>(configuration);
+ configuration->set(minifi::Configure::nifi_flow_configuration_file, test_file_location);
+ std::shared_ptr<minifi::io::StreamFactory> stream_factory = std::make_shared<minifi::io::StreamFactory>(configuration);
- std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<
- core::YamlConfiguration>(
- new core::YamlConfiguration(test_repo, test_repo, stream_factory,
- configuration, test_file_location));
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
+ std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<core::YamlConfiguration>(new core::YamlConfiguration(test_repo, test_repo, stream_factory, configuration, test_file_location));
+ std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo);
- std::shared_ptr<minifi::FlowController> controller = std::make_shared<
- minifi::FlowController>(test_repo, test_flow_repo, configuration,
- std::move(yaml_ptr),
- DEFAULT_ROOT_GROUP_NAME,
- true);
+ std::shared_ptr<minifi::FlowController> controller = std::make_shared<minifi::FlowController>(test_repo, test_flow_repo, configuration, std::move(yaml_ptr),
+ DEFAULT_ROOT_GROUP_NAME,
+ true);
- core::YamlConfiguration yaml_config(test_repo, test_repo, stream_factory,
- configuration, test_file_location);
+ core::YamlConfiguration yaml_config(test_repo, test_repo, stream_factory, configuration, test_file_location);
- std::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(
- test_file_location);
- std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(
- ptr.get());
+ std::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(test_file_location);
+ std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(ptr.get());
ptr.release();
controller->load();
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/integration/ProvenanceReportingTest.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/integration/ProvenanceReportingTest.cpp b/libminifi/test/integration/ProvenanceReportingTest.cpp
index 5e2c7b8..a7bcc2b 100644
--- a/libminifi/test/integration/ProvenanceReportingTest.cpp
+++ b/libminifi/test/integration/ProvenanceReportingTest.cpp
@@ -37,7 +37,6 @@
#include "io/StreamFactory.h"
#include "../TestBase.h"
-
void waitToVerifyProcessor() {
std::this_thread::sleep_for(std::chrono::seconds(2));
}
@@ -53,45 +52,28 @@ int main(int argc, char **argv) {
LogTestController::getInstance().setDebug<core::ProcessGroup>();
- std::shared_ptr<minifi::Configure> configuration = std::make_shared<
- minifi::Configure>();
+ std::shared_ptr<minifi::Configure> configuration = std::make_shared<minifi::Configure>();
- std::shared_ptr<core::Repository> test_repo =
- std::make_shared<TestRepository>();
- std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<
- TestFlowRepository>();
+ std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>();
+ std::shared_ptr<core::Repository> test_flow_repo = std::make_shared<TestFlowRepository>();
- configuration->set(minifi::Configure::nifi_flow_configuration_file,
- test_file_location);
- std::shared_ptr<minifi::io::StreamFactory> stream_factory = std::make_shared<
- minifi::io::StreamFactory>(configuration);
+ configuration->set(minifi::Configure::nifi_flow_configuration_file, test_file_location);
+ std::shared_ptr<minifi::io::StreamFactory> stream_factory = std::make_shared<minifi::io::StreamFactory>(configuration);
- std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<
- core::YamlConfiguration>(
- new core::YamlConfiguration(test_repo, test_repo, stream_factory,
- configuration, test_file_location));
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
+ std::unique_ptr<core::FlowConfiguration> yaml_ptr = std::unique_ptr<core::YamlConfiguration>(new core::YamlConfiguration(test_repo, test_repo, stream_factory, configuration, test_file_location));
+ std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo);
- std::shared_ptr<minifi::FlowController> controller = std::make_shared<
- minifi::FlowController>(test_repo, test_flow_repo, configuration,
- std::move(yaml_ptr),
- DEFAULT_ROOT_GROUP_NAME,
- true);
+ std::shared_ptr<minifi::FlowController> controller = std::make_shared<minifi::FlowController>(test_repo, test_flow_repo, configuration, std::move(yaml_ptr),
+ DEFAULT_ROOT_GROUP_NAME,
+ true);
- core::YamlConfiguration yaml_config(test_repo, test_repo, stream_factory,
- configuration, test_file_location);
+ core::YamlConfiguration yaml_config(test_repo, test_repo, stream_factory, configuration, test_file_location);
- std::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(
- test_file_location);
- std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(
- ptr.get());
+ std::unique_ptr<core::ProcessGroup> ptr = yaml_config.getRoot(test_file_location);
+ std::shared_ptr<core::ProcessGroup> pg = std::shared_ptr<core::ProcessGroup>(ptr.get());
ptr.release();
- std::shared_ptr<org::apache::nifi::minifi::io::SocketContext> socket_context =
- std::make_shared<org::apache::nifi::minifi::io::SocketContext>(
- std::make_shared<minifi::Configure>());
- org::apache::nifi::minifi::io::Socket server(socket_context, "localhost",
- 10001, 1);
+ std::shared_ptr<org::apache::nifi::minifi::io::SocketContext> socket_context = std::make_shared<org::apache::nifi::minifi::io::SocketContext>(std::make_shared<minifi::Configure>());
+ org::apache::nifi::minifi::io::Socket server(socket_context, "localhost", 10001, 1);
controller->load();
controller->start();
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/integration/TestExecuteProcess.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/integration/TestExecuteProcess.cpp b/libminifi/test/integration/TestExecuteProcess.cpp
index c3a3f4c..ef0d113 100644
--- a/libminifi/test/integration/TestExecuteProcess.cpp
+++ b/libminifi/test/integration/TestExecuteProcess.cpp
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-
#include <cassert>
#include <chrono>
#include <string>
@@ -45,23 +44,18 @@
int main(int argc, char **argv) {
TestController testController;
- std::shared_ptr<core::Processor> processor = std::make_shared<
- org::apache::nifi::minifi::processors::ExecuteProcess>("executeProcess");
+ std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::ExecuteProcess>("executeProcess");
processor->setMaxConcurrentTasks(1);
- std::shared_ptr<core::Repository> test_repo =
- std::make_shared<TestRepository>();
+ std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>();
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
- std::shared_ptr<minifi::FlowController> controller = std::make_shared<
- TestFlowController>(test_repo, test_repo);
+ std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo);
+ std::shared_ptr<minifi::FlowController> controller = std::make_shared<TestFlowController>(test_repo, test_repo);
uuid_t processoruuid;
assert(true == processor->getUUID(processoruuid));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(test_repo, "executeProcessConnection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(test_repo, "executeProcessConnection");
connection->setRelationship(core::Relationship("success", "description"));
// link the connections so that we can test results at the end for this
@@ -84,37 +78,29 @@ int main(int argc, char **argv) {
std::vector<std::thread> processor_workers;
core::ProcessorNode node2(processor);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
- std::shared_ptr<core::ProcessContext> contextset = std::make_shared<
- core::ProcessContext>(node2, controller_services_provider, test_repo);
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
+ std::shared_ptr<core::ProcessContext> contextset = std::make_shared<core::ProcessContext>(node2, controller_services_provider, test_repo);
core::ProcessSessionFactory factory(contextset.get());
processor->onSchedule(contextset.get(), &factory);
for (int i = 0; i < 1; i++) {
- processor_workers.push_back(
- std::thread(
- [processor, test_repo, &is_ready]() {
- core::ProcessorNode node(processor);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
- std::shared_ptr<core::ProcessContext> context = std::make_shared<core::ProcessContext>(node, controller_services_provider, test_repo);
- context->setProperty(org::apache::nifi::minifi::processors::ExecuteProcess::Command, "sleep 0.5");
- std::shared_ptr<core::ProcessSession> session = std::make_shared<core::ProcessSession>(context.get());
- while (!is_ready.load(std::memory_order_relaxed)) {
- }
- processor->onTrigger(context.get(), session.get());
- }));
+ processor_workers.push_back(std::thread([processor, test_repo, &is_ready]() {
+ core::ProcessorNode node(processor);
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
+ std::shared_ptr<core::ProcessContext> context = std::make_shared<core::ProcessContext>(node, controller_services_provider, test_repo);
+ context->setProperty(org::apache::nifi::minifi::processors::ExecuteProcess::Command, "sleep 0.5");
+ std::shared_ptr<core::ProcessSession> session = std::make_shared<core::ProcessSession>(context.get());
+ while (!is_ready.load(std::memory_order_relaxed)) {
+ }
+ processor->onTrigger(context.get(), session.get());
+ }));
}
is_ready.store(true, std::memory_order_relaxed);
- std::for_each(processor_workers.begin(), processor_workers.end(),
- [](std::thread &t) {
- t.join();
- });
-
+ std::for_each(processor_workers.begin(), processor_workers.end(), [](std::thread &t) {
+ t.join();
+ });
- std::shared_ptr<org::apache::nifi::minifi::processors::ExecuteProcess> execp =
- std::static_pointer_cast<
- org::apache::nifi::minifi::processors::ExecuteProcess>(processor);
+ std::shared_ptr<org::apache::nifi::minifi::processors::ExecuteProcess> execp = std::static_pointer_cast<org::apache::nifi::minifi::processors::ExecuteProcess>(processor);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/nodefs/NoLevelDB.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/nodefs/NoLevelDB.cpp b/libminifi/test/nodefs/NoLevelDB.cpp
index 677886e..6856287 100644
--- a/libminifi/test/nodefs/NoLevelDB.cpp
+++ b/libminifi/test/nodefs/NoLevelDB.cpp
@@ -22,13 +22,11 @@
#include "core/RepositoryFactory.h"
TEST_CASE("NoLevelDBTest1", "[NoLevelDBTest]") {
- std::shared_ptr<core::Repository> prov_repo = core::createRepository(
- "provenancerepository", true);
+ std::shared_ptr<core::Repository> prov_repo = core::createRepository("provenancerepository", true);
REQUIRE(nullptr != prov_repo);
}
TEST_CASE("NoLevelDBTest2", "[NoLevelDBTest]") {
- std::shared_ptr<core::Repository> prov_repo = core::createRepository(
- "flowfilerepository", true);
+ std::shared_ptr<core::Repository> prov_repo = core::createRepository("flowfilerepository", true);
REQUIRE(nullptr != prov_repo);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/CRCTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/CRCTests.cpp b/libminifi/test/unit/CRCTests.cpp
index d2b0466..97af4c3 100644
--- a/libminifi/test/unit/CRCTests.cpp
+++ b/libminifi/test/unit/CRCTests.cpp
@@ -26,16 +26,14 @@
TEST_CASE("Test CRC1", "[testcrc1]") {
org::apache::nifi::minifi::io::BaseStream base;
- org::apache::nifi::minifi::io::CRCStream<
- org::apache::nifi::minifi::io::BaseStream> test(&base);
+ org::apache::nifi::minifi::io::CRCStream<org::apache::nifi::minifi::io::BaseStream> test(&base);
test.writeData(reinterpret_cast<uint8_t*>(const_cast<char*>("cow")), 3);
REQUIRE(2580823964 == test.getCRC());
}
TEST_CASE("Test CRC2", "[testcrc2]") {
org::apache::nifi::minifi::io::BaseStream base;
- org::apache::nifi::minifi::io::CRCStream<
- org::apache::nifi::minifi::io::BaseStream> test(&base);
+ org::apache::nifi::minifi::io::CRCStream<org::apache::nifi::minifi::io::BaseStream> test(&base);
std::string fox = "the quick brown fox jumped over the brown fox";
std::vector<uint8_t> charvect(fox.begin(), fox.end());
test.writeData(charvect, charvect.size());
@@ -44,8 +42,7 @@ TEST_CASE("Test CRC2", "[testcrc2]") {
TEST_CASE("Test CRC3", "[testcrc3]") {
org::apache::nifi::minifi::io::BaseStream base;
- org::apache::nifi::minifi::io::CRCStream<
- org::apache::nifi::minifi::io::BaseStream> test(&base);
+ org::apache::nifi::minifi::io::CRCStream<org::apache::nifi::minifi::io::BaseStream> test(&base);
uint64_t number = 7;
test.write(number);
REQUIRE(4215687882 == test.getCRC());
@@ -53,8 +50,7 @@ TEST_CASE("Test CRC3", "[testcrc3]") {
TEST_CASE("Test CRC4", "[testcrc4]") {
org::apache::nifi::minifi::io::BaseStream base;
- org::apache::nifi::minifi::io::CRCStream<
- org::apache::nifi::minifi::io::BaseStream> test(&base);
+ org::apache::nifi::minifi::io::CRCStream<org::apache::nifi::minifi::io::BaseStream> test(&base);
uint32_t number = 7;
test.write(number);
REQUIRE(3206564543 == test.getCRC());
@@ -62,8 +58,7 @@ TEST_CASE("Test CRC4", "[testcrc4]") {
TEST_CASE("Test CRC5", "[testcrc5]") {
org::apache::nifi::minifi::io::BaseStream base;
- org::apache::nifi::minifi::io::CRCStream<
- org::apache::nifi::minifi::io::BaseStream> test(&base);
+ org::apache::nifi::minifi::io::CRCStream<org::apache::nifi::minifi::io::BaseStream> test(&base);
uint16_t number = 7;
test.write(number);
REQUIRE(3753740124 == test.getCRC());
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/ClassLoaderTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ClassLoaderTests.cpp b/libminifi/test/unit/ClassLoaderTests.cpp
index e27c753..fa8e5ef 100644
--- a/libminifi/test/unit/ClassLoaderTests.cpp
+++ b/libminifi/test/unit/ClassLoaderTests.cpp
@@ -25,20 +25,8 @@
TEST_CASE("TestLoader", "[TestLoader]") {
TestController controller;
- REQUIRE(
- nullptr
- != core::ClassLoader::getDefaultClassLoader().instantiate(
- "AppendHostInfo", "hosty"));
- REQUIRE(
- nullptr
- != core::ClassLoader::getDefaultClassLoader().instantiate(
- "ListenHTTP", "hosty2"));
- REQUIRE(
- nullptr
- == core::ClassLoader::getDefaultClassLoader().instantiate(
- "Don'tExist", "hosty3"));
- REQUIRE(
- nullptr
- == core::ClassLoader::getDefaultClassLoader().instantiate(
- "", "EmptyEmpty"));
+ REQUIRE(nullptr != core::ClassLoader::getDefaultClassLoader().instantiate("AppendHostInfo", "hosty"));
+ REQUIRE(nullptr != core::ClassLoader::getDefaultClassLoader().instantiate("ListenHTTP", "hosty2"));
+ REQUIRE(nullptr == core::ClassLoader::getDefaultClassLoader().instantiate("Don'tExist", "hosty3"));
+ REQUIRE(nullptr == core::ClassLoader::getDefaultClassLoader().instantiate("", "EmptyEmpty"));
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/ControllerServiceTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ControllerServiceTests.cpp b/libminifi/test/unit/ControllerServiceTests.cpp
index 44d30d4..a24ee03 100644
--- a/libminifi/test/unit/ControllerServiceTests.cpp
+++ b/libminifi/test/unit/ControllerServiceTests.cpp
@@ -40,11 +40,8 @@ TEST_CASE("Test ControllerServicesMap", "[cs1]") {
core::controller::ControllerServiceMap map;
REQUIRE(0 == map.getAllControllerServices().size());
- std::shared_ptr<core::controller::ControllerService> service =
- std::make_shared<MockControllerService>();
- std::shared_ptr<core::controller::StandardControllerServiceNode> testNode =
- std::make_shared<core::controller::StandardControllerServiceNode>(
- service, "ID", std::make_shared<minifi::Configure>());
+ std::shared_ptr<core::controller::ControllerService> service = std::make_shared<MockControllerService>();
+ std::shared_ptr<core::controller::StandardControllerServiceNode> testNode = std::make_shared<core::controller::StandardControllerServiceNode>(service, "ID", std::make_shared<minifi::Configure>());
map.put("ID", testNode);
REQUIRE(1 == map.getAllControllerServices().size());
@@ -56,19 +53,14 @@ TEST_CASE("Test ControllerServicesMap", "[cs1]") {
// ensure the pointer is the same
- REQUIRE(
- service.get()
- == map.getControllerServiceNode("ID")
- ->getControllerServiceImplementation().get());
+ REQUIRE(service.get() == map.getControllerServiceNode("ID")->getControllerServiceImplementation().get());
}
TEST_CASE("Test StandardControllerServiceNode nullPtr", "[cs1]") {
core::controller::ControllerServiceMap map;
try {
- std::shared_ptr<core::controller::StandardControllerServiceNode> testNode =
- std::make_shared<core::controller::StandardControllerServiceNode>(
- nullptr, "ID", std::make_shared<minifi::Configure>());
+ std::shared_ptr<core::controller::StandardControllerServiceNode> testNode = std::make_shared<core::controller::StandardControllerServiceNode>(nullptr, "ID", std::make_shared<minifi::Configure>());
} catch (minifi::Exception &ex) {
return;
}
@@ -76,13 +68,9 @@ TEST_CASE("Test StandardControllerServiceNode nullPtr", "[cs1]") {
FAIL("Should have encountered exception");
}
-std::shared_ptr<core::controller::StandardControllerServiceNode> newCsNode(
- const std::string id) {
- std::shared_ptr<core::controller::ControllerService> service =
- std::make_shared<MockControllerService>();
- std::shared_ptr<core::controller::StandardControllerServiceNode> testNode =
- std::make_shared<core::controller::StandardControllerServiceNode>(
- service, id, std::make_shared<minifi::Configure>());
+std::shared_ptr<core::controller::StandardControllerServiceNode> newCsNode(const std::string id) {
+ std::shared_ptr<core::controller::ControllerService> service = std::make_shared<MockControllerService>();
+ std::shared_ptr<core::controller::StandardControllerServiceNode> testNode = std::make_shared<core::controller::StandardControllerServiceNode>(service, id, std::make_shared<minifi::Configure>());
return testNode;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/InvokeHTTPTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/InvokeHTTPTests.cpp b/libminifi/test/unit/InvokeHTTPTests.cpp
index 95b4a2e..705ac84 100644
--- a/libminifi/test/unit/InvokeHTTPTests.cpp
+++ b/libminifi/test/unit/InvokeHTTPTests.cpp
@@ -41,23 +41,19 @@ TEST_CASE("HTTPTestsPostNoResourceClaim", "[httptest1]") {
std::shared_ptr<TestRepository> repo = std::make_shared<TestRepository>();
- std::shared_ptr<core::Processor> processor = std::make_shared<
- org::apache::nifi::minifi::processors::ListenHTTP>("listenhttp");
+ std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::ListenHTTP>("listenhttp");
- std::shared_ptr<core::Processor> invokehttp = std::make_shared<
- org::apache::nifi::minifi::processors::InvokeHTTP>("invokehttp");
+ std::shared_ptr<core::Processor> invokehttp = std::make_shared<org::apache::nifi::minifi::processors::InvokeHTTP>("invokehttp");
uuid_t processoruuid;
REQUIRE(true == processor->getUUID(processoruuid));
uuid_t invokehttp_uuid;
REQUIRE(true == invokehttp->getUUID(invokehttp_uuid));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(repo, "getfileCreate2Connection");
connection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> connection2 = std::make_shared<
- minifi::Connection>(repo, "listenhttp");
+ std::shared_ptr<minifi::Connection> connection2 = std::make_shared<minifi::Connection>(repo, "listenhttp");
connection2->setRelationship(core::Relationship("No Retry", "description"));
@@ -80,20 +76,14 @@ TEST_CASE("HTTPTestsPostNoResourceClaim", "[httptest1]") {
core::ProcessorNode node(processor);
core::ProcessorNode node2(invokehttp);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
core::ProcessContext context(node, controller_services_provider, repo);
core::ProcessContext context2(node2, controller_services_provider, repo);
- context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::Port,
- "8685");
- context.setProperty(
- org::apache::nifi::minifi::processors::ListenHTTP::BasePath,
- "/testytesttest");
-
- context2.setProperty(
- org::apache::nifi::minifi::processors::InvokeHTTP::Method, "POST");
- context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::URL,
- "http://localhost:8685/testytesttest");
+ context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::Port, "8685");
+ context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::BasePath, "/testytesttest");
+
+ context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::Method, "POST");
+ context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::URL, "http://localhost:8685/testytesttest");
core::ProcessSession session(&context);
core::ProcessSession session2(&context2);
@@ -148,40 +138,32 @@ TEST_CASE("HTTPTestsWithNoResourceClaimPOST", "[httptest1]") {
std::shared_ptr<TestRepository> repo = std::make_shared<TestRepository>();
- std::shared_ptr<core::Processor> getfileprocessor = std::make_shared<
- org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
+ std::shared_ptr<core::Processor> getfileprocessor = std::make_shared<org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
- std::shared_ptr<core::Processor> logAttribute = std::make_shared<
- org::apache::nifi::minifi::processors::LogAttribute>("logattribute");
+ std::shared_ptr<core::Processor> logAttribute = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute");
char format[] = "/tmp/gt.XXXXXX";
char *dir = testController.createTempDirectory(format);
- std::shared_ptr<core::Processor> listenhttp = std::make_shared<
- org::apache::nifi::minifi::processors::ListenHTTP>("listenhttp");
+ std::shared_ptr<core::Processor> listenhttp = std::make_shared<org::apache::nifi::minifi::processors::ListenHTTP>("listenhttp");
- std::shared_ptr<core::Processor> invokehttp = std::make_shared<
- org::apache::nifi::minifi::processors::InvokeHTTP>("invokehttp");
+ std::shared_ptr<core::Processor> invokehttp = std::make_shared<org::apache::nifi::minifi::processors::InvokeHTTP>("invokehttp");
uuid_t processoruuid;
REQUIRE(true == listenhttp->getUUID(processoruuid));
uuid_t invokehttp_uuid;
REQUIRE(true == invokehttp->getUUID(invokehttp_uuid));
- std::shared_ptr<minifi::Connection> gcConnection = std::make_shared<
- minifi::Connection>(repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> gcConnection = std::make_shared<minifi::Connection>(repo, "getfileCreate2Connection");
gcConnection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> laConnection = std::make_shared<
- minifi::Connection>(repo, "logattribute");
+ std::shared_ptr<minifi::Connection> laConnection = std::make_shared<minifi::Connection>(repo, "logattribute");
laConnection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(repo, "getfileCreate2Connection");
connection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> connection2 = std::make_shared<
- minifi::Connection>(repo, "listenhttp");
+ std::shared_ptr<minifi::Connection> connection2 = std::make_shared<minifi::Connection>(repo, "listenhttp");
connection2->setRelationship(core::Relationship("No Retry", "description"));
@@ -198,20 +180,14 @@ TEST_CASE("HTTPTestsWithNoResourceClaimPOST", "[httptest1]") {
core::ProcessorNode node(listenhttp);
core::ProcessorNode node2(invokehttp);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
core::ProcessContext context(node, controller_services_provider, repo);
core::ProcessContext context2(node2, controller_services_provider, repo);
- context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::Port,
- "8686");
- context.setProperty(
- org::apache::nifi::minifi::processors::ListenHTTP::BasePath,
- "/testytesttest");
-
- context2.setProperty(
- org::apache::nifi::minifi::processors::InvokeHTTP::Method, "POST");
- context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::URL,
- "http://localhost:8686/testytesttest");
+ context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::Port, "8686");
+ context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::BasePath, "/testytesttest");
+
+ context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::Method, "POST");
+ context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::URL, "http://localhost:8686/testytesttest");
core::ProcessSession session(&context);
core::ProcessSession session2(&context2);
@@ -276,43 +252,34 @@ TEST_CASE("HTTPTestsWithResourceClaimPOST", "[httptest1]") {
TestController testController;
LogTestController::getInstance().setInfo<org::apache::nifi::minifi::processors::InvokeHTTP>();
- std::shared_ptr<TestRepository> repo = std::make_shared<
- TestRepository>();
+ std::shared_ptr<TestRepository> repo = std::make_shared<TestRepository>();
- std::shared_ptr<core::Processor> getfileprocessor = std::make_shared<
- org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
+ std::shared_ptr<core::Processor> getfileprocessor = std::make_shared<org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
- std::shared_ptr<core::Processor> logAttribute = std::make_shared<
- org::apache::nifi::minifi::processors::LogAttribute>("logattribute");
+ std::shared_ptr<core::Processor> logAttribute = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute");
char format[] = "/tmp/gt.XXXXXX";
char *dir = testController.createTempDirectory(format);
- std::shared_ptr<core::Processor> listenhttp = std::make_shared<
- org::apache::nifi::minifi::processors::ListenHTTP>("listenhttp");
+ std::shared_ptr<core::Processor> listenhttp = std::make_shared<org::apache::nifi::minifi::processors::ListenHTTP>("listenhttp");
- std::shared_ptr<core::Processor> invokehttp = std::make_shared<
- org::apache::nifi::minifi::processors::InvokeHTTP>("invokehttp");
+ std::shared_ptr<core::Processor> invokehttp = std::make_shared<org::apache::nifi::minifi::processors::InvokeHTTP>("invokehttp");
uuid_t processoruuid;
REQUIRE(true == listenhttp->getUUID(processoruuid));
uuid_t invokehttp_uuid;
REQUIRE(true == invokehttp->getUUID(invokehttp_uuid));
- std::shared_ptr<minifi::Connection> gcConnection = std::make_shared<
- minifi::Connection>(repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> gcConnection = std::make_shared<minifi::Connection>(repo, "getfileCreate2Connection");
gcConnection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> laConnection = std::make_shared<
- minifi::Connection>(repo, "logattribute");
+ std::shared_ptr<minifi::Connection> laConnection = std::make_shared<minifi::Connection>(repo, "logattribute");
laConnection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(repo, "getfileCreate2Connection");
connection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> connection2 = std::make_shared<
- minifi::Connection>(repo, "listenhttp");
+ std::shared_ptr<minifi::Connection> connection2 = std::make_shared<minifi::Connection>(repo, "listenhttp");
connection2->setRelationship(core::Relationship("No Retry", "description"));
@@ -331,20 +298,14 @@ TEST_CASE("HTTPTestsWithResourceClaimPOST", "[httptest1]") {
core::ProcessorNode node(invokehttp);
core::ProcessorNode node2(listenhttp);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
core::ProcessContext context(node, controller_services_provider, repo);
core::ProcessContext context2(node2, controller_services_provider, repo);
- context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::Port,
- "8680");
- context.setProperty(
- org::apache::nifi::minifi::processors::ListenHTTP::BasePath,
- "/testytesttest");
-
- context2.setProperty(
- org::apache::nifi::minifi::processors::InvokeHTTP::Method, "POST");
- context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::URL,
- "http://localhost:8680/testytesttest");
+ context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::Port, "8680");
+ context.setProperty(org::apache::nifi::minifi::processors::ListenHTTP::BasePath, "/testytesttest");
+
+ context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::Method, "POST");
+ context2.setProperty(org::apache::nifi::minifi::processors::InvokeHTTP::URL, "http://localhost:8680/testytesttest");
core::ProcessSession session(&context);
core::ProcessSession session2(&context2);
@@ -363,8 +324,7 @@ TEST_CASE("HTTPTestsWithResourceClaimPOST", "[httptest1]") {
*/
std::map<std::string, std::string> attributes;
attributes["testy"] = "test";
- std::shared_ptr<minifi::FlowFileRecord> flow = std::make_shared<
- minifi::FlowFileRecord>(repo, attributes);
+ std::shared_ptr<minifi::FlowFileRecord> flow = std::make_shared<minifi::FlowFileRecord>(repo, attributes);
session2.write(flow, &callback);
invokehttp->incrementActiveTasks();
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/LoggerConfigurationTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/LoggerConfigurationTests.cpp b/libminifi/test/unit/LoggerConfigurationTests.cpp
index 7c340d1..8a8b0bc 100644
--- a/libminifi/test/unit/LoggerConfigurationTests.cpp
+++ b/libminifi/test/unit/LoggerConfigurationTests.cpp
@@ -34,7 +34,7 @@ TEST_CASE("TestLoggerProperties::get_keys_of_type", "[test get_keys_of_type]") {
logger_properties.set("notappender.notrolling", "notrolling");
logger_properties.set("appender.stdout", "stdout");
logger_properties.set("appender.stdout2.ignore", "stdout");
- std::vector<std::string> expected = {"appender.rolling", "appender.stdout"};
+ std::vector<std::string> expected = { "appender.rolling", "appender.stdout" };
std::vector<std::string> actual = logger_properties.get_keys_of_type("appender");
std::sort(actual.begin(), actual.end());
REQUIRE(expected == actual);
@@ -42,7 +42,7 @@ TEST_CASE("TestLoggerProperties::get_keys_of_type", "[test get_keys_of_type]") {
class TestLoggerConfiguration : public logging::LoggerConfiguration {
public:
- static std::shared_ptr<logging::internal::LoggerNamespace> initialize_namespaces(const std::shared_ptr<logging::LoggerProperties> &logger_properties) {
+ static std::shared_ptr<logging::internal::LoggerNamespace> initialize_namespaces(const std::shared_ptr<logging::LoggerProperties> &logger_properties) {
return logging::LoggerConfiguration::initialize_namespaces(logger_properties);
}
static std::shared_ptr<spdlog::logger> get_logger(const std::shared_ptr<logging::internal::LoggerNamespace> &root_namespace, const std::string &name, std::shared_ptr<spdlog::formatter> formatter) {
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/LoggerTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/LoggerTests.cpp b/libminifi/test/unit/LoggerTests.cpp
index 5f87fe6..c7509f5 100644
--- a/libminifi/test/unit/LoggerTests.cpp
+++ b/libminifi/test/unit/LoggerTests.cpp
@@ -27,10 +27,7 @@ TEST_CASE("Test log Levels", "[ttl1]") {
std::shared_ptr<logging::Logger> logger = logging::LoggerFactory<logging::Logger>::getLogger();
logger->log_info("hello %s", "world");
- REQUIRE(
- true
- == LogTestController::getInstance().contains(
- "[org::apache::nifi::minifi::core::logging::Logger] [info] hello world"));
+ REQUIRE(true == LogTestController::getInstance().contains("[org::apache::nifi::minifi::core::logging::Logger] [info] hello world"));
LogTestController::getInstance().reset();
}
@@ -39,10 +36,7 @@ TEST_CASE("Test log Levels debug", "[ttl2]") {
std::shared_ptr<logging::Logger> logger = logging::LoggerFactory<logging::Logger>::getLogger();
logger->log_debug("hello %s", "world");
- REQUIRE(
- true
- == LogTestController::getInstance().contains(
- "[org::apache::nifi::minifi::core::logging::Logger] [debug] hello world"));
+ REQUIRE(true == LogTestController::getInstance().contains("[org::apache::nifi::minifi::core::logging::Logger] [debug] hello world"));
LogTestController::getInstance().reset();
}
@@ -51,10 +45,7 @@ TEST_CASE("Test log Levels trace", "[ttl3]") {
std::shared_ptr<logging::Logger> logger = logging::LoggerFactory<logging::Logger>::getLogger();
logger->log_trace("hello %s", "world");
- REQUIRE(
- true
- == LogTestController::getInstance().contains(
- "[org::apache::nifi::minifi::core::logging::Logger] [trace] hello world"));
+ REQUIRE(true == LogTestController::getInstance().contains("[org::apache::nifi::minifi::core::logging::Logger] [trace] hello world"));
LogTestController::getInstance().reset();
}
@@ -63,10 +54,7 @@ TEST_CASE("Test log Levels error", "[ttl4]") {
std::shared_ptr<logging::Logger> logger = logging::LoggerFactory<logging::Logger>::getLogger();
logger->log_error("hello %s", "world");
- REQUIRE(
- true
- == LogTestController::getInstance().contains(
- "[org::apache::nifi::minifi::core::logging::Logger] [error] hello world"));
+ REQUIRE(true == LogTestController::getInstance().contains("[org::apache::nifi::minifi::core::logging::Logger] [error] hello world"));
LogTestController::getInstance().reset();
}
@@ -75,17 +63,11 @@ TEST_CASE("Test log Levels change", "[ttl5]") {
std::shared_ptr<logging::Logger> logger = logging::LoggerFactory<logging::Logger>::getLogger();
logger->log_error("hello %s", "world");
- REQUIRE(
- true
- == LogTestController::getInstance().contains(
- "[org::apache::nifi::minifi::core::logging::Logger] [error] hello world"));
+ REQUIRE(true == LogTestController::getInstance().contains("[org::apache::nifi::minifi::core::logging::Logger] [error] hello world"));
LogTestController::getInstance().reset();
LogTestController::getInstance().setOff<logging::Logger>();
logger->log_error("hello %s", "world");
- REQUIRE(
- false
- == LogTestController::getInstance().contains(
- "[org::apache::nifi::minifi::core::logging::Logger] [error] hello world"));
+ REQUIRE(false == LogTestController::getInstance().contains("[org::apache::nifi::minifi::core::logging::Logger] [error] hello world"));
LogTestController::getInstance().reset();
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/MockClasses.h
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/MockClasses.h b/libminifi/test/unit/MockClasses.h
index 0aa4235..00eaf82 100644
--- a/libminifi/test/unit/MockClasses.h
+++ b/libminifi/test/unit/MockClasses.h
@@ -104,23 +104,18 @@ class MockProcessor : public core::Processor {
}
// OnTrigger method, implemented by NiFi Processor Designer
- virtual void onTrigger(core::ProcessContext *context,
- core::ProcessSession *session) {
+ virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
std::string linked_service = "";
getProperty("linkedService", linked_service);
if (!IsNullOrEmpty(linked_service)) {
- std::shared_ptr<core::controller::ControllerService> service = context
- ->getControllerService(linked_service);
+ std::shared_ptr<core::controller::ControllerService> service = context->getControllerService(linked_service);
std::lock_guard<std::mutex> lock(control_mutex);
if (!disabled.load()) {
assert(true == context->isControllerServiceEnabled(linked_service));
assert(nullptr != service);
- assert(
- "pushitrealgood"
- == std::static_pointer_cast<MockControllerService>(service)
- ->doSomething());
+ assert("pushitrealgood" == std::static_pointer_cast<MockControllerService>(service)->doSomething());
} else {
assert(false == context->isControllerServiceEnabled(linked_service));
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/ProcessorTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ProcessorTests.cpp b/libminifi/test/unit/ProcessorTests.cpp
index 491ca8f..ac2b54e 100644
--- a/libminifi/test/unit/ProcessorTests.cpp
+++ b/libminifi/test/unit/ProcessorTests.cpp
@@ -38,28 +38,21 @@
TEST_CASE("Test Creation of GetFile", "[getfileCreate]") {
TestController testController;
- std::shared_ptr<core::Processor> processor = std::make_shared<
- org::apache::nifi::minifi::processors::GetFile>("processorname");
+ std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::GetFile>("processorname");
REQUIRE(processor->getName() == "processorname");
}
TEST_CASE("Test Find file", "[getfileCreate2]") {
TestController testController;
- std::shared_ptr<core::Processor> processor = std::make_shared<
- org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
+ std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
- std::shared_ptr<core::Processor> processorReport =
- std::make_shared<
- org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask>(
- std::make_shared<org::apache::nifi::minifi::io::StreamFactory>(
- std::make_shared<org::apache::nifi::minifi::Configure>()));
+ std::shared_ptr<core::Processor> processorReport = std::make_shared<org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask>(
+ std::make_shared<org::apache::nifi::minifi::io::StreamFactory>(std::make_shared<org::apache::nifi::minifi::Configure>()));
- std::shared_ptr<core::Repository> test_repo =
- std::make_shared<TestRepository>();
+ std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>();
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
+ std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo);
char format[] = "/tmp/gt.XXXXXX";
char *dir = testController.createTempDirectory(format);
@@ -67,8 +60,7 @@ TEST_CASE("Test Find file", "[getfileCreate2]") {
uuid_t processoruuid;
REQUIRE(true == processor->getUUID(processoruuid));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(test_repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(test_repo, "getfileCreate2Connection");
connection->setRelationship(core::Relationship("success", "description"));
// link the connections so that we can test results at the end for this
@@ -82,12 +74,10 @@ TEST_CASE("Test Find file", "[getfileCreate2]") {
REQUIRE(dir != NULL);
core::ProcessorNode node(processor);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
core::ProcessContext context(node, controller_services_provider, test_repo);
core::ProcessSessionFactory factory(&context);
- context.setProperty(org::apache::nifi::minifi::processors::GetFile::Directory,
- dir);
+ context.setProperty(org::apache::nifi::minifi::processors::GetFile::Directory, dir);
core::ProcessSession session(&context);
processor->onSchedule(&context, &factory);
@@ -131,9 +121,7 @@ TEST_CASE("Test Find file", "[getfileCreate2]") {
for (auto entry : repo->getRepoMap()) {
provenance::ProvenanceEventRecord newRecord;
- newRecord.DeSerialize(
- reinterpret_cast<uint8_t*>(const_cast<char*>(entry.second.data())),
- entry.second.length());
+ newRecord.DeSerialize(reinterpret_cast<uint8_t*>(const_cast<char*>(entry.second.data())), entry.second.length());
bool found = false;
for (auto provRec : records) {
@@ -153,45 +141,32 @@ TEST_CASE("Test Find file", "[getfileCreate2]") {
}
core::ProcessorNode nodeReport(processorReport);
- core::ProcessContext contextReport(nodeReport, controller_services_provider,
- test_repo);
+ core::ProcessContext contextReport(nodeReport, controller_services_provider, test_repo);
core::ProcessSessionFactory factoryReport(&contextReport);
core::ProcessSession sessionReport(&contextReport);
processorReport->onSchedule(&contextReport, &factoryReport);
- std::shared_ptr<
- org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask> taskReport =
- std::static_pointer_cast<
- org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask>(
- processorReport);
+ std::shared_ptr<org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask> taskReport = std::static_pointer_cast<
+ org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask>(processorReport);
taskReport->setBatchSize(1);
std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> recordsReport;
processorReport->incrementActiveTasks();
processorReport->setScheduledState(core::ScheduledState::RUNNING);
std::string jsonStr;
repo->getProvenanceRecord(recordsReport, 1);
- taskReport->getJsonReport(&contextReport, &sessionReport, recordsReport,
- jsonStr);
+ taskReport->getJsonReport(&contextReport, &sessionReport, recordsReport, jsonStr);
REQUIRE(recordsReport.size() == 1);
- REQUIRE(
- taskReport->getName()
- == std::string(
- org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask::ReportTaskName));
- REQUIRE(
- jsonStr.find("\"componentType\" : \"getfileCreate2\"")
- != std::string::npos);
+ REQUIRE(taskReport->getName() == std::string(org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask::ReportTaskName));
+ REQUIRE(jsonStr.find("\"componentType\" : \"getfileCreate2\"") != std::string::npos);
}
TEST_CASE("Test GetFileLikeIt'sThreaded", "[getfileCreate3]") {
TestController testController;
- std::shared_ptr<core::Processor> processor = std::make_shared<
- org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
+ std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
- std::shared_ptr<core::Repository> test_repo =
- std::make_shared<TestRepository>();
+ std::shared_ptr<core::Repository> test_repo = std::make_shared<TestRepository>();
- std::shared_ptr<TestRepository> repo =
- std::static_pointer_cast<TestRepository>(test_repo);
+ std::shared_ptr<TestRepository> repo = std::static_pointer_cast<TestRepository>(test_repo);
char format[] = "/tmp/gt.XXXXXX";
char *dir = testController.createTempDirectory(format);
@@ -199,8 +174,7 @@ TEST_CASE("Test GetFileLikeIt'sThreaded", "[getfileCreate3]") {
uuid_t processoruuid;
REQUIRE(true == processor->getUUID(processoruuid));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(test_repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(test_repo, "getfileCreate2Connection");
connection->setRelationship(core::Relationship("success", "description"));
// link the connections so that we can test results at the end for this
@@ -214,12 +188,10 @@ TEST_CASE("Test GetFileLikeIt'sThreaded", "[getfileCreate3]") {
REQUIRE(dir != NULL);
core::ProcessorNode node(processor);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
core::ProcessContext context(node, controller_services_provider, test_repo);
core::ProcessSessionFactory factory(&context);
- context.setProperty(org::apache::nifi::minifi::processors::GetFile::Directory,
- dir);
+ context.setProperty(org::apache::nifi::minifi::processors::GetFile::Directory, dir);
// replicate 10 threads
processor->setScheduledState(core::ScheduledState::RUNNING);
processor->onSchedule(&context, &factory);
@@ -234,8 +206,7 @@ TEST_CASE("Test GetFileLikeIt'sThreaded", "[getfileCreate3]") {
processor->onTrigger(&context, &session);
provenance::ProvenanceReporter *reporter = session.getProvenanceReporter();
- std::set<provenance::ProvenanceEventRecord*> records =
- reporter->getEvents();
+ std::set<provenance::ProvenanceEventRecord*> records = reporter->getEvents();
record = session.get();
REQUIRE(record == nullptr);
REQUIRE(records.size() == 0);
@@ -275,11 +246,9 @@ TEST_CASE("LogAttributeTest", "[getfileCreate3]") {
std::shared_ptr<core::Repository> repo = std::make_shared<TestRepository>();
- std::shared_ptr<core::Processor> processor = std::make_shared<
- org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
+ std::shared_ptr<core::Processor> processor = std::make_shared<org::apache::nifi::minifi::processors::GetFile>("getfileCreate2");
- std::shared_ptr<core::Processor> logAttribute = std::make_shared<
- org::apache::nifi::minifi::processors::LogAttribute>("logattribute");
+ std::shared_ptr<core::Processor> logAttribute = std::make_shared<org::apache::nifi::minifi::processors::LogAttribute>("logattribute");
char format[] = "/tmp/gt.XXXXXX";
char *dir = testController.createTempDirectory(format);
@@ -290,12 +259,10 @@ TEST_CASE("LogAttributeTest", "[getfileCreate3]") {
uuid_t logattribute_uuid;
REQUIRE(true == logAttribute->getUUID(logattribute_uuid));
- std::shared_ptr<minifi::Connection> connection = std::make_shared<
- minifi::Connection>(repo, "getfileCreate2Connection");
+ std::shared_ptr<minifi::Connection> connection = std::make_shared<minifi::Connection>(repo, "getfileCreate2Connection");
connection->setRelationship(core::Relationship("success", "description"));
- std::shared_ptr<minifi::Connection> connection2 = std::make_shared<
- minifi::Connection>(repo, "logattribute");
+ std::shared_ptr<minifi::Connection> connection2 = std::make_shared<minifi::Connection>(repo, "logattribute");
connection2->setRelationship(core::Relationship("success", "description"));
// link the connections so that we can test results at the end for this
@@ -317,12 +284,10 @@ TEST_CASE("LogAttributeTest", "[getfileCreate3]") {
core::ProcessorNode node(processor);
core::ProcessorNode node2(logAttribute);
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider =
- nullptr;
+ std::shared_ptr<core::controller::ControllerServiceProvider> controller_services_provider = nullptr;
core::ProcessContext context(node, controller_services_provider, repo);
core::ProcessContext context2(node2, controller_services_provider, repo);
- context.setProperty(org::apache::nifi::minifi::processors::GetFile::Directory,
- dir);
+ context.setProperty(org::apache::nifi::minifi::processors::GetFile::Directory, dir);
core::ProcessSession session(&context);
core::ProcessSession session2(&context2);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/PropertyTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/PropertyTests.cpp b/libminifi/test/unit/PropertyTests.cpp
index a2d5858..af85579 100644
--- a/libminifi/test/unit/PropertyTests.cpp
+++ b/libminifi/test/unit/PropertyTests.cpp
@@ -23,22 +23,14 @@
TEST_CASE("Test Boolean Conversion", "[testboolConversion]") {
bool b;
- REQUIRE(
- true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("true", b));
- REQUIRE(
- true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("True", b));
- REQUIRE(
- true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("TRue", b));
- REQUIRE(
- true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("tRUE", b));
- REQUIRE(
- false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("FALSE", b));
- REQUIRE(
- false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("FALLSEY", b));
- REQUIRE(
- false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("FaLSE", b));
- REQUIRE(
- false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("false", b));
+ REQUIRE(true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("true", b));
+ REQUIRE(true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("True", b));
+ REQUIRE(true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("TRue", b));
+ REQUIRE(true == org::apache::nifi::minifi::utils::StringUtils::StringToBool("tRUE", b));
+ REQUIRE(false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("FALSE", b));
+ REQUIRE(false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("FALLSEY", b));
+ REQUIRE(false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("FaLSE", b));
+ REQUIRE(false == org::apache::nifi::minifi::utils::StringUtils::StringToBool("false", b));
}
TEST_CASE("Test Trimmer Right", "[testTrims]") {
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/ProvenanceTestHelper.h
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ProvenanceTestHelper.h b/libminifi/test/unit/ProvenanceTestHelper.h
index 585c0d3..17e6078 100644
--- a/libminifi/test/unit/ProvenanceTestHelper.h
+++ b/libminifi/test/unit/ProvenanceTestHelper.h
@@ -42,9 +42,7 @@ class TestRepository : public core::Repository {
}
bool Put(std::string key, uint8_t *buf, int bufLen) {
- repositoryResults.insert(
- std::pair<std::string, std::string>(
- key, std::string((const char*) buf, bufLen)));
+ repositoryResults.insert(std::pair<std::string, std::string>(key, std::string((const char*) buf, bufLen)));
return true;
}
// Delete
@@ -67,17 +65,13 @@ class TestRepository : public core::Repository {
return repositoryResults;
}
- void getProvenanceRecord(
- std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records,
- int maxSize) {
+ void getProvenanceRecord(std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records, int maxSize) {
for (auto entry : repositoryResults) {
if (records.size() >= maxSize)
break;
- std::shared_ptr<provenance::ProvenanceEventRecord> eventRead =
- std::make_shared<provenance::ProvenanceEventRecord>();
+ std::shared_ptr<provenance::ProvenanceEventRecord> eventRead = std::make_shared<provenance::ProvenanceEventRecord>();
- if (eventRead->DeSerialize((uint8_t*) entry.second.data(),
- entry.second.length())) {
+ if (eventRead->DeSerialize((uint8_t*) entry.second.data(), entry.second.length())) {
records.push_back(eventRead);
}
}
@@ -93,7 +87,7 @@ class TestRepository : public core::Repository {
class TestFlowRepository : public core::repository::FlowFileRepository {
public:
TestFlowRepository()
- : core::repository::FlowFileRepository("ff","./dir", 1000, 100, 0) {
+ : core::repository::FlowFileRepository("ff", "./dir", 1000, 100, 0) {
}
// initialize
bool initialize() {
@@ -106,9 +100,7 @@ class TestFlowRepository : public core::repository::FlowFileRepository {
}
bool Put(std::string key, uint8_t *buf, int bufLen) {
- repositoryResults.insert(
- std::pair<std::string, std::string>(
- key, std::string((const char*) buf, bufLen)));
+ repositoryResults.insert(std::pair<std::string, std::string>(key, std::string((const char*) buf, bufLen)));
return true;
}
// Delete
@@ -131,17 +123,13 @@ class TestFlowRepository : public core::repository::FlowFileRepository {
return repositoryResults;
}
- void getProvenanceRecord(
- std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records,
- int maxSize) {
+ void getProvenanceRecord(std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records, int maxSize) {
for (auto entry : repositoryResults) {
if (records.size() >= maxSize)
break;
- std::shared_ptr<provenance::ProvenanceEventRecord> eventRead =
- std::make_shared<provenance::ProvenanceEventRecord>();
+ std::shared_ptr<provenance::ProvenanceEventRecord> eventRead = std::make_shared<provenance::ProvenanceEventRecord>();
- if (eventRead->DeSerialize((uint8_t*) entry.second.data(),
- entry.second.length())) {
+ if (eventRead->DeSerialize((uint8_t*) entry.second.data(), entry.second.length())) {
records.push_back(eventRead);
}
}
@@ -157,11 +145,8 @@ class TestFlowRepository : public core::repository::FlowFileRepository {
class TestFlowController : public minifi::FlowController {
public:
- TestFlowController(std::shared_ptr<core::Repository> repo,
- std::shared_ptr<core::Repository> flow_file_repo)
- : minifi::FlowController(repo, flow_file_repo,
- std::make_shared<minifi::Configure>(), nullptr,
- "", true) {
+ TestFlowController(std::shared_ptr<core::Repository> repo, std::shared_ptr<core::Repository> flow_file_repo)
+ : minifi::FlowController(repo, flow_file_repo, std::make_shared<minifi::Configure>(), nullptr, "", true) {
}
~TestFlowController() {
@@ -194,8 +179,7 @@ class TestFlowController : public minifi::FlowController {
return true;
}
- std::shared_ptr<core::Processor> createProcessor(std::string name,
- uuid_t uuid) {
+ std::shared_ptr<core::Processor> createProcessor(std::string name, uuid_t uuid) {
return 0;
}
@@ -207,8 +191,7 @@ class TestFlowController : public minifi::FlowController {
return 0;
}
- std::shared_ptr<minifi::Connection> createConnection(std::string name,
- uuid_t uuid) {
+ std::shared_ptr<minifi::Connection> createConnection(std::string name, uuid_t uuid) {
return 0;
}
protected:
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/ProvenanceTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/ProvenanceTests.cpp b/libminifi/test/unit/ProvenanceTests.cpp
index 993fe58..6a58597 100644
--- a/libminifi/test/unit/ProvenanceTests.cpp
+++ b/libminifi/test/unit/ProvenanceTests.cpp
@@ -30,17 +30,13 @@
#include "core/repository/VolatileRepository.h"
TEST_CASE("Test Provenance record create", "[Testprovenance::ProvenanceEventRecord]") {
- provenance::ProvenanceEventRecord record1(
- provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE, "blah",
- "blahblah");
+ provenance::ProvenanceEventRecord record1(provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE, "blah", "blahblah");
REQUIRE(record1.getAttributes().size() == 0);
REQUIRE(record1.getAlternateIdentifierUri().length() == 0);
}
TEST_CASE("Test Provenance record serialization", "[Testprovenance::ProvenanceEventRecordSerializeDeser]") {
- provenance::ProvenanceEventRecord record1(
- provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE,
- "componentid", "componenttype");
+ provenance::ProvenanceEventRecord record1(provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE, "componentid", "componenttype");
std::string eventId = record1.getEventId();
@@ -48,8 +44,7 @@ TEST_CASE("Test Provenance record serialization", "[Testprovenance::ProvenanceEv
record1.setDetails(smileyface);
uint64_t sample = 65555;
- std::shared_ptr<core::Repository> testRepository = std::make_shared<
- TestRepository>();
+ std::shared_ptr<core::Repository> testRepository = std::make_shared<TestRepository>();
record1.setEventDuration(sample);
record1.Serialize(testRepository);
@@ -64,24 +59,18 @@ TEST_CASE("Test Provenance record serialization", "[Testprovenance::ProvenanceEv
}
TEST_CASE("Test Flowfile record added to provenance", "[TestFlowAndProv1]") {
- provenance::ProvenanceEventRecord record1(
- provenance::ProvenanceEventRecord::ProvenanceEventType::CLONE,
- "componentid", "componenttype");
+ provenance::ProvenanceEventRecord record1(provenance::ProvenanceEventRecord::ProvenanceEventType::CLONE, "componentid", "componenttype");
std::string eventId = record1.getEventId();
std::map<std::string, std::string> attributes;
attributes.insert(std::pair<std::string, std::string>("potato", "potatoe"));
attributes.insert(std::pair<std::string, std::string>("tomato", "tomatoe"));
- std::shared_ptr<core::repository::FlowFileRepository> frepo =
- std::make_shared<core::repository::FlowFileRepository>(
- "ff", "./content_repository", 0, 0, 0);
- std::shared_ptr<minifi::FlowFileRecord> ffr1 = std::make_shared<
- minifi::FlowFileRecord>(frepo, attributes);
+ std::shared_ptr<core::repository::FlowFileRepository> frepo = std::make_shared<core::repository::FlowFileRepository>("ff", "./content_repository", 0, 0, 0);
+ std::shared_ptr<minifi::FlowFileRecord> ffr1 = std::make_shared<minifi::FlowFileRecord>(frepo, attributes);
record1.addChildFlowFile(ffr1);
uint64_t sample = 65555;
- std::shared_ptr<core::Repository> testRepository = std::make_shared<
- TestRepository>();
+ std::shared_ptr<core::Repository> testRepository = std::make_shared<TestRepository>();
record1.setEventDuration(sample);
record1.Serialize(testRepository);
@@ -96,9 +85,7 @@ TEST_CASE("Test Flowfile record added to provenance", "[TestFlowAndProv1]") {
}
TEST_CASE("Test Provenance record serialization Volatile", "[Testprovenance::ProvenanceEventRecordSerializeDeser]") {
- provenance::ProvenanceEventRecord record1(
- provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE,
- "componentid", "componenttype");
+ provenance::ProvenanceEventRecord record1(provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE, "componentid", "componenttype");
std::string eventId = record1.getEventId();
@@ -107,8 +94,7 @@ TEST_CASE("Test Provenance record serialization Volatile", "[Testprovenance::Pro
uint64_t sample = 65555;
- std::shared_ptr<core::Repository> testRepository = std::make_shared<
- core::repository::VolatileRepository>();
+ std::shared_ptr<core::Repository> testRepository = std::make_shared<core::repository::VolatileRepository>();
testRepository->initialize(0);
record1.setEventDuration(sample);
@@ -124,24 +110,19 @@ TEST_CASE("Test Provenance record serialization Volatile", "[Testprovenance::Pro
}
TEST_CASE("Test Flowfile record added to provenance using Volatile Repo", "[TestFlowAndProv1]") {
- provenance::ProvenanceEventRecord record1(
- provenance::ProvenanceEventRecord::ProvenanceEventType::CLONE,
- "componentid", "componenttype");
+ provenance::ProvenanceEventRecord record1(provenance::ProvenanceEventRecord::ProvenanceEventType::CLONE, "componentid", "componenttype");
std::string eventId = record1.getEventId();
std::map<std::string, std::string> attributes;
attributes.insert(std::pair<std::string, std::string>("potato", "potatoe"));
attributes.insert(std::pair<std::string, std::string>("tomato", "tomatoe"));
- std::shared_ptr<core::Repository> frepo = std::make_shared<
- core::repository::VolatileRepository>();
+ std::shared_ptr<core::Repository> frepo = std::make_shared<core::repository::VolatileRepository>();
frepo->initialize(0);
- std::shared_ptr<minifi::FlowFileRecord> ffr1 = std::make_shared<
- minifi::FlowFileRecord>(frepo, attributes);
+ std::shared_ptr<minifi::FlowFileRecord> ffr1 = std::make_shared<minifi::FlowFileRecord>(frepo, attributes);
record1.addChildFlowFile(ffr1);
uint64_t sample = 65555;
- std::shared_ptr<core::Repository> testRepository = std::make_shared<
- core::repository::VolatileRepository>();
+ std::shared_ptr<core::Repository> testRepository = std::make_shared<core::repository::VolatileRepository>();
testRepository->initialize(0);
record1.setEventDuration(sample);
@@ -157,9 +138,7 @@ TEST_CASE("Test Flowfile record added to provenance using Volatile Repo", "[Test
}
TEST_CASE("Test Provenance record serialization NoOp", "[Testprovenance::ProvenanceEventRecordSerializeDeser]") {
- provenance::ProvenanceEventRecord record1(
- provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE,
- "componentid", "componenttype");
+ provenance::ProvenanceEventRecord record1(provenance::ProvenanceEventRecord::ProvenanceEventType::CREATE, "componentid", "componenttype");
std::string eventId = record1.getEventId();
@@ -168,8 +147,7 @@ TEST_CASE("Test Provenance record serialization NoOp", "[Testprovenance::Provena
uint64_t sample = 65555;
- std::shared_ptr<core::Repository> testRepository = std::make_shared<
- core::Repository>();
+ std::shared_ptr<core::Repository> testRepository = std::make_shared<core::Repository>();
testRepository->initialize(0);
record1.setEventDuration(sample);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/RepoTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/RepoTests.cpp b/libminifi/test/unit/RepoTests.cpp
index 34b1f35..4424a93 100644
--- a/libminifi/test/unit/RepoTests.cpp
+++ b/libminifi/test/unit/RepoTests.cpp
@@ -30,9 +30,7 @@ TEST_CASE("Test Repo Empty Value Attribute", "[TestFFR1]") {
TestController testController;
char format[] = "/tmp/testRepo.XXXXXX";
char *dir = testController.createTempDirectory(format);
- std::shared_ptr<core::repository::FlowFileRepository> repository =
- std::make_shared<core::repository::FlowFileRepository>("ff", dir, 0, 0,
- 1);
+ std::shared_ptr<core::repository::FlowFileRepository> repository = std::make_shared<core::repository::FlowFileRepository>("ff", dir, 0, 0, 1);
repository->initialize(std::make_shared<minifi::Configure>());
@@ -49,9 +47,7 @@ TEST_CASE("Test Repo Empty Key Attribute ", "[TestFFR2]") {
TestController testController;
char format[] = "/tmp/testRepo.XXXXXX";
char *dir = testController.createTempDirectory(format);
- std::shared_ptr<core::repository::FlowFileRepository> repository =
- std::make_shared<core::repository::FlowFileRepository>("ff", dir, 0, 0,
- 1);
+ std::shared_ptr<core::repository::FlowFileRepository> repository = std::make_shared<core::repository::FlowFileRepository>("ff", dir, 0, 0, 1);
repository->initialize(std::make_shared<minifi::Configure>());
@@ -70,12 +66,9 @@ TEST_CASE("Test Repo Key Attribute Verify ", "[TestFFR3]") {
TestController testController;
char format[] = "/tmp/testRepo.XXXXXX";
char *dir = testController.createTempDirectory(format);
- std::shared_ptr<core::repository::FlowFileRepository> repository =
- std::make_shared<core::repository::FlowFileRepository>("ff", dir, 0, 0,
- 1);
+ std::shared_ptr<core::repository::FlowFileRepository> repository = std::make_shared<core::repository::FlowFileRepository>("ff", dir, 0, 0, 1);
- repository->initialize(
- std::make_shared<org::apache::nifi::minifi::Configure>());
+ repository->initialize(std::make_shared<org::apache::nifi::minifi::Configure>());
minifi::FlowFileRecord record(repository);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/Site2SiteTests.cpp
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/Site2SiteTests.cpp b/libminifi/test/unit/Site2SiteTests.cpp
index 18878ad..2eef532 100644
--- a/libminifi/test/unit/Site2SiteTests.cpp
+++ b/libminifi/test/unit/Site2SiteTests.cpp
@@ -32,12 +32,8 @@
#define FMT_DEFAULT fmt_lower
TEST_CASE("TestSetPortId", "[S2S1]") {
- std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<
- minifi::Site2SitePeer>(
- new minifi::Site2SitePeer(
- std::unique_ptr<org::apache::nifi::minifi::io::DataStream>(
- new org::apache::nifi::minifi::io::DataStream()),
- "fake_host", 65433));
+ std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<minifi::Site2SitePeer>(
+ new minifi::Site2SitePeer(std::unique_ptr<org::apache::nifi::minifi::io::DataStream>(new org::apache::nifi::minifi::io::DataStream()), "fake_host", 65433));
minifi::Site2SiteClientProtocol protocol(std::move(peer));
@@ -53,12 +49,8 @@ TEST_CASE("TestSetPortId", "[S2S1]") {
}
TEST_CASE("TestSetPortIdUppercase", "[S2S2]") {
- std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<
- minifi::Site2SitePeer>(
- new minifi::Site2SitePeer(
- std::unique_ptr<org::apache::nifi::minifi::io::DataStream>(
- new org::apache::nifi::minifi::io::DataStream()),
- "fake_host", 65433));
+ std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<minifi::Site2SitePeer>(
+ new minifi::Site2SitePeer(std::unique_ptr<org::apache::nifi::minifi::io::DataStream>(new org::apache::nifi::minifi::io::DataStream()), "fake_host", 65433));
minifi::Site2SiteClientProtocol protocol(std::move(peer));
@@ -102,12 +94,8 @@ TEST_CASE("TestSiteToSiteVerifySend", "[S2S3]") {
sunny_path_bootstrap(collector);
- std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<
- minifi::Site2SitePeer>(
- new minifi::Site2SitePeer(
- std::unique_ptr<minifi::io::DataStream>(
- new org::apache::nifi::minifi::io::BaseStream(collector)),
- "fake_host", 65433));
+ std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<minifi::Site2SitePeer>(
+ new minifi::Site2SitePeer(std::unique_ptr<minifi::io::DataStream>(new org::apache::nifi::minifi::io::BaseStream(collector)), "fake_host", 65433));
minifi::Site2SiteClientProtocol protocol(std::move(peer));
@@ -137,9 +125,7 @@ TEST_CASE("TestSiteToSiteVerifySend", "[S2S3]") {
collector->get_next_client_response();
REQUIRE(collector->get_next_client_response() == "PORT_IDENTIFIER");
collector->get_next_client_response();
- REQUIRE(
- collector->get_next_client_response()
- == "c56a4180-65aa-42ec-a945-5fd21dec0538");
+ REQUIRE(collector->get_next_client_response() == "c56a4180-65aa-42ec-a945-5fd21dec0538");
collector->get_next_client_response();
REQUIRE(collector->get_next_client_response() == "REQUEST_EXPIRATION_MILLIS");
collector->get_next_client_response();
@@ -176,12 +162,8 @@ TEST_CASE("TestSiteToSiteVerifyNegotiationFail", "[S2S4]") {
collector->push_response(resp_code);
collector->push_response(resp_code);
- std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<
- minifi::Site2SitePeer>(
- new minifi::Site2SitePeer(
- std::unique_ptr<minifi::io::DataStream>(
- new org::apache::nifi::minifi::io::BaseStream(collector)),
- "fake_host", 65433));
+ std::unique_ptr<minifi::Site2SitePeer> peer = std::unique_ptr<minifi::Site2SitePeer>(
+ new minifi::Site2SitePeer(std::unique_ptr<minifi::io::DataStream>(new org::apache::nifi::minifi::io::BaseStream(collector)), "fake_host", 65433));
minifi::Site2SiteClientProtocol protocol(std::move(peer));
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/test/unit/SiteToSiteHelper.h
----------------------------------------------------------------------
diff --git a/libminifi/test/unit/SiteToSiteHelper.h b/libminifi/test/unit/SiteToSiteHelper.h
index 1876bde..586b17a 100755
--- a/libminifi/test/unit/SiteToSiteHelper.h
+++ b/libminifi/test/unit/SiteToSiteHelper.h
@@ -79,8 +79,7 @@ class SiteToSiteResponder : public minifi::io::BaseStream {
* @param stream stream from which we will read
* @return resulting read size
**/
- virtual int read(uint16_t &base_value, bool is_little_endian =
- minifi::io::EndiannessCheck::IS_LITTLE) {
+ virtual int read(uint16_t &base_value, bool is_little_endian = minifi::io::EndiannessCheck::IS_LITTLE) {
base_value = std::stoi(get_next_response());
return 2;
}
@@ -122,8 +121,7 @@ class SiteToSiteResponder : public minifi::io::BaseStream {
* @param stream stream from which we will read
* @return resulting read size
**/
- virtual int read(uint32_t &value, bool is_little_endian =
- minifi::io::EndiannessCheck::IS_LITTLE) {
+ virtual int read(uint32_t &value, bool is_little_endian = minifi::io::EndiannessCheck::IS_LITTLE) {
value = std::stoul(get_next_response());
return 4;
}
@@ -134,8 +132,7 @@ class SiteToSiteResponder : public minifi::io::BaseStream {
* @param stream stream from which we will read
* @return resulting read size
**/
- virtual int read(uint64_t &value, bool is_little_endian =
- minifi::io::EndiannessCheck::IS_LITTLE) {
+ virtual int read(uint64_t &value, bool is_little_endian = minifi::io::EndiannessCheck::IS_LITTLE) {
value = std::stoull(get_next_response());
return 8;
}
[4/9] nifi-minifi-cpp git commit: MINIFI-331: Apply formatter with
increased line length to source
Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/yaml/YamlConfiguration.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/yaml/YamlConfiguration.cpp b/libminifi/src/core/yaml/YamlConfiguration.cpp
index 7bf4f58..a11db2b 100644
--- a/libminifi/src/core/yaml/YamlConfiguration.cpp
+++ b/libminifi/src/core/yaml/YamlConfiguration.cpp
@@ -29,8 +29,7 @@ namespace nifi {
namespace minifi {
namespace core {
-core::ProcessGroup *YamlConfiguration::parseRootProcessGroupYaml(
- YAML::Node rootFlowNode) {
+core::ProcessGroup *YamlConfiguration::parseRootProcessGroupYaml(YAML::Node rootFlowNode) {
uuid_t uuid;
checkRequiredField(&rootFlowNode, "name", CONFIG_YAML_REMOTE_PROCESS_GROUP_KEY);
@@ -38,18 +37,15 @@ core::ProcessGroup *YamlConfiguration::parseRootProcessGroupYaml(
std::string id = getOrGenerateId(&rootFlowNode);
uuid_parse(id.c_str(), uuid);
- logger_->log_debug("parseRootProcessGroup: id => [%s], name => [%s]", id,
- flowName);
- std::unique_ptr<core::ProcessGroup> group =
- FlowConfiguration::createRootProcessGroup(flowName, uuid);
+ logger_->log_debug("parseRootProcessGroup: id => [%s], name => [%s]", id, flowName);
+ std::unique_ptr<core::ProcessGroup> group = FlowConfiguration::createRootProcessGroup(flowName, uuid);
this->name_ = flowName;
return group.release();
}
-void YamlConfiguration::parseProcessorNodeYaml(
- YAML::Node processorsNode, core::ProcessGroup * parentGroup) {
+void YamlConfiguration::parseProcessorNodeYaml(YAML::Node processorsNode, core::ProcessGroup * parentGroup) {
int64_t schedulingPeriod = -1;
int64_t penalizationPeriod = -1;
int64_t yieldPeriod = -1;
@@ -65,8 +61,7 @@ void YamlConfiguration::parseProcessorNodeYaml(
if (processorsNode) {
if (processorsNode.IsSequence()) {
// Evaluate sequence of processors
- for (YAML::const_iterator iter = processorsNode.begin();
- iter != processorsNode.end(); ++iter) {
+ for (YAML::const_iterator iter = processorsNode.begin(); iter != processorsNode.end(); ++iter) {
core::ProcessorConfig procCfg;
YAML::Node procNode = iter->as<YAML::Node>();
@@ -74,28 +69,23 @@ void YamlConfiguration::parseProcessorNodeYaml(
procCfg.name = procNode["name"].as<std::string>();
procCfg.id = getOrGenerateId(&procNode);
uuid_parse(procCfg.id.c_str(), uuid);
- logger_->log_debug("parseProcessorNode: name => [%s] id => [%s]",
- procCfg.name, procCfg.id);
+ logger_->log_debug("parseProcessorNode: name => [%s] id => [%s]", procCfg.name, procCfg.id);
checkRequiredField(&procNode, "class", CONFIG_YAML_PROCESSORS_KEY);
procCfg.javaClass = procNode["class"].as<std::string>();
- logger_->log_debug("parseProcessorNode: class => [%s]",
- procCfg.javaClass);
+ logger_->log_debug("parseProcessorNode: class => [%s]", procCfg.javaClass);
// Determine the processor name only from the Java class
int lastOfIdx = procCfg.javaClass.find_last_of(".");
if (lastOfIdx != std::string::npos) {
lastOfIdx++; // if a value is found, increment to move beyond the .
int nameLength = procCfg.javaClass.length() - lastOfIdx;
- std::string processorName = procCfg.javaClass.substr(lastOfIdx,
- nameLength);
+ std::string processorName = procCfg.javaClass.substr(lastOfIdx, nameLength);
processor = this->createProcessor(processorName, uuid);
}
if (!processor) {
- logger_->log_error("Could not create a processor %s with id %s",
- procCfg.name, procCfg.id);
- throw std::invalid_argument(
- "Could not create processor " + procCfg.name);
+ logger_->log_error("Could not create a processor %s with id %s", procCfg.name, procCfg.id);
+ throw std::invalid_argument("Could not create processor " + procCfg.name);
}
processor->setName(procCfg.name);
@@ -131,11 +121,8 @@ void YamlConfiguration::parseProcessorNodeYaml(
if (procNode["auto-terminated relationships list"]) {
YAML::Node autoTerminatedSequence = procNode["auto-terminated relationships list"];
std::vector<std::string> rawAutoTerminatedRelationshipValues;
- if (autoTerminatedSequence.IsSequence()
- && !autoTerminatedSequence.IsNull()
- && autoTerminatedSequence.size() > 0) {
- for (YAML::const_iterator relIter = autoTerminatedSequence.begin();
- relIter != autoTerminatedSequence.end(); ++relIter) {
+ if (autoTerminatedSequence.IsSequence() && !autoTerminatedSequence.IsNull() && autoTerminatedSequence.size() > 0) {
+ for (YAML::const_iterator relIter = autoTerminatedSequence.begin(); relIter != autoTerminatedSequence.end(); ++relIter) {
std::string autoTerminatedRel = relIter->as<std::string>();
rawAutoTerminatedRelationshipValues.push_back(autoTerminatedRel);
}
@@ -151,20 +138,17 @@ void YamlConfiguration::parseProcessorNodeYaml(
// Take care of scheduling
core::TimeUnit unit;
- if (core::Property::StringToTime(procCfg.schedulingPeriod, schedulingPeriod, unit)
- && core::Property::ConvertTimeUnitToNS(schedulingPeriod, unit, schedulingPeriod)) {
+ if (core::Property::StringToTime(procCfg.schedulingPeriod, schedulingPeriod, unit) && core::Property::ConvertTimeUnitToNS(schedulingPeriod, unit, schedulingPeriod)) {
logger_->log_debug("convert: parseProcessorNode: schedulingPeriod => [%d] ns", schedulingPeriod);
processor->setSchedulingPeriodNano(schedulingPeriod);
}
- if (core::Property::StringToTime(procCfg.penalizationPeriod, penalizationPeriod, unit)
- && core::Property::ConvertTimeUnitToMS(penalizationPeriod, unit, penalizationPeriod)) {
+ if (core::Property::StringToTime(procCfg.penalizationPeriod, penalizationPeriod, unit) && core::Property::ConvertTimeUnitToMS(penalizationPeriod, unit, penalizationPeriod)) {
logger_->log_debug("convert: parseProcessorNode: penalizationPeriod => [%d] ms", penalizationPeriod);
processor->setPenalizationPeriodMsec(penalizationPeriod);
}
- if (core::Property::StringToTime(procCfg.yieldPeriod, yieldPeriod, unit)
- && core::Property::ConvertTimeUnitToMS(yieldPeriod, unit, yieldPeriod)) {
+ if (core::Property::StringToTime(procCfg.yieldPeriod, yieldPeriod, unit) && core::Property::ConvertTimeUnitToMS(yieldPeriod, unit, yieldPeriod)) {
logger_->log_debug("convert: parseProcessorNode: yieldPeriod => [%d] ms", yieldPeriod);
processor->setYieldPeriodMsec(yieldPeriod);
}
@@ -174,16 +158,13 @@ void YamlConfiguration::parseProcessorNodeYaml(
if (procCfg.schedulingStrategy == "TIMER_DRIVEN") {
processor->setSchedulingStrategy(core::TIMER_DRIVEN);
- logger_->log_debug("setting scheduling strategy as %s",
- procCfg.schedulingStrategy);
+ logger_->log_debug("setting scheduling strategy as %s", procCfg.schedulingStrategy);
} else if (procCfg.schedulingStrategy == "EVENT_DRIVEN") {
processor->setSchedulingStrategy(core::EVENT_DRIVEN);
- logger_->log_debug("setting scheduling strategy as %s",
- procCfg.schedulingStrategy);
+ logger_->log_debug("setting scheduling strategy as %s", procCfg.schedulingStrategy);
} else {
processor->setSchedulingStrategy(core::CRON_DRIVEN);
- logger_->log_debug("setting scheduling strategy as %s",
- procCfg.schedulingStrategy);
+ logger_->log_debug("setting scheduling strategy as %s", procCfg.schedulingStrategy);
}
int64_t maxConcurrentTasks;
@@ -209,18 +190,15 @@ void YamlConfiguration::parseProcessorNodeYaml(
parentGroup->addProcessor(processor);
}
} else {
- throw new std::invalid_argument(
- "Cannot instantiate a MiNiFi instance without a defined Processors configuration node.");
+ throw new std::invalid_argument("Cannot instantiate a MiNiFi instance without a defined Processors configuration node.");
}
} else {
- throw new std::invalid_argument(
- "Cannot instantiate a MiNiFi instance without a defined "
- "Processors configuration node.");
+ throw new std::invalid_argument("Cannot instantiate a MiNiFi instance without a defined "
+ "Processors configuration node.");
}
}
-void YamlConfiguration::parseRemoteProcessGroupYaml(
- YAML::Node *rpgNode, core::ProcessGroup * parentGroup) {
+void YamlConfiguration::parseRemoteProcessGroupYaml(YAML::Node *rpgNode, core::ProcessGroup * parentGroup) {
uuid_t uuid;
std::string id;
@@ -231,8 +209,7 @@ void YamlConfiguration::parseRemoteProcessGroupYaml(
if (rpgNode) {
if (rpgNode->IsSequence()) {
- for (YAML::const_iterator iter = rpgNode->begin(); iter != rpgNode->end();
- ++iter) {
+ for (YAML::const_iterator iter = rpgNode->begin(); iter != rpgNode->end(); ++iter) {
YAML::Node currRpgNode = iter->as<YAML::Node>();
checkRequiredField(&currRpgNode, "name", CONFIG_YAML_REMOTE_PROCESS_GROUP_KEY);
@@ -258,12 +235,8 @@ void YamlConfiguration::parseRemoteProcessGroupYaml(
std::string yieldPeriod = currRpgNode["yield period"].as<std::string>();
logger_->log_debug("parseRemoteProcessGroupYaml: yield period => [%s]", yieldPeriod);
- if (core::Property::StringToTime(yieldPeriod, yieldPeriodValue, unit)
- && core::Property::ConvertTimeUnitToMS(yieldPeriodValue, unit,
- yieldPeriodValue) && group) {
- logger_->log_debug(
- "parseRemoteProcessGroupYaml: yieldPeriod => [%d] ms",
- yieldPeriodValue);
+ if (core::Property::StringToTime(yieldPeriod, yieldPeriodValue, unit) && core::Property::ConvertTimeUnitToMS(yieldPeriodValue, unit, yieldPeriodValue) && group) {
+ logger_->log_debug("parseRemoteProcessGroupYaml: yieldPeriod => [%d] ms", yieldPeriodValue);
group->setYieldPeriodMsec(yieldPeriodValue);
}
}
@@ -272,12 +245,8 @@ void YamlConfiguration::parseRemoteProcessGroupYaml(
std::string timeout = currRpgNode["timeout"].as<std::string>();
logger_->log_debug("parseRemoteProcessGroupYaml: timeout => [%s]", timeout);
- if (core::Property::StringToTime(timeout, timeoutValue, unit)
- && core::Property::ConvertTimeUnitToMS(timeoutValue, unit,
- timeoutValue) && group) {
- logger_->log_debug(
- "parseRemoteProcessGroupYaml: timeoutValue => [%d] ms",
- timeoutValue);
+ if (core::Property::StringToTime(timeout, timeoutValue, unit) && core::Property::ConvertTimeUnitToMS(timeoutValue, unit, timeoutValue) && group) {
+ logger_->log_debug("parseRemoteProcessGroupYaml: timeoutValue => [%d] ms", timeoutValue);
group->setTimeOut(timeoutValue);
}
}
@@ -288,8 +257,7 @@ void YamlConfiguration::parseRemoteProcessGroupYaml(
checkRequiredField(&currRpgNode, "Input Ports", CONFIG_YAML_REMOTE_PROCESS_GROUP_KEY);
YAML::Node inputPorts = currRpgNode["Input Ports"].as<YAML::Node>();
if (inputPorts && inputPorts.IsSequence()) {
- for (YAML::const_iterator portIter = inputPorts.begin();
- portIter != inputPorts.end(); ++portIter) {
+ for (YAML::const_iterator portIter = inputPorts.begin(); portIter != inputPorts.end(); ++portIter) {
logger_->log_debug("Got a current port, iterating...");
YAML::Node currPort = portIter->as<YAML::Node>();
@@ -299,8 +267,7 @@ void YamlConfiguration::parseRemoteProcessGroupYaml(
}
YAML::Node outputPorts = currRpgNode["Output Ports"].as<YAML::Node>();
if (outputPorts && outputPorts.IsSequence()) {
- for (YAML::const_iterator portIter = outputPorts.begin();
- portIter != outputPorts.end(); ++portIter) {
+ for (YAML::const_iterator portIter = outputPorts.begin(); portIter != outputPorts.end(); ++portIter) {
logger_->log_debug("Got a current port, iterating...");
YAML::Node currPort = portIter->as<YAML::Node>();
@@ -313,8 +280,7 @@ void YamlConfiguration::parseRemoteProcessGroupYaml(
}
}
-void YamlConfiguration::parseProvenanceReportingYaml(
- YAML::Node *reportNode, core::ProcessGroup * parentGroup) {
+void YamlConfiguration::parseProvenanceReportingYaml(YAML::Node *reportNode, core::ProcessGroup * parentGroup) {
uuid_t port_uuid;
int64_t schedulingPeriod = -1;
@@ -330,9 +296,7 @@ void YamlConfiguration::parseProvenanceReportingYaml(
std::shared_ptr<core::Processor> processor = nullptr;
processor = createProvenanceReportTask();
- std::shared_ptr<core::reporting::SiteToSiteProvenanceReportingTask> reportTask =
- std::static_pointer_cast<
- core::reporting::SiteToSiteProvenanceReportingTask>(processor);
+ std::shared_ptr<core::reporting::SiteToSiteProvenanceReportingTask> reportTask = std::static_pointer_cast<core::reporting::SiteToSiteProvenanceReportingTask>(processor);
YAML::Node node = reportNode->as<YAML::Node>();
@@ -354,21 +318,16 @@ void YamlConfiguration::parseProvenanceReportingYaml(
processor->setScheduledState(core::RUNNING);
core::TimeUnit unit;
- if (core::Property::StringToTime(schedulingPeriodStr, schedulingPeriod, unit)
- && core::Property::ConvertTimeUnitToNS(schedulingPeriod, unit,
- schedulingPeriod)) {
- logger_->log_debug("ProvenanceReportingTask schedulingPeriod %d ns",
- schedulingPeriod);
+ if (core::Property::StringToTime(schedulingPeriodStr, schedulingPeriod, unit) && core::Property::ConvertTimeUnitToNS(schedulingPeriod, unit, schedulingPeriod)) {
+ logger_->log_debug("ProvenanceReportingTask schedulingPeriod %d ns", schedulingPeriod);
processor->setSchedulingPeriodNano(schedulingPeriod);
}
if (schedulingStrategyStr == "TIMER_DRIVEN") {
processor->setSchedulingStrategy(core::TIMER_DRIVEN);
- logger_->log_debug("ProvenanceReportingTask scheduling strategy %s",
- schedulingStrategyStr);
+ logger_->log_debug("ProvenanceReportingTask scheduling strategy %s", schedulingStrategyStr);
} else {
- throw std::invalid_argument(
- "Invalid scheduling strategy " + schedulingStrategyStr);
+ throw std::invalid_argument("Invalid scheduling strategy " + schedulingStrategyStr);
}
reportTask->setHost(hostStr);
@@ -387,19 +346,18 @@ void YamlConfiguration::parseProvenanceReportingYaml(
}
}
-void YamlConfiguration::parseControllerServices(
- YAML::Node *controllerServicesNode) {
+void YamlConfiguration::parseControllerServices(YAML::Node *controllerServicesNode) {
if (!IsNullOrEmpty(controllerServicesNode)) {
if (controllerServicesNode->IsSequence()) {
for (auto iter : *controllerServicesNode) {
YAML::Node controllerServiceNode = iter.as<YAML::Node>();
try {
checkRequiredField(&controllerServiceNode, "name",
- CONFIG_YAML_CONTROLLER_SERVICES_KEY);
+ CONFIG_YAML_CONTROLLER_SERVICES_KEY);
checkRequiredField(&controllerServiceNode, "id",
- CONFIG_YAML_CONTROLLER_SERVICES_KEY);
+ CONFIG_YAML_CONTROLLER_SERVICES_KEY);
checkRequiredField(&controllerServiceNode, "class",
- CONFIG_YAML_CONTROLLER_SERVICES_KEY);
+ CONFIG_YAML_CONTROLLER_SERVICES_KEY);
auto name = controllerServiceNode["name"].as<std::string>();
auto id = controllerServiceNode["id"].as<std::string>();
@@ -407,42 +365,28 @@ void YamlConfiguration::parseControllerServices(
uuid_t uuid;
uuid_parse(id.c_str(), uuid);
- auto controller_service_node = createControllerService(type, name,
- uuid);
+ auto controller_service_node = createControllerService(type, name, uuid);
if (nullptr != controller_service_node) {
- logger_->log_debug(
- "Created Controller Service with UUID %s and name %s", id,
- name);
+ logger_->log_debug("Created Controller Service with UUID %s and name %s", id, name);
controller_service_node->initialize();
YAML::Node propertiesNode = controllerServiceNode["Properties"];
// we should propogate propertiets to the node and to the implementation
- parsePropertiesNodeYaml(
- &propertiesNode,
- std::static_pointer_cast<core::ConfigurableComponent>(
- controller_service_node));
- if (controller_service_node->getControllerServiceImplementation()
- != nullptr) {
- parsePropertiesNodeYaml(
- &propertiesNode,
- std::static_pointer_cast<core::ConfigurableComponent>(
- controller_service_node
- ->getControllerServiceImplementation()));
+ parsePropertiesNodeYaml(&propertiesNode, std::static_pointer_cast<core::ConfigurableComponent>(controller_service_node));
+ if (controller_service_node->getControllerServiceImplementation() != nullptr) {
+ parsePropertiesNodeYaml(&propertiesNode, std::static_pointer_cast<core::ConfigurableComponent>(controller_service_node->getControllerServiceImplementation()));
}
}
controller_services_->put(id, controller_service_node);
controller_services_->put(name, controller_service_node);
} catch (YAML::InvalidNode &in) {
- throw Exception(
- ExceptionType::GENERAL_EXCEPTION,
- "Name, id, and class must be specified for controller services");
+ throw Exception(ExceptionType::GENERAL_EXCEPTION, "Name, id, and class must be specified for controller services");
}
}
}
}
}
-void YamlConfiguration::parseConnectionYaml(YAML::Node *connectionsNode,
- core::ProcessGroup *parent) {
+void YamlConfiguration::parseConnectionYaml(YAML::Node *connectionsNode, core::ProcessGroup *parent) {
if (!parent) {
logger_->log_error("parseProcessNode: no parent group was provided");
return;
@@ -450,8 +394,7 @@ void YamlConfiguration::parseConnectionYaml(YAML::Node *connectionsNode,
if (connectionsNode) {
if (connectionsNode->IsSequence()) {
- for (YAML::const_iterator iter = connectionsNode->begin();
- iter != connectionsNode->end(); ++iter) {
+ for (YAML::const_iterator iter = connectionsNode->begin(); iter != connectionsNode->end(); ++iter) {
YAML::Node connectionNode = iter->as<YAML::Node>();
std::shared_ptr<minifi::Connection> connection = nullptr;
@@ -462,15 +405,13 @@ void YamlConfiguration::parseConnectionYaml(YAML::Node *connectionsNode,
std::string id = getOrGenerateId(&connectionNode);
uuid_parse(id.c_str(), uuid);
connection = this->createConnection(name, uuid);
- logger_->log_debug("Created connection with UUID %s and name %s", id,
- name);
+ logger_->log_debug("Created connection with UUID %s and name %s", id, name);
// Configure connection source
checkRequiredField(&connectionNode, "source relationship name", CONFIG_YAML_CONNECTIONS_KEY);
auto rawRelationship = connectionNode["source relationship name"].as<std::string>();
core::Relationship relationship(rawRelationship, "");
- logger_->log_debug("parseConnection: relationship => [%s]",
- rawRelationship);
+ logger_->log_debug("parseConnection: relationship => [%s]", rawRelationship);
if (connection) {
connection->setRelationship(relationship);
}
@@ -481,7 +422,8 @@ void YamlConfiguration::parseConnectionYaml(YAML::Node *connectionsNode,
std::string connectionSrcProcId = connectionNode["source id"].as<std::string>();
uuid_parse(connectionSrcProcId.c_str(), srcUUID);
logger_->log_debug("Using 'source id' to match source with same id for "
- "connection '%s': source id => [%s]", name, connectionSrcProcId);
+ "connection '%s': source id => [%s]",
+ name, connectionSrcProcId);
} else {
// if we don't have a source id, try to resolve using source name. config schema v2 will make this unnecessary
checkRequiredField(&connectionNode, "source name", CONFIG_YAML_CONNECTIONS_KEY);
@@ -491,20 +433,20 @@ void YamlConfiguration::parseConnectionYaml(YAML::Node *connectionsNode,
// the source name is a remote port id, so use that as the source id
uuid_copy(srcUUID, tmpUUID);
logger_->log_debug("Using 'source name' containing a remote port id to match the source for "
- "connection '%s': source name => [%s]", name, connectionSrcProcName);
+ "connection '%s': source name => [%s]",
+ name, connectionSrcProcName);
} else {
// lastly, look the processor up by name
auto srcProcessor = parent->findProcessor(connectionSrcProcName);
if (NULL != srcProcessor) {
srcProcessor->getUUID(srcUUID);
logger_->log_debug("Using 'source name' to match source with same name for "
- "connection '%s': source name => [%s]", name, connectionSrcProcName);
+ "connection '%s': source name => [%s]",
+ name, connectionSrcProcName);
} else {
// we ran out of ways to discover the source processor
- logger_->log_error(
- "Could not locate a source with name %s to create a connection", connectionSrcProcName);
- throw std::invalid_argument(
- "Could not locate a source with name " + connectionSrcProcName + " to create a connection ");
+ logger_->log_error("Could not locate a source with name %s to create a connection", connectionSrcProcName);
+ throw std::invalid_argument("Could not locate a source with name " + connectionSrcProcName + " to create a connection ");
}
}
}
@@ -516,7 +458,8 @@ void YamlConfiguration::parseConnectionYaml(YAML::Node *connectionsNode,
std::string connectionDestProcId = connectionNode["destination id"].as<std::string>();
uuid_parse(connectionDestProcId.c_str(), destUUID);
logger_->log_debug("Using 'destination id' to match destination with same id for "
- "connection '%s': destination id => [%s]", name, connectionDestProcId);
+ "connection '%s': destination id => [%s]",
+ name, connectionDestProcId);
} else {
// we use the same logic as above for resolving the source processor
// for looking up the destination processor in absence of a processor id
@@ -524,24 +467,24 @@ void YamlConfiguration::parseConnectionYaml(YAML::Node *connectionsNode,
std::string connectionDestProcName = connectionNode["destination name"].as<std::string>();
uuid_t tmpUUID;
if (!uuid_parse(connectionDestProcName.c_str(), tmpUUID) &&
- NULL != parent->findProcessor(tmpUUID)) {
+ NULL != parent->findProcessor(tmpUUID)) {
// the destination name is a remote port id, so use that as the dest id
uuid_copy(destUUID, tmpUUID);
logger_->log_debug("Using 'destination name' containing a remote port id to match the destination for "
- "connection '%s': destination name => [%s]", name, connectionDestProcName);
+ "connection '%s': destination name => [%s]",
+ name, connectionDestProcName);
} else {
// look the processor up by name
auto destProcessor = parent->findProcessor(connectionDestProcName);
if (NULL != destProcessor) {
destProcessor->getUUID(destUUID);
logger_->log_debug("Using 'destination name' to match destination with same name for "
- "connection '%s': destination name => [%s]", name, connectionDestProcName);
+ "connection '%s': destination name => [%s]",
+ name, connectionDestProcName);
} else {
// we ran out of ways to discover the destination processor
- logger_->log_error(
- "Could not locate a destination with name %s to create a connection", connectionDestProcName);
- throw std::invalid_argument(
- "Could not locate a destination with name " + connectionDestProcName + " to create a connection");
+ logger_->log_error("Could not locate a destination with name %s to create a connection", connectionDestProcName);
+ throw std::invalid_argument("Could not locate a destination with name " + connectionDestProcName + " to create a connection");
}
}
}
@@ -555,9 +498,7 @@ void YamlConfiguration::parseConnectionYaml(YAML::Node *connectionsNode,
}
}
-void YamlConfiguration::parsePortYaml(YAML::Node *portNode,
- core::ProcessGroup *parent,
- TransferDirection direction) {
+void YamlConfiguration::parsePortYaml(YAML::Node *portNode, core::ProcessGroup *parent, TransferDirection direction) {
uuid_t uuid;
std::shared_ptr<core::Processor> processor = NULL;
std::shared_ptr<minifi::RemoteProcessorGroupPort> port = NULL;
@@ -572,16 +513,13 @@ void YamlConfiguration::parsePortYaml(YAML::Node *portNode,
// Check for required fields
checkRequiredField(&inputPortsObj, "name", CONFIG_YAML_REMOTE_PROCESS_GROUP_KEY);
auto nameStr = inputPortsObj["name"].as<std::string>();
- checkRequiredField(
- &inputPortsObj,
- "id",
- CONFIG_YAML_REMOTE_PROCESS_GROUP_KEY,
- "The field 'id' is required for "
- "the port named '" + nameStr
- + "' in the YAML Config. If this port "
- "is an input port for a NiFi Remote Process Group, the port "
- "id should match the corresponding id specified in the NiFi configuration. "
- "This is a UUID of the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.");
+ checkRequiredField(&inputPortsObj, "id",
+ CONFIG_YAML_REMOTE_PROCESS_GROUP_KEY,
+ "The field 'id' is required for "
+ "the port named '" + nameStr + "' in the YAML Config. If this port "
+ "is an input port for a NiFi Remote Process Group, the port "
+ "id should match the corresponding id specified in the NiFi configuration. "
+ "This is a UUID of the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.");
auto portId = inputPortsObj["id"].as<std::string>();
uuid_parse(portId.c_str(), uuid);
@@ -597,9 +535,7 @@ void YamlConfiguration::parsePortYaml(YAML::Node *portNode,
// handle port properties
YAML::Node nodeVal = portNode->as<YAML::Node>();
YAML::Node propertiesNode = nodeVal["Properties"];
- parsePropertiesNodeYaml(
- &propertiesNode,
- std::static_pointer_cast<core::ConfigurableComponent>(processor));
+ parsePropertiesNodeYaml(&propertiesNode, std::static_pointer_cast<core::ConfigurableComponent>(processor));
// add processor to parent
parent->addProcessor(processor);
@@ -616,12 +552,9 @@ void YamlConfiguration::parsePortYaml(YAML::Node *portNode,
}
}
-void YamlConfiguration::parsePropertiesNodeYaml(
- YAML::Node *propertiesNode,
- std::shared_ptr<core::ConfigurableComponent> processor) {
+void YamlConfiguration::parsePropertiesNodeYaml(YAML::Node *propertiesNode, std::shared_ptr<core::ConfigurableComponent> processor) {
// Treat generically as a YAML node so we can perform inspection on entries to ensure they are populated
- for (YAML::const_iterator propsIter = propertiesNode->begin();
- propsIter != propertiesNode->end(); ++propsIter) {
+ for (YAML::const_iterator propsIter = propertiesNode->begin(); propsIter != propertiesNode->end(); ++propsIter) {
std::string propertyName = propsIter->first.as<std::string>();
YAML::Node propertyValueNode = propsIter->second;
if (!propertyValueNode.IsNull() && propertyValueNode.IsDefined()) {
@@ -634,12 +567,9 @@ void YamlConfiguration::parsePropertiesNodeYaml(
std::string rawValueString = propertiesNode.as<std::string>();
logger_->log_info("Found %s=%s", propertyName, rawValueString);
if (!processor->updateProperty(propertyName, rawValueString)) {
- std::shared_ptr<core::Connectable> proc =
- std::dynamic_pointer_cast<core::Connectable>(processor);
+ std::shared_ptr<core::Connectable> proc = std::dynamic_pointer_cast<core::Connectable>(processor);
if (proc != 0) {
- logger_->log_warn(
- "Received property %s with value %s but is not one of the properties for %s",
- propertyName, rawValueString, proc->getName());
+ logger_->log_warn("Received property %s with value %s but is not one of the properties for %s", propertyName, rawValueString, proc->getName());
}
}
}
@@ -647,12 +577,9 @@ void YamlConfiguration::parsePropertiesNodeYaml(
} else {
std::string rawValueString = propertyValueNode.as<std::string>();
if (!processor->setProperty(propertyName, rawValueString)) {
- std::shared_ptr<core::Connectable> proc = std::dynamic_pointer_cast<
- core::Connectable>(processor);
+ std::shared_ptr<core::Connectable> proc = std::dynamic_pointer_cast<core::Connectable>(processor);
if (proc != 0) {
- logger_->log_warn(
- "Received property %s with value %s but is not one of the properties for %s",
- propertyName, rawValueString, proc->getName());
+ logger_->log_warn("Received property %s with value %s but is not one of the properties for %s", propertyName, rawValueString, proc->getName());
}
}
}
@@ -660,8 +587,7 @@ void YamlConfiguration::parsePropertiesNodeYaml(
}
}
-std::string YamlConfiguration::getOrGenerateId(YAML::Node *yamlNode,
- const std::string &idField) {
+std::string YamlConfiguration::getOrGenerateId(YAML::Node *yamlNode, const std::string &idField) {
std::string id;
YAML::Node node = yamlNode->as<YAML::Node>();
@@ -669,9 +595,8 @@ std::string YamlConfiguration::getOrGenerateId(YAML::Node *yamlNode,
if (YAML::NodeType::Scalar == node[idField].Type()) {
id = node[idField].as<std::string>();
} else {
- throw std::invalid_argument(
- "getOrGenerateId: idField is expected to reference YAML::Node "
- "of YAML::NodeType::Scalar.");
+ throw std::invalid_argument("getOrGenerateId: idField is expected to reference YAML::Node "
+ "of YAML::NodeType::Scalar.");
}
} else {
uuid_t uuid;
@@ -684,10 +609,7 @@ std::string YamlConfiguration::getOrGenerateId(YAML::Node *yamlNode,
return id;
}
-void YamlConfiguration::checkRequiredField(YAML::Node *yamlNode,
- const std::string &fieldName,
- const std::string &yamlSection,
- const std::string &errorMessage) {
+void YamlConfiguration::checkRequiredField(YAML::Node *yamlNode, const std::string &fieldName, const std::string &yamlSection, const std::string &errorMessage) {
std::string errMsg = errorMessage;
if (!yamlNode->as<YAML::Node>()[fieldName]) {
if (errMsg.empty()) {
@@ -695,11 +617,8 @@ void YamlConfiguration::checkRequiredField(YAML::Node *yamlNode,
// invalid YAML config file, using the component name if present
errMsg =
yamlNode->as<YAML::Node>()["name"] ?
- "Unable to parse configuration file for component named '"
- + yamlNode->as<YAML::Node>()["name"].as<std::string>()
- + "' as required field '" + fieldName + "' is missing" :
- "Unable to parse configuration file as required field '"
- + fieldName + "' is missing";
+ "Unable to parse configuration file for component named '" + yamlNode->as<YAML::Node>()["name"].as<std::string>() + "' as required field '" + fieldName + "' is missing" :
+ "Unable to parse configuration file as required field '" + fieldName + "' is missing";
if (!yamlSection.empty()) {
errMsg += " [in '" + yamlSection + "' section of configuration file]";
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/io/BaseStream.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/io/BaseStream.cpp b/libminifi/src/io/BaseStream.cpp
index 307f41d..137bf1a 100644
--- a/libminifi/src/io/BaseStream.cpp
+++ b/libminifi/src/io/BaseStream.cpp
@@ -33,9 +33,7 @@ namespace io {
* @return resulting write size
**/
int BaseStream::write(uint32_t base_value, bool is_little_endian) {
- return Serializable::write(base_value,
- reinterpret_cast<DataStream*>(composable_stream_),
- is_little_endian);
+ return Serializable::write(base_value, reinterpret_cast<DataStream*>(composable_stream_), is_little_endian);
}
int BaseStream::writeData(uint8_t *value, int size) {
@@ -54,9 +52,7 @@ int BaseStream::writeData(uint8_t *value, int size) {
* @return resulting write size
**/
int BaseStream::write(uint16_t base_value, bool is_little_endian) {
- return Serializable::write(base_value,
- reinterpret_cast<DataStream*>(composable_stream_),
- is_little_endian);
+ return Serializable::write(base_value, reinterpret_cast<DataStream*>(composable_stream_), is_little_endian);
}
/**
@@ -67,8 +63,7 @@ int BaseStream::write(uint16_t base_value, bool is_little_endian) {
* @return resulting write size
**/
int BaseStream::write(uint8_t *value, int len) {
- return Serializable::write(value, len,
- reinterpret_cast<DataStream*>(composable_stream_));
+ return Serializable::write(value, len, reinterpret_cast<DataStream*>(composable_stream_));
}
/**
@@ -79,9 +74,7 @@ int BaseStream::write(uint8_t *value, int len) {
* @return resulting write size
**/
int BaseStream::write(uint64_t base_value, bool is_little_endian) {
- return Serializable::write(base_value,
- reinterpret_cast<DataStream*>(composable_stream_),
- is_little_endian);
+ return Serializable::write(base_value, reinterpret_cast<DataStream*>(composable_stream_), is_little_endian);
}
/**
@@ -100,8 +93,7 @@ int BaseStream::write(bool value) {
* @return resulting write size
**/
int BaseStream::writeUTF(std::string str, bool widen) {
- return Serializable::writeUTF(
- str, reinterpret_cast<DataStream*>(composable_stream_), widen);
+ return Serializable::writeUTF(str, reinterpret_cast<DataStream*>(composable_stream_), widen);
}
/**
@@ -111,8 +103,7 @@ int BaseStream::writeUTF(std::string str, bool widen) {
* @return resulting read size
**/
int BaseStream::read(uint8_t &value) {
- return Serializable::read(value,
- reinterpret_cast<DataStream*>(composable_stream_));
+ return Serializable::read(value, reinterpret_cast<DataStream*>(composable_stream_));
}
/**
@@ -122,8 +113,7 @@ int BaseStream::read(uint8_t &value) {
* @return resulting read size
**/
int BaseStream::read(uint16_t &base_value, bool is_little_endian) {
- return Serializable::read(base_value,
- reinterpret_cast<DataStream*>(composable_stream_));
+ return Serializable::read(base_value, reinterpret_cast<DataStream*>(composable_stream_));
}
/**
@@ -133,8 +123,7 @@ int BaseStream::read(uint16_t &base_value, bool is_little_endian) {
* @return resulting read size
**/
int BaseStream::read(char &value) {
- return Serializable::read(value,
- reinterpret_cast<DataStream*>(composable_stream_));
+ return Serializable::read(value, reinterpret_cast<DataStream*>(composable_stream_));
}
/**
@@ -145,8 +134,7 @@ int BaseStream::read(char &value) {
* @return resulting read size
**/
int BaseStream::read(uint8_t *value, int len) {
- return Serializable::read(value, len,
- reinterpret_cast<DataStream*>(composable_stream_));
+ return Serializable::read(value, len, reinterpret_cast<DataStream*>(composable_stream_));
}
/**
@@ -155,8 +143,7 @@ int BaseStream::read(uint8_t *value, int len) {
* @param buflen
*/
int BaseStream::readData(std::vector<uint8_t> &buf, int buflen) {
- return Serializable::read(&buf[0], buflen,
- reinterpret_cast<DataStream*>(composable_stream_));
+ return Serializable::read(&buf[0], buflen, reinterpret_cast<DataStream*>(composable_stream_));
}
/**
* Reads data and places it into buf
@@ -164,8 +151,7 @@ int BaseStream::readData(std::vector<uint8_t> &buf, int buflen) {
* @param buflen
*/
int BaseStream::readData(uint8_t *buf, int buflen) {
- return Serializable::read(buf, buflen,
- reinterpret_cast<DataStream*>(composable_stream_));
+ return Serializable::read(buf, buflen, reinterpret_cast<DataStream*>(composable_stream_));
}
/**
@@ -175,9 +161,7 @@ int BaseStream::readData(uint8_t *buf, int buflen) {
* @return resulting read size
**/
int BaseStream::read(uint32_t &value, bool is_little_endian) {
- return Serializable::read(value,
- reinterpret_cast<DataStream*>(composable_stream_),
- is_little_endian);
+ return Serializable::read(value, reinterpret_cast<DataStream*>(composable_stream_), is_little_endian);
}
/**
@@ -187,9 +171,7 @@ int BaseStream::read(uint32_t &value, bool is_little_endian) {
* @return resulting read size
**/
int BaseStream::read(uint64_t &value, bool is_little_endian) {
- return Serializable::read(value,
- reinterpret_cast<DataStream*>(composable_stream_),
- is_little_endian);
+ return Serializable::read(value, reinterpret_cast<DataStream*>(composable_stream_), is_little_endian);
}
/**
@@ -199,8 +181,7 @@ int BaseStream::read(uint64_t &value, bool is_little_endian) {
* @return resulting read size
**/
int BaseStream::readUTF(std::string &str, bool widen) {
- return Serializable::readUTF(
- str, reinterpret_cast<DataStream*>(composable_stream_), widen);
+ return Serializable::readUTF(str, reinterpret_cast<DataStream*>(composable_stream_), widen);
}
} /* namespace io */
} /* namespace minifi */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/io/ClientSocket.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/io/ClientSocket.cpp b/libminifi/src/io/ClientSocket.cpp
index bd99bc7..57d6f03 100644
--- a/libminifi/src/io/ClientSocket.cpp
+++ b/libminifi/src/io/ClientSocket.cpp
@@ -39,8 +39,7 @@ namespace nifi {
namespace minifi {
namespace io {
-Socket::Socket(const std::shared_ptr<SocketContext> &context, const std::string &hostname, const uint16_t port,
- const uint16_t listeners = -1)
+Socket::Socket(const std::shared_ptr<SocketContext> &context, const std::string &hostname, const uint16_t port, const uint16_t listeners = -1)
: requested_hostname_(hostname),
port_(port),
addr_info_(0),
@@ -86,8 +85,7 @@ void Socket::closeStream() {
}
int8_t Socket::createConnection(const addrinfo *p, in_addr_t &addr) {
- if ((socket_file_descriptor_ = socket(p->ai_family, p->ai_socktype,
- p->ai_protocol)) == -1) {
+ if ((socket_file_descriptor_ = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
logger_->log_error("error while connecting to server socket");
return -1;
}
@@ -111,8 +109,7 @@ int8_t Socket::createConnection(const addrinfo *p, in_addr_t &addr) {
sa_loc->sin_port = htons(port_);
// use any address if you are connecting to the local machine for testing
// otherwise we must use the requested hostname
- if (IsNullOrEmpty(requested_hostname_)
- || requested_hostname_ == "localhost") {
+ if (IsNullOrEmpty(requested_hostname_) || requested_hostname_ == "localhost") {
sa_loc->sin_addr.s_addr = htonl(INADDR_ANY);
} else {
sa_loc->sin_addr.s_addr = addr;
@@ -149,12 +146,10 @@ int16_t Socket::initialize() {
hints.ai_flags |= AI_PASSIVE;
hints.ai_protocol = 0; /* any protocol */
- int errcode = getaddrinfo(requested_hostname_.c_str(), 0, &hints,
- &addr_info_);
+ int errcode = getaddrinfo(requested_hostname_.c_str(), 0, &hints, &addr_info_);
if (errcode != 0) {
- logger_->log_error("Saw error during getaddrinfo, error: %s",
- strerror(errno));
+ logger_->log_error("Saw error during getaddrinfo, error: %s", strerror(errno));
return -1;
}
@@ -210,8 +205,7 @@ int16_t Socket::select_descriptor(const uint16_t msec) {
retval = select(socket_max_ + 1, &read_fds_, NULL, NULL, NULL);
if (retval < 0) {
- logger_->log_error("Saw error during selection, error:%i %s", retval,
- strerror(errno));
+ logger_->log_error("Saw error during selection, error:%i %s", retval, strerror(errno));
return retval;
}
@@ -221,8 +215,7 @@ int16_t Socket::select_descriptor(const uint16_t msec) {
if (listeners_ > 0) {
struct sockaddr_storage remoteaddr; // client address
socklen_t addrlen = sizeof remoteaddr;
- int newfd = accept(socket_file_descriptor_,
- (struct sockaddr *) &remoteaddr, &addrlen);
+ int newfd = accept(socket_file_descriptor_, (struct sockaddr *) &remoteaddr, &addrlen);
FD_SET(newfd, &total_list_); // add to master set
if (newfd > socket_max_) { // keep track of the max
socket_max_ = newfd;
@@ -273,8 +266,7 @@ int16_t Socket::setSocketOptions(const int sock) {
#else
if (listeners_ > 0) {
// lose the pesky "address already in use" error message
- if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
- reinterpret_cast<char *>(&opt), sizeof(opt)) < 0) {
+ if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char *>(&opt), sizeof(opt)) < 0) {
logger_->log_error("setsockopt() SO_REUSEADDR failed");
close(sock);
return -1;
@@ -304,16 +296,14 @@ int Socket::writeData(uint8_t *value, int size) {
// check for errors
if (ret <= 0) {
close(socket_file_descriptor_);
- logger_->log_error("Could not send to %d, error: %s",
- socket_file_descriptor_, strerror(errno));
+ logger_->log_error("Could not send to %d, error: %s", socket_file_descriptor_, strerror(errno));
return ret;
}
bytes += ret;
}
if (ret)
- logger_->log_trace("Send data size %d over socket %d", size,
- socket_file_descriptor_);
+ logger_->log_trace("Send data size %d over socket %d", size, socket_file_descriptor_);
return bytes;
}
@@ -341,15 +331,11 @@ int Socket::read(uint64_t &value, bool is_little_endian) {
auto buf = readBuffer(value);
if (is_little_endian) {
- value = ((uint64_t) buf[0] << 56) | ((uint64_t) (buf[1] & 255) << 48)
- | ((uint64_t) (buf[2] & 255) << 40) | ((uint64_t) (buf[3] & 255) << 32)
- | ((uint64_t) (buf[4] & 255) << 24) | ((uint64_t) (buf[5] & 255) << 16)
- | ((uint64_t) (buf[6] & 255) << 8) | ((uint64_t) (buf[7] & 255) << 0);
+ value = ((uint64_t) buf[0] << 56) | ((uint64_t) (buf[1] & 255) << 48) | ((uint64_t) (buf[2] & 255) << 40) | ((uint64_t) (buf[3] & 255) << 32) | ((uint64_t) (buf[4] & 255) << 24)
+ | ((uint64_t) (buf[5] & 255) << 16) | ((uint64_t) (buf[6] & 255) << 8) | ((uint64_t) (buf[7] & 255) << 0);
} else {
- value = ((uint64_t) buf[0] << 0) | ((uint64_t) (buf[1] & 255) << 8)
- | ((uint64_t) (buf[2] & 255) << 16) | ((uint64_t) (buf[3] & 255) << 24)
- | ((uint64_t) (buf[4] & 255) << 32) | ((uint64_t) (buf[5] & 255) << 40)
- | ((uint64_t) (buf[6] & 255) << 48) | ((uint64_t) (buf[7] & 255) << 56);
+ value = ((uint64_t) buf[0] << 0) | ((uint64_t) (buf[1] & 255) << 8) | ((uint64_t) (buf[2] & 255) << 16) | ((uint64_t) (buf[3] & 255) << 24) | ((uint64_t) (buf[4] & 255) << 32)
+ | ((uint64_t) (buf[5] & 255) << 40) | ((uint64_t) (buf[6] & 255) << 48) | ((uint64_t) (buf[7] & 255) << 56);
}
return sizeof(value);
}
@@ -397,8 +383,7 @@ int Socket::readData(uint8_t *buf, int buflen) {
if (bytes_read == 0) {
logger_->log_info("Other side hung up on %d", fd);
} else {
- logger_->log_error("Could not recv on %d, error: %s", fd,
- strerror(errno));
+ logger_->log_error("Could not recv on %d, error: %s", fd, strerror(errno));
}
return -1;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/io/DataStream.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/io/DataStream.cpp b/libminifi/src/io/DataStream.cpp
index 9e0dfce..92c7cda 100644
--- a/libminifi/src/io/DataStream.cpp
+++ b/libminifi/src/io/DataStream.cpp
@@ -44,15 +44,11 @@ int DataStream::read(uint64_t &value, bool is_little_endian) {
uint8_t *buf = &buffer[readBuffer];
if (is_little_endian) {
- value = ((uint64_t) buf[0] << 56) | ((uint64_t) (buf[1] & 255) << 48)
- | ((uint64_t) (buf[2] & 255) << 40) | ((uint64_t) (buf[3] & 255) << 32)
- | ((uint64_t) (buf[4] & 255) << 24) | ((uint64_t) (buf[5] & 255) << 16)
- | ((uint64_t) (buf[6] & 255) << 8) | ((uint64_t) (buf[7] & 255) << 0);
+ value = ((uint64_t) buf[0] << 56) | ((uint64_t) (buf[1] & 255) << 48) | ((uint64_t) (buf[2] & 255) << 40) | ((uint64_t) (buf[3] & 255) << 32) | ((uint64_t) (buf[4] & 255) << 24)
+ | ((uint64_t) (buf[5] & 255) << 16) | ((uint64_t) (buf[6] & 255) << 8) | ((uint64_t) (buf[7] & 255) << 0);
} else {
- value = ((uint64_t) buf[0] << 0) | ((uint64_t) (buf[1] & 255) << 8)
- | ((uint64_t) (buf[2] & 255) << 16) | ((uint64_t) (buf[3] & 255) << 24)
- | ((uint64_t) (buf[4] & 255) << 32) | ((uint64_t) (buf[5] & 255) << 40)
- | ((uint64_t) (buf[6] & 255) << 48) | ((uint64_t) (buf[7] & 255) << 56);
+ value = ((uint64_t) buf[0] << 0) | ((uint64_t) (buf[1] & 255) << 8) | ((uint64_t) (buf[2] & 255) << 16) | ((uint64_t) (buf[3] & 255) << 24) | ((uint64_t) (buf[4] & 255) << 32)
+ | ((uint64_t) (buf[5] & 255) << 40) | ((uint64_t) (buf[6] & 255) << 48) | ((uint64_t) (buf[7] & 255) << 56);
}
readBuffer += 8;
return 8;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/io/Serializable.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/io/Serializable.cpp b/libminifi/src/io/Serializable.cpp
index c3f74c7..5e57c80 100644
--- a/libminifi/src/io/Serializable.cpp
+++ b/libminifi/src/io/Serializable.cpp
@@ -35,26 +35,20 @@ namespace io {
template<typename T>
int Serializable::writeData(const T &t, DataStream *stream) {
uint8_t bytes[sizeof t];
- std::copy(static_cast<const char*>(static_cast<const void*>(&t)),
- static_cast<const char*>(static_cast<const void*>(&t)) + sizeof t,
- bytes);
+ std::copy(static_cast<const char*>(static_cast<const void*>(&t)), static_cast<const char*>(static_cast<const void*>(&t)) + sizeof t, bytes);
return stream->writeData(bytes, sizeof t);
}
template<typename T>
int Serializable::writeData(const T &t, uint8_t *to_vec) {
- std::copy(static_cast<const char*>(static_cast<const void*>(&t)),
- static_cast<const char*>(static_cast<const void*>(&t)) + sizeof t,
- to_vec);
+ std::copy(static_cast<const char*>(static_cast<const void*>(&t)), static_cast<const char*>(static_cast<const void*>(&t)) + sizeof t, to_vec);
return sizeof t;
}
template<typename T>
int Serializable::writeData(const T &t, std::vector<uint8_t> &to_vec) {
uint8_t bytes[sizeof t];
- std::copy(static_cast<const char*>(static_cast<const void*>(&t)),
- static_cast<const char*>(static_cast<const void*>(&t)) + sizeof t,
- bytes);
+ std::copy(static_cast<const char*>(static_cast<const void*>(&t)), static_cast<const char*>(static_cast<const void*>(&t)) + sizeof t, bytes);
to_vec.insert(to_vec.end(), &bytes[0], &bytes[sizeof t]);
return sizeof t;
}
@@ -97,36 +91,29 @@ int Serializable::read(uint8_t *value, int len, DataStream *stream) {
return stream->readData(value, len);
}
-int Serializable::read(uint16_t &value, DataStream *stream,
- bool is_little_endian) {
+int Serializable::read(uint16_t &value, DataStream *stream, bool is_little_endian) {
return stream->read(value, is_little_endian);
}
-int Serializable::read(uint32_t &value, DataStream *stream,
- bool is_little_endian) {
+int Serializable::read(uint32_t &value, DataStream *stream, bool is_little_endian) {
return stream->read(value, is_little_endian);
}
-int Serializable::read(uint64_t &value, DataStream *stream,
- bool is_little_endian) {
+int Serializable::read(uint64_t &value, DataStream *stream, bool is_little_endian) {
return stream->read(value, is_little_endian);
}
-int Serializable::write(uint32_t base_value, DataStream *stream,
- bool is_little_endian) {
+int Serializable::write(uint32_t base_value, DataStream *stream, bool is_little_endian) {
const uint32_t value = is_little_endian ? htonl(base_value) : base_value;
return writeData(value, stream);
}
-int Serializable::write(uint64_t base_value, DataStream *stream,
- bool is_little_endian) {
- const uint64_t value =
- is_little_endian == 1 ? htonll_r(base_value) : base_value;
+int Serializable::write(uint64_t base_value, DataStream *stream, bool is_little_endian) {
+ const uint64_t value = is_little_endian == 1 ? htonll_r(base_value) : base_value;
return writeData(value, stream);
}
-int Serializable::write(uint16_t base_value, DataStream *stream,
- bool is_little_endian) {
+int Serializable::write(uint16_t base_value, DataStream *stream, bool is_little_endian) {
const uint16_t value = is_little_endian == 1 ? htons(base_value) : base_value;
return writeData(value, stream);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/io/tls/TLSSocket.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/io/tls/TLSSocket.cpp b/libminifi/src/io/tls/TLSSocket.cpp
index b269cef..40cf1e9 100644
--- a/libminifi/src/io/tls/TLSSocket.cpp
+++ b/libminifi/src/io/tls/TLSSocket.cpp
@@ -57,9 +57,7 @@ int16_t TLSContext::initialize() {
std::string clientAuthStr;
bool needClientCert = true;
- if (!(configure_->get(Configure::nifi_security_need_ClientAuth, clientAuthStr)
- && org::apache::nifi::minifi::utils::StringUtils::StringToBool(
- clientAuthStr, needClientCert))) {
+ if (!(configure_->get(Configure::nifi_security_need_ClientAuth, clientAuthStr) && org::apache::nifi::minifi::utils::StringUtils::StringToBool(clientAuthStr, needClientCert))) {
needClientCert = true;
}
@@ -67,8 +65,7 @@ int16_t TLSContext::initialize() {
method = TLSv1_2_client_method();
ctx = SSL_CTX_new(method);
if (ctx == NULL) {
- logger_->log_error("Could not create SSL context, error: %s.",
- std::strerror(errno));
+ logger_->log_error("Could not create SSL context, error: %s.", std::strerror(errno));
error_value = TLS_ERROR_CONTEXT;
return error_value;
}
@@ -78,56 +75,40 @@ int16_t TLSContext::initialize() {
std::string passphrase;
std::string caCertificate;
- if (!(configure_->get(Configure::nifi_security_client_certificate,
- certificate)
- && configure_->get(Configure::nifi_security_client_private_key,
- privatekey))) {
- logger_->log_error(
- "Certificate and Private Key PEM file not configured, error: %s.",
- std::strerror(errno));
+ if (!(configure_->get(Configure::nifi_security_client_certificate, certificate) && configure_->get(Configure::nifi_security_client_private_key, privatekey))) {
+ logger_->log_error("Certificate and Private Key PEM file not configured, error: %s.", std::strerror(errno));
error_value = TLS_ERROR_PEM_MISSING;
return error_value;
}
// load certificates and private key in PEM format
- if (SSL_CTX_use_certificate_file(ctx, certificate.c_str(), SSL_FILETYPE_PEM)
- <= 0) {
- logger_->log_error("Could not create load certificate, error : %s",
- std::strerror(errno));
+ if (SSL_CTX_use_certificate_file(ctx, certificate.c_str(), SSL_FILETYPE_PEM) <= 0) {
+ logger_->log_error("Could not create load certificate, error : %s", std::strerror(errno));
error_value = TLS_ERROR_CERT_MISSING;
return error_value;
}
- if (configure_->get(Configure::nifi_security_client_pass_phrase,
- passphrase)) {
+ if (configure_->get(Configure::nifi_security_client_pass_phrase, passphrase)) {
// if the private key has passphase
SSL_CTX_set_default_passwd_cb(ctx, pemPassWordCb);
- SSL_CTX_set_default_passwd_cb_userdata(
- ctx, static_cast<void*>(configure_.get()));
+ SSL_CTX_set_default_passwd_cb_userdata(ctx, static_cast<void*>(configure_.get()));
}
- int retp = SSL_CTX_use_PrivateKey_file(ctx, privatekey.c_str(),
- SSL_FILETYPE_PEM);
+ int retp = SSL_CTX_use_PrivateKey_file(ctx, privatekey.c_str(), SSL_FILETYPE_PEM);
if (retp != 1) {
- logger_->log_error(
- "Could not create load private key,%i on %s error : %s", retp,
- privatekey.c_str(), std::strerror(errno));
+ logger_->log_error("Could not create load private key,%i on %s error : %s", retp, privatekey.c_str(), std::strerror(errno));
error_value = TLS_ERROR_KEY_ERROR;
return error_value;
}
// verify private key
if (!SSL_CTX_check_private_key(ctx)) {
- logger_->log_error(
- "Private key does not match the public certificate, error : %s",
- std::strerror(errno));
+ logger_->log_error("Private key does not match the public certificate, error : %s", std::strerror(errno));
error_value = TLS_ERROR_KEY_ERROR;
return error_value;
}
// load CA certificates
- if (configure_->get(Configure::nifi_security_client_ca_certificate,
- caCertificate)) {
+ if (configure_->get(Configure::nifi_security_client_ca_certificate, caCertificate)) {
retp = SSL_CTX_load_verify_locations(ctx, caCertificate.c_str(), 0);
if (retp == 0) {
- logger_->log_error("Can not load CA certificate, Exiting, error : %s",
- std::strerror(errno));
+ logger_->log_error("Can not load CA certificate, Exiting, error : %s", std::strerror(errno));
error_value = TLS_ERROR_CERT_ERROR;
return error_value;
}
@@ -149,24 +130,24 @@ TLSSocket::~TLSSocket() {
* @param port connecting port
* @param listeners number of listeners in the queue
*/
-TLSSocket::TLSSocket(const std::shared_ptr<TLSContext> &context,
- const std::string &hostname, const uint16_t port,
- const uint16_t listeners)
+TLSSocket::TLSSocket(const std::shared_ptr<TLSContext> &context, const std::string &hostname, const uint16_t port, const uint16_t listeners)
: Socket(context, hostname, port, listeners),
- ssl(0), logger_(logging::LoggerFactory<TLSSocket>::getLogger()) {
+ ssl(0),
+ logger_(logging::LoggerFactory<TLSSocket>::getLogger()) {
context_ = context;
}
-TLSSocket::TLSSocket(const std::shared_ptr<TLSContext> &context,
- const std::string &hostname, const uint16_t port)
+TLSSocket::TLSSocket(const std::shared_ptr<TLSContext> &context, const std::string &hostname, const uint16_t port)
: Socket(context, hostname, port, 0),
- ssl(0), logger_(logging::LoggerFactory<TLSSocket>::getLogger()) {
+ ssl(0),
+ logger_(logging::LoggerFactory<TLSSocket>::getLogger()) {
context_ = context;
}
TLSSocket::TLSSocket(const TLSSocket &&d)
: Socket(std::move(d)),
- ssl(0), logger_(std::move(d.logger_)) {
+ ssl(0),
+ logger_(std::move(d.logger_)) {
context_ = d.context_;
}
@@ -178,15 +159,13 @@ int16_t TLSSocket::initialize() {
ssl = SSL_new(context_->getContext());
SSL_set_fd(ssl, socket_file_descriptor_);
if (SSL_connect(ssl) == -1) {
- logger_->log_error("SSL socket connect failed to %s %d",
- requested_hostname_.c_str(), port_);
+ logger_->log_error("SSL socket connect failed to %s %d", requested_hostname_.c_str(), port_);
SSL_free(ssl);
ssl = NULL;
close(socket_file_descriptor_);
return -1;
} else {
- logger_->log_info("SSL socket connect success to %s %d",
- requested_hostname_.c_str(), port_);
+ logger_->log_info("SSL socket connect success to %s %d", requested_hostname_.c_str(), port_);
return 0;
}
}
@@ -213,8 +192,7 @@ int TLSSocket::writeData(uint8_t *value, int size) {
sent = SSL_write(ssl, value + bytes, size - bytes);
// check for errors
if (sent < 0) {
- logger_->log_error("Site2Site Peer socket %d send failed %s",
- socket_file_descriptor_, strerror(errno));
+ logger_->log_error("Site2Site Peer socket %d send failed %s", socket_file_descriptor_, strerror(errno));
return sent;
}
bytes += sent;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/processors/AppendHostInfo.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/processors/AppendHostInfo.cpp b/libminifi/src/processors/AppendHostInfo.cpp
index b3c76db..bbc86a5 100644
--- a/libminifi/src/processors/AppendHostInfo.cpp
+++ b/libminifi/src/processors/AppendHostInfo.cpp
@@ -46,19 +46,10 @@ namespace processors {
#define HOST_NAME_MAX 255
#endif
-core::Property AppendHostInfo::InterfaceName(
- "Network Interface Name",
- "Network interface from which to read an IP v4 address", "eth0");
-core::Property AppendHostInfo::HostAttribute(
- "Hostname Attribute",
- "Flowfile attribute to used to record the agent's hostname",
- "source.hostname");
-core::Property AppendHostInfo::IPAttribute(
- "IP Attribute",
- "Flowfile attribute to used to record the agent's IP address",
- "source.ipv4");
-core::Relationship AppendHostInfo::Success(
- "success", "success operational on the flow record");
+core::Property AppendHostInfo::InterfaceName("Network Interface Name", "Network interface from which to read an IP v4 address", "eth0");
+core::Property AppendHostInfo::HostAttribute("Hostname Attribute", "Flowfile attribute to used to record the agent's hostname", "source.hostname");
+core::Property AppendHostInfo::IPAttribute("IP Attribute", "Flowfile attribute to used to record the agent's IP address", "source.ipv4");
+core::Relationship AppendHostInfo::Success("success", "success operational on the flow record");
void AppendHostInfo::initialize() {
// Set the supported properties
@@ -74,8 +65,7 @@ void AppendHostInfo::initialize() {
setSupportedRelationships(relationships);
}
-void AppendHostInfo::onTrigger(core::ProcessContext *context,
- core::ProcessSession *session) {
+void AppendHostInfo::onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
std::shared_ptr<core::FlowFile> flow = session->get();
if (!flow)
return;
@@ -84,8 +74,7 @@ void AppendHostInfo::onTrigger(core::ProcessContext *context,
std::string hostAttribute = "";
context->getProperty(HostAttribute.getName(), hostAttribute);
- flow->addAttribute(hostAttribute.c_str(),
- org::apache::nifi::minifi::io::Socket::getMyHostName());
+ flow->addAttribute(hostAttribute.c_str(), org::apache::nifi::minifi::io::Socket::getMyHostName());
// Get IP address for the specified interface
std::string iface;
@@ -103,9 +92,7 @@ void AppendHostInfo::onTrigger(core::ProcessContext *context,
std::string ipAttribute;
context->getProperty(IPAttribute.getName(), ipAttribute);
- flow->addAttribute(
- ipAttribute.c_str(),
- inet_ntoa(((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr));
+ flow->addAttribute(ipAttribute.c_str(), inet_ntoa(((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr));
}
// Transfer to the relationship
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/processors/ExecuteProcess.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/processors/ExecuteProcess.cpp b/libminifi/src/processors/ExecuteProcess.cpp
index 701c645..323d69a 100644
--- a/libminifi/src/processors/ExecuteProcess.cpp
+++ b/libminifi/src/processors/ExecuteProcess.cpp
@@ -33,31 +33,18 @@ namespace nifi {
namespace minifi {
namespace processors {
-core::Property ExecuteProcess::Command(
- "Command",
- "Specifies the command to be executed; if just the name of an executable"
- " is provided, it must be in the user's environment PATH.",
- "");
-core::Property ExecuteProcess::CommandArguments(
- "Command Arguments",
- "The arguments to supply to the executable delimited by white space. White "
- "space can be escaped by enclosing it in double-quotes.",
- "");
-core::Property ExecuteProcess::WorkingDir(
- "Working Directory",
- "The directory to use as the current working directory when executing the command",
- "");
-core::Property ExecuteProcess::BatchDuration(
- "Batch Duration",
- "If the process is expected to be long-running and produce textual output, a "
- "batch duration can be specified.",
- "0");
-core::Property ExecuteProcess::RedirectErrorStream(
- "Redirect Error Stream",
- "If true will redirect any error stream output of the process to the output stream.",
- "false");
-core::Relationship ExecuteProcess::Success(
- "success", "All created FlowFiles are routed to this relationship.");
+core::Property ExecuteProcess::Command("Command", "Specifies the command to be executed; if just the name of an executable"
+ " is provided, it must be in the user's environment PATH.",
+ "");
+core::Property ExecuteProcess::CommandArguments("Command Arguments", "The arguments to supply to the executable delimited by white space. White "
+ "space can be escaped by enclosing it in double-quotes.",
+ "");
+core::Property ExecuteProcess::WorkingDir("Working Directory", "The directory to use as the current working directory when executing the command", "");
+core::Property ExecuteProcess::BatchDuration("Batch Duration", "If the process is expected to be long-running and produce textual output, a "
+ "batch duration can be specified.",
+ "0");
+core::Property ExecuteProcess::RedirectErrorStream("Redirect Error Stream", "If true will redirect any error stream output of the process to the output stream.", "false");
+core::Relationship ExecuteProcess::Success("success", "All created FlowFiles are routed to this relationship.");
void ExecuteProcess::initialize() {
// Set the supported properties
@@ -74,8 +61,7 @@ void ExecuteProcess::initialize() {
setSupportedRelationships(relationships);
}
-void ExecuteProcess::onTrigger(core::ProcessContext *context,
- core::ProcessSession *session) {
+void ExecuteProcess::onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
std::string value;
if (context->getProperty(Command.getName(), value)) {
this->_command = value;
@@ -88,15 +74,12 @@ void ExecuteProcess::onTrigger(core::ProcessContext *context,
}
if (context->getProperty(BatchDuration.getName(), value)) {
core::TimeUnit unit;
- if (core::Property::StringToTime(value, _batchDuration, unit)
- && core::Property::ConvertTimeUnitToMS(_batchDuration, unit,
- _batchDuration)) {
+ if (core::Property::StringToTime(value, _batchDuration, unit) && core::Property::ConvertTimeUnitToMS(_batchDuration, unit, _batchDuration)) {
logger_->log_info("Setting _batchDuration");
}
}
if (context->getProperty(RedirectErrorStream.getName(), value)) {
- org::apache::nifi::minifi::utils::StringUtils::StringToBool(
- value, _redirectErrorStream);
+ org::apache::nifi::minifi::utils::StringUtils::StringToBool(value, _redirectErrorStream);
}
this->_fullCommand = _command + " " + _commandArgument;
if (_fullCommand.length() == 0) {
@@ -106,8 +89,7 @@ void ExecuteProcess::onTrigger(core::ProcessContext *context,
if (_workingDir.length() > 0 && _workingDir != ".") {
// change to working directory
if (chdir(_workingDir.c_str()) != 0) {
- logger_->log_error("Execute Command can not chdir %s",
- _workingDir.c_str());
+ logger_->log_error("Execute Command can not chdir %s", _workingDir.c_str());
yield();
return;
}
@@ -156,21 +138,18 @@ void ExecuteProcess::onTrigger(core::ProcessContext *context,
close(_pipefd[1]);
if (_batchDuration > 0) {
while (1) {
- std::this_thread::sleep_for(
- std::chrono::milliseconds(_batchDuration));
+ std::this_thread::sleep_for(std::chrono::milliseconds(_batchDuration));
char buffer[4096];
int numRead = read(_pipefd[0], buffer, sizeof(buffer));
if (numRead <= 0)
break;
logger_->log_info("Execute Command Respond %d", numRead);
ExecuteProcess::WriteCallback callback(buffer, numRead);
- std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<
- FlowFileRecord>(session->create());
+ std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<FlowFileRecord>(session->create());
if (!flowFile)
continue;
flowFile->addAttribute("command", _command.c_str());
- flowFile->addAttribute("command.arguments",
- _commandArgument.c_str());
+ flowFile->addAttribute("command.arguments", _commandArgument.c_str());
session->write(flowFile, &callback);
session->transfer(flowFile, Success);
session->commit();
@@ -181,21 +160,18 @@ void ExecuteProcess::onTrigger(core::ProcessContext *context,
int totalRead = 0;
std::shared_ptr<FlowFileRecord> flowFile = nullptr;
while (1) {
- int numRead = read(_pipefd[0], bufPtr,
- (sizeof(buffer) - totalRead));
+ int numRead = read(_pipefd[0], bufPtr, (sizeof(buffer) - totalRead));
if (numRead <= 0) {
if (totalRead > 0) {
logger_->log_info("Execute Command Respond %d", totalRead);
// child exits and close the pipe
ExecuteProcess::WriteCallback callback(buffer, totalRead);
if (!flowFile) {
- flowFile = std::static_pointer_cast<FlowFileRecord>(
- session->create());
+ flowFile = std::static_pointer_cast<FlowFileRecord>(session->create());
if (!flowFile)
break;
flowFile->addAttribute("command", _command.c_str());
- flowFile->addAttribute("command.arguments",
- _commandArgument.c_str());
+ flowFile->addAttribute("command.arguments", _commandArgument.c_str());
session->write(flowFile, &callback);
} else {
session->append(flowFile, &callback);
@@ -206,17 +182,14 @@ void ExecuteProcess::onTrigger(core::ProcessContext *context,
} else {
if (numRead == (sizeof(buffer) - totalRead)) {
// we reach the max buffer size
- logger_->log_info("Execute Command Max Respond %d",
- sizeof(buffer));
+ logger_->log_info("Execute Command Max Respond %d", sizeof(buffer));
ExecuteProcess::WriteCallback callback(buffer, sizeof(buffer));
if (!flowFile) {
- flowFile = std::static_pointer_cast<FlowFileRecord>(
- session->create());
+ flowFile = std::static_pointer_cast<FlowFileRecord>(session->create());
if (!flowFile)
continue;
flowFile->addAttribute("command", _command.c_str());
- flowFile->addAttribute("command.arguments",
- _commandArgument.c_str());
+ flowFile->addAttribute("command.arguments", _commandArgument.c_str());
session->write(flowFile, &callback);
} else {
session->append(flowFile, &callback);
@@ -234,11 +207,9 @@ void ExecuteProcess::onTrigger(core::ProcessContext *context,
died = wait(&status);
if (WIFEXITED(status)) {
- logger_->log_info("Execute Command Complete %s status %d pid %d",
- _fullCommand.c_str(), WEXITSTATUS(status), _pid);
+ logger_->log_info("Execute Command Complete %s status %d pid %d", _fullCommand.c_str(), WEXITSTATUS(status), _pid);
} else {
- logger_->log_info("Execute Command Complete %s status %d pid %d",
- _fullCommand.c_str(), WTERMSIG(status), _pid);
+ logger_->log_info("Execute Command Complete %s status %d pid %d", _fullCommand.c_str(), WTERMSIG(status), _pid);
}
close(_pipefd[0]);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/processors/GenerateFlowFile.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/processors/GenerateFlowFile.cpp b/libminifi/src/processors/GenerateFlowFile.cpp
index 34c0ae2..3741a8f 100644
--- a/libminifi/src/processors/GenerateFlowFile.cpp
+++ b/libminifi/src/processors/GenerateFlowFile.cpp
@@ -40,20 +40,11 @@ namespace minifi {
namespace processors {
const char *GenerateFlowFile::DATA_FORMAT_BINARY = "Binary";
const char *GenerateFlowFile::DATA_FORMAT_TEXT = "Text";
-core::Property GenerateFlowFile::FileSize(
- "File Size", "The size of the file that will be used", "1 kB");
-core::Property GenerateFlowFile::BatchSize(
- "Batch Size",
- "The number of FlowFiles to be transferred in each invocation", "1");
-core::Property GenerateFlowFile::DataFormat(
- "Data Format", "Specifies whether the data should be Text or Binary",
- GenerateFlowFile::DATA_FORMAT_BINARY);
-core::Property GenerateFlowFile::UniqueFlowFiles(
- "Unique FlowFiles",
- "If true, each FlowFile that is generated will be unique. If false, a random value will be generated and all FlowFiles",
- "true");
-core::Relationship GenerateFlowFile::Success(
- "success", "success operational on the flow record");
+core::Property GenerateFlowFile::FileSize("File Size", "The size of the file that will be used", "1 kB");
+core::Property GenerateFlowFile::BatchSize("Batch Size", "The number of FlowFiles to be transferred in each invocation", "1");
+core::Property GenerateFlowFile::DataFormat("Data Format", "Specifies whether the data should be Text or Binary", GenerateFlowFile::DATA_FORMAT_BINARY);
+core::Property GenerateFlowFile::UniqueFlowFiles("Unique FlowFiles", "If true, each FlowFile that is generated will be unique. If false, a random value will be generated and all FlowFiles", "true");
+core::Relationship GenerateFlowFile::Success("success", "success operational on the flow record");
void GenerateFlowFile::initialize() {
// Set the supported properties
@@ -69,8 +60,7 @@ void GenerateFlowFile::initialize() {
setSupportedRelationships(relationships);
}
-void GenerateFlowFile::onTrigger(core::ProcessContext *context,
- core::ProcessSession *session) {
+void GenerateFlowFile::onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
int64_t batchSize = 1;
bool uniqueFlowFile = true;
int64_t fileSize = 1024;
@@ -83,8 +73,7 @@ void GenerateFlowFile::onTrigger(core::ProcessContext *context,
core::Property::StringToInt(value, batchSize);
}
if (context->getProperty(UniqueFlowFiles.getName(), value)) {
- org::apache::nifi::minifi::utils::StringUtils::StringToBool(value,
- uniqueFlowFile);
+ org::apache::nifi::minifi::utils::StringUtils::StringToBool(value, uniqueFlowFile);
}
if (!uniqueFlowFile) {
@@ -102,8 +91,7 @@ void GenerateFlowFile::onTrigger(core::ProcessContext *context,
}
for (int i = 0; i < batchSize; i++) {
// For each batch
- std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<
- FlowFileRecord>(session->create());
+ std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<FlowFileRecord>(session->create());
if (!flowFile)
return;
if (fileSize > 0)
@@ -126,8 +114,7 @@ void GenerateFlowFile::onTrigger(core::ProcessContext *context,
GenerateFlowFile::WriteCallback callback(_data, _dataSize);
for (int i = 0; i < batchSize; i++) {
// For each batch
- std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<
- FlowFileRecord>(session->create());
+ std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<FlowFileRecord>(session->create());
if (!flowFile)
return;
if (fileSize > 0)
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/processors/GetFile.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/processors/GetFile.cpp b/libminifi/src/processors/GetFile.cpp
index e39afec..f1dbb21 100644
--- a/libminifi/src/processors/GetFile.cpp
+++ b/libminifi/src/processors/GetFile.cpp
@@ -44,50 +44,22 @@ namespace nifi {
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", ".");
-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;"
- " any file younger than this amount of time (according to last modification date) will be ignored",
- "0 sec");
-core::Property GetFile::MinAge(
- "Minimum File Age",
- "The maximum age that a file must be in order to be pulled; any file"
- "older than this amount of time (according to last modification date) will be ignored",
- "0 sec");
-core::Property GetFile::MaxSize(
- "Maximum File Size",
- "The maximum size that a file can be in order to be pulled", "0 B");
-core::Property GetFile::MinSize(
- "Minimum File Size",
- "The minimum size that a file must be in order to be pulled", "0 B");
-core::Property GetFile::PollInterval(
- "Polling Interval",
- "Indicates how long to wait before performing a directory listing",
- "0 sec");
-core::Property GetFile::Recurse(
- "Recurse Subdirectories",
- "Indicates whether or not to pull files from subdirectories", "true");
-core::Property GetFile::FileFilter(
- "File Filter",
- "Only files whose names match the given regular expression will be picked up",
- "[^\\.].*");
-core::Relationship GetFile::Success("success",
- "All files are routed to success");
+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", ".");
+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;"
+ " any file younger than this amount of time (according to last modification date) will be ignored",
+ "0 sec");
+core::Property GetFile::MinAge("Minimum File Age", "The maximum age that a file must be in order to be pulled; any file"
+ "older than this amount of time (according to last modification date) will be ignored",
+ "0 sec");
+core::Property GetFile::MaxSize("Maximum File Size", "The maximum size that a file can be in order to be pulled", "0 B");
+core::Property GetFile::MinSize("Minimum File Size", "The minimum size that a file must be in order to be pulled", "0 B");
+core::Property GetFile::PollInterval("Polling Interval", "Indicates how long to wait before performing a directory listing", "0 sec");
+core::Property GetFile::Recurse("Recurse Subdirectories", "Indicates whether or not to pull files from subdirectories", "true");
+core::Property GetFile::FileFilter("File Filter", "Only files whose names match the given regular expression will be picked up", "[^\\.].*");
+core::Relationship GetFile::Success("success", "All files are routed to success");
void GetFile::initialize() {
// Set the supported properties
@@ -110,8 +82,7 @@ void GetFile::initialize() {
setSupportedRelationships(relationships);
}
-void GetFile::onSchedule(core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory) {
+void GetFile::onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory) {
std::string value;
if (context->getProperty(Directory.getName(), value)) {
@@ -121,27 +92,21 @@ void GetFile::onSchedule(core::ProcessContext *context,
core::Property::StringToInt(value, request_.batchSize);
}
if (context->getProperty(IgnoreHiddenFile.getName(), value)) {
- org::apache::nifi::minifi::utils::StringUtils::StringToBool(
- value, request_.ignoreHiddenFile);
+ org::apache::nifi::minifi::utils::StringUtils::StringToBool(value, request_.ignoreHiddenFile);
}
if (context->getProperty(KeepSourceFile.getName(), value)) {
- org::apache::nifi::minifi::utils::StringUtils::StringToBool(
- value, request_.keepSourceFile);
+ org::apache::nifi::minifi::utils::StringUtils::StringToBool(value, request_.keepSourceFile);
}
if (context->getProperty(MaxAge.getName(), value)) {
core::TimeUnit unit;
- if (core::Property::StringToTime(value, request_.maxAge, unit)
- && core::Property::ConvertTimeUnitToMS(request_.maxAge, unit,
- request_.maxAge)) {
+ if (core::Property::StringToTime(value, request_.maxAge, unit) && core::Property::ConvertTimeUnitToMS(request_.maxAge, unit, request_.maxAge)) {
logger_->log_debug("successfully applied _maxAge");
}
}
if (context->getProperty(MinAge.getName(), value)) {
core::TimeUnit unit;
- if (core::Property::StringToTime(value, request_.minAge, unit)
- && core::Property::ConvertTimeUnitToMS(request_.minAge, unit,
- request_.minAge)) {
+ if (core::Property::StringToTime(value, request_.minAge, unit) && core::Property::ConvertTimeUnitToMS(request_.minAge, unit, request_.minAge)) {
logger_->log_debug("successfully applied _minAge");
}
}
@@ -153,15 +118,12 @@ void GetFile::onSchedule(core::ProcessContext *context,
}
if (context->getProperty(PollInterval.getName(), value)) {
core::TimeUnit unit;
- if (core::Property::StringToTime(value, request_.pollInterval, unit)
- && core::Property::ConvertTimeUnitToMS(request_.pollInterval, unit,
- request_.pollInterval)) {
+ if (core::Property::StringToTime(value, request_.pollInterval, unit) && core::Property::ConvertTimeUnitToMS(request_.pollInterval, unit, request_.pollInterval)) {
logger_->log_debug("successfully applied _pollInterval");
}
}
if (context->getProperty(Recurse.getName(), value)) {
- org::apache::nifi::minifi::utils::StringUtils::StringToBool(
- value, request_.recursive);
+ org::apache::nifi::minifi::utils::StringUtils::StringToBool(value, request_.recursive);
}
if (context->getProperty(FileFilter.getName(), value)) {
@@ -169,13 +131,11 @@ void GetFile::onSchedule(core::ProcessContext *context,
}
}
-void GetFile::onTrigger(core::ProcessContext *context,
- core::ProcessSession *session) {
+void GetFile::onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
// Perform directory list
logger_->log_info("Is listing empty %i", isListingEmpty());
if (isListingEmpty()) {
- if (request_.pollInterval == 0
- || (getTimeMillis() - last_listing_time_) > request_.pollInterval) {
+ if (request_.pollInterval == 0 || (getTimeMillis() - last_listing_time_) > request_.pollInterval) {
performListing(request_.directory, request_);
last_listing_time_.store(getTimeMillis());
}
@@ -190,8 +150,7 @@ void GetFile::onTrigger(core::ProcessContext *context,
std::string fileName = list.front();
list.pop();
logger_->log_info("GetFile process %s", fileName.c_str());
- std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<
- FlowFileRecord>(session->create());
+ std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<FlowFileRecord>(session->create());
if (flowFile == nullptr)
return;
std::size_t found = fileName.find_last_of("/\\");
@@ -224,12 +183,10 @@ void GetFile::putListing(std::string fileName) {
_dirList.push(fileName);
}
-void GetFile::pollListing(std::queue<std::string> &list,
- const GetFileRequest &request) {
+void GetFile::pollListing(std::queue<std::string> &list, const GetFileRequest &request) {
std::lock_guard<std::mutex> lock(mutex_);
- while (!_dirList.empty()
- && (request.maxSize == 0 || list.size() < request.maxSize)) {
+ while (!_dirList.empty() && (request.maxSize == 0 || list.size() < request.maxSize)) {
std::string fileName = _dirList.front();
_dirList.pop();
list.push(fileName);
@@ -238,8 +195,7 @@ void GetFile::pollListing(std::queue<std::string> &list,
return;
}
-bool GetFile::acceptFile(std::string fullName, std::string name,
- const GetFileRequest &request) {
+bool GetFile::acceptFile(std::string fullName, std::string name, const GetFileRequest &request) {
struct stat statbuf;
if (stat(fullName.c_str(), &statbuf) == 0) {
@@ -296,8 +252,7 @@ void GetFile::performListing(std::string dir, const GetFileRequest &request) {
std::string d_name = entry->d_name;
if ((entry->d_type & DT_DIR)) {
// if this is a directory
- if (request.recursive && strcmp(d_name.c_str(), "..") != 0
- && strcmp(d_name.c_str(), ".") != 0) {
+ if (request.recursive && strcmp(d_name.c_str(), "..") != 0 && strcmp(d_name.c_str(), ".") != 0) {
std::string path = dir + "/" + d_name;
performListing(path, request);
}
[8/9] nifi-minifi-cpp git commit: MINIFI-331: Apply formatter with
increased line length to source
Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/Property.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/Property.h b/libminifi/include/core/Property.h
index fd940c5..278e2ec 100644
--- a/libminifi/include/core/Property.h
+++ b/libminifi/include/core/Property.h
@@ -56,8 +56,7 @@ class Property {
/*!
* Create a new property
*/
- Property(const std::string name, const std::string description,
- const std::string value)
+ Property(const std::string name, const std::string description, const std::string value)
: name_(name),
isCollection(false),
description_(description) {
@@ -144,8 +143,7 @@ class Property {
}
}
// Convert String
- static bool StringToTime(std::string input, int64_t &output,
- TimeUnit &timeunit) {
+ static bool StringToTime(std::string input, int64_t &output, TimeUnit &timeunit) {
if (input.size() == 0) {
return false;
}
@@ -165,28 +163,23 @@ class Property {
std::string unit(pEnd);
- if (unit == "sec" || unit == "s" || unit == "second" || unit == "seconds"
- || unit == "secs") {
+ if (unit == "sec" || unit == "s" || unit == "second" || unit == "seconds" || unit == "secs") {
timeunit = SECOND;
output = ival;
return true;
- } else if (unit == "min" || unit == "m" || unit == "mins"
- || unit == "minute" || unit == "minutes") {
+ } else if (unit == "min" || unit == "m" || unit == "mins" || unit == "minute" || unit == "minutes") {
timeunit = MINUTE;
output = ival;
return true;
- } else if (unit == "ns" || unit == "nano" || unit == "nanos"
- || unit == "nanoseconds") {
+ } else if (unit == "ns" || unit == "nano" || unit == "nanos" || unit == "nanoseconds") {
timeunit = NANOSECOND;
output = ival;
return true;
- } else if (unit == "ms" || unit == "milli" || unit == "millis"
- || unit == "milliseconds") {
+ } else if (unit == "ms" || unit == "milli" || unit == "millis" || unit == "milliseconds") {
timeunit = MILLISECOND;
output = ival;
return true;
- } else if (unit == "h" || unit == "hr" || unit == "hour" || unit == "hrs"
- || unit == "hours") {
+ } else if (unit == "h" || unit == "hr" || unit == "hour" || unit == "hrs" || unit == "hours") {
timeunit = HOUR;
output = ival;
return true;
@@ -219,8 +212,7 @@ class Property {
}
char end0 = toupper(pEnd[0]);
- if ((end0 == 'K') || (end0 == 'M') || (end0 == 'G') || (end0 == 'T')
- || (end0 == 'P')) {
+ if ((end0 == 'K') || (end0 == 'M') || (end0 == 'G') || (end0 == 'T') || (end0 == 'P')) {
if (pEnd[1] == '\0') {
unsigned long int multiplier = 1000;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/Repository.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/Repository.h b/libminifi/include/core/Repository.h
index debdc01..5f7e6c2 100644
--- a/libminifi/include/core/Repository.h
+++ b/libminifi/include/core/Repository.h
@@ -57,10 +57,8 @@ class Repository : public CoreComponent {
/*
* Constructor for the repository
*/
- Repository(std::string repo_name="Repository",
- std::string directory = REPOSITORY_DIRECTORY,
- int64_t maxPartitionMillis = MAX_REPOSITORY_ENTRY_LIFE_TIME,
- int64_t maxPartitionBytes = MAX_REPOSITORY_STORAGE_SIZE,
+ Repository(std::string repo_name = "Repository", std::string directory = REPOSITORY_DIRECTORY, int64_t maxPartitionMillis = MAX_REPOSITORY_ENTRY_LIFE_TIME, int64_t maxPartitionBytes =
+ MAX_REPOSITORY_STORAGE_SIZE,
uint64_t purgePeriod = REPOSITORY_PURGE_PERIOD)
: CoreComponent(repo_name),
thread_(),
@@ -111,8 +109,7 @@ class Repository : public CoreComponent {
virtual bool isRunning() {
return running_;
}
- uint64_t incrementSize(const char *fpath, const struct stat *sb,
- int typeflag) {
+ uint64_t incrementSize(const char *fpath, const struct stat *sb, int typeflag) {
return (repo_size_ += sb->st_size);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/RepositoryFactory.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/RepositoryFactory.h b/libminifi/include/core/RepositoryFactory.h
index db474a0..9fafb57 100644
--- a/libminifi/include/core/RepositoryFactory.h
+++ b/libminifi/include/core/RepositoryFactory.h
@@ -30,8 +30,7 @@ namespace minifi {
namespace core {
-std::shared_ptr<core::Repository> createRepository(
- const std::string configuration_class_name, bool fail_safe = false,const std::string repo_name = "");
+std::shared_ptr<core::Repository> createRepository(const std::string configuration_class_name, bool fail_safe = false, const std::string repo_name = "");
} /* namespace core */
} /* namespace minifi */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/Resource.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/Resource.h b/libminifi/include/core/Resource.h
index 8f110a1..1787843 100644
--- a/libminifi/include/core/Resource.h
+++ b/libminifi/include/core/Resource.h
@@ -32,8 +32,7 @@ class StaticClassType {
StaticClassType(const std::string &name) {
// Notify when the static member is created
- ClassLoader::getDefaultClassLoader().registerClass(
- name, std::unique_ptr<ObjectFactory>(new DefautObjectFactory<T>()));
+ ClassLoader::getDefaultClassLoader().registerClass(name, std::unique_ptr<ObjectFactory>(new DefautObjectFactory<T>()));
}
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/controller/ControllerServiceLookup.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/controller/ControllerServiceLookup.h b/libminifi/include/core/controller/ControllerServiceLookup.h
index 6f23e34..31dfa21 100644
--- a/libminifi/include/core/controller/ControllerServiceLookup.h
+++ b/libminifi/include/core/controller/ControllerServiceLookup.h
@@ -53,8 +53,7 @@ class ControllerServiceLookup {
* @param identifier reference string for controller service.
* @return controller service reference.
*/
- virtual std::shared_ptr<ControllerService> getControllerService(
- const std::string &identifier) = 0;
+ virtual std::shared_ptr<ControllerService> getControllerService(const std::string &identifier) = 0;
/**
* Detects if controller service is enabled.
@@ -74,8 +73,7 @@ class ControllerServiceLookup {
* Gets the controller service name for the provided reference identifier
* @param identifier reference string for the controller service.
*/
- virtual const std::string getControllerServiceName(
- const std::string &identifier) = 0;
+ virtual const std::string getControllerServiceName(const std::string &identifier) = 0;
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/controller/ControllerServiceMap.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/controller/ControllerServiceMap.h b/libminifi/include/core/controller/ControllerServiceMap.h
index f1cc2cf..b5e3599 100644
--- a/libminifi/include/core/controller/ControllerServiceMap.h
+++ b/libminifi/include/core/controller/ControllerServiceMap.h
@@ -51,8 +51,7 @@ class ControllerServiceMap {
* @param id identifier for controller service.
* @return nullptr if node does not exist or controller service node shared pointer.
*/
- virtual std::shared_ptr<ControllerServiceNode> getControllerServiceNode(
- const std::string &id) {
+ virtual std::shared_ptr<ControllerServiceNode> getControllerServiceNode(const std::string &id) {
std::lock_guard<std::mutex> lock(mutex_);
auto exists = controller_services_.find(id);
if (exists != controller_services_.end())
@@ -66,8 +65,7 @@ class ControllerServiceMap {
* @param serviceNode service node to remove
*
*/
- virtual bool removeControllerService(
- const std::shared_ptr<ControllerServiceNode> &serviceNode) {
+ virtual bool removeControllerService(const std::shared_ptr<ControllerServiceNode> &serviceNode) {
if (IsNullOrEmpty(serviceNode.get()))
return false;
std::lock_guard<std::mutex> lock(mutex_);
@@ -82,8 +80,7 @@ class ControllerServiceMap {
* @param serviceNode controller service node shared pointer.
*
*/
- virtual bool put(const std::string &id,
- const std::shared_ptr<ControllerServiceNode> &serviceNode) {
+ virtual bool put(const std::string &id, const std::shared_ptr<ControllerServiceNode> &serviceNode) {
if (IsNullOrEmpty(id) || IsNullOrEmpty(serviceNode.get()))
return false;
std::lock_guard<std::mutex> lock(mutex_);
@@ -98,8 +95,7 @@ class ControllerServiceMap {
*/
std::vector<std::shared_ptr<ControllerServiceNode>> getAllControllerServices() {
std::lock_guard<std::mutex> lock(mutex_);
- return std::vector<std::shared_ptr<ControllerServiceNode>>(
- controller_services_list_.begin(), controller_services_list_.end());
+ return std::vector<std::shared_ptr<ControllerServiceNode>>(controller_services_list_.begin(), controller_services_list_.end());
}
ControllerServiceMap(const ControllerServiceMap &other) = delete;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/controller/ControllerServiceNode.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/controller/ControllerServiceNode.h b/libminifi/include/core/controller/ControllerServiceNode.h
index 54015be..8f30e4e 100644
--- a/libminifi/include/core/controller/ControllerServiceNode.h
+++ b/libminifi/include/core/controller/ControllerServiceNode.h
@@ -42,8 +42,7 @@ class ControllerServiceNode : public CoreComponent, public ConfigurableComponent
* @param id identifier for this node.
* @param configuration shared pointer configuration.
*/
- explicit ControllerServiceNode(std::shared_ptr<ControllerService> service,
- const std::string &id, std::shared_ptr<Configure> configuration)
+ explicit ControllerServiceNode(std::shared_ptr<ControllerService> service, const std::string &id, std::shared_ptr<Configure> configuration)
: CoreComponent(id),
ConfigurableComponent(),
controller_service_(service),
@@ -53,8 +52,7 @@ class ControllerServiceNode : public CoreComponent, public ConfigurableComponent
throw Exception(GENERAL_EXCEPTION, "Service must be properly configured");
}
if (IsNullOrEmpty(configuration)) {
- throw Exception(GENERAL_EXCEPTION,
- "Configuration must be properly configured");
+ throw Exception(GENERAL_EXCEPTION, "Configuration must be properly configured");
}
service->setConfiguration(configuration);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/controller/ControllerServiceProvider.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/controller/ControllerServiceProvider.h b/libminifi/include/core/controller/ControllerServiceProvider.h
index 978352b..148f970 100644
--- a/libminifi/include/core/controller/ControllerServiceProvider.h
+++ b/libminifi/include/core/controller/ControllerServiceProvider.h
@@ -33,8 +33,7 @@ namespace minifi {
namespace core {
namespace controller {
-class ControllerServiceProvider : public CoreComponent,
- public ConfigurableComponent, public ControllerServiceLookup {
+class ControllerServiceProvider : public CoreComponent, public ConfigurableComponent, public ControllerServiceLookup {
public:
explicit ControllerServiceProvider(const std::string &name)
@@ -43,15 +42,13 @@ class ControllerServiceProvider : public CoreComponent,
controller_map_ = std::make_shared<ControllerServiceMap>();
}
- explicit ControllerServiceProvider(
- std::shared_ptr<ControllerServiceMap> services)
+ explicit ControllerServiceProvider(std::shared_ptr<ControllerServiceMap> services)
: CoreComponent(core::getClassName<ControllerServiceProvider>()),
ConfigurableComponent(),
controller_map_(services) {
}
- explicit ControllerServiceProvider(
- const std::string &name, std::shared_ptr<ControllerServiceMap> services)
+ explicit ControllerServiceProvider(const std::string &name, std::shared_ptr<ControllerServiceMap> services)
: CoreComponent(name),
ConfigurableComponent(),
controller_map_(services) {
@@ -73,9 +70,8 @@ class ControllerServiceProvider : public CoreComponent,
* @param id controller service identifier.
* @return shared pointer to the controller service node.
*/
- virtual std::shared_ptr<ControllerServiceNode> createControllerService(
- const std::string &type, const std::string &id,
- bool firstTimeAdded) = 0;
+ virtual std::shared_ptr<ControllerServiceNode> createControllerService(const std::string &type, const std::string &id,
+ bool firstTimeAdded) = 0;
/**
* Gets a controller service node wrapping the controller service
*
@@ -83,8 +79,7 @@ class ControllerServiceProvider : public CoreComponent,
* @param id controller service identifier.
* @return shared pointer to the controller service node.
*/
- virtual std::shared_ptr<ControllerServiceNode> getControllerServiceNode(
- const std::string &id) {
+ virtual std::shared_ptr<ControllerServiceNode> getControllerServiceNode(const std::string &id) {
return controller_map_->getControllerServiceNode(id);
}
@@ -92,8 +87,7 @@ class ControllerServiceProvider : public CoreComponent,
* Removes a controller service.
* @param serviceNode controller service node.
*/
- virtual void removeControllerService(
- const std::shared_ptr<ControllerServiceNode> &serviceNode) {
+ virtual void removeControllerService(const std::shared_ptr<ControllerServiceNode> &serviceNode) {
controller_map_->removeControllerService(serviceNode);
}
@@ -101,22 +95,19 @@ class ControllerServiceProvider : public CoreComponent,
* Enables the provided controller service
* @param serviceNode controller service node.
*/
- virtual void enableControllerService(
- std::shared_ptr<ControllerServiceNode> &serviceNode) = 0;
+ virtual void enableControllerService(std::shared_ptr<ControllerServiceNode> &serviceNode) = 0;
/**
* Enables the provided controller service nodes
* @param serviceNode controller service node.
*/
- virtual void enableControllerServices(
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> serviceNodes) = 0;
+ virtual void enableControllerServices(std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> serviceNodes) = 0;
/**
* Disables the provided controller service node
* @param serviceNode controller service node.
*/
- virtual void disableControllerService(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
+ virtual void disableControllerService(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
/**
* Gets a list of all controller services.
@@ -128,28 +119,24 @@ class ControllerServiceProvider : public CoreComponent,
/**
* Verifies that referencing components can be stopped for the controller service
*/
- virtual void verifyCanStopReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
+ virtual void verifyCanStopReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
/**
* Unschedules referencing components.
*/
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> unscheduleReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> unscheduleReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
/**
* Verifies referencing components for <code>serviceNode</code> can be disabled.
* @param serviceNode shared pointer to a controller service node.
*/
- virtual void verifyCanDisableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
+ virtual void verifyCanDisableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
/**
* Disables referencing components for <code>serviceNode</code> can be disabled.
* @param serviceNode shared pointer to a controller service node.
*/
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> disableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> disableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
return std::vector<std::shared_ptr<core::controller::ControllerServiceNode>>();
}
@@ -157,10 +144,8 @@ class ControllerServiceProvider : public CoreComponent,
* Verifies referencing components for <code>serviceNode</code> can be enabled.
* @param serviceNode shared pointer to a controller service node.
*/
- virtual void verifyCanEnableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references =
- findLinkedComponents(serviceNode);
+ virtual void verifyCanEnableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references = findLinkedComponents(serviceNode);
for (auto ref : references) {
ref->canEnable();
}
@@ -170,24 +155,20 @@ class ControllerServiceProvider : public CoreComponent,
* Enables referencing components for <code>serviceNode</code> can be Enabled.
* @param serviceNode shared pointer to a controller service node.
*/
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> enableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> enableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
/**
* Schedules the service node and referencing components.
* @param serviceNode shared pointer to a controller service node.
*/
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> scheduleReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> scheduleReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) = 0;
/**
* Returns a controller service for the service identifier and componentID
* @param service Identifier service identifier.
*/
- virtual std::shared_ptr<ControllerService> getControllerServiceForComponent(
- const std::string &serviceIdentifier, const std::string &componentId) {
- std::shared_ptr<ControllerService> node = getControllerService(
- serviceIdentifier);
+ virtual std::shared_ptr<ControllerService> getControllerServiceForComponent(const std::string &serviceIdentifier, const std::string &componentId) {
+ std::shared_ptr<ControllerService> node = getControllerService(serviceIdentifier);
return node;
}
@@ -195,16 +176,14 @@ class ControllerServiceProvider : public CoreComponent,
* Gets the controller service for the provided identifier
* @param identifier service identifier.
*/
- virtual std::shared_ptr<ControllerService> getControllerService(
- const std::string &identifier);
+ virtual std::shared_ptr<ControllerService> getControllerService(const std::string &identifier);
/**
* Determines if Controller service is enabled.
* @param identifier service identifier.
*/
virtual bool isControllerServiceEnabled(const std::string &identifier) {
- std::shared_ptr<ControllerServiceNode> node = getControllerServiceNode(
- identifier);
+ std::shared_ptr<ControllerServiceNode> node = getControllerServiceNode(identifier);
if (nullptr != node) {
return linkedServicesAre(ENABLED, node);
} else
@@ -216,16 +195,14 @@ class ControllerServiceProvider : public CoreComponent,
* @param identifier service identifier.
*/
virtual bool isControllerServiceEnabling(const std::string &identifier) {
- std::shared_ptr<ControllerServiceNode> node = getControllerServiceNode(
- identifier);
+ std::shared_ptr<ControllerServiceNode> node = getControllerServiceNode(identifier);
if (nullptr != node) {
return linkedServicesAre(ENABLING, node);
} else
return false;
}
- virtual const std::string getControllerServiceName(
- const std::string &identifier) {
+ virtual const std::string getControllerServiceName(const std::string &identifier) {
std::shared_ptr<ControllerService> node = getControllerService(identifier);
if (nullptr != node) {
return node->getName();
@@ -240,13 +217,10 @@ class ControllerServiceProvider : public CoreComponent,
/**
* verifies that linked services match the provided state.
*/
- inline bool linkedServicesAre(
- ControllerServiceState state,
- const std::shared_ptr<ControllerServiceNode> &node) {
+ inline bool linkedServicesAre(ControllerServiceState state, const std::shared_ptr<ControllerServiceNode> &node) {
if (node->getControllerServiceImplementation()->getState() == state) {
for (auto child_service : node->getLinkedControllerServices()) {
- if (child_service->getControllerServiceImplementation()->getState()
- != state) {
+ if (child_service->getControllerServiceImplementation()->getState() != state) {
return false;
}
}
@@ -264,30 +238,22 @@ class ControllerServiceProvider : public CoreComponent,
* Finds linked components
* @param referenceNode reference node from whcih we will find linked references.
*/
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> findLinkedComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &referenceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> findLinkedComponents(std::shared_ptr<core::controller::ControllerServiceNode> &referenceNode) {
std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references;
- for (std::shared_ptr<core::controller::ControllerServiceNode> linked_node : referenceNode
- ->getLinkedControllerServices()) {
+ for (std::shared_ptr<core::controller::ControllerServiceNode> linked_node : referenceNode->getLinkedControllerServices()) {
references.push_back(linked_node);
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> linked_references =
- findLinkedComponents(linked_node);
-
- auto removal_predicate =
- [&linked_references](std::shared_ptr<core::controller::ControllerServiceNode> key) ->bool
- {
- return std::find(linked_references.begin(), linked_references.end(), key) != linked_references.end();
- };
-
- references.erase(
- std::remove_if(references.begin(), references.end(),
- removal_predicate),
- references.end());
-
- references.insert(std::end(references), linked_references.begin(),
- linked_references.end());
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> linked_references = findLinkedComponents(linked_node);
+
+ auto removal_predicate = [&linked_references](std::shared_ptr<core::controller::ControllerServiceNode> key) ->bool
+ {
+ return std::find(linked_references.begin(), linked_references.end(), key) != linked_references.end();
+ };
+
+ references.erase(std::remove_if(references.begin(), references.end(), removal_predicate), references.end());
+
+ references.insert(std::end(references), linked_references.begin(), linked_references.end());
}
return references;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/controller/StandardControllerServiceNode.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/controller/StandardControllerServiceNode.h b/libminifi/include/core/controller/StandardControllerServiceNode.h
index 563c0f5..8e0b238 100644
--- a/libminifi/include/core/controller/StandardControllerServiceNode.h
+++ b/libminifi/include/core/controller/StandardControllerServiceNode.h
@@ -33,18 +33,14 @@ namespace controller {
class StandardControllerServiceNode : public ControllerServiceNode {
public:
- explicit StandardControllerServiceNode(
- std::shared_ptr<ControllerService> service,
- std::shared_ptr<ControllerServiceProvider> provider,
- const std::string &id, std::shared_ptr<Configure> configuration)
+ explicit StandardControllerServiceNode(std::shared_ptr<ControllerService> service, std::shared_ptr<ControllerServiceProvider> provider, const std::string &id,
+ std::shared_ptr<Configure> configuration)
: ControllerServiceNode(service, id, configuration),
provider(provider),
logger_(logging::LoggerFactory<StandardControllerServiceNode>::getLogger()) {
}
- explicit StandardControllerServiceNode(
- std::shared_ptr<ControllerService> service, const std::string &id,
- std::shared_ptr<Configure> configuration)
+ explicit StandardControllerServiceNode(std::shared_ptr<ControllerService> service, const std::string &id, std::shared_ptr<Configure> configuration)
: ControllerServiceNode(service, id, configuration),
provider(nullptr),
logger_(logging::LoggerFactory<StandardControllerServiceNode>::getLogger()) {
@@ -55,8 +51,7 @@ class StandardControllerServiceNode : public ControllerServiceNode {
void setProcessGroup(std::shared_ptr<ProcessGroup> &processGroup);
StandardControllerServiceNode(const StandardControllerServiceNode &other) = delete;
- StandardControllerServiceNode &operator=(
- const StandardControllerServiceNode &parent) = delete;
+ StandardControllerServiceNode &operator=(const StandardControllerServiceNode &parent) = delete;
/**
* Initializes the controller service node.
@@ -98,7 +93,7 @@ class StandardControllerServiceNode : public ControllerServiceNode {
std::mutex mutex_;
private:
- std::shared_ptr<logging::Logger> logger_;
+ std::shared_ptr<logging::Logger> logger_;
};
} /* namespace controller */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/controller/StandardControllerServiceProvider.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/controller/StandardControllerServiceProvider.h b/libminifi/include/core/controller/StandardControllerServiceProvider.h
index 1e94ab7..f474ed2 100644
--- a/libminifi/include/core/controller/StandardControllerServiceProvider.h
+++ b/libminifi/include/core/controller/StandardControllerServiceProvider.h
@@ -38,15 +38,12 @@ namespace minifi {
namespace core {
namespace controller {
-class StandardControllerServiceProvider : public ControllerServiceProvider,
- public std::enable_shared_from_this<StandardControllerServiceProvider> {
+class StandardControllerServiceProvider : public ControllerServiceProvider, public std::enable_shared_from_this<StandardControllerServiceProvider> {
public:
- explicit StandardControllerServiceProvider(
- std::shared_ptr<ControllerServiceMap> services,
- std::shared_ptr<ProcessGroup> root_group, std::shared_ptr<Configure> configuration,
- std::shared_ptr<minifi::SchedulingAgent> agent, ClassLoader &loader =
- ClassLoader::getDefaultClassLoader())
+ explicit StandardControllerServiceProvider(std::shared_ptr<ControllerServiceMap> services, std::shared_ptr<ProcessGroup> root_group, std::shared_ptr<Configure> configuration,
+ std::shared_ptr<minifi::SchedulingAgent> agent,
+ ClassLoader &loader = ClassLoader::getDefaultClassLoader())
: ControllerServiceProvider(services),
root_group_(root_group),
agent_(agent),
@@ -55,10 +52,8 @@ class StandardControllerServiceProvider : public ControllerServiceProvider,
logger_(logging::LoggerFactory<StandardControllerServiceProvider>::getLogger()) {
}
- explicit StandardControllerServiceProvider(
- std::shared_ptr<ControllerServiceMap> services,
- std::shared_ptr<ProcessGroup> root_group, std::shared_ptr<Configure> configuration,
- ClassLoader &loader = ClassLoader::getDefaultClassLoader())
+ explicit StandardControllerServiceProvider(std::shared_ptr<ControllerServiceMap> services, std::shared_ptr<ProcessGroup> root_group, std::shared_ptr<Configure> configuration, ClassLoader &loader =
+ ClassLoader::getDefaultClassLoader())
: ControllerServiceProvider(services),
root_group_(root_group),
agent_(0),
@@ -67,8 +62,7 @@ class StandardControllerServiceProvider : public ControllerServiceProvider,
logger_(logging::LoggerFactory<StandardControllerServiceProvider>::getLogger()) {
}
- explicit StandardControllerServiceProvider(
- const StandardControllerServiceProvider && other)
+ explicit StandardControllerServiceProvider(const StandardControllerServiceProvider && other)
: ControllerServiceProvider(std::move(other)),
root_group_(std::move(other.root_group_)),
agent_(std::move(other.agent_)),
@@ -86,40 +80,33 @@ class StandardControllerServiceProvider : public ControllerServiceProvider,
agent_ = agent;
}
- std::shared_ptr<ControllerServiceNode> createControllerService(
- const std::string &type, const std::string &id,
- bool firstTimeAdded) {
+ std::shared_ptr<ControllerServiceNode> createControllerService(const std::string &type, const std::string &id,
+ bool firstTimeAdded) {
- std::shared_ptr<ControllerService> new_controller_service =
- extension_loader_.instantiate<ControllerService>(type, id);
+ std::shared_ptr<ControllerService> new_controller_service = extension_loader_.instantiate<ControllerService>(type, id);
if (nullptr == new_controller_service) {
return nullptr;
}
- std::shared_ptr<ControllerServiceNode> new_service_node = std::make_shared<
- StandardControllerServiceNode>(
- new_controller_service,
- std::static_pointer_cast<ControllerServiceProvider>(shared_from_this()),
- id, configuration_);
+ std::shared_ptr<ControllerServiceNode> new_service_node = std::make_shared<StandardControllerServiceNode>(new_controller_service,
+ std::static_pointer_cast<ControllerServiceProvider>(shared_from_this()),
+ id,
+ configuration_);
controller_map_->put(id, new_service_node);
return new_service_node;
}
-
- void enableControllerService(
- std::shared_ptr<ControllerServiceNode> &serviceNode) {
+ void enableControllerService(std::shared_ptr<ControllerServiceNode> &serviceNode) {
if (serviceNode->canEnable()) {
agent_->enableControllerService(serviceNode);
}
}
-
virtual void enableAllControllerServices() {
- logger_->log_info("Enabling %d controller services",
- controller_map_->getAllControllerServices().size());
+ logger_->log_info("Enabling %d controller services", controller_map_->getAllControllerServices().size());
for (auto service : controller_map_->getAllControllerServices()) {
if (service->canEnable()) {
@@ -131,43 +118,31 @@ class StandardControllerServiceProvider : public ControllerServiceProvider,
}
}
-
- void enableControllerServices(
- std::vector<std::shared_ptr<ControllerServiceNode>> serviceNodes) {
+ void enableControllerServices(std::vector<std::shared_ptr<ControllerServiceNode>> serviceNodes) {
for (auto node : serviceNodes) {
enableControllerService(node);
}
}
-
- void disableControllerService(
- std::shared_ptr<ControllerServiceNode> &serviceNode) {
+ void disableControllerService(std::shared_ptr<ControllerServiceNode> &serviceNode) {
if (!IsNullOrEmpty(serviceNode.get()) && serviceNode->enabled()) {
agent_->disableControllerService(serviceNode);
}
}
-
- void verifyCanStopReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ void verifyCanStopReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
}
-
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> unscheduleReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references =
- findLinkedComponents(serviceNode);
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> unscheduleReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references = findLinkedComponents(serviceNode);
for (auto ref : references) {
agent_->disableControllerService(ref);
}
return references;
}
-
- void verifyCanDisableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references =
- findLinkedComponents(serviceNode);
+ void verifyCanDisableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references = findLinkedComponents(serviceNode);
for (auto ref : references) {
if (!ref->canEnable()) {
logger_->log_info("Cannot disable %s", ref->getName());
@@ -175,11 +150,8 @@ class StandardControllerServiceProvider : public ControllerServiceProvider,
}
}
-
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> disableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references =
- findLinkedComponents(serviceNode);
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> disableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references = findLinkedComponents(serviceNode);
for (auto ref : references) {
agent_->disableControllerService(ref);
}
@@ -187,20 +159,16 @@ class StandardControllerServiceProvider : public ControllerServiceProvider,
return references;
}
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> enableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references =
- findLinkedComponents(serviceNode);
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> enableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references = findLinkedComponents(serviceNode);
for (auto ref : references) {
agent_->enableControllerService(ref);
}
return references;
}
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> scheduleReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references =
- findLinkedComponents(serviceNode);
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> scheduleReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> references = findLinkedComponents(serviceNode);
for (auto ref : references) {
agent_->enableControllerService(ref);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/logging/Logger.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/logging/Logger.h b/libminifi/include/core/logging/Logger.h
index 6b71763..8b80006 100644
--- a/libminifi/include/core/logging/Logger.h
+++ b/libminifi/include/core/logging/Logger.h
@@ -64,9 +64,9 @@ class Logger {
*/
template<typename ... Args>
void log_error(const char * const format, const Args& ... args) {
- log(spdlog::level::err, format, args...);
+ log(spdlog::level::err, format, args...);
}
-
+
/**
* @brief Log warn message
* @param format format string ('man printf' for syntax)
@@ -74,9 +74,9 @@ class Logger {
*/
template<typename ... Args>
void log_warn(const char * const format, const Args& ... args) {
- log(spdlog::level::warn, format, args...);
+ log(spdlog::level::warn, format, args...);
}
-
+
/**
* @brief Log info message
* @param format format string ('man printf' for syntax)
@@ -84,9 +84,9 @@ class Logger {
*/
template<typename ... Args>
void log_info(const char * const format, const Args& ... args) {
- log(spdlog::level::info, format, args...);
+ log(spdlog::level::info, format, args...);
}
-
+
/**
* @brief Log debug message
* @param format format string ('man printf' for syntax)
@@ -94,9 +94,9 @@ class Logger {
*/
template<typename ... Args>
void log_debug(const char * const format, const Args& ... args) {
- log(spdlog::level::debug, format, args...);
+ log(spdlog::level::debug, format, args...);
}
-
+
/**
* @brief Log trace message
* @param format format string ('man printf' for syntax)
@@ -104,25 +104,27 @@ class Logger {
*/
template<typename ... Args>
void log_trace(const char * const format, const Args& ... args) {
- log(spdlog::level::trace, format, args...);
+ log(spdlog::level::trace, format, args...);
}
-
+
protected:
- Logger(std::shared_ptr<spdlog::logger> delegate) : delegate_(delegate) {}
-
+ Logger(std::shared_ptr<spdlog::logger> delegate)
+ : delegate_(delegate) {
+ }
+
std::shared_ptr<spdlog::logger> delegate_;
std::mutex mutex_;
- private:
+ private:
template<typename ... Args>
inline void log(spdlog::level::level_enum level, const char * const format, const Args& ... args) {
- std::lock_guard<std::mutex> lock(mutex_);
- if (!delegate_->should_log(level)) {
- return;
- }
- delegate_->log(level, format_string(format, conditional_conversion(args)...));
+ std::lock_guard<std::mutex> lock(mutex_);
+ if (!delegate_->should_log(level)) {
+ return;
+ }
+ delegate_->log(level, format_string(format, conditional_conversion(args)...));
}
-
+
Logger(Logger const&);
Logger& operator=(Logger const&);
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/logging/LoggerConfiguration.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/logging/LoggerConfiguration.h b/libminifi/include/core/logging/LoggerConfiguration.h
index 53f1403..99d318b 100644
--- a/libminifi/include/core/logging/LoggerConfiguration.h
+++ b/libminifi/include/core/logging/LoggerConfiguration.h
@@ -38,15 +38,21 @@ namespace core {
namespace logging {
namespace internal {
- struct LoggerNamespace {
- spdlog::level::level_enum level;
- bool has_level;
- std::vector<std::shared_ptr<spdlog::sinks::sink>> sinks;
- std::map<std::string, std::shared_ptr<LoggerNamespace>> children;
-
- LoggerNamespace() : level(spdlog::level::off), has_level(false), sinks(std::vector<std::shared_ptr<spdlog::sinks::sink>>()), children(std::map<std::string, std::shared_ptr<LoggerNamespace>>()) {}
- };
+struct LoggerNamespace {
+ spdlog::level::level_enum level;
+ bool has_level;
+ std::vector<std::shared_ptr<spdlog::sinks::sink>> sinks;
+ std::map<std::string, std::shared_ptr<LoggerNamespace>> children;
+
+ LoggerNamespace()
+ : level(spdlog::level::off),
+ has_level(false),
+ sinks(std::vector<std::shared_ptr<spdlog::sinks::sink>>()),
+ children(std::map<std::string, std::shared_ptr<LoggerNamespace>>()) {
+ }
};
+}
+;
class LoggerProperties : public Properties {
public:
@@ -62,15 +68,15 @@ class LoggerProperties : public Properties {
* Registers a sink witht the given name. This allows for programmatic definition of sinks.
*/
void add_sink(const std::string &name, std::shared_ptr<spdlog::sinks::sink> sink) {
- sinks_[name] = sink;
+ sinks_[name] = sink;
}
std::map<std::string, std::shared_ptr<spdlog::sinks::sink>> initial_sinks() {
- return sinks_;
+ return sinks_;
}
static const char* appender_prefix;
static const char* logger_prefix;
- private:
+ private:
std::map<std::string, std::shared_ptr<spdlog::sinks::sink>> sinks_;
};
@@ -80,8 +86,8 @@ class LoggerConfiguration {
* Gets the current log configuration
*/
static LoggerConfiguration& getConfiguration() {
- static LoggerConfiguration logger_configuration;
- return logger_configuration;
+ static LoggerConfiguration logger_configuration;
+ return logger_configuration;
}
/**
@@ -94,20 +100,25 @@ class LoggerConfiguration {
*/
std::shared_ptr<Logger> getLogger(const std::string &name);
static const char *spdlog_default_pattern;
- protected:
- static std::shared_ptr<internal::LoggerNamespace> initialize_namespaces(const std::shared_ptr<LoggerProperties> &logger_properties);
- static std::shared_ptr<spdlog::logger> get_logger(std::shared_ptr<Logger> logger, const std::shared_ptr<internal::LoggerNamespace> &root_namespace, const std::string &name, std::shared_ptr<spdlog::formatter> formatter, bool remove_if_present = false);
- private:
+ protected:
+ static std::shared_ptr<internal::LoggerNamespace> initialize_namespaces(const std::shared_ptr<LoggerProperties> &logger_properties);
+ static std::shared_ptr<spdlog::logger> get_logger(std::shared_ptr<Logger> logger, const std::shared_ptr<internal::LoggerNamespace> &root_namespace, const std::string &name,
+ std::shared_ptr<spdlog::formatter> formatter,
+ bool remove_if_present = false);
+ private:
static std::shared_ptr<internal::LoggerNamespace> create_default_root();
class LoggerImpl : public Logger {
- public:
- LoggerImpl(std::string name, std::shared_ptr<spdlog::logger> delegate):Logger(delegate), name(name) {}
- void set_delegate(std::shared_ptr<spdlog::logger> delegate) {
- std::lock_guard<std::mutex> lock(mutex_);
- delegate_ = delegate;
- }
- const std::string name;
+ public:
+ LoggerImpl(std::string name, std::shared_ptr<spdlog::logger> delegate)
+ : Logger(delegate),
+ name(name) {
+ }
+ void set_delegate(std::shared_ptr<spdlog::logger> delegate) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ delegate_ = delegate;
+ }
+ const std::string name;
};
LoggerConfiguration();
@@ -125,8 +136,8 @@ class LoggerFactory {
* Gets an initialized logger for the template class.
*/
static std::shared_ptr<Logger> getLogger() {
- static std::shared_ptr<Logger> logger = LoggerConfiguration::getConfiguration().getLogger(core::getClassName<T>());
- return logger;
+ static std::shared_ptr<Logger> logger = LoggerConfiguration::getConfiguration().getLogger(core::getClassName<T>());
+ return logger;
}
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/reporting/SiteToSiteProvenanceReportingTask.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/reporting/SiteToSiteProvenanceReportingTask.h b/libminifi/include/core/reporting/SiteToSiteProvenanceReportingTask.h
index b191499..9e3f567 100644
--- a/libminifi/include/core/reporting/SiteToSiteProvenanceReportingTask.h
+++ b/libminifi/include/core/reporting/SiteToSiteProvenanceReportingTask.h
@@ -39,15 +39,13 @@ namespace core {
namespace reporting {
//! SiteToSiteProvenanceReportingTask Class
-class SiteToSiteProvenanceReportingTask :
- public minifi::RemoteProcessorGroupPort {
+class SiteToSiteProvenanceReportingTask : public minifi::RemoteProcessorGroupPort {
public:
//! Constructor
/*!
* Create a new processor
*/
- SiteToSiteProvenanceReportingTask(
- const std::shared_ptr<io::StreamFactory> &stream_factory)
+ SiteToSiteProvenanceReportingTask(const std::shared_ptr<io::StreamFactory> &stream_factory)
: minifi::RemoteProcessorGroupPort(stream_factory, ReportTaskName),
logger_(logging::LoggerFactory<SiteToSiteProvenanceReportingTask>::getLogger()) {
this->setTriggerWhenEmpty(true);
@@ -59,21 +57,15 @@ class SiteToSiteProvenanceReportingTask :
}
//! Report Task Name
- static constexpr char const* ReportTaskName =
- "SiteToSiteProvenanceReportingTask";
+ static constexpr char const* ReportTaskName = "SiteToSiteProvenanceReportingTask";
static const char *ProvenanceAppStr;
public:
//! Get provenance json report
- void getJsonReport(
- core::ProcessContext *context, core::ProcessSession *session,
- std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records,
- std::string &report);
- void onSchedule(core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory);
+ void getJsonReport(core::ProcessContext *context, core::ProcessSession *session, std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records, std::string &report);
+ void onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory);
//! OnTrigger method, implemented by NiFi SiteToSiteProvenanceReportingTask
- virtual void onTrigger(core::ProcessContext *context,
- core::ProcessSession *session);
+ virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
//! Initialize, over write by NiFi SiteToSiteProvenanceReportingTask
virtual void initialize(void);
//! Set Port UUID
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/repository/FlowFileRepository.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/repository/FlowFileRepository.h b/libminifi/include/core/repository/FlowFileRepository.h
index 330a3d0..b7c43b2 100644
--- a/libminifi/include/core/repository/FlowFileRepository.h
+++ b/libminifi/include/core/repository/FlowFileRepository.h
@@ -43,22 +43,20 @@ namespace repository {
* Flow File repository
* Design: Extends Repository and implements the run function, using LevelDB as the primary substrate.
*/
-class FlowFileRepository : public core::Repository,
- public std::enable_shared_from_this<FlowFileRepository> {
+class FlowFileRepository : public core::Repository, public std::enable_shared_from_this<FlowFileRepository> {
public:
// Constructor
- FlowFileRepository(const std::string repo_name = "", std::string directory=FLOWFILE_REPOSITORY_DIRECTORY, int64_t maxPartitionMillis=MAX_FLOWFILE_REPOSITORY_ENTRY_LIFE_TIME,
- int64_t maxPartitionBytes=MAX_FLOWFILE_REPOSITORY_STORAGE_SIZE, uint64_t purgePeriod=FLOWFILE_REPOSITORY_PURGE_PERIOD)
- : Repository(repo_name.length() > 0 ? repo_name : core::getClassName<FlowFileRepository>(), directory,
- maxPartitionMillis, maxPartitionBytes, purgePeriod),
+ FlowFileRepository(const std::string repo_name = "", std::string directory = FLOWFILE_REPOSITORY_DIRECTORY, int64_t maxPartitionMillis = MAX_FLOWFILE_REPOSITORY_ENTRY_LIFE_TIME,
+ int64_t maxPartitionBytes = MAX_FLOWFILE_REPOSITORY_STORAGE_SIZE,
+ uint64_t purgePeriod = FLOWFILE_REPOSITORY_PURGE_PERIOD)
+ : Repository(repo_name.length() > 0 ? repo_name : core::getClassName<FlowFileRepository>(), directory, maxPartitionMillis, maxPartitionBytes, purgePeriod),
logger_(logging::LoggerFactory<FlowFileRepository>::getLogger())
{
db_ = NULL;
}
-
// Destructor
~FlowFileRepository() {
if (db_)
@@ -69,38 +67,27 @@ class FlowFileRepository : public core::Repository,
virtual bool initialize(const std::shared_ptr<Configure> &configure) {
std::string value;
- if (configure->get(Configure::nifi_flowfile_repository_directory_default,
- value)) {
+ if (configure->get(Configure::nifi_flowfile_repository_directory_default, value)) {
directory_ = value;
}
- logger_->log_info("NiFi FlowFile Repository Directory %s",
- directory_.c_str());
- if (configure->get(Configure::nifi_flowfile_repository_max_storage_size,
- value)) {
+ logger_->log_info("NiFi FlowFile Repository Directory %s", directory_.c_str());
+ if (configure->get(Configure::nifi_flowfile_repository_max_storage_size, value)) {
Property::StringToInt(value, max_partition_bytes_);
}
- logger_->log_info("NiFi FlowFile Max Partition Bytes %d",
- max_partition_bytes_);
- if (configure->get(Configure::nifi_flowfile_repository_max_storage_time,
- value)) {
+ logger_->log_info("NiFi FlowFile Max Partition Bytes %d", max_partition_bytes_);
+ if (configure->get(Configure::nifi_flowfile_repository_max_storage_time, value)) {
TimeUnit unit;
- if (Property::StringToTime(value, max_partition_millis_, unit)
- && Property::ConvertTimeUnitToMS(max_partition_millis_, unit,
- max_partition_millis_)) {
+ if (Property::StringToTime(value, max_partition_millis_, unit) && Property::ConvertTimeUnitToMS(max_partition_millis_, unit, max_partition_millis_)) {
}
}
- logger_->log_info("NiFi FlowFile Max Storage Time: [%d] ms",
- max_partition_millis_);
+ logger_->log_info("NiFi FlowFile Max Storage Time: [%d] ms", max_partition_millis_);
leveldb::Options options;
options.create_if_missing = true;
- leveldb::Status status = leveldb::DB::Open(options, directory_.c_str(),
- &db_);
+ leveldb::Status status = leveldb::DB::Open(options, directory_.c_str(), &db_);
if (status.ok()) {
- logger_->log_info("NiFi FlowFile Repository database open %s success",
- directory_.c_str());
+ logger_->log_info("NiFi FlowFile Repository database open %s success", directory_.c_str());
} else {
- logger_->log_error("NiFi FlowFile Repository database open %s fail",
- directory_.c_str());
+ logger_->log_error("NiFi FlowFile Repository database open %s fail", directory_.c_str());
return false;
}
return true;
@@ -145,8 +132,7 @@ class FlowFileRepository : public core::Repository,
return false;
}
- void setConnectionMap(
- std::map<std::string, std::shared_ptr<minifi::Connection>> &connectionMap) {
+ void setConnectionMap(std::map<std::string, std::shared_ptr<minifi::Connection>> &connectionMap) {
this->connectionMap = connectionMap;
}
void loadComponent();
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/repository/VolatileRepository.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/repository/VolatileRepository.h b/libminifi/include/core/repository/VolatileRepository.h
index 37c1a0c..870a1f5 100644
--- a/libminifi/include/core/repository/VolatileRepository.h
+++ b/libminifi/include/core/repository/VolatileRepository.h
@@ -33,8 +33,7 @@ namespace minifi {
namespace core {
namespace repository {
-static uint16_t accounting_size = sizeof(std::vector<uint8_t>)
- + sizeof(std::string) + sizeof(size_t);
+static uint16_t accounting_size = sizeof(std::vector<uint8_t>) + sizeof(std::string) + sizeof(size_t);
class RepoValue {
public:
@@ -173,23 +172,16 @@ class AtomicEntry {
* Flow File repository
* Design: Extends Repository and implements the run function, using LevelDB as the primary substrate.
*/
-class VolatileRepository : public core::Repository,
- public std::enable_shared_from_this<VolatileRepository> {
+class VolatileRepository : public core::Repository, public std::enable_shared_from_this<VolatileRepository> {
public:
static const char *volatile_repo_max_count;
// Constructor
- VolatileRepository(
- std::string repo_name = "", std::string dir = REPOSITORY_DIRECTORY,
- int64_t maxPartitionMillis = MAX_REPOSITORY_ENTRY_LIFE_TIME,
- int64_t maxPartitionBytes =
- MAX_REPOSITORY_STORAGE_SIZE,
- uint64_t purgePeriod = REPOSITORY_PURGE_PERIOD)
- : Repository(
- repo_name.length() > 0 ?
- repo_name : core::getClassName<VolatileRepository>(),
- "", maxPartitionMillis, maxPartitionBytes, purgePeriod),
+ VolatileRepository(std::string repo_name = "", std::string dir = REPOSITORY_DIRECTORY, int64_t maxPartitionMillis = MAX_REPOSITORY_ENTRY_LIFE_TIME, int64_t maxPartitionBytes =
+ MAX_REPOSITORY_STORAGE_SIZE,
+ uint64_t purgePeriod = REPOSITORY_PURGE_PERIOD)
+ : Repository(repo_name.length() > 0 ? repo_name : core::getClassName<VolatileRepository>(), "", maxPartitionMillis, maxPartitionBytes, purgePeriod),
max_size_(maxPartitionBytes * 0.75),
current_index_(0),
max_count_(10000),
@@ -215,8 +207,7 @@ class VolatileRepository : public core::Repository,
if (configure != nullptr) {
int64_t max_cnt = 0;
std::stringstream strstream;
- strstream << Configure::nifi_volatile_repository_options << getName()
- << "." << volatile_repo_max_count;
+ strstream << Configure::nifi_volatile_repository_options << getName() << "." << volatile_repo_max_count;
if (configure->get(strstream.str(), value)) {
if (core::Property::StringToInt(value, max_cnt)) {
max_count_ = max_cnt;
@@ -225,8 +216,7 @@ class VolatileRepository : public core::Repository,
}
}
- logger_->log_debug("Resizing value_vector_ for %s count is %d", getName(),
- max_count_);
+ logger_->log_debug("Resizing value_vector_ for %s count is %d", getName(), max_count_);
value_vector_.reserve(max_count_);
for (int i = 0; i < max_count_; i++) {
value_vector_.emplace_back(new AtomicEntry());
@@ -259,10 +249,8 @@ class VolatileRepository : public core::Repository,
continue;
}
}
- logger_->log_info("Set repo value at %d out of %d", private_index,
- max_count_);
- updated = value_vector_.at(private_index)->setRepoValue(new_value,
- reclaimed_size);
+ logger_->log_info("Set repo value at %d out of %d", private_index, max_count_);
+ updated = value_vector_.at(private_index)->setRepoValue(new_value, reclaimed_size);
if (reclaimed_size > 0) {
current_size_ -= reclaimed_size;
@@ -271,8 +259,7 @@ class VolatileRepository : public core::Repository,
} while (!updated);
current_size_ += size;
- logger_->log_info("VolatileRepository -- put %s %d %d", key,
- current_size_.load(), current_index_.load());
+ logger_->log_info("VolatileRepository -- put %s %d %d", key, current_size_.load(), current_index_.load());
return true;
}
/**
@@ -307,8 +294,7 @@ class VolatileRepository : public core::Repository,
if (ent->getValue(key, repo_value)) {
current_size_ -= value.size();
repo_value.emplace(value);
- logger_->log_info("VolatileRepository -- get %s %d", key,
- current_size_.load());
+ logger_->log_info("VolatileRepository -- get %s %d", key, current_size_.load());
return true;
}
@@ -316,8 +302,7 @@ class VolatileRepository : public core::Repository,
return false;
}
- void setConnectionMap(
- std::map<std::string, std::shared_ptr<minifi::Connection>> &connectionMap) {
+ void setConnectionMap(std::map<std::string, std::shared_ptr<minifi::Connection>> &connectionMap) {
this->connectionMap = connectionMap;
}
void loadComponent();
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/yaml/YamlConfiguration.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/yaml/YamlConfiguration.h b/libminifi/include/core/yaml/YamlConfiguration.h
index a63412c..3bfaefd 100644
--- a/libminifi/include/core/yaml/YamlConfiguration.h
+++ b/libminifi/include/core/yaml/YamlConfiguration.h
@@ -45,14 +45,11 @@ namespace core {
class YamlConfiguration : public FlowConfiguration {
public:
- explicit YamlConfiguration(std::shared_ptr<core::Repository> repo,
- std::shared_ptr<core::Repository> flow_file_repo,
- std::shared_ptr<io::StreamFactory> stream_factory,
- std::shared_ptr<Configure> configuration,
- const std::string path = DEFAULT_FLOW_YAML_FILE_NAME)
- : FlowConfiguration(repo, flow_file_repo, stream_factory, configuration,
- path),
- logger_(logging::LoggerFactory<YamlConfiguration>::getLogger()) {
+ explicit YamlConfiguration(std::shared_ptr<core::Repository> repo, std::shared_ptr<core::Repository> flow_file_repo, std::shared_ptr<io::StreamFactory> stream_factory,
+ std::shared_ptr<Configure> configuration,
+ const std::string path = DEFAULT_FLOW_YAML_FILE_NAME)
+ : FlowConfiguration(repo, flow_file_repo, stream_factory, configuration, path),
+ logger_(logging::LoggerFactory<YamlConfiguration>::getLogger()) {
stream_factory_ = stream_factory;
if (IsNullOrEmpty(config_path_)) {
config_path_ = DEFAULT_FLOW_YAML_FILE_NAME;
@@ -112,12 +109,9 @@ class YamlConfiguration : public FlowConfiguration {
YAML::Node flowControllerNode = rootYaml[CONFIG_YAML_FLOW_CONTROLLER_KEY];
YAML::Node processorsNode = rootYaml[CONFIG_YAML_PROCESSORS_KEY];
YAML::Node connectionsNode = rootYaml[CONFIG_YAML_CONNECTIONS_KEY];
- YAML::Node controllerServiceNode =
- rootYaml[CONFIG_YAML_CONTROLLER_SERVICES_KEY];
- YAML::Node remoteProcessingGroupsNode =
- rootYaml[CONFIG_YAML_REMOTE_PROCESS_GROUP_KEY];
- YAML::Node provenanceReportNode =
- rootYaml[CONFIG_YAML_PROVENANCE_REPORT_KEY];
+ YAML::Node controllerServiceNode = rootYaml[CONFIG_YAML_CONTROLLER_SERVICES_KEY];
+ YAML::Node remoteProcessingGroupsNode = rootYaml[CONFIG_YAML_REMOTE_PROCESS_GROUP_KEY];
+ YAML::Node provenanceReportNode = rootYaml[CONFIG_YAML_PROVENANCE_REPORT_KEY];
parseControllerServices(&controllerServiceNode);
// Create the root process group
@@ -128,12 +122,9 @@ class YamlConfiguration : public FlowConfiguration {
parseProvenanceReportingYaml(&provenanceReportNode, root);
// set the controller services into the root group.
- for (auto controller_service : controller_services_
- ->getAllControllerServices()) {
- root->addControllerService(controller_service->getName(),
- controller_service);
- root->addControllerService(controller_service->getUUIDStr(),
- controller_service);
+ for (auto controller_service : controller_services_->getAllControllerServices()) {
+ root->addControllerService(controller_service->getName(), controller_service);
+ root->addControllerService(controller_service->getUUIDStr(), controller_service);
}
return std::unique_ptr<core::ProcessGroup>(root);
@@ -150,8 +141,7 @@ class YamlConfiguration : public FlowConfiguration {
* @param parent the parent ProcessGroup to which the the created
* Processor should be added
*/
- void parseProcessorNodeYaml(YAML::Node processorNode,
- core::ProcessGroup * parent);
+ void parseProcessorNodeYaml(YAML::Node processorNode, core::ProcessGroup * parent);
/**
* Parses a port from its corressponding YAML config node and adds
@@ -164,8 +154,7 @@ class YamlConfiguration : public FlowConfiguration {
* @param parent the parent ProcessGroup for the port
* @param direction the TransferDirection of the port
*/
- void parsePortYaml(YAML::Node *portNode, core::ProcessGroup *parent,
- TransferDirection direction);
+ void parsePortYaml(YAML::Node *portNode, core::ProcessGroup *parent, TransferDirection direction);
/**
* Parses the root level YAML node for the flow configuration and
@@ -178,8 +167,7 @@ class YamlConfiguration : public FlowConfiguration {
core::ProcessGroup *parseRootProcessGroupYaml(YAML::Node rootNode);
// Process Property YAML
- void parseProcessorPropertyYaml(YAML::Node *doc, YAML::Node *node,
- std::shared_ptr<core::Processor> processor);
+ void parseProcessorPropertyYaml(YAML::Node *doc, YAML::Node *node, std::shared_ptr<core::Processor> processor);
/**
* Parse controller services
* @param controllerServicesNode controller services YAML node.
@@ -208,8 +196,7 @@ class YamlConfiguration : public FlowConfiguration {
* @param parent the root node of flow configuration to which
* to add the process groups that are parsed
*/
- void parseRemoteProcessGroupYaml(YAML::Node *node,
- core::ProcessGroup * parent);
+ void parseRemoteProcessGroupYaml(YAML::Node *node, core::ProcessGroup * parent);
/**
* Parses the Provenance Reporting section of a configuration YAML.
@@ -221,8 +208,7 @@ class YamlConfiguration : public FlowConfiguration {
* @param parentGroup the root node of flow configuration to which
* to add the provenance reporting config
*/
- void parseProvenanceReportingYaml(YAML::Node *reportNode,
- core::ProcessGroup * parentGroup);
+ void parseProvenanceReportingYaml(YAML::Node *reportNode, core::ProcessGroup * parentGroup);
/**
* A helper function to parse the Properties Node YAML for a processor.
@@ -230,9 +216,7 @@ class YamlConfiguration : public FlowConfiguration {
* @param propertiesNode the YAML::Node containing the properties
* @param processor the Processor to which to add the resulting properties
*/
- void parsePropertiesNodeYaml(
- YAML::Node *propertiesNode,
- std::shared_ptr<core::ConfigurableComponent> processor);
+ void parsePropertiesNodeYaml(YAML::Node *propertiesNode, std::shared_ptr<core::ConfigurableComponent> processor);
/**
* A helper function for parsing or generating optional id fields.
@@ -250,8 +234,7 @@ class YamlConfiguration : public FlowConfiguration {
* is optional and defaults to 'id'
* @return the parsed or generated UUID string
*/
- std::string getOrGenerateId(YAML::Node *yamlNode, const std::string &idField =
- "id");
+ std::string getOrGenerateId(YAML::Node *yamlNode, const std::string &idField = "id");
/**
* This is a helper function for verifying the existence of a required
@@ -271,13 +254,11 @@ class YamlConfiguration : public FlowConfiguration {
* @throws std::invalid_argument if the required field 'fieldName' is
* not present in 'yamlNode'
*/
- void checkRequiredField(YAML::Node *yamlNode, const std::string &fieldName,
- const std::string &yamlSection = "",
- const std::string &errorMessage = "");
+ void checkRequiredField(YAML::Node *yamlNode, const std::string &fieldName, const std::string &yamlSection = "", const std::string &errorMessage = "");
protected:
std::shared_ptr<io::StreamFactory> stream_factory_;
- private:
+ private:
std::shared_ptr<logging::Logger> logger_;
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/BaseStream.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/BaseStream.h b/libminifi/include/io/BaseStream.h
index 6f843bc..cae8a43 100644
--- a/libminifi/include/io/BaseStream.h
+++ b/libminifi/include/io/BaseStream.h
@@ -51,8 +51,7 @@ class BaseStream : public DataStream, public Serializable {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- virtual int write(uint32_t base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint32_t base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
int writeData(uint8_t *value, int size);
@@ -63,8 +62,7 @@ class BaseStream : public DataStream, public Serializable {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- virtual int write(uint16_t base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint16_t base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write valueto stream
@@ -82,8 +80,7 @@ class BaseStream : public DataStream, public Serializable {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- virtual int write(uint64_t base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint64_t base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write bool to stream
@@ -126,8 +123,7 @@ class BaseStream : public DataStream, public Serializable {
* @param stream stream from which we will read
* @return resulting read size
**/
- virtual int read(uint16_t &base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint16_t &base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* reads a byte from the stream
@@ -152,8 +148,7 @@ class BaseStream : public DataStream, public Serializable {
* @param stream stream from which we will read
* @return resulting read size
**/
- virtual int read(uint32_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint32_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* reads eight byte from the stream
@@ -161,8 +156,7 @@ class BaseStream : public DataStream, public Serializable {
* @param stream stream from which we will read
* @return resulting read size
**/
- virtual int read(uint64_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint64_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* read UTF from stream
@@ -171,7 +165,7 @@ class BaseStream : public DataStream, public Serializable {
* @return resulting read size
**/
virtual int readUTF(std::string &str, bool widen = false);
- protected:
+ protected:
DataStream *composable_stream_;
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/CRCStream.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/CRCStream.h b/libminifi/include/io/CRCStream.h
index 99fdfc3..696f418 100644
--- a/libminifi/include/io/CRCStream.h
+++ b/libminifi/include/io/CRCStream.h
@@ -83,8 +83,7 @@ class CRCStream : public BaseStream {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- virtual int write(uint32_t base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint32_t base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write 2 bytes to stream
* @param base_value non encoded value
@@ -92,8 +91,7 @@ class CRCStream : public BaseStream {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- virtual int write(uint16_t base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint16_t base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write 8 bytes to stream
@@ -102,29 +100,25 @@ class CRCStream : public BaseStream {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- virtual int write(uint64_t base_value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint64_t base_value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a system word
* @param value value to write
*/
- virtual int read(uint64_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint64_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a uint32_t
* @param value value to write
*/
- virtual int read(uint32_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint32_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a system short
* @param value value to write
*/
- virtual int read(uint16_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint16_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
virtual short initialize() {
child_stream_->initialize();
@@ -139,7 +133,7 @@ class CRCStream : public BaseStream {
}
void reset();
- protected:
+ protected:
/**
* Creates a vector and returns the vector using the provided
@@ -215,13 +209,9 @@ void CRCStream<T>::updateCRC(uint8_t *buffer, uint32_t length) {
template<typename T>
int CRCStream<T>::write(uint64_t base_value, bool is_little_endian) {
- const uint64_t value =
- is_little_endian == 1 ? htonll_r(base_value) : base_value;
+ const uint64_t value = is_little_endian == 1 ? htonll_r(base_value) : base_value;
uint8_t bytes[sizeof value];
- std::copy(
- static_cast<const char*>(static_cast<const void*>(&value)),
- static_cast<const char*>(static_cast<const void*>(&value)) + sizeof value,
- bytes);
+ std::copy(static_cast<const char*>(static_cast<const void*>(&value)), static_cast<const char*>(static_cast<const void*>(&value)) + sizeof value, bytes);
return writeData(bytes, sizeof value);
}
@@ -229,10 +219,7 @@ template<typename T>
int CRCStream<T>::write(uint32_t base_value, bool is_little_endian) {
const uint32_t value = is_little_endian ? htonl(base_value) : base_value;
uint8_t bytes[sizeof value];
- std::copy(
- static_cast<const char*>(static_cast<const void*>(&value)),
- static_cast<const char*>(static_cast<const void*>(&value)) + sizeof value,
- bytes);
+ std::copy(static_cast<const char*>(static_cast<const void*>(&value)), static_cast<const char*>(static_cast<const void*>(&value)) + sizeof value, bytes);
return writeData(bytes, sizeof value);
}
@@ -240,10 +227,7 @@ template<typename T>
int CRCStream<T>::write(uint16_t base_value, bool is_little_endian) {
const uint16_t value = is_little_endian == 1 ? htons(base_value) : base_value;
uint8_t bytes[sizeof value];
- std::copy(
- static_cast<const char*>(static_cast<const void*>(&value)),
- static_cast<const char*>(static_cast<const void*>(&value)) + sizeof value,
- bytes);
+ std::copy(static_cast<const char*>(static_cast<const void*>(&value)), static_cast<const char*>(static_cast<const void*>(&value)) + sizeof value, bytes);
return writeData(bytes, sizeof value);
}
@@ -253,15 +237,11 @@ int CRCStream<T>::read(uint64_t &value, bool is_little_endian) {
auto buf = readBuffer(value);
if (is_little_endian) {
- value = ((uint64_t) buf[0] << 56) | ((uint64_t) (buf[1] & 255) << 48)
- | ((uint64_t) (buf[2] & 255) << 40) | ((uint64_t) (buf[3] & 255) << 32)
- | ((uint64_t) (buf[4] & 255) << 24) | ((uint64_t) (buf[5] & 255) << 16)
- | ((uint64_t) (buf[6] & 255) << 8) | ((uint64_t) (buf[7] & 255) << 0);
+ value = ((uint64_t) buf[0] << 56) | ((uint64_t) (buf[1] & 255) << 48) | ((uint64_t) (buf[2] & 255) << 40) | ((uint64_t) (buf[3] & 255) << 32) | ((uint64_t) (buf[4] & 255) << 24)
+ | ((uint64_t) (buf[5] & 255) << 16) | ((uint64_t) (buf[6] & 255) << 8) | ((uint64_t) (buf[7] & 255) << 0);
} else {
- value = ((uint64_t) buf[0] << 0) | ((uint64_t) (buf[1] & 255) << 8)
- | ((uint64_t) (buf[2] & 255) << 16) | ((uint64_t) (buf[3] & 255) << 24)
- | ((uint64_t) (buf[4] & 255) << 32) | ((uint64_t) (buf[5] & 255) << 40)
- | ((uint64_t) (buf[6] & 255) << 48) | ((uint64_t) (buf[7] & 255) << 56);
+ value = ((uint64_t) buf[0] << 0) | ((uint64_t) (buf[1] & 255) << 8) | ((uint64_t) (buf[2] & 255) << 16) | ((uint64_t) (buf[3] & 255) << 24) | ((uint64_t) (buf[4] & 255) << 32)
+ | ((uint64_t) (buf[5] & 255) << 40) | ((uint64_t) (buf[6] & 255) << 48) | ((uint64_t) (buf[7] & 255) << 56);
}
return sizeof(value);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/ClientSocket.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/ClientSocket.h b/libminifi/include/io/ClientSocket.h
index ea2312f..c7db7f1 100644
--- a/libminifi/include/io/ClientSocket.h
+++ b/libminifi/include/io/ClientSocket.h
@@ -40,10 +40,11 @@ namespace io {
/**
* Context class for socket. This is currently only used as a parent class for TLSContext. It is necessary so the Socket and TLSSocket constructors
* can be the same. It also gives us a common place to set timeouts, etc from the Configure object in the future.
- */
+ */
class SocketContext {
public:
- SocketContext(const std::shared_ptr<Configure> &configure) {}
+ SocketContext(const std::shared_ptr<Configure> &configure) {
+ }
};
/**
* Socket class.
@@ -64,8 +65,7 @@ class Socket : public BaseStream {
* @param port connecting port
* @param listeners number of listeners in the queue
*/
- explicit Socket(const std::shared_ptr<SocketContext> &context, const std::string &hostname, const uint16_t port,
- const uint16_t listeners);
+ explicit Socket(const std::shared_ptr<SocketContext> &context, const std::string &hostname, const uint16_t port, const uint16_t listeners);
/**
* Constructor that creates a client socket.
@@ -142,43 +142,37 @@ class Socket : public BaseStream {
* Writes a system word
* @param value value to write
*/
- virtual int write(uint64_t value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint64_t value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Writes a uint32_t
* @param value value to write
*/
- virtual int write(uint32_t value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint32_t value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Writes a system short
* @param value value to write
*/
- virtual int write(uint16_t value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int write(uint16_t value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a system word
* @param value value to write
*/
- virtual int read(uint64_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint64_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a uint32_t
* @param value value to write
*/
- virtual int read(uint32_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint32_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a system short
* @param value value to write
*/
- virtual int read(uint16_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint16_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Returns the underlying buffer
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/DataStream.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/DataStream.h b/libminifi/include/io/DataStream.h
index e37dbf7..460930d 100644
--- a/libminifi/include/io/DataStream.h
+++ b/libminifi/include/io/DataStream.h
@@ -85,22 +85,19 @@ class DataStream {
* Reads a system word
* @param value value to write
*/
- virtual int read(uint64_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint64_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a uint32_t
* @param value value to write
*/
- virtual int read(uint32_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint32_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Reads a system short
* @param value value to write
*/
- virtual int read(uint16_t &value, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ virtual int read(uint16_t &value, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* Returns the underlying buffer
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/EndianCheck.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/EndianCheck.h b/libminifi/include/io/EndianCheck.h
index 3ceb19c..c4d4504 100644
--- a/libminifi/include/io/EndianCheck.h
+++ b/libminifi/include/io/EndianCheck.h
@@ -30,7 +30,7 @@ namespace io {
class EndiannessCheck {
public:
static bool IS_LITTLE;
- private:
+ private:
static bool is_little_endian() {
/* do whatever is needed at static init time */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/Serializable.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/Serializable.h b/libminifi/include/io/Serializable.h
index 5ee886b..326c7b7 100644
--- a/libminifi/include/io/Serializable.h
+++ b/libminifi/include/io/Serializable.h
@@ -73,8 +73,7 @@ class Serializable {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- int write(uint32_t base_value, DataStream *stream, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ int write(uint32_t base_value, DataStream *stream, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write 2 bytes to stream
@@ -83,8 +82,7 @@ class Serializable {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- int write(uint16_t base_value, DataStream *stream, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ int write(uint16_t base_value, DataStream *stream, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write valueto stream
@@ -102,8 +100,7 @@ class Serializable {
* @param is_little_endian endianness determination
* @return resulting write size
**/
- int write(uint64_t base_value, DataStream *stream, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ int write(uint64_t base_value, DataStream *stream, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* write bool to stream
@@ -133,8 +130,7 @@ class Serializable {
* @param stream stream from which we will read
* @return resulting read size
**/
- int read(uint16_t &base_value, DataStream *stream, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ int read(uint16_t &base_value, DataStream *stream, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* reads a byte from the stream
@@ -159,8 +155,7 @@ class Serializable {
* @param stream stream from which we will read
* @return resulting read size
**/
- int read(uint32_t &value, DataStream *stream, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ int read(uint32_t &value, DataStream *stream, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* reads eight byte from the stream
@@ -168,8 +163,7 @@ class Serializable {
* @param stream stream from which we will read
* @return resulting read size
**/
- int read(uint64_t &value, DataStream *stream, bool is_little_endian =
- EndiannessCheck::IS_LITTLE);
+ int read(uint64_t &value, DataStream *stream, bool is_little_endian = EndiannessCheck::IS_LITTLE);
/**
* read UTF from stream
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/StreamFactory.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/StreamFactory.h b/libminifi/include/io/StreamFactory.h
index 3faee45..bcb2847 100644
--- a/libminifi/include/io/StreamFactory.h
+++ b/libminifi/include/io/StreamFactory.h
@@ -33,8 +33,7 @@ class AbstractStreamFactory {
virtual ~AbstractStreamFactory() {
}
- virtual std::unique_ptr<Socket> createSocket(const std::string &host,
- const uint16_t port) = 0;
+ virtual std::unique_ptr<Socket> createSocket(const std::string &host, const uint16_t port) = 0;
};
/**
@@ -49,8 +48,7 @@ class StreamFactory {
* Creates a socket and returns a unique ptr
*
*/
- std::unique_ptr<Socket> createSocket(const std::string &host,
- const uint16_t port) {
+ std::unique_ptr<Socket> createSocket(const std::string &host, const uint16_t port) {
return delegate_->createSocket(host, port);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/TLSSocket.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/TLSSocket.h b/libminifi/include/io/TLSSocket.h
index 011a012..e9e6ce4 100644
--- a/libminifi/include/io/TLSSocket.h
+++ b/libminifi/include/io/TLSSocket.h
@@ -50,8 +50,7 @@ class TLSContext {
* @returns new TLSContext;
*/
static TLSContext *getInstance() {
- TLSContext* atomic_context = context_instance.load(
- std::memory_order_relaxed);
+ TLSContext* atomic_context = context_instance.load(std::memory_order_relaxed);
std::atomic_thread_fence(std::memory_order_acquire);
if (atomic_context == nullptr) {
std::lock_guard<std::mutex> lock(context_mutex);
@@ -86,8 +85,7 @@ class TLSContext {
static int pemPassWordCb(char *buf, int size, int rwflag, void *userdata) {
std::string passphrase;
- if (Configure::getConfigure()->get(
- Configure::nifi_security_client_pass_phrase, passphrase)) {
+ if (Configure::getConfigure()->get(Configure::nifi_security_client_pass_phrase, passphrase)) {
std::ifstream file(passphrase.c_str(), std::ifstream::in);
if (!file.good()) {
@@ -96,8 +94,7 @@ class TLSContext {
}
std::string password;
- password.assign((std::istreambuf_iterator<char>(file)),
- std::istreambuf_iterator<char>());
+ password.assign((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
file.close();
memset(buf, 0x00, size);
memcpy(buf, password.c_str(), password.length() - 1);
@@ -129,8 +126,7 @@ class TLSSocket : public Socket {
* @param port connecting port
* @param listeners number of listeners in the queue
*/
- explicit TLSSocket(const std::string &hostname, const uint16_t port,
- const uint16_t listeners);
+ explicit TLSSocket(const std::string &hostname, const uint16_t port, const uint16_t listeners);
/**
* Constructor that creates a client socket.
[5/9] nifi-minifi-cpp git commit: MINIFI-331: Apply formatter with
increased line length to source
Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/ProcessGroup.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/ProcessGroup.cpp b/libminifi/src/core/ProcessGroup.cpp
index c33800d..9e6778c 100644
--- a/libminifi/src/core/ProcessGroup.cpp
+++ b/libminifi/src/core/ProcessGroup.cpp
@@ -37,8 +37,7 @@ namespace nifi {
namespace minifi {
namespace core {
-ProcessGroup::ProcessGroup(ProcessGroupType type, std::string name, uuid_t uuid,
- ProcessGroup *parent)
+ProcessGroup::ProcessGroup(ProcessGroupType type, std::string name, uuid_t uuid, ProcessGroup *parent)
: logger_(logging::LoggerFactory<ProcessGroup>::getLogger()),
name_(name),
type_(type),
@@ -60,8 +59,7 @@ ProcessGroup::~ProcessGroup() {
connection->drain();
}
- for (std::set<ProcessGroup *>::iterator it = child_process_groups_.begin();
- it != child_process_groups_.end(); ++it) {
+ for (std::set<ProcessGroup *>::iterator it = child_process_groups_.begin(); it != child_process_groups_.end(); ++it) {
ProcessGroup *processGroup(*it);
delete processGroup;
}
@@ -78,8 +76,7 @@ void ProcessGroup::addProcessor(std::shared_ptr<Processor> processor) {
if (processors_.find(processor) == processors_.end()) {
// We do not have the same processor in this process group yet
processors_.insert(processor);
- logger_->log_info("Add processor %s into process group %s",
- processor->getName().c_str(), name_.c_str());
+ logger_->log_info("Add processor %s into process group %s", processor->getName().c_str(), name_.c_str());
}
}
@@ -89,8 +86,7 @@ void ProcessGroup::removeProcessor(std::shared_ptr<Processor> processor) {
if (processors_.find(processor) != processors_.end()) {
// We do have the same processor in this process group yet
processors_.erase(processor);
- logger_->log_info("Remove processor %s from process group %s",
- processor->getName().c_str(), name_.c_str());
+ logger_->log_info("Remove processor %s from process group %s", processor->getName().c_str(), name_.c_str());
}
}
@@ -100,8 +96,7 @@ void ProcessGroup::addProcessGroup(ProcessGroup *child) {
if (child_process_groups_.find(child) == child_process_groups_.end()) {
// We do not have the same child process group in this process group yet
child_process_groups_.insert(child);
- logger_->log_info("Add child process group %s into process group %s",
- child->getName().c_str(), name_.c_str());
+ logger_->log_info("Add child process group %s into process group %s", child->getName().c_str(), name_.c_str());
}
}
@@ -111,13 +106,11 @@ void ProcessGroup::removeProcessGroup(ProcessGroup *child) {
if (child_process_groups_.find(child) != child_process_groups_.end()) {
// We do have the same child process group in this process group yet
child_process_groups_.erase(child);
- logger_->log_info("Remove child process group %s from process group %s",
- child->getName().c_str(), name_.c_str());
+ logger_->log_info("Remove child process group %s from process group %s", child->getName().c_str(), name_.c_str());
}
}
-void ProcessGroup::startProcessing(TimerDrivenSchedulingAgent *timeScheduler,
- EventDrivenSchedulingAgent *eventScheduler) {
+void ProcessGroup::startProcessing(TimerDrivenSchedulingAgent *timeScheduler, EventDrivenSchedulingAgent *eventScheduler) {
std::lock_guard<std::recursive_mutex> lock(mutex_);
try {
@@ -125,8 +118,7 @@ void ProcessGroup::startProcessing(TimerDrivenSchedulingAgent *timeScheduler,
for (auto processor : processors_) {
logger_->log_debug("Starting %s", processor->getName().c_str());
- if (!processor->isRunning()
- && processor->getScheduledState() != DISABLED) {
+ if (!processor->isRunning() && processor->getScheduledState() != DISABLED) {
if (processor->getSchedulingStrategy() == TIMER_DRIVEN)
timeScheduler->schedule(processor);
else if (processor->getSchedulingStrategy() == EVENT_DRIVEN)
@@ -141,20 +133,17 @@ void ProcessGroup::startProcessing(TimerDrivenSchedulingAgent *timeScheduler,
logger_->log_debug("Caught Exception %s", exception.what());
throw;
} catch (...) {
- logger_->log_debug(
- "Caught Exception during process group start processing");
+ logger_->log_debug("Caught Exception during process group start processing");
throw;
}
}
-void ProcessGroup::stopProcessing(TimerDrivenSchedulingAgent *timeScheduler,
- EventDrivenSchedulingAgent *eventScheduler) {
+void ProcessGroup::stopProcessing(TimerDrivenSchedulingAgent *timeScheduler, EventDrivenSchedulingAgent *eventScheduler) {
std::lock_guard<std::recursive_mutex> lock(mutex_);
try {
// Stop all the processor node, input and output ports
- for (std::set<std::shared_ptr<Processor> >::iterator it =
- processors_.begin(); it != processors_.end(); ++it) {
+ for (std::set<std::shared_ptr<Processor> >::iterator it = processors_.begin(); it != processors_.end(); ++it) {
std::shared_ptr<Processor> processor(*it);
if (processor->getSchedulingStrategy() == TIMER_DRIVEN)
timeScheduler->unschedule(processor);
@@ -162,8 +151,7 @@ void ProcessGroup::stopProcessing(TimerDrivenSchedulingAgent *timeScheduler,
eventScheduler->unschedule(processor);
}
- for (std::set<ProcessGroup *>::iterator it = child_process_groups_.begin();
- it != child_process_groups_.end(); ++it) {
+ for (std::set<ProcessGroup *>::iterator it = child_process_groups_.begin(); it != child_process_groups_.end(); ++it) {
ProcessGroup *processGroup(*it);
processGroup->stopProcessing(timeScheduler, eventScheduler);
}
@@ -195,8 +183,7 @@ std::shared_ptr<Processor> ProcessGroup::findProcessor(uuid_t uuid) {
}
}
for (auto processGroup : child_process_groups_) {
- logger_->log_info("find processor child %s",
- processGroup->getName().c_str());
+ logger_->log_info("find processor child %s", processGroup->getName().c_str());
std::shared_ptr<Processor> processor = processGroup->findProcessor(uuid);
if (processor)
return processor;
@@ -204,9 +191,7 @@ std::shared_ptr<Processor> ProcessGroup::findProcessor(uuid_t uuid) {
return ret;
}
-void ProcessGroup::addControllerService(
- const std::string &nodeId,
- std::shared_ptr<core::controller::ControllerServiceNode> &node) {
+void ProcessGroup::addControllerService(const std::string &nodeId, std::shared_ptr<core::controller::ControllerServiceNode> &node) {
controller_service_map_.put(nodeId, node);
}
@@ -215,13 +200,11 @@ void ProcessGroup::addControllerService(
* @param node node identifier
* @return controller service node, if it exists.
*/
-std::shared_ptr<core::controller::ControllerServiceNode> ProcessGroup::findControllerService(
- const std::string &nodeId) {
+std::shared_ptr<core::controller::ControllerServiceNode> ProcessGroup::findControllerService(const std::string &nodeId) {
return controller_service_map_.getControllerServiceNode(nodeId);
}
-std::shared_ptr<Processor> ProcessGroup::findProcessor(
- const std::string &processorName) {
+std::shared_ptr<Processor> ProcessGroup::findProcessor(const std::string &processorName) {
std::lock_guard<std::recursive_mutex> lock(mutex_);
std::shared_ptr<Processor> ret = NULL;
for (auto processor : processors_) {
@@ -230,17 +213,14 @@ std::shared_ptr<Processor> ProcessGroup::findProcessor(
return processor;
}
for (auto processGroup : child_process_groups_) {
- std::shared_ptr<Processor> processor = processGroup->findProcessor(
- processorName);
+ std::shared_ptr<Processor> processor = processGroup->findProcessor(processorName);
if (processor)
return processor;
}
return ret;
}
-void ProcessGroup::updatePropertyValue(std::string processorName,
- std::string propertyName,
- std::string propertyValue) {
+void ProcessGroup::updatePropertyValue(std::string processorName, std::string propertyName, std::string propertyValue) {
std::lock_guard<std::recursive_mutex> lock(mutex_);
for (auto processor : processors_) {
if (processor->getName() == processorName) {
@@ -248,14 +228,12 @@ void ProcessGroup::updatePropertyValue(std::string processorName,
}
}
for (auto processGroup : child_process_groups_) {
- processGroup->updatePropertyValue(processorName, propertyName,
- propertyValue);
+ processGroup->updatePropertyValue(processorName, propertyName, propertyValue);
}
return;
}
-void ProcessGroup::getConnections(
- std::map<std::string, std::shared_ptr<Connection>> &connectionMap) {
+void ProcessGroup::getConnections(std::map<std::string, std::shared_ptr<Connection>> &connectionMap) {
for (auto connection : connections_) {
connectionMap[connection->getUUIDStr()] = connection;
}
@@ -270,8 +248,7 @@ void ProcessGroup::addConnection(std::shared_ptr<Connection> connection) {
if (connections_.find(connection) == connections_.end()) {
// We do not have the same connection in this process group yet
connections_.insert(connection);
- logger_->log_info("Add connection %s into process group %s",
- connection->getName().c_str(), name_.c_str());
+ logger_->log_info("Add connection %s into process group %s", connection->getName().c_str(), name_.c_str());
uuid_t sourceUUID;
std::shared_ptr<Processor> source = NULL;
connection->getSourceUUID(sourceUUID);
@@ -293,8 +270,7 @@ void ProcessGroup::removeConnection(std::shared_ptr<Connection> connection) {
if (connections_.find(connection) != connections_.end()) {
// We do not have the same connection in this process group yet
connections_.erase(connection);
- logger_->log_info("Remove connection %s into process group %s",
- connection->getName().c_str(), name_.c_str());
+ logger_->log_info("Remove connection %s into process group %s", connection->getName().c_str(), name_.c_str());
uuid_t sourceUUID;
std::shared_ptr<Processor> source = NULL;
connection->getSourceUUID(sourceUUID);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/ProcessSession.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/ProcessSession.cpp b/libminifi/src/core/ProcessSession.cpp
index 70de3f6..037660f 100644
--- a/libminifi/src/core/ProcessSession.cpp
+++ b/libminifi/src/core/ProcessSession.cpp
@@ -38,40 +38,31 @@ namespace core {
std::shared_ptr<core::FlowFile> ProcessSession::create() {
std::map<std::string, std::string> empty;
- std::shared_ptr<core::FlowFile> record = std::make_shared<FlowFileRecord>(
- process_context_->getProvenanceRepository(), empty);
+ std::shared_ptr<core::FlowFile> record = std::make_shared<FlowFileRecord>(process_context_->getProvenanceRepository(), empty);
_addedFlowFiles[record->getUUIDStr()] = record;
- logger_->log_debug("Create FlowFile with UUID %s",
- record->getUUIDStr().c_str());
- std::string details = process_context_->getProcessorNode().getName()
- + " creates flow record " + record->getUUIDStr();
+ logger_->log_debug("Create FlowFile with UUID %s", record->getUUIDStr().c_str());
+ std::string details = process_context_->getProcessorNode().getName() + " creates flow record " + record->getUUIDStr();
provenance_report_->create(record, details);
return record;
}
-std::shared_ptr<core::FlowFile> ProcessSession::create(
- std::shared_ptr<core::FlowFile> &&parent) {
+std::shared_ptr<core::FlowFile> ProcessSession::create(std::shared_ptr<core::FlowFile> &&parent) {
std::map<std::string, std::string> empty;
- std::shared_ptr<core::FlowFile> record = std::make_shared<FlowFileRecord>(
- process_context_->getProvenanceRepository(), empty);
+ std::shared_ptr<core::FlowFile> record = std::make_shared<FlowFileRecord>(process_context_->getProvenanceRepository(), empty);
if (record) {
_addedFlowFiles[record->getUUIDStr()] = record;
- logger_->log_debug("Create FlowFile with UUID %s",
- record->getUUIDStr().c_str());
+ logger_->log_debug("Create FlowFile with UUID %s", record->getUUIDStr().c_str());
}
if (record) {
// Copy attributes
- std::map<std::string, std::string> parentAttributes =
- parent->getAttributes();
+ std::map<std::string, std::string> parentAttributes = parent->getAttributes();
std::map<std::string, std::string>::iterator it;
for (it = parentAttributes.begin(); it != parentAttributes.end(); it++) {
- if (it->first == FlowAttributeKey(ALTERNATE_IDENTIFIER)
- || it->first == FlowAttributeKey(DISCARD_REASON)
- || it->first == FlowAttributeKey(UUID))
+ if (it->first == FlowAttributeKey(ALTERNATE_IDENTIFIER) || it->first == FlowAttributeKey(DISCARD_REASON) || it->first == FlowAttributeKey(UUID))
// Do not copy special attributes from parent
continue;
record->setAttribute(it->first, it->second);
@@ -83,8 +74,7 @@ std::shared_ptr<core::FlowFile> ProcessSession::create(
return record;
}
-std::shared_ptr<core::FlowFile> ProcessSession::clone(
- std::shared_ptr<core::FlowFile> &parent) {
+std::shared_ptr<core::FlowFile> ProcessSession::clone(std::shared_ptr<core::FlowFile> &parent) {
std::shared_ptr<core::FlowFile> record = this->create(parent);
if (record) {
// Copy Resource Claim
@@ -100,24 +90,18 @@ std::shared_ptr<core::FlowFile> ProcessSession::clone(
return record;
}
-std::shared_ptr<core::FlowFile> ProcessSession::cloneDuringTransfer(
- std::shared_ptr<core::FlowFile> &parent) {
+std::shared_ptr<core::FlowFile> ProcessSession::cloneDuringTransfer(std::shared_ptr<core::FlowFile> &parent) {
std::map<std::string, std::string> empty;
- std::shared_ptr<core::FlowFile> record = std::make_shared<FlowFileRecord>(
- process_context_->getProvenanceRepository(), empty);
+ std::shared_ptr<core::FlowFile> record = std::make_shared<FlowFileRecord>(process_context_->getProvenanceRepository(), empty);
if (record) {
this->_clonedFlowFiles[record->getUUIDStr()] = record;
- logger_->log_debug("Clone FlowFile with UUID %s during transfer",
- record->getUUIDStr().c_str());
+ logger_->log_debug("Clone FlowFile with UUID %s during transfer", record->getUUIDStr().c_str());
// Copy attributes
- std::map<std::string, std::string> parentAttributes =
- parent->getAttributes();
+ std::map<std::string, std::string> parentAttributes = parent->getAttributes();
std::map<std::string, std::string>::iterator it;
for (it = parentAttributes.begin(); it != parentAttributes.end(); it++) {
- if (it->first == FlowAttributeKey(ALTERNATE_IDENTIFIER)
- || it->first == FlowAttributeKey(DISCARD_REASON)
- || it->first == FlowAttributeKey(UUID))
+ if (it->first == FlowAttributeKey(ALTERNATE_IDENTIFIER) || it->first == FlowAttributeKey(DISCARD_REASON) || it->first == FlowAttributeKey(UUID))
// Do not copy special attributes from parent
continue;
record->setAttribute(it->first, it->second);
@@ -141,18 +125,15 @@ std::shared_ptr<core::FlowFile> ProcessSession::cloneDuringTransfer(
return record;
}
-std::shared_ptr<core::FlowFile> ProcessSession::clone(
- std::shared_ptr<core::FlowFile> &parent, int64_t offset, int64_t size) {
+std::shared_ptr<core::FlowFile> ProcessSession::clone(std::shared_ptr<core::FlowFile> &parent, int64_t offset, int64_t size) {
std::shared_ptr<core::FlowFile> record = this->create(parent);
if (record) {
if (parent->getResourceClaim()) {
if ((offset + size) > parent->getSize()) {
// Set offset and size
- logger_->log_error("clone offset %d and size %d exceed parent size %d",
- offset, size, parent->getSize());
+ logger_->log_error("clone offset %d and size %d exceed parent size %d", offset, size, parent->getSize());
// Remove the Add FlowFile for the session
- std::map<std::string, std::shared_ptr<core::FlowFile> >::iterator it =
- this->_addedFlowFiles.find(record->getUUIDStr());
+ std::map<std::string, std::shared_ptr<core::FlowFile> >::iterator it = this->_addedFlowFiles.find(record->getUUIDStr());
if (it != this->_addedFlowFiles.end())
this->_addedFlowFiles.erase(record->getUUIDStr());
return nullptr;
@@ -174,85 +155,65 @@ std::shared_ptr<core::FlowFile> ProcessSession::clone(
void ProcessSession::remove(std::shared_ptr<core::FlowFile> &flow) {
flow->setDeleted(true);
_deletedFlowFiles[flow->getUUIDStr()] = flow;
- std::string reason = process_context_->getProcessorNode().getName()
- + " drop flow record " + flow->getUUIDStr();
+ std::string reason = process_context_->getProcessorNode().getName() + " drop flow record " + flow->getUUIDStr();
provenance_report_->drop(flow, reason);
}
void ProcessSession::remove(std::shared_ptr<core::FlowFile> &&flow) {
flow->setDeleted(true);
_deletedFlowFiles[flow->getUUIDStr()] = flow;
- std::string reason = process_context_->getProcessorNode().getName()
- + " drop flow record " + flow->getUUIDStr();
+ std::string reason = process_context_->getProcessorNode().getName() + " drop flow record " + flow->getUUIDStr();
provenance_report_->drop(flow, reason);
}
-void ProcessSession::putAttribute(std::shared_ptr<core::FlowFile> &flow,
- std::string key, std::string value) {
+void ProcessSession::putAttribute(std::shared_ptr<core::FlowFile> &flow, std::string key, std::string value) {
flow->setAttribute(key, value);
- std::string details = process_context_->getProcessorNode().getName()
- + " modify flow record " + flow->getUUIDStr() + " attribute " + key + ":"
- + value;
+ std::string details = process_context_->getProcessorNode().getName() + " modify flow record " + flow->getUUIDStr() + " attribute " + key + ":" + value;
provenance_report_->modifyAttributes(flow, details);
}
-void ProcessSession::removeAttribute(std::shared_ptr<core::FlowFile> &flow,
- std::string key) {
+void ProcessSession::removeAttribute(std::shared_ptr<core::FlowFile> &flow, std::string key) {
flow->removeAttribute(key);
- std::string details = process_context_->getProcessorNode().getName()
- + " remove flow record " + flow->getUUIDStr() + " attribute " + key;
+ std::string details = process_context_->getProcessorNode().getName() + " remove flow record " + flow->getUUIDStr() + " attribute " + key;
provenance_report_->modifyAttributes(flow, details);
}
-void ProcessSession::putAttribute(std::shared_ptr<core::FlowFile> &&flow,
- std::string key, std::string value) {
+void ProcessSession::putAttribute(std::shared_ptr<core::FlowFile> &&flow, std::string key, std::string value) {
flow->setAttribute(key, value);
- std::string details = process_context_->getProcessorNode().getName()
- + " modify flow record " + flow->getUUIDStr() + " attribute " + key + ":"
- + value;
+ std::string details = process_context_->getProcessorNode().getName() + " modify flow record " + flow->getUUIDStr() + " attribute " + key + ":" + value;
provenance_report_->modifyAttributes(flow, details);
}
-void ProcessSession::removeAttribute(std::shared_ptr<core::FlowFile> &&flow,
- std::string key) {
+void ProcessSession::removeAttribute(std::shared_ptr<core::FlowFile> &&flow, std::string key) {
flow->removeAttribute(key);
- std::string details = process_context_->getProcessorNode().getName()
- + " remove flow record " + flow->getUUIDStr() + " attribute " + key;
+ std::string details = process_context_->getProcessorNode().getName() + " remove flow record " + flow->getUUIDStr() + " attribute " + key;
provenance_report_->modifyAttributes(flow, details);
}
void ProcessSession::penalize(std::shared_ptr<core::FlowFile> &flow) {
- flow->setPenaltyExpiration(
- getTimeMillis()
- + process_context_->getProcessorNode().getPenalizationPeriodMsec());
+ flow->setPenaltyExpiration(getTimeMillis() + process_context_->getProcessorNode().getPenalizationPeriodMsec());
}
void ProcessSession::penalize(std::shared_ptr<core::FlowFile> &&flow) {
- flow->setPenaltyExpiration(
- getTimeMillis()
- + process_context_->getProcessorNode().getPenalizationPeriodMsec());
+ flow->setPenaltyExpiration(getTimeMillis() + process_context_->getProcessorNode().getPenalizationPeriodMsec());
}
-void ProcessSession::transfer(std::shared_ptr<core::FlowFile> &flow,
- Relationship relationship) {
+void ProcessSession::transfer(std::shared_ptr<core::FlowFile> &flow, Relationship relationship) {
_transferRelationship[flow->getUUIDStr()] = relationship;
}
-void ProcessSession::transfer(std::shared_ptr<core::FlowFile> &&flow,
- Relationship relationship) {
+void ProcessSession::transfer(std::shared_ptr<core::FlowFile> &&flow, Relationship relationship) {
_transferRelationship[flow->getUUIDStr()] = relationship;
}
-void ProcessSession::write(std::shared_ptr<core::FlowFile> &flow,
- OutputStreamCallback *callback) {
+void ProcessSession::write(std::shared_ptr<core::FlowFile> &flow, OutputStreamCallback *callback) {
std::shared_ptr<ResourceClaim> claim = std::make_shared<ResourceClaim>(
DEFAULT_CONTENT_DIRECTORY);
try {
std::ofstream fs;
uint64_t startTime = getTimeMillis();
- fs.open(claim->getContentFullPath().c_str(),
- std::fstream::out | std::fstream::binary | std::fstream::trunc);
+ fs.open(claim->getContentFullPath().c_str(), std::fstream::out | std::fstream::binary | std::fstream::trunc);
if (fs.is_open()) {
// Call the callback to write the content
callback->process(&fs);
@@ -271,8 +232,7 @@ void ProcessSession::write(std::shared_ptr<core::FlowFile> &flow,
logger_->log_debug("Write offset %d length %d into content %s for FlowFile UUID %s",
flow->_offset, flow->_size, flow->_claim->getContentFullPath().c_str(), flow->getUUIDStr().c_str()); */
fs.close();
- std::string details = process_context_->getProcessorNode().getName()
- + " modify flow record content " + flow->getUUIDStr();
+ std::string details = process_context_->getProcessorNode().getName() + " modify flow record content " + flow->getUUIDStr();
uint64_t endTime = getTimeMillis();
provenance_report_->modifyContent(flow, details, endTime - startTime);
} else {
@@ -299,14 +259,12 @@ void ProcessSession::write(std::shared_ptr<core::FlowFile> &flow,
}
}
-void ProcessSession::write(std::shared_ptr<core::FlowFile> &&flow,
- OutputStreamCallback *callback) {
+void ProcessSession::write(std::shared_ptr<core::FlowFile> &&flow, OutputStreamCallback *callback) {
std::shared_ptr<ResourceClaim> claim = std::make_shared<ResourceClaim>();
try {
std::ofstream fs;
uint64_t startTime = getTimeMillis();
- fs.open(claim->getContentFullPath().c_str(),
- std::fstream::out | std::fstream::binary | std::fstream::trunc);
+ fs.open(claim->getContentFullPath().c_str(), std::fstream::out | std::fstream::binary | std::fstream::trunc);
if (fs.is_open()) {
// Call the callback to write the content
callback->process(&fs);
@@ -325,8 +283,7 @@ void ProcessSession::write(std::shared_ptr<core::FlowFile> &&flow,
logger_->log_debug("Write offset %d length %d into content %s for FlowFile UUID %s",
flow->_offset, flow->_size, flow->_claim->getContentFullPath().c_str(), flow->getUUIDStr().c_str()); */
fs.close();
- std::string details = process_context_->getProcessorNode().getName()
- + " modify flow record content " + flow->getUUIDStr();
+ std::string details = process_context_->getProcessorNode().getName() + " modify flow record content " + flow->getUUIDStr();
uint64_t endTime = getTimeMillis();
provenance_report_->modifyContent(flow, details, endTime - startTime);
} else {
@@ -353,8 +310,7 @@ void ProcessSession::write(std::shared_ptr<core::FlowFile> &&flow,
}
}
-void ProcessSession::append(std::shared_ptr<core::FlowFile> &&flow,
- OutputStreamCallback *callback) {
+void ProcessSession::append(std::shared_ptr<core::FlowFile> &&flow, OutputStreamCallback *callback) {
std::shared_ptr<ResourceClaim> claim = nullptr;
if (flow->getResourceClaim() == nullptr) {
@@ -367,8 +323,7 @@ void ProcessSession::append(std::shared_ptr<core::FlowFile> &&flow,
try {
std::ofstream fs;
uint64_t startTime = getTimeMillis();
- fs.open(claim->getContentFullPath().c_str(),
- std::fstream::out | std::fstream::binary | std::fstream::app);
+ fs.open(claim->getContentFullPath().c_str(), std::fstream::out | std::fstream::binary | std::fstream::app);
if (fs.is_open()) {
// Call the callback to write the content
std::streampos oldPos = fs.tellp();
@@ -380,8 +335,7 @@ void ProcessSession::append(std::shared_ptr<core::FlowFile> &&flow,
logger_->log_debug("Append offset %d extra length %d to new size %d into content %s for FlowFile UUID %s",
flow->_offset, appendSize, flow->_size, claim->getContentFullPath().c_str(), flow->getUUIDStr().c_str()); */
fs.close();
- std::string details = process_context_->getProcessorNode().getName()
- + " modify flow record content " + flow->getUUIDStr();
+ std::string details = process_context_->getProcessorNode().getName() + " modify flow record content " + flow->getUUIDStr();
uint64_t endTime = getTimeMillis();
provenance_report_->modifyContent(flow, details, endTime - startTime);
} else {
@@ -400,8 +354,7 @@ void ProcessSession::append(std::shared_ptr<core::FlowFile> &&flow,
}
}
-void ProcessSession::append(std::shared_ptr<core::FlowFile> &flow,
- OutputStreamCallback *callback) {
+void ProcessSession::append(std::shared_ptr<core::FlowFile> &flow, OutputStreamCallback *callback) {
std::shared_ptr<ResourceClaim> claim = nullptr;
if (flow->getResourceClaim() == nullptr) {
@@ -414,8 +367,7 @@ void ProcessSession::append(std::shared_ptr<core::FlowFile> &flow,
try {
std::ofstream fs;
uint64_t startTime = getTimeMillis();
- fs.open(claim->getContentFullPath().c_str(),
- std::fstream::out | std::fstream::binary | std::fstream::app);
+ fs.open(claim->getContentFullPath().c_str(), std::fstream::out | std::fstream::binary | std::fstream::app);
if (fs.is_open()) {
// Call the callback to write the content
std::streampos oldPos = fs.tellp();
@@ -427,8 +379,7 @@ void ProcessSession::append(std::shared_ptr<core::FlowFile> &flow,
logger_->log_debug("Append offset %d extra length %d to new size %d into content %s for FlowFile UUID %s",
flow->_offset, appendSize, flow->_size, claim->getContentFullPath().c_str(), flow->getUUIDStr().c_str()); */
fs.close();
- std::string details = process_context_->getProcessorNode().getName()
- + " modify flow record content " + flow->getUUIDStr();
+ std::string details = process_context_->getProcessorNode().getName() + " modify flow record content " + flow->getUUIDStr();
uint64_t endTime = getTimeMillis();
provenance_report_->modifyContent(flow, details, endTime - startTime);
} else {
@@ -447,21 +398,18 @@ void ProcessSession::append(std::shared_ptr<core::FlowFile> &flow,
}
}
-void ProcessSession::read(std::shared_ptr<core::FlowFile> &flow,
- InputStreamCallback *callback) {
+void ProcessSession::read(std::shared_ptr<core::FlowFile> &flow, InputStreamCallback *callback) {
try {
std::shared_ptr<ResourceClaim> claim = nullptr;
if (flow->getResourceClaim() == nullptr) {
// No existed claim for read, we throw exception
- throw Exception(FILE_OPERATION_EXCEPTION,
- "No Content Claim existed for read");
+ throw Exception(FILE_OPERATION_EXCEPTION, "No Content Claim existed for read");
}
claim = flow->getResourceClaim();
std::ifstream fs;
- fs.open(claim->getContentFullPath().c_str(),
- std::fstream::in | std::fstream::binary);
+ fs.open(claim->getContentFullPath().c_str(), std::fstream::in | std::fstream::binary);
if (fs.is_open()) {
fs.seekg(flow->getOffset(), fs.beg);
@@ -487,21 +435,18 @@ void ProcessSession::read(std::shared_ptr<core::FlowFile> &flow,
}
}
-void ProcessSession::read(std::shared_ptr<core::FlowFile> &&flow,
- InputStreamCallback *callback) {
+void ProcessSession::read(std::shared_ptr<core::FlowFile> &&flow, InputStreamCallback *callback) {
try {
std::shared_ptr<ResourceClaim> claim = nullptr;
if (flow->getResourceClaim() == nullptr) {
// No existed claim for read, we throw exception
- throw Exception(FILE_OPERATION_EXCEPTION,
- "No Content Claim existed for read");
+ throw Exception(FILE_OPERATION_EXCEPTION, "No Content Claim existed for read");
}
claim = flow->getResourceClaim();
std::ifstream fs;
- fs.open(claim->getContentFullPath().c_str(),
- std::fstream::in | std::fstream::binary);
+ fs.open(claim->getContentFullPath().c_str(), std::fstream::in | std::fstream::binary);
if (fs.is_open()) {
fs.seekg(flow->getOffset(), fs.beg);
@@ -533,8 +478,7 @@ void ProcessSession::read(std::shared_ptr<core::FlowFile> &&flow,
* @param flow flow file
*
*/
-void ProcessSession::importFrom(io::DataStream &stream,
- std::shared_ptr<core::FlowFile> &&flow) {
+void ProcessSession::importFrom(io::DataStream &stream, std::shared_ptr<core::FlowFile> &&flow) {
std::shared_ptr<ResourceClaim> claim = std::make_shared<ResourceClaim>();
int max_read = getpagesize();
@@ -544,8 +488,7 @@ void ProcessSession::importFrom(io::DataStream &stream,
try {
std::ofstream fs;
uint64_t startTime = getTimeMillis();
- fs.open(claim->getContentFullPath().c_str(),
- std::fstream::out | std::fstream::binary | std::fstream::trunc);
+ fs.open(claim->getContentFullPath().c_str(), std::fstream::out | std::fstream::binary | std::fstream::trunc);
if (fs.is_open()) {
size_t position = 0;
@@ -576,15 +519,11 @@ void ProcessSession::importFrom(io::DataStream &stream,
flow->setResourceClaim(claim);
claim->increaseFlowFileRecordOwnedCount();
- logger_->log_debug(
- "Import offset %d length %d into content %s for FlowFile UUID %s",
- flow->getOffset(), flow->getSize(),
- flow->getResourceClaim()->getContentFullPath().c_str(),
- flow->getUUIDStr().c_str());
+ logger_->log_debug("Import offset %d length %d into content %s for FlowFile UUID %s", flow->getOffset(), flow->getSize(), flow->getResourceClaim()->getContentFullPath().c_str(),
+ flow->getUUIDStr().c_str());
fs.close();
- std::string details = process_context_->getProcessorNode().getName()
- + " modify flow record content " + flow->getUUIDStr();
+ std::string details = process_context_->getProcessorNode().getName() + " modify flow record content " + flow->getUUIDStr();
uint64_t endTime = getTimeMillis();
provenance_report_->modifyContent(flow, details, endTime - startTime);
} else {
@@ -611,9 +550,9 @@ void ProcessSession::importFrom(io::DataStream &stream,
}
}
-void ProcessSession::import(std::string source,
- std::shared_ptr<core::FlowFile> &flow,
- bool keepSource, uint64_t offset) {
+void ProcessSession::import(std::string source, std::shared_ptr<core::FlowFile> &flow,
+bool keepSource,
+ uint64_t offset) {
std::shared_ptr<ResourceClaim> claim = std::make_shared<ResourceClaim>();
char *buf = NULL;
int size = 4096;
@@ -622,8 +561,7 @@ void ProcessSession::import(std::string source,
try {
std::ofstream fs;
uint64_t startTime = getTimeMillis();
- fs.open(claim->getContentFullPath().c_str(),
- std::fstream::out | std::fstream::binary | std::fstream::trunc);
+ fs.open(claim->getContentFullPath().c_str(), std::fstream::out | std::fstream::binary | std::fstream::trunc);
std::ifstream input;
input.open(source.c_str(), std::fstream::in | std::fstream::binary);
@@ -649,18 +587,14 @@ void ProcessSession::import(std::string source,
flow->setResourceClaim(claim);
claim->increaseFlowFileRecordOwnedCount();
- logger_->log_debug(
- "Import offset %d length %d into content %s for FlowFile UUID %s",
- flow->getOffset(), flow->getSize(),
- flow->getResourceClaim()->getContentFullPath().c_str(),
- flow->getUUIDStr().c_str());
+ logger_->log_debug("Import offset %d length %d into content %s for FlowFile UUID %s", flow->getOffset(), flow->getSize(), flow->getResourceClaim()->getContentFullPath().c_str(),
+ flow->getUUIDStr().c_str());
fs.close();
input.close();
if (!keepSource)
std::remove(source.c_str());
- std::string details = process_context_->getProcessorNode().getName()
- + " modify flow record content " + flow->getUUIDStr();
+ std::string details = process_context_->getProcessorNode().getName() + " modify flow record content " + flow->getUUIDStr();
uint64_t endTime = getTimeMillis();
provenance_report_->modifyContent(flow, details, endTime - startTime);
} else {
@@ -692,9 +626,9 @@ void ProcessSession::import(std::string source,
}
}
-void ProcessSession::import(std::string source,
- std::shared_ptr<core::FlowFile> &&flow,
- bool keepSource, uint64_t offset) {
+void ProcessSession::import(std::string source, std::shared_ptr<core::FlowFile> &&flow,
+bool keepSource,
+ uint64_t offset) {
std::shared_ptr<ResourceClaim> claim = std::make_shared<ResourceClaim>();
char *buf = NULL;
@@ -704,8 +638,7 @@ void ProcessSession::import(std::string source,
try {
std::ofstream fs;
uint64_t startTime = getTimeMillis();
- fs.open(claim->getContentFullPath().c_str(),
- std::fstream::out | std::fstream::binary | std::fstream::trunc);
+ fs.open(claim->getContentFullPath().c_str(), std::fstream::out | std::fstream::binary | std::fstream::trunc);
std::ifstream input;
input.open(source.c_str(), std::fstream::in | std::fstream::binary);
@@ -731,18 +664,14 @@ void ProcessSession::import(std::string source,
flow->setResourceClaim(claim);
claim->increaseFlowFileRecordOwnedCount();
- logger_->log_debug(
- "Import offset %d length %d into content %s for FlowFile UUID %s",
- flow->getOffset(), flow->getSize(),
- flow->getResourceClaim()->getContentFullPath().c_str(),
- flow->getUUIDStr().c_str());
+ logger_->log_debug("Import offset %d length %d into content %s for FlowFile UUID %s", flow->getOffset(), flow->getSize(), flow->getResourceClaim()->getContentFullPath().c_str(),
+ flow->getUUIDStr().c_str());
fs.close();
input.close();
if (!keepSource)
std::remove(source.c_str());
- std::string details = process_context_->getProcessorNode().getName()
- + " modify flow record content " + flow->getUUIDStr();
+ std::string details = process_context_->getProcessorNode().getName() + " modify flow record content " + flow->getUUIDStr();
uint64_t endTime = getTimeMillis();
provenance_report_->modifyContent(flow, details, endTime - startTime);
} else {
@@ -781,21 +710,16 @@ void ProcessSession::commit() {
std::shared_ptr<core::FlowFile> record = it.second;
if (record->isDeleted())
continue;
- std::map<std::string, Relationship>::iterator itRelationship = this
- ->_transferRelationship.find(record->getUUIDStr());
+ std::map<std::string, Relationship>::iterator itRelationship = this->_transferRelationship.find(record->getUUIDStr());
if (itRelationship != _transferRelationship.end()) {
Relationship relationship = itRelationship->second;
// Find the relationship, we need to find the connections for that relationship
- std::set<std::shared_ptr<Connectable>> connections = process_context_
- ->getProcessorNode().getOutGoingConnections(relationship.getName());
+ std::set<std::shared_ptr<Connectable>> connections = process_context_->getProcessorNode().getOutGoingConnections(relationship.getName());
if (connections.empty()) {
// No connection
- if (!process_context_->getProcessorNode().isAutoTerminated(
- relationship)) {
+ if (!process_context_->getProcessorNode().isAutoTerminated(relationship)) {
// Not autoterminate, we should have the connect
- std::string message =
- "Connect empty for non auto terminated relationship"
- + relationship.getName();
+ std::string message = "Connect empty for non auto terminated relationship" + relationship.getName();
throw Exception(PROCESS_SESSION_EXCEPTION, message.c_str());
} else {
// Autoterminated
@@ -803,9 +727,7 @@ void ProcessSession::commit() {
}
} else {
// We connections, clone the flow and assign the connection accordingly
- for (std::set<std::shared_ptr<Connectable>>::iterator itConnection =
- connections.begin(); itConnection != connections.end();
- ++itConnection) {
+ for (std::set<std::shared_ptr<Connectable>>::iterator itConnection = connections.begin(); itConnection != connections.end(); ++itConnection) {
std::shared_ptr<Connectable> connection = *itConnection;
if (itConnection == connections.begin()) {
// First connection which the flow need be routed to
@@ -817,15 +739,13 @@ void ProcessSession::commit() {
if (cloneRecord)
cloneRecord->setConnection(connection);
else
- throw Exception(PROCESS_SESSION_EXCEPTION,
- "Can not clone the flow for transfer");
+ throw Exception(PROCESS_SESSION_EXCEPTION, "Can not clone the flow for transfer");
}
}
}
} else {
// Can not find relationship for the flow
- throw Exception(PROCESS_SESSION_EXCEPTION,
- "Can not find the transfer relationship for the flow");
+ throw Exception(PROCESS_SESSION_EXCEPTION, "Can not find the transfer relationship for the flow");
}
}
@@ -834,21 +754,16 @@ void ProcessSession::commit() {
std::shared_ptr<core::FlowFile> record = it.second;
if (record->isDeleted())
continue;
- std::map<std::string, Relationship>::iterator itRelationship = this
- ->_transferRelationship.find(record->getUUIDStr());
+ std::map<std::string, Relationship>::iterator itRelationship = this->_transferRelationship.find(record->getUUIDStr());
if (itRelationship != _transferRelationship.end()) {
Relationship relationship = itRelationship->second;
// Find the relationship, we need to find the connections for that relationship
- std::set<std::shared_ptr<Connectable>> connections = process_context_
- ->getProcessorNode().getOutGoingConnections(relationship.getName());
+ std::set<std::shared_ptr<Connectable>> connections = process_context_->getProcessorNode().getOutGoingConnections(relationship.getName());
if (connections.empty()) {
// No connection
- if (!process_context_->getProcessorNode().isAutoTerminated(
- relationship)) {
+ if (!process_context_->getProcessorNode().isAutoTerminated(relationship)) {
// Not autoterminate, we should have the connect
- std::string message =
- "Connect empty for non auto terminated relationship "
- + relationship.getName();
+ std::string message = "Connect empty for non auto terminated relationship " + relationship.getName();
throw Exception(PROCESS_SESSION_EXCEPTION, message.c_str());
} else {
// Autoterminated
@@ -856,9 +771,7 @@ void ProcessSession::commit() {
}
} else {
// We connections, clone the flow and assign the connection accordingly
- for (std::set<std::shared_ptr<Connectable>>::iterator itConnection =
- connections.begin(); itConnection != connections.end();
- ++itConnection) {
+ for (std::set<std::shared_ptr<Connectable>>::iterator itConnection = connections.begin(); itConnection != connections.end(); ++itConnection) {
std::shared_ptr<Connectable> connection(*itConnection);
if (itConnection == connections.begin()) {
// First connection which the flow need be routed to
@@ -870,15 +783,13 @@ void ProcessSession::commit() {
if (cloneRecord)
cloneRecord->setConnection(connection);
else
- throw Exception(PROCESS_SESSION_EXCEPTION,
- "Can not clone the flow for transfer");
+ throw Exception(PROCESS_SESSION_EXCEPTION, "Can not clone the flow for transfer");
}
}
}
} else {
// Can not find relationship for the flow
- throw Exception(PROCESS_SESSION_EXCEPTION,
- "Can not find the transfer relationship for the flow");
+ throw Exception(PROCESS_SESSION_EXCEPTION, "Can not find the transfer relationship for the flow");
}
}
@@ -890,8 +801,7 @@ void ProcessSession::commit() {
continue;
}
- connection = std::static_pointer_cast<Connection>(
- record->getConnection());
+ connection = std::static_pointer_cast<Connection>(record->getConnection());
if ((connection) != nullptr)
connection->put(record);
}
@@ -900,8 +810,7 @@ void ProcessSession::commit() {
if (record->isDeleted()) {
continue;
}
- connection = std::static_pointer_cast<Connection>(
- record->getConnection());
+ connection = std::static_pointer_cast<Connection>(record->getConnection());
if ((connection) != nullptr)
connection->put(record);
}
@@ -911,8 +820,7 @@ void ProcessSession::commit() {
if (record->isDeleted()) {
continue;
}
- connection = std::static_pointer_cast<Connection>(
- record->getConnection());
+ connection = std::static_pointer_cast<Connection>(record->getConnection());
if ((connection) != nullptr)
connection->put(record);
}
@@ -925,8 +833,7 @@ void ProcessSession::commit() {
_originalFlowFiles.clear();
// persistent the provenance report
this->provenance_report_->commit();
- logger_->log_trace("ProcessSession committed for %s",
- process_context_->getProcessorNode().getName().c_str());
+ logger_->log_trace("ProcessSession committed for %s", process_context_->getProcessorNode().getName().c_str());
} catch (std::exception &exception) {
logger_->log_debug("Caught Exception %s", exception.what());
throw;
@@ -942,11 +849,9 @@ void ProcessSession::rollback() {
// Requeue the snapshot of the flowfile back
for (const auto &it : _originalFlowFiles) {
std::shared_ptr<core::FlowFile> record = it.second;
- connection = std::static_pointer_cast<Connection>(
- record->getOriginalConnection());
+ connection = std::static_pointer_cast<Connection>(record->getOriginalConnection());
if ((connection) != nullptr) {
- std::shared_ptr<FlowFileRecord> flowf = std::static_pointer_cast<
- FlowFileRecord>(record);
+ std::shared_ptr<FlowFileRecord> flowf = std::static_pointer_cast<FlowFileRecord>(record);
flowf->setSnapShot(false);
connection->put(record);
}
@@ -957,8 +862,7 @@ void ProcessSession::rollback() {
_addedFlowFiles.clear();
_updatedFlowFiles.clear();
_deletedFlowFiles.clear();
- logger_->log_trace("ProcessSession rollback for %s",
- process_context_->getProcessorNode().getName().c_str());
+ logger_->log_trace("ProcessSession rollback for %s", process_context_->getProcessorNode().getName().c_str());
} catch (std::exception &exception) {
logger_->log_debug("Caught Exception %s", exception.what());
throw;
@@ -969,25 +873,21 @@ void ProcessSession::rollback() {
}
std::shared_ptr<core::FlowFile> ProcessSession::get() {
- std::shared_ptr<Connectable> first = process_context_->getProcessorNode()
- .getNextIncomingConnection();
+ std::shared_ptr<Connectable> first = process_context_->getProcessorNode().getNextIncomingConnection();
if (first == NULL)
return NULL;
- std::shared_ptr<Connection> current = std::static_pointer_cast<Connection>(
- first);
+ std::shared_ptr<Connection> current = std::static_pointer_cast<Connection>(first);
do {
std::set<std::shared_ptr<core::FlowFile> > expired;
std::shared_ptr<core::FlowFile> ret = current->poll(expired);
if (expired.size() > 0) {
// Remove expired flow record
- for (std::set<std::shared_ptr<core::FlowFile> >::iterator it = expired
- .begin(); it != expired.end(); ++it) {
+ for (std::set<std::shared_ptr<core::FlowFile> >::iterator it = expired.begin(); it != expired.end(); ++it) {
std::shared_ptr<core::FlowFile> record = *it;
- std::string details = process_context_->getProcessorNode().getName()
- + " expire flow record " + record->getUUIDStr();
+ std::string details = process_context_->getProcessorNode().getName() + " expire flow record " + record->getUUIDStr();
provenance_report_->expire(record, details);
}
}
@@ -996,19 +896,15 @@ std::shared_ptr<core::FlowFile> ProcessSession::get() {
ret->setDeleted(false);
_updatedFlowFiles[ret->getUUIDStr()] = ret;
std::map<std::string, std::string> empty;
- std::shared_ptr<core::FlowFile> snapshot =
- std::make_shared<FlowFileRecord>(
- process_context_->getProvenanceRepository(), empty);
- logger_->log_debug("Create Snapshot FlowFile with UUID %s",
- snapshot->getUUIDStr().c_str());
+ std::shared_ptr<core::FlowFile> snapshot = std::make_shared<FlowFileRecord>(process_context_->getProvenanceRepository(), empty);
+ logger_->log_debug("Create Snapshot FlowFile with UUID %s", snapshot->getUUIDStr().c_str());
snapshot = ret;
// snapshot->duplicate(ret);
// save a snapshot
_originalFlowFiles[snapshot->getUUIDStr()] = snapshot;
return ret;
}
- current = std::static_pointer_cast<Connection>(
- process_context_->getProcessorNode().getNextIncomingConnection());
+ current = std::static_pointer_cast<Connection>(process_context_->getProcessorNode().getNextIncomingConnection());
} while (current != NULL && current != first);
return NULL;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/Processor.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/Processor.cpp b/libminifi/src/core/Processor.cpp
index dbeb46f..7b07638 100644
--- a/libminifi/src/core/Processor.cpp
+++ b/libminifi/src/core/Processor.cpp
@@ -45,8 +45,9 @@ namespace minifi {
namespace core {
Processor::Processor(std::string name, uuid_t uuid)
- : Connectable(name, uuid), ConfigurableComponent(),
- logger_(logging::LoggerFactory<Processor>::getLogger()) {
+ : Connectable(name, uuid),
+ ConfigurableComponent(),
+ logger_(logging::LoggerFactory<Processor>::getLogger()) {
has_work_.store(false);
// Setup the default values
state_ = DISABLED;
@@ -61,8 +62,7 @@ Processor::Processor(std::string name, uuid_t uuid)
active_tasks_ = 0;
yield_expiration_ = 0;
incoming_connections_Iter = this->_incomingConnections.begin();
- logger_->log_info("Processor %s created UUID %s", name_.c_str(),
- uuidStr_.c_str());
+ logger_->log_info("Processor %s created UUID %s", name_.c_str(), uuidStr_.c_str());
}
bool Processor::isRunning() {
@@ -77,12 +77,10 @@ bool Processor::addConnection(std::shared_ptr<Connectable> conn) {
bool ret = false;
if (isRunning()) {
- logger_->log_info("Can not add connection while the process %s is running",
- name_.c_str());
+ logger_->log_info("Can not add connection while the process %s is running", name_.c_str());
return false;
}
- std::shared_ptr<Connection> connection = std::static_pointer_cast<Connection>(
- conn);
+ std::shared_ptr<Connection> connection = std::static_pointer_cast<Connection>(conn);
std::lock_guard<std::mutex> lock(mutex_);
uuid_t srcUUID;
@@ -101,9 +99,7 @@ bool Processor::addConnection(std::shared_ptr<Connectable> conn) {
if (_incomingConnections.find(connection) == _incomingConnections.end()) {
_incomingConnections.insert(connection);
connection->setDestination(shared_from_this());
- logger_->log_info(
- "Add connection %s into Processor %s incoming connection",
- connection->getName().c_str(), name_.c_str());
+ logger_->log_info("Add connection %s into Processor %s incoming connection", connection->getName().c_str(), name_.c_str());
incoming_connections_Iter = this->_incomingConnections.begin();
ret = true;
}
@@ -122,9 +118,7 @@ bool Processor::addConnection(std::shared_ptr<Connectable> conn) {
existedConnection.insert(connection);
connection->setSource(shared_from_this());
out_going_connections_[relationship] = existedConnection;
- logger_->log_info(
- "Add connection %s into Processor %s outgoing connection for relationship %s",
- connection->getName().c_str(), name_.c_str(), relationship.c_str());
+ logger_->log_info("Add connection %s into Processor %s outgoing connection for relationship %s", connection->getName().c_str(), name_.c_str(), relationship.c_str());
ret = true;
}
} else {
@@ -133,9 +127,7 @@ bool Processor::addConnection(std::shared_ptr<Connectable> conn) {
newConnection.insert(connection);
connection->setSource(shared_from_this());
out_going_connections_[relationship] = newConnection;
- logger_->log_info(
- "Add connection %s into Processor %s outgoing connection for relationship %s",
- connection->getName().c_str(), name_.c_str(), relationship.c_str());
+ logger_->log_info("Add connection %s into Processor %s outgoing connection for relationship %s", connection->getName().c_str(), name_.c_str(), relationship.c_str());
ret = true;
}
}
@@ -145,9 +137,7 @@ bool Processor::addConnection(std::shared_ptr<Connectable> conn) {
void Processor::removeConnection(std::shared_ptr<Connectable> conn) {
if (isRunning()) {
- logger_->log_info(
- "Can not remove connection while the process %s is running",
- name_.c_str());
+ logger_->log_info("Can not remove connection while the process %s is running", name_.c_str());
return;
}
@@ -156,8 +146,7 @@ void Processor::removeConnection(std::shared_ptr<Connectable> conn) {
uuid_t srcUUID;
uuid_t destUUID;
- std::shared_ptr<Connection> connection = std::static_pointer_cast<Connection>(
- conn);
+ std::shared_ptr<Connection> connection = std::static_pointer_cast<Connection>(conn);
connection->getSourceUUID(srcUUID);
connection->getDestinationUUID(destUUID);
@@ -167,9 +156,7 @@ void Processor::removeConnection(std::shared_ptr<Connectable> conn) {
if (_incomingConnections.find(connection) != _incomingConnections.end()) {
_incomingConnections.erase(connection);
connection->setDestination(NULL);
- logger_->log_info(
- "Remove connection %s into Processor %s incoming connection",
- connection->getName().c_str(), name_.c_str());
+ logger_->log_info("Remove connection %s into Processor %s incoming connection", connection->getName().c_str(), name_.c_str());
incoming_connections_Iter = this->_incomingConnections.begin();
}
}
@@ -181,13 +168,10 @@ void Processor::removeConnection(std::shared_ptr<Connectable> conn) {
if (it == out_going_connections_.end()) {
return;
} else {
- if (out_going_connections_[relationship].find(connection)
- != out_going_connections_[relationship].end()) {
+ if (out_going_connections_[relationship].find(connection) != out_going_connections_[relationship].end()) {
out_going_connections_[relationship].erase(connection);
connection->setSource(NULL);
- logger_->log_info(
- "Remove connection %s into Processor %s outgoing connection for relationship %s",
- connection->getName().c_str(), name_.c_str(), relationship.c_str());
+ logger_->log_info("Remove connection %s into Processor %s outgoing connection for relationship %s", connection->getName().c_str(), name_.c_str(), relationship.c_str());
}
}
}
@@ -200,8 +184,7 @@ bool Processor::flowFilesQueued() {
return false;
for (auto &&conn : _incomingConnections) {
- std::shared_ptr<Connection> connection =
- std::static_pointer_cast<Connection>(conn);
+ std::shared_ptr<Connection> connection = std::static_pointer_cast<Connection>(conn);
if (connection->getQueueSize() > 0)
return true;
}
@@ -216,8 +199,7 @@ bool Processor::flowFilesOutGoingFull() {
// We already has connection for this relationship
std::set<std::shared_ptr<Connectable>> existedConnection = connection.second;
for (const auto conn : existedConnection) {
- std::shared_ptr<Connection> connection = std::static_pointer_cast<
- Connection>(conn);
+ std::shared_ptr<Connection> connection = std::static_pointer_cast<Connection>(conn);
if (connection->isFull())
return true;
}
@@ -226,8 +208,7 @@ bool Processor::flowFilesOutGoingFull() {
return false;
}
-void Processor::onTrigger(ProcessContext *context,
- ProcessSessionFactory *sessionFactory) {
+void Processor::onTrigger(ProcessContext *context, ProcessSessionFactory *sessionFactory) {
auto session = sessionFactory->createSession();
try {
@@ -251,17 +232,15 @@ bool Processor::isWorkAvailable() {
try {
for (const auto &conn : _incomingConnections) {
- std::shared_ptr<Connection> connection = std::static_pointer_cast<
- Connection>(conn);
+ std::shared_ptr<Connection> connection = std::static_pointer_cast<Connection>(conn);
if (connection->getQueueSize() > 0) {
hasWork = true;
break;
}
}
} catch (...) {
- logger_->log_error(
- "Caught an exception while checking if work is available;"
- " unless it was positively determined that work is available, assuming NO work is available!");
+ logger_->log_error("Caught an exception while checking if work is available;"
+ " unless it was positively determined that work is available, assuming NO work is available!");
}
return hasWork;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/ProcessorNode.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/ProcessorNode.cpp b/libminifi/src/core/ProcessorNode.cpp
index bf39738..05f31a0 100644
--- a/libminifi/src/core/ProcessorNode.cpp
+++ b/libminifi/src/core/ProcessorNode.cpp
@@ -25,7 +25,8 @@ namespace core {
ProcessorNode::ProcessorNode(const std::shared_ptr<Connectable> processor)
: processor_(processor),
- Connectable(processor->getName(), 0), ConfigurableComponent() {
+ Connectable(processor->getName(), 0),
+ ConfigurableComponent() {
uuid_t copy;
processor->getUUID(copy);
setUUID(copy);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/RepositoryFactory.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/RepositoryFactory.cpp b/libminifi/src/core/RepositoryFactory.cpp
index 45ad980..cf18601 100644
--- a/libminifi/src/core/RepositoryFactory.cpp
+++ b/libminifi/src/core/RepositoryFactory.cpp
@@ -41,12 +41,10 @@ namespace core {
class FlowFileRepository;
#endif
-std::shared_ptr<core::Repository> createRepository(
- const std::string configuration_class_name, bool fail_safe, const std::string repo_name) {
+std::shared_ptr<core::Repository> createRepository(const std::string configuration_class_name, bool fail_safe, const std::string repo_name) {
std::shared_ptr<core::Repository> return_obj = nullptr;
std::string class_name_lc = configuration_class_name;
- std::transform(class_name_lc.begin(), class_name_lc.end(),
- class_name_lc.begin(), ::tolower);
+ std::transform(class_name_lc.begin(), class_name_lc.end(), class_name_lc.begin(), ::tolower);
try {
std::shared_ptr<core::Repository> return_obj = nullptr;
if (class_name_lc == "flowfilerepository") {
@@ -65,21 +63,17 @@ std::shared_ptr<core::Repository> createRepository(
return return_obj;
}
if (fail_safe) {
- return std::make_shared<core::Repository>("fail_safe", "fail_safe", 1, 1,
- 1);
+ return std::make_shared<core::Repository>("fail_safe", "fail_safe", 1, 1, 1);
} else {
- throw std::runtime_error(
- "Support for the provided configuration class could not be found");
+ throw std::runtime_error("Support for the provided configuration class could not be found");
}
} catch (const std::runtime_error &r) {
if (fail_safe) {
- return std::make_shared<core::Repository>("fail_safe", "fail_safe", 1, 1,
- 1);
+ return std::make_shared<core::Repository>("fail_safe", "fail_safe", 1, 1, 1);
}
}
- throw std::runtime_error(
- "Support for the provided configuration class could not be found");
+ throw std::runtime_error("Support for the provided configuration class could not be found");
}
} /* namespace core */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/controller/ControllerServiceNode.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/controller/ControllerServiceNode.cpp b/libminifi/src/core/controller/ControllerServiceNode.cpp
index 12e3653..3097574 100644
--- a/libminifi/src/core/controller/ControllerServiceNode.cpp
+++ b/libminifi/src/core/controller/ControllerServiceNode.cpp
@@ -39,8 +39,6 @@ std::vector<std::shared_ptr<ConfigurableComponent> > &ControllerServiceNode::get
return linked_components_;
}
-
-
} /* namespace controller */
} /* namespace core */
} /* namespace minifi */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/controller/ControllerServiceProvider.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/controller/ControllerServiceProvider.cpp b/libminifi/src/core/controller/ControllerServiceProvider.cpp
index da5c6a1..942c299 100644
--- a/libminifi/src/core/controller/ControllerServiceProvider.cpp
+++ b/libminifi/src/core/controller/ControllerServiceProvider.cpp
@@ -32,8 +32,7 @@ namespace controller {
* @return the ControllerService that is registered with the given
* identifier
*/
-std::shared_ptr<ControllerService> ControllerServiceProvider::getControllerService(
- const std::string &identifier) {
+std::shared_ptr<ControllerService> ControllerServiceProvider::getControllerService(const std::string &identifier) {
auto service = controller_map_->getControllerServiceNode(identifier);
if (service != nullptr) {
return service->getControllerServiceImplementation();
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/controller/StandardControllerServiceNode.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/controller/StandardControllerServiceNode.cpp b/libminifi/src/core/controller/StandardControllerServiceNode.cpp
index 26804f6..5c4aa70 100644
--- a/libminifi/src/core/controller/StandardControllerServiceNode.cpp
+++ b/libminifi/src/core/controller/StandardControllerServiceNode.cpp
@@ -31,8 +31,7 @@ std::shared_ptr<core::ProcessGroup> &StandardControllerServiceNode::getProcessGr
return process_group_;
}
-void StandardControllerServiceNode::setProcessGroup(
- std::shared_ptr<ProcessGroup> &processGroup) {
+void StandardControllerServiceNode::setProcessGroup(std::shared_ptr<ProcessGroup> &processGroup) {
std::lock_guard<std::mutex> lock(mutex_);
process_group_ = processGroup;
}
@@ -44,8 +43,7 @@ bool StandardControllerServiceNode::enable() {
if (getProperty(property.getName(), property)) {
active = true;
for (auto linked_service : property.getValues()) {
- std::shared_ptr<ControllerServiceNode> csNode = provider
- ->getControllerServiceNode(linked_service);
+ std::shared_ptr<ControllerServiceNode> csNode = provider->getControllerServiceNode(linked_service);
if (nullptr != csNode) {
std::lock_guard<std::mutex> lock(mutex_);
linked_controller_services_.push_back(csNode);
@@ -53,8 +51,7 @@ bool StandardControllerServiceNode::enable() {
}
} else {
}
- std::shared_ptr<ControllerService> impl =
- getControllerServiceImplementation();
+ std::shared_ptr<ControllerService> impl = getControllerServiceImplementation();
if (nullptr != impl) {
impl->onEnable();
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/logging/LoggerConfiguration.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/logging/LoggerConfiguration.cpp b/libminifi/src/core/logging/LoggerConfiguration.cpp
index 4bb6615..89e6a1b 100644
--- a/libminifi/src/core/logging/LoggerConfiguration.cpp
+++ b/libminifi/src/core/logging/LoggerConfiguration.cpp
@@ -42,25 +42,26 @@ namespace logging {
const char* LoggerConfiguration::spdlog_default_pattern = "[%Y-%m-%d %H:%M:%S.%e] [%n] [%l] %v";
-std::vector< std::string > LoggerProperties::get_keys_of_type(const std::string &type) {
+std::vector<std::string> LoggerProperties::get_keys_of_type(const std::string &type) {
std::vector<std::string> appenders;
std::string prefix = type + ".";
for (auto const & entry : properties_) {
- if (entry.first.rfind(prefix, 0) == 0 &&
- entry.first.find(".", prefix.length() + 1) == std::string::npos) {
+ if (entry.first.rfind(prefix, 0) == 0 && entry.first.find(".", prefix.length() + 1) == std::string::npos) {
appenders.push_back(entry.first);
}
}
return appenders;
}
-LoggerConfiguration::LoggerConfiguration() : root_namespace_(create_default_root()), loggers(std::vector<std::shared_ptr<LoggerImpl>>()),
- formatter_(std::make_shared<spdlog::pattern_formatter>(spdlog_default_pattern)) {
+LoggerConfiguration::LoggerConfiguration()
+ : root_namespace_(create_default_root()),
+ loggers(std::vector<std::shared_ptr<LoggerImpl>>()),
+ formatter_(std::make_shared<spdlog::pattern_formatter>(spdlog_default_pattern)) {
logger_ = std::shared_ptr<LoggerImpl>(new LoggerImpl(core::getClassName<LoggerConfiguration>(), get_logger(nullptr, root_namespace_, core::getClassName<LoggerConfiguration>(), formatter_)));
loggers.push_back(logger_);
}
-void LoggerConfiguration::initialize(const std::shared_ptr<LoggerProperties> &logger_properties) {
+void LoggerConfiguration::initialize(const std::shared_ptr<LoggerProperties> &logger_properties) {
std::lock_guard<std::mutex> lock(mutex);
root_namespace_ = initialize_namespaces(logger_properties);
std::string spdlog_pattern;
@@ -90,8 +91,7 @@ std::shared_ptr<Logger> LoggerConfiguration::getLogger(const std::string &name)
return result;
}
-std::shared_ptr<internal::LoggerNamespace> LoggerConfiguration::
- initialize_namespaces(const std::shared_ptr<LoggerProperties> &logger_properties) {
+std::shared_ptr<internal::LoggerNamespace> LoggerConfiguration::initialize_namespaces(const std::shared_ptr<LoggerProperties> &logger_properties) {
std::map<std::string, std::shared_ptr<spdlog::sinks::sink>> sink_map = logger_properties->initial_sinks();
std::string appender_type = "appender";
@@ -117,16 +117,18 @@ std::shared_ptr<internal::LoggerNamespace> LoggerConfiguration::
try {
max_files = std::stoi(max_files_str);
} catch (const std::invalid_argument &ia) {
- } catch (const std::out_of_range &oor) {}
+ } catch (const std::out_of_range &oor) {
+ }
}
- int max_file_size = 5*1024*1024;
+ int max_file_size = 5 * 1024 * 1024;
std::string max_file_size_str = "";
if (logger_properties->get(appender_key + ".max_file_size", max_file_size_str)) {
try {
max_file_size = std::stoi(max_file_size_str);
} catch (const std::invalid_argument &ia) {
- } catch (const std::out_of_range &oor) {}
+ } catch (const std::out_of_range &oor) {
+ }
}
sink_map[appender_name] = std::make_shared<spdlog::sinks::rotating_file_sink_mt>(file_name, max_file_size, max_files);
} else if ("stdout" == appender_type) {
@@ -170,8 +172,7 @@ std::shared_ptr<internal::LoggerNamespace> LoggerConfiguration::
}
std::shared_ptr<internal::LoggerNamespace> current_namespace = root_namespace;
if (logger_key != "logger.root") {
- for (auto const & name : utils::StringUtils::split(logger_key.substr(logger_type.length() + 1,
- logger_key.length() - logger_type.length()), "::")) {
+ for (auto const & name : utils::StringUtils::split(logger_key.substr(logger_type.length() + 1, logger_key.length() - logger_type.length()), "::")) {
auto child_pair = current_namespace->children.find(name);
std::shared_ptr<internal::LoggerNamespace> child;
if (child_pair == current_namespace->children.end()) {
@@ -190,8 +191,8 @@ std::shared_ptr<internal::LoggerNamespace> LoggerConfiguration::
return root_namespace;
}
-std::shared_ptr<spdlog::logger> LoggerConfiguration::get_logger(std::shared_ptr<Logger> logger, const std::shared_ptr<internal::LoggerNamespace> &root_namespace,
- const std::string &name, std::shared_ptr<spdlog::formatter> formatter, bool remove_if_present) {
+std::shared_ptr<spdlog::logger> LoggerConfiguration::get_logger(std::shared_ptr<Logger> logger, const std::shared_ptr<internal::LoggerNamespace> &root_namespace, const std::string &name,
+ std::shared_ptr<spdlog::formatter> formatter, bool remove_if_present) {
std::shared_ptr<spdlog::logger> spdlogger = spdlog::get(name);
if (spdlogger) {
if (remove_if_present) {
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/reporting/SiteToSiteProvenanceReportingTask.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/reporting/SiteToSiteProvenanceReportingTask.cpp b/libminifi/src/core/reporting/SiteToSiteProvenanceReportingTask.cpp
index 3d21683..e46f740 100644
--- a/libminifi/src/core/reporting/SiteToSiteProvenanceReportingTask.cpp
+++ b/libminifi/src/core/reporting/SiteToSiteProvenanceReportingTask.cpp
@@ -50,11 +50,8 @@ const char *SiteToSiteProvenanceReportingTask::ProvenanceAppStr = "MiNiFi Flow";
void SiteToSiteProvenanceReportingTask::initialize() {
}
-void SiteToSiteProvenanceReportingTask::getJsonReport(
- core::ProcessContext *context, core::ProcessSession *session,
- std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records,
- std::string &report) {
-
+void SiteToSiteProvenanceReportingTask::getJsonReport(core::ProcessContext *context, core::ProcessSession *session, std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> &records,
+ std::string &report) {
Json::Value array;
for (auto record : records) {
Json::Value recordJson;
@@ -62,9 +59,7 @@ void SiteToSiteProvenanceReportingTask::getJsonReport(
Json::Value parentUuidJson;
Json::Value childUuidJson;
recordJson["eventId"] = record->getEventId().c_str();
- recordJson["eventType"] =
- provenance::ProvenanceEventRecord::ProvenanceEventTypeStr[record
- ->getEventType()];
+ recordJson["eventType"] = provenance::ProvenanceEventRecord::ProvenanceEventTypeStr[record->getEventType()];
recordJson["timestampMillis"] = record->getEventTime();
recordJson["durationMillis"] = record->getEventDuration();
recordJson["lineageStart"] = record->getlineageStartDate();
@@ -91,10 +86,8 @@ void SiteToSiteProvenanceReportingTask::getJsonReport(
}
recordJson["childIds"] = childUuidJson;
recordJson["transitUri"] = record->getTransitUri().c_str();
- recordJson["remoteIdentifier"] = record->getSourceSystemFlowFileIdentifier()
- .c_str();
- recordJson["alternateIdentifier"] = record->getAlternateIdentifierUri()
- .c_str();
+ recordJson["remoteIdentifier"] = record->getSourceSystemFlowFileIdentifier().c_str();
+ recordJson["alternateIdentifier"] = record->getAlternateIdentifierUri().c_str();
recordJson["application"] = ProvenanceAppStr;
array.append(recordJson);
}
@@ -103,14 +96,10 @@ void SiteToSiteProvenanceReportingTask::getJsonReport(
report = writer.write(array);
}
-void SiteToSiteProvenanceReportingTask::onSchedule(
- core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory) {
+void SiteToSiteProvenanceReportingTask::onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory) {
}
-void SiteToSiteProvenanceReportingTask::onTrigger(
- core::ProcessContext *context, core::ProcessSession *session) {
-
+void SiteToSiteProvenanceReportingTask::onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
std::unique_ptr<Site2SiteClientProtocol> protocol_ = getNextProtocol(true);
if (!protocol_) {
@@ -121,18 +110,14 @@ void SiteToSiteProvenanceReportingTask::onTrigger(
if (!protocol_->bootstrap()) {
// bootstrap the client protocol if needeed
context->yield();
- std::shared_ptr<Processor> processor = std::static_pointer_cast<Processor>(
- context->getProcessorNode().getProcessor());
- logger_->log_error("Site2Site bootstrap failed yield period %d peer ",
- processor->getYieldPeriodMsec());
+ std::shared_ptr<Processor> processor = std::static_pointer_cast<Processor>(context->getProcessorNode().getProcessor());
+ logger_->log_error("Site2Site bootstrap failed yield period %d peer ", processor->getYieldPeriodMsec());
returnProtocol(std::move(protocol_));
return;
}
std::vector<std::shared_ptr<provenance::ProvenanceEventRecord>> records;
- std::shared_ptr<provenance::ProvenanceRepository> repo =
- std::static_pointer_cast<provenance::ProvenanceRepository>(
- context->getProvenanceRepository());
+ std::shared_ptr<provenance::ProvenanceRepository> repo = std::static_pointer_cast<provenance::ProvenanceRepository>(context->getProvenanceRepository());
repo->getProvenanceRecord(records, batch_size_);
if (records.size() <= 0) {
returnProtocol(std::move(protocol_));
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/repository/FlowFileRepository.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/repository/FlowFileRepository.cpp b/libminifi/src/core/repository/FlowFileRepository.cpp
index 5f62f83..e6d561a 100644
--- a/libminifi/src/core/repository/FlowFileRepository.cpp
+++ b/libminifi/src/core/repository/FlowFileRepository.cpp
@@ -40,24 +40,19 @@ void FlowFileRepository::run() {
leveldb::Iterator* it = db_->NewIterator(leveldb::ReadOptions());
for (it->SeekToFirst(); it->Valid(); it->Next()) {
- std::shared_ptr<FlowFileRecord> eventRead = std::make_shared<
- FlowFileRecord>(shared_from_this());
+ std::shared_ptr<FlowFileRecord> eventRead = std::make_shared<FlowFileRecord>(shared_from_this());
std::string key = it->key().ToString();
- if (eventRead->DeSerialize(
- reinterpret_cast<const uint8_t *>(it->value().data()),
- it->value().size())) {
+ if (eventRead->DeSerialize(reinterpret_cast<const uint8_t *>(it->value().data()), it->value().size())) {
if ((curTime - eventRead->getEventTime()) > max_partition_millis_)
purgeList.push_back(key);
} else {
- logger_->log_debug("NiFi %s retrieve event %s fail", name_.c_str(),
- key.c_str());
+ logger_->log_debug("NiFi %s retrieve event %s fail", name_.c_str(), key.c_str());
purgeList.push_back(key);
}
}
delete it;
for (auto eventId : purgeList) {
- logger_->log_info("Repository Repo %s Purge %s", name_.c_str(),
- eventId.c_str());
+ logger_->log_info("Repository Repo %s Purge %s", name_.c_str(), eventId.c_str());
Delete(eventId);
}
}
@@ -74,19 +69,14 @@ void FlowFileRepository::loadComponent() {
leveldb::Iterator* it = db_->NewIterator(leveldb::ReadOptions());
for (it->SeekToFirst(); it->Valid(); it->Next()) {
- std::shared_ptr<FlowFileRecord> eventRead =
- std::make_shared<FlowFileRecord>(shared_from_this());
+ std::shared_ptr<FlowFileRecord> eventRead = std::make_shared<FlowFileRecord>(shared_from_this());
std::string key = it->key().ToString();
- if (eventRead->DeSerialize(
- reinterpret_cast<const uint8_t *>(it->value().data()),
- it->value().size())) {
+ if (eventRead->DeSerialize(reinterpret_cast<const uint8_t *>(it->value().data()), it->value().size())) {
auto search = connectionMap.find(eventRead->getConnectionUuid());
if (search != connectionMap.end()) {
// we find the connection for the persistent flowfile, create the flowfile and enqueue that
- std::shared_ptr<core::FlowFile> flow_file_ref =
- std::static_pointer_cast<core::FlowFile>(eventRead);
- std::shared_ptr<FlowFileRecord> record =
- std::make_shared<FlowFileRecord>(shared_from_this(), flow_file_ref);
+ std::shared_ptr<core::FlowFile> flow_file_ref = std::static_pointer_cast<core::FlowFile>(eventRead);
+ std::shared_ptr<FlowFileRecord> record = std::make_shared<FlowFileRecord>(shared_from_this(), flow_file_ref);
// set store to repo to true so that we do need to persistent again in enqueue
record->setStoredToRepository(true);
search->second->put(record);
@@ -105,8 +95,7 @@ void FlowFileRepository::loadComponent() {
std::vector<std::string>::iterator itPurge;
for (itPurge = purgeList.begin(); itPurge != purgeList.end(); itPurge++) {
std::string eventId = *itPurge;
- logger_->log_info("Repository Repo %s Purge %s", name_.c_str(),
- eventId.c_str());
+ logger_->log_info("Repository Repo %s Purge %s", name_.c_str(), eventId.c_str());
Delete(eventId);
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/repository/VolatileRepository.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/repository/VolatileRepository.cpp b/libminifi/src/core/repository/VolatileRepository.cpp
index db036f8..a7e3a51 100644
--- a/libminifi/src/core/repository/VolatileRepository.cpp
+++ b/libminifi/src/core/repository/VolatileRepository.cpp
@@ -28,8 +28,7 @@ namespace minifi {
namespace core {
namespace repository {
-const char *VolatileRepository::volatile_repo_max_count =
- "max.count";
+const char *VolatileRepository::volatile_repo_max_count = "max.count";
void VolatileRepository::run() {
repo_full_ = false;
@@ -45,9 +44,7 @@ void VolatileRepository::purge() {
RepoValue value;
if (ent->getValue(value)) {
current_size_ -= value.size();
- logger_->log_info("VolatileRepository -- purge %s %d %d %d",
- value.getKey(), current_size_.load(), max_size_,
- current_index_.load());
+ logger_->log_info("VolatileRepository -- purge %s %d %d %d", value.getKey(), current_size_.load(), max_size_, current_index_.load());
}
if (current_size_ < max_size_)
break;
[6/9] nifi-minifi-cpp git commit: MINIFI-331: Apply formatter with
increased line length to source
Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/FlowFileRecord.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/FlowFileRecord.cpp b/libminifi/src/FlowFileRecord.cpp
index 614ee28..0ee33b3 100644
--- a/libminifi/src/FlowFileRecord.cpp
+++ b/libminifi/src/FlowFileRecord.cpp
@@ -39,10 +39,7 @@ namespace minifi {
std::atomic<uint64_t> FlowFileRecord::local_flow_seq_number_(0);
-FlowFileRecord::FlowFileRecord(
- std::shared_ptr<core::Repository> flow_repository,
- std::map<std::string, std::string> attributes,
- std::shared_ptr<ResourceClaim> claim)
+FlowFileRecord::FlowFileRecord(std::shared_ptr<core::Repository> flow_repository, std::map<std::string, std::string> attributes, std::shared_ptr<ResourceClaim> claim)
: FlowFile(),
flow_repository_(flow_repository),
logger_(logging::LoggerFactory<FlowFileRecord>::getLogger()) {
@@ -68,9 +65,7 @@ FlowFileRecord::FlowFileRecord(
claim_->increaseFlowFileRecordOwnedCount();
}
-FlowFileRecord::FlowFileRecord(
- std::shared_ptr<core::Repository> flow_repository,
- std::shared_ptr<core::FlowFile> &event, const std::string &uuidConnection)
+FlowFileRecord::FlowFileRecord(std::shared_ptr<core::Repository> flow_repository, std::shared_ptr<core::FlowFile> &event, const std::string &uuidConnection)
: FlowFile(),
snapshot_(""),
flow_repository_(flow_repository),
@@ -89,9 +84,7 @@ FlowFileRecord::FlowFileRecord(
}
}
-FlowFileRecord::FlowFileRecord(
- std::shared_ptr<core::Repository> flow_repository,
- std::shared_ptr<core::FlowFile> &event)
+FlowFileRecord::FlowFileRecord(std::shared_ptr<core::Repository> flow_repository, std::shared_ptr<core::FlowFile> &event)
: FlowFile(),
uuid_connection_(""),
snapshot_(""),
@@ -109,8 +102,7 @@ FlowFileRecord::~FlowFileRecord() {
claim_->decreaseFlowFileRecordOwnedCount();
std::string value;
if (claim_->getFlowFileRecordOwnedCount() <= 0) {
- logger_->log_debug("Delete Resource Claim %s",
- claim_->getContentFullPath().c_str());
+ logger_->log_debug("Delete Resource Claim %s", claim_->getContentFullPath().c_str());
if (!this->stored || !flow_repository_->Get(uuid_str_, value)) {
std::remove(claim_->getContentFullPath().c_str());
}
@@ -138,8 +130,7 @@ bool FlowFileRecord::removeKeyedAttribute(FlowAttribute key) {
}
}
-bool FlowFileRecord::updateKeyedAttribute(FlowAttribute key,
- std::string value) {
+bool FlowFileRecord::updateKeyedAttribute(FlowAttribute key, std::string value) {
const char *keyStr = FlowAttributeKey(key);
if (keyStr) {
std::string keyString = keyStr;
@@ -174,25 +165,19 @@ bool FlowFileRecord::DeSerialize(std::string key) {
ret = flow_repository_->Get(key, value);
if (!ret) {
- logger_->log_error("NiFi FlowFile Store event %s can not found",
- key.c_str());
+ logger_->log_error("NiFi FlowFile Store event %s can not found", key.c_str());
return false;
} else {
- logger_->log_debug("NiFi FlowFile Read event %s length %d", key.c_str(),
- value.length());
+ logger_->log_debug("NiFi FlowFile Read event %s length %d", key.c_str(), value.length());
}
io::DataStream stream((const uint8_t*) value.data(), value.length());
ret = DeSerialize(stream);
if (ret) {
- logger_->log_debug(
- "NiFi FlowFile retrieve uuid %s size %d connection %s success",
- uuid_str_.c_str(), stream.getSize(), uuid_connection_.c_str());
+ logger_->log_debug("NiFi FlowFile retrieve uuid %s size %d connection %s success", uuid_str_.c_str(), stream.getSize(), uuid_connection_.c_str());
} else {
- logger_->log_debug(
- "NiFi FlowFile retrieve uuid %s size %d connection %d fail",
- uuid_str_.c_str(), stream.getSize(), uuid_connection_.c_str());
+ logger_->log_debug("NiFi FlowFile retrieve uuid %s size %d connection %d fail", uuid_str_.c_str(), stream.getSize(), uuid_connection_.c_str());
}
return ret;
@@ -260,15 +245,11 @@ bool FlowFileRecord::Serialize() {
return false;
}
- if (flow_repository_->Put(uuid_str_,
- const_cast<uint8_t*>(outStream.getBuffer()),
- outStream.getSize())) {
- logger_->log_debug("NiFi FlowFile Store event %s size %d success",
- uuid_str_.c_str(), outStream.getSize());
+ if (flow_repository_->Put(uuid_str_, const_cast<uint8_t*>(outStream.getBuffer()), outStream.getSize())) {
+ logger_->log_debug("NiFi FlowFile Store event %s size %d success", uuid_str_.c_str(), outStream.getSize());
return true;
} else {
- logger_->log_error("NiFi FlowFile Store event %s size %d fail",
- uuid_str_.c_str(), outStream.getSize());
+ logger_->log_error("NiFi FlowFile Store event %s size %d fail", uuid_str_.c_str(), outStream.getSize());
return false;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/Properties.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/Properties.cpp b/libminifi/src/Properties.cpp
index f877e7a..abebfbb 100644
--- a/libminifi/src/Properties.cpp
+++ b/libminifi/src/Properties.cpp
@@ -28,7 +28,9 @@ namespace minifi {
#define BUFFER_SIZE 512
-Properties::Properties() : logger_(logging::LoggerFactory<Properties>::getLogger()) {}
+Properties::Properties()
+ : logger_(logging::LoggerFactory<Properties>::getLogger()) {
+}
// Get the config value
bool Properties::get(std::string key, std::string &value) {
@@ -62,8 +64,7 @@ void Properties::parseConfigureFileLine(char *buf) {
++line;
char first = line[0];
- if ((first == '\0') || (first == '#') || (first == '\r') || (first == '\n')
- || (first == '=')) {
+ if ((first == '\0') || (first == '#') || (first == '\r') || (first == '\n') || (first == '=')) {
return;
}
@@ -96,8 +97,7 @@ void Properties::loadConfigureFile(const char *fileName) {
if (fileName) {
// perform a naive determination if this is a relative path
if (fileName[0] != '/') {
- adjustedFilename = adjustedFilename + getHome() + "/"
- + fileName;
+ adjustedFilename = adjustedFilename + getHome() + "/" + fileName;
} else {
adjustedFilename += fileName;
}
@@ -115,8 +115,7 @@ void Properties::loadConfigureFile(const char *fileName) {
this->clear();
char buf[BUFFER_SIZE];
- for (file.getline(buf, BUFFER_SIZE); file.good();
- file.getline(buf, BUFFER_SIZE)) {
+ for (file.getline(buf, BUFFER_SIZE); file.good(); file.getline(buf, BUFFER_SIZE)) {
parseConfigureFileLine(buf);
}
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/RemoteProcessorGroupPort.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/RemoteProcessorGroupPort.cpp b/libminifi/src/RemoteProcessorGroupPort.cpp
index 2e7e61a..ca8d3be 100644
--- a/libminifi/src/RemoteProcessorGroupPort.cpp
+++ b/libminifi/src/RemoteProcessorGroupPort.cpp
@@ -43,39 +43,29 @@ namespace apache {
namespace nifi {
namespace minifi {
-const std::string RemoteProcessorGroupPort::ProcessorName(
- "RemoteProcessorGroupPort");
-core::Property RemoteProcessorGroupPort::hostName("Host Name",
- "Remote Host Name.",
- "localhost");
+const char *RemoteProcessorGroupPort::ProcessorName("RemoteProcessorGroupPort");
+core::Property RemoteProcessorGroupPort::hostName("Host Name", "Remote Host Name.", "localhost");
core::Property RemoteProcessorGroupPort::port("Port", "Remote Port", "9999");
-core::Property RemoteProcessorGroupPort::portUUID(
- "Port UUID", "Specifies remote NiFi Port UUID.", "");
+core::Property RemoteProcessorGroupPort::portUUID("Port UUID", "Specifies remote NiFi Port UUID.", "");
core::Relationship RemoteProcessorGroupPort::relation;
std::unique_ptr<Site2SiteClientProtocol> RemoteProcessorGroupPort::getNextProtocol(
- bool create = true) {
+bool create = true) {
std::unique_ptr<Site2SiteClientProtocol> nextProtocol = nullptr;
if (!available_protocols_.try_dequeue(nextProtocol)) {
if (create) {
// create
- nextProtocol = std::unique_ptr<Site2SiteClientProtocol>(
- new Site2SiteClientProtocol(nullptr));
+ nextProtocol = std::unique_ptr<Site2SiteClientProtocol>(new Site2SiteClientProtocol(nullptr));
nextProtocol->setPortId(protocol_uuid_);
- std::unique_ptr<org::apache::nifi::minifi::io::DataStream> str =
- std::unique_ptr<org::apache::nifi::minifi::io::DataStream>(
- stream_factory_->createSocket(host_, port_));
- std::unique_ptr<Site2SitePeer> peer_ = std::unique_ptr<Site2SitePeer>(
- new Site2SitePeer(std::move(str), host_, port_));
+ std::unique_ptr<org::apache::nifi::minifi::io::DataStream> str = std::unique_ptr<org::apache::nifi::minifi::io::DataStream>(stream_factory_->createSocket(host_, port_));
+ std::unique_ptr<Site2SitePeer> peer_ = std::unique_ptr<Site2SitePeer>(new Site2SitePeer(std::move(str), host_, port_));
nextProtocol->setPeer(std::move(peer_));
}
}
return std::move(nextProtocol);
}
-void RemoteProcessorGroupPort::returnProtocol(
- std::unique_ptr<Site2SiteClientProtocol> return_protocol) {
-
+void RemoteProcessorGroupPort::returnProtocol(std::unique_ptr<Site2SiteClientProtocol> return_protocol) {
if (available_protocols_.size_approx() >= max_concurrent_tasks_) {
// let the memory be freed
return;
@@ -96,9 +86,7 @@ void RemoteProcessorGroupPort::initialize() {
setSupportedRelationships(relationships);
}
-void RemoteProcessorGroupPort::onSchedule(
- core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory) {
+void RemoteProcessorGroupPort::onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory) {
std::string value;
int64_t lvalue;
@@ -106,8 +94,7 @@ void RemoteProcessorGroupPort::onSchedule(
if (context->getProperty(hostName.getName(), value)) {
host_ = value;
}
- if (context->getProperty(port.getName(), value)
- && core::Property::StringToInt(value, lvalue)) {
+ if (context->getProperty(port.getName(), value) && core::Property::StringToInt(value, lvalue)) {
port_ = (uint16_t) lvalue;
}
if (context->getProperty(portUUID.getName(), value)) {
@@ -115,8 +102,7 @@ void RemoteProcessorGroupPort::onSchedule(
}
}
-void RemoteProcessorGroupPort::onTrigger(core::ProcessContext *context,
- core::ProcessSession *session) {
+void RemoteProcessorGroupPort::onTrigger(core::ProcessContext *context, core::ProcessSession *session) {
if (!transmitting_)
return;
@@ -130,8 +116,7 @@ void RemoteProcessorGroupPort::onTrigger(core::ProcessContext *context,
if (context->getProperty(hostName.getName(), value)) {
host = value;
}
- if (context->getProperty(port.getName(), value)
- && core::Property::StringToInt(value, lvalue)) {
+ if (context->getProperty(port.getName(), value) && core::Property::StringToInt(value, lvalue)) {
sport = (uint16_t) lvalue;
}
if (context->getProperty(portUUID.getName(), value)) {
@@ -148,10 +133,8 @@ void RemoteProcessorGroupPort::onTrigger(core::ProcessContext *context,
if (!protocol_->bootstrap()) {
// bootstrap the client protocol if needeed
context->yield();
- std::shared_ptr<Processor> processor = std::static_pointer_cast<Processor>(
- context->getProcessorNode().getProcessor());
- logger_->log_error("Site2Site bootstrap failed yield period %d peer ",
- processor->getYieldPeriodMsec());
+ std::shared_ptr<Processor> processor = std::static_pointer_cast<Processor>(context->getProcessorNode().getProcessor());
+ logger_->log_error("Site2Site bootstrap failed yield period %d peer ", processor->getYieldPeriodMsec());
returnProtocol(std::move(protocol_));
return;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/SchedulingAgent.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/SchedulingAgent.cpp b/libminifi/src/SchedulingAgent.cpp
index c582c52..24ba146 100644
--- a/libminifi/src/SchedulingAgent.cpp
+++ b/libminifi/src/SchedulingAgent.cpp
@@ -33,18 +33,14 @@ namespace minifi {
bool SchedulingAgent::hasWorkToDo(std::shared_ptr<core::Processor> processor) {
// Whether it has work to do
- if (processor->getTriggerWhenEmpty() || !processor->hasIncomingConnections()
- || processor->flowFilesQueued())
+ if (processor->getTriggerWhenEmpty() || !processor->hasIncomingConnections() || processor->flowFilesQueued())
return true;
else
return false;
}
-void SchedulingAgent::enableControllerService(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
-
- logger_->log_trace("Enabling CSN in SchedulingAgent %s",
- serviceNode->getName());
+void SchedulingAgent::enableControllerService(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ logger_->log_trace("Enabling CSN in SchedulingAgent %s", serviceNode->getName());
// reference the enable function from serviceNode
std::function<bool()> f_ex = [serviceNode] {
return serviceNode->enable();
@@ -57,9 +53,7 @@ void SchedulingAgent::enableControllerService(
component_lifecycle_thread_pool_.execute(std::move(functor), future);
}
-void SchedulingAgent::disableControllerService(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
-
+void SchedulingAgent::disableControllerService(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
// reference the disable function from serviceNode
std::function<bool()> f_ex = [serviceNode] {
return serviceNode->disable();
@@ -72,14 +66,11 @@ void SchedulingAgent::disableControllerService(
component_lifecycle_thread_pool_.execute(std::move(functor), future);
}
-bool SchedulingAgent::hasTooMuchOutGoing(
- std::shared_ptr<core::Processor> processor) {
+bool SchedulingAgent::hasTooMuchOutGoing(std::shared_ptr<core::Processor> processor) {
return processor->flowFilesOutGoingFull();
}
-bool SchedulingAgent::onTrigger(std::shared_ptr<core::Processor> processor,
- core::ProcessContext *processContext,
- core::ProcessSessionFactory *sessionFactory) {
+bool SchedulingAgent::onTrigger(std::shared_ptr<core::Processor> processor, core::ProcessContext *processContext, core::ProcessSessionFactory *sessionFactory) {
if (processor->isYield())
return false;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/Site2SiteClientProtocol.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/Site2SiteClientProtocol.cpp b/libminifi/src/Site2SiteClientProtocol.cpp
index 475d49d..08ee665 100644
--- a/libminifi/src/Site2SiteClientProtocol.cpp
+++ b/libminifi/src/Site2SiteClientProtocol.cpp
@@ -38,8 +38,7 @@ namespace minifi {
bool Site2SiteClientProtocol::establish() {
if (_peerState != IDLE) {
- logger_->log_error(
- "Site2Site peer state is not idle while try to establish");
+ logger_->log_error("Site2Site peer state is not idle while try to establish");
return false;
}
@@ -70,14 +69,11 @@ bool Site2SiteClientProtocol::establish() {
bool Site2SiteClientProtocol::initiateResourceNegotiation() {
// Negotiate the version
if (_peerState != IDLE) {
- logger_->log_error(
- "Site2Site peer state is not idle while initiateResourceNegotiation");
+ logger_->log_error("Site2Site peer state is not idle while initiateResourceNegotiation");
return false;
}
- logger_->log_info(
- "Negotiate protocol version with destination port %s current version %d",
- _portIdStr.c_str(), _currentVersion);
+ logger_->log_info("Negotiate protocol version with destination port %s current version %d", _portIdStr.c_str(), _currentVersion);
int ret = peer_->writeUTF(this->getResourceName());
@@ -106,39 +102,35 @@ bool Site2SiteClientProtocol::initiateResourceNegotiation() {
}
logger_->log_info("status code is %i", statusCode);
switch (statusCode) {
- case RESOURCE_OK:
- logger_->log_info("Site2Site Protocol Negotiate protocol version OK");
- return true;
- case DIFFERENT_RESOURCE_VERSION:
- uint32_t serverVersion;
- ret = peer_->read(serverVersion);
- if (ret <= 0) {
+ case RESOURCE_OK:
+ logger_->log_info("Site2Site Protocol Negotiate protocol version OK");
+ return true;
+ case DIFFERENT_RESOURCE_VERSION:
+ uint32_t serverVersion;
+ ret = peer_->read(serverVersion);
+ if (ret <= 0) {
+ // tearDown();
+ return false;
+ }
+ logger_->log_info("Site2Site Server Response asked for a different protocol version %d", serverVersion);
+ for (unsigned int i = (_currentVersionIndex + 1); i < sizeof(_supportedVersion) / sizeof(uint32_t); i++) {
+ if (serverVersion >= _supportedVersion[i]) {
+ _currentVersion = _supportedVersion[i];
+ _currentVersionIndex = i;
+ return initiateResourceNegotiation();
+ }
+ }
+ ret = -1;
// tearDown();
return false;
- }
- logger_->log_info(
- "Site2Site Server Response asked for a different protocol version %d",
- serverVersion);
- for (unsigned int i = (_currentVersionIndex + 1);
- i < sizeof(_supportedVersion) / sizeof(uint32_t); i++) {
- if (serverVersion >= _supportedVersion[i]) {
- _currentVersion = _supportedVersion[i];
- _currentVersionIndex = i;
- return initiateResourceNegotiation();
- }
- }
- ret = -1;
- // tearDown();
- return false;
- case NEGOTIATED_ABORT:
- logger_->log_info("Site2Site Negotiate protocol response ABORT");
- ret = -1;
- // tearDown();
- return false;
- default:
- logger_->log_info("Negotiate protocol response unknown code %d",
- statusCode);
- return true;
+ case NEGOTIATED_ABORT:
+ logger_->log_info("Site2Site Negotiate protocol response ABORT");
+ ret = -1;
+ // tearDown();
+ return false;
+ default:
+ logger_->log_info("Negotiate protocol response unknown code %d", statusCode);
+ return true;
}
return true;
@@ -147,14 +139,11 @@ bool Site2SiteClientProtocol::initiateResourceNegotiation() {
bool Site2SiteClientProtocol::initiateCodecResourceNegotiation() {
// Negotiate the version
if (_peerState != HANDSHAKED) {
- logger_->log_error(
- "Site2Site peer state is not handshaked while initiateCodecResourceNegotiation");
+ logger_->log_error("Site2Site peer state is not handshaked while initiateCodecResourceNegotiation");
return false;
}
- logger_->log_info(
- "Negotiate Codec version with destination port %s current version %d",
- _portIdStr.c_str(), _currentCodecVersion);
+ logger_->log_info("Negotiate Codec version with destination port %s current version %d", _portIdStr.c_str(), _currentCodecVersion);
int ret = peer_->writeUTF(this->getCodecResourceName());
@@ -181,38 +170,35 @@ bool Site2SiteClientProtocol::initiateCodecResourceNegotiation() {
}
switch (statusCode) {
- case RESOURCE_OK:
- logger_->log_info("Site2Site Codec Negotiate version OK");
- return true;
- case DIFFERENT_RESOURCE_VERSION:
- uint32_t serverVersion;
- ret = peer_->read(serverVersion);
- if (ret <= 0) {
+ case RESOURCE_OK:
+ logger_->log_info("Site2Site Codec Negotiate version OK");
+ return true;
+ case DIFFERENT_RESOURCE_VERSION:
+ uint32_t serverVersion;
+ ret = peer_->read(serverVersion);
+ if (ret <= 0) {
+ // tearDown();
+ return false;
+ }
+ logger_->log_info("Site2Site Server Response asked for a different codec version %d", serverVersion);
+ for (unsigned int i = (_currentCodecVersionIndex + 1); i < sizeof(_supportedCodecVersion) / sizeof(uint32_t); i++) {
+ if (serverVersion >= _supportedCodecVersion[i]) {
+ _currentCodecVersion = _supportedCodecVersion[i];
+ _currentCodecVersionIndex = i;
+ return initiateCodecResourceNegotiation();
+ }
+ }
+ ret = -1;
// tearDown();
return false;
- }
- logger_->log_info(
- "Site2Site Server Response asked for a different codec version %d",
- serverVersion);
- for (unsigned int i = (_currentCodecVersionIndex + 1);
- i < sizeof(_supportedCodecVersion) / sizeof(uint32_t); i++) {
- if (serverVersion >= _supportedCodecVersion[i]) {
- _currentCodecVersion = _supportedCodecVersion[i];
- _currentCodecVersionIndex = i;
- return initiateCodecResourceNegotiation();
- }
- }
- ret = -1;
- // tearDown();
- return false;
- case NEGOTIATED_ABORT:
- logger_->log_info("Site2Site Codec Negotiate response ABORT");
- ret = -1;
- // tearDown();
- return false;
- default:
- logger_->log_info("Negotiate Codec response unknown code %d", statusCode);
- return true;
+ case NEGOTIATED_ABORT:
+ logger_->log_info("Site2Site Codec Negotiate response ABORT");
+ ret = -1;
+ // tearDown();
+ return false;
+ default:
+ logger_->log_info("Negotiate Codec response unknown code %d", statusCode);
+ return true;
}
return true;
@@ -220,13 +206,10 @@ bool Site2SiteClientProtocol::initiateCodecResourceNegotiation() {
bool Site2SiteClientProtocol::handShake() {
if (_peerState != ESTABLISHED) {
- logger_->log_error(
- "Site2Site peer state is not established while handshake");
+ logger_->log_error("Site2Site peer state is not established while handshake");
return false;
}
- logger_->log_info(
- "Site2Site Protocol Perform hand shake with destination port %s",
- _portIdStr.c_str());
+ logger_->log_info("Site2Site Protocol Perform hand shake with destination port %s", _portIdStr.c_str());
uuid_t uuid;
// Generate the global UUID for the com identify
uuid_generate(uuid);
@@ -244,18 +227,14 @@ bool Site2SiteClientProtocol::handShake() {
std::map<std::string, std::string> properties;
properties[HandShakePropertyStr[GZIP]] = "false";
properties[HandShakePropertyStr[PORT_IDENTIFIER]] = _portIdStr;
- properties[HandShakePropertyStr[REQUEST_EXPIRATION_MILLIS]] = std::to_string(
- this->_timeOut);
+ properties[HandShakePropertyStr[REQUEST_EXPIRATION_MILLIS]] = std::to_string(this->_timeOut);
if (this->_currentVersion >= 5) {
if (this->_batchCount > 0)
- properties[HandShakePropertyStr[BATCH_COUNT]] = std::to_string(
- this->_batchCount);
+ properties[HandShakePropertyStr[BATCH_COUNT]] = std::to_string(this->_batchCount);
if (this->_batchSize > 0)
- properties[HandShakePropertyStr[BATCH_SIZE]] = std::to_string(
- this->_batchSize);
+ properties[HandShakePropertyStr[BATCH_SIZE]] = std::to_string(this->_batchSize);
if (this->_batchDuration > 0)
- properties[HandShakePropertyStr[BATCH_DURATION]] = std::to_string(
- this->_batchDuration);
+ properties[HandShakePropertyStr[BATCH_DURATION]] = std::to_string(this->_batchDuration);
}
if (_currentVersion >= 3) {
@@ -285,8 +264,7 @@ bool Site2SiteClientProtocol::handShake() {
// tearDown();
return false;
}
- logger_->log_info("Site2Site Protocol Send handshake properties %s %s",
- it->first.c_str(), it->second.c_str());
+ logger_->log_info("Site2Site Protocol Send handshake properties %s %s", it->first.c_str(), it->second.c_str());
}
RespondCode code;
@@ -307,16 +285,14 @@ bool Site2SiteClientProtocol::handShake() {
case PORT_NOT_IN_VALID_STATE:
case UNKNOWN_PORT:
case PORTS_DESTINATION_FULL:
- logger_->log_error(
- "Site2Site HandShake Failed because destination port is either invalid or full");
+ logger_->log_error("Site2Site HandShake Failed because destination port is either invalid or full");
ret = -1;
/*
peer_->yield();
tearDown(); */
return false;
default:
- logger_->log_info("HandShake Failed because of unknown respond code %d",
- code);
+ logger_->log_info("HandShake Failed because of unknown respond code %d", code);
ret = -1;
/*
peer_->yield();
@@ -368,8 +344,7 @@ int Site2SiteClientProtocol::readRequestType(RequestType &type) {
return -1;
}
-int Site2SiteClientProtocol::readRespond(RespondCode &code,
- std::string &message) {
+int Site2SiteClientProtocol::readRespond(RespondCode &code, std::string &message) {
uint8_t firstByte;
int ret = peer_->read(firstByte);
@@ -407,8 +382,7 @@ int Site2SiteClientProtocol::readRespond(RespondCode &code,
return 3 + message.size();
}
-int Site2SiteClientProtocol::writeRespond(RespondCode code,
- std::string message) {
+int Site2SiteClientProtocol::writeRespond(RespondCode code, std::string message) {
RespondCodeContext *resCode = this->getRespondCodeContext(code);
if (resCode == NULL) {
@@ -440,14 +414,11 @@ int Site2SiteClientProtocol::writeRespond(RespondCode code,
bool Site2SiteClientProtocol::negotiateCodec() {
if (_peerState != HANDSHAKED) {
- logger_->log_error(
- "Site2Site peer state is not handshaked while negotiate codec");
+ logger_->log_error("Site2Site peer state is not handshaked while negotiate codec");
return false;
}
- logger_->log_info(
- "Site2Site Protocol Negotiate Codec with destination port %s",
- _portIdStr.c_str());
+ logger_->log_info("Site2Site Protocol Negotiate Codec with destination port %s", _portIdStr.c_str());
int status = this->writeRequestType(NEGOTIATE_FLOWFILE_CODEC);
@@ -467,8 +438,7 @@ bool Site2SiteClientProtocol::negotiateCodec() {
return false;
}
- logger_->log_info(
- "Site2Site Codec Completed and move to READY state for data transfer");
+ logger_->log_info("Site2Site Codec Completed and move to READY state for data transfer");
_peerState = READY;
return true;
@@ -490,8 +460,7 @@ bool Site2SiteClientProtocol::bootstrap() {
}
}
-Transaction* Site2SiteClientProtocol::createTransaction(
- std::string &transactionID, TransferDirection direction) {
+Transaction* Site2SiteClientProtocol::createTransaction(std::string &transactionID, TransferDirection direction) {
int ret;
bool dataAvailable;
Transaction *transaction = NULL;
@@ -522,8 +491,7 @@ Transaction* Site2SiteClientProtocol::createTransaction(
return NULL;
}
- org::apache::nifi::minifi::io::CRCStream<Site2SitePeer> crcstream(
- peer_.get());
+ org::apache::nifi::minifi::io::CRCStream<Site2SitePeer> crcstream(peer_.get());
switch (code) {
case MORE_DATA:
dataAvailable = true;
@@ -532,8 +500,7 @@ Transaction* Site2SiteClientProtocol::createTransaction(
_transactionMap[transaction->getUUIDStr()] = transaction;
transactionID = transaction->getUUIDStr();
transaction->setDataAvailable(dataAvailable);
- logger_->log_info("Site2Site create transaction %s",
- transaction->getUUIDStr().c_str());
+ logger_->log_info("Site2Site create transaction %s", transaction->getUUIDStr().c_str());
return transaction;
case NO_MORE_DATA:
dataAvailable = false;
@@ -542,12 +509,10 @@ Transaction* Site2SiteClientProtocol::createTransaction(
_transactionMap[transaction->getUUIDStr()] = transaction;
transactionID = transaction->getUUIDStr();
transaction->setDataAvailable(dataAvailable);
- logger_->log_info("Site2Site create transaction %s",
- transaction->getUUIDStr().c_str());
+ logger_->log_info("Site2Site create transaction %s", transaction->getUUIDStr().c_str());
return transaction;
default:
- logger_->log_info(
- "Site2Site got unexpected response %d when asking for data", code);
+ logger_->log_info("Site2Site got unexpected response %d when asking for data", code);
// tearDown();
return NULL;
}
@@ -558,20 +523,17 @@ Transaction* Site2SiteClientProtocol::createTransaction(
// tearDown();
return NULL;
} else {
- org::apache::nifi::minifi::io::CRCStream<Site2SitePeer> crcstream(
- peer_.get());
+ org::apache::nifi::minifi::io::CRCStream<Site2SitePeer> crcstream(peer_.get());
transaction = new Transaction(direction, crcstream);
_transactionMap[transaction->getUUIDStr()] = transaction;
transactionID = transaction->getUUIDStr();
- logger_->log_info("Site2Site create transaction %s",
- transaction->getUUIDStr().c_str());
+ logger_->log_info("Site2Site create transaction %s", transaction->getUUIDStr().c_str());
return transaction;
}
}
}
-bool Site2SiteClientProtocol::receive(std::string transactionID,
- DataPacket *packet, bool &eof) {
+bool Site2SiteClientProtocol::receive(std::string transactionID, DataPacket *packet, bool &eof) {
int ret;
Transaction *transaction = NULL;
@@ -583,8 +545,7 @@ bool Site2SiteClientProtocol::receive(std::string transactionID,
return false;
}
- std::map<std::string, Transaction *>::iterator it =
- this->_transactionMap.find(transactionID);
+ std::map<std::string, Transaction *>::iterator it = this->_transactionMap.find(transactionID);
if (it == _transactionMap.end()) {
return false;
@@ -592,17 +553,13 @@ bool Site2SiteClientProtocol::receive(std::string transactionID,
transaction = it->second;
}
- if (transaction->getState() != TRANSACTION_STARTED
- && transaction->getState() != DATA_EXCHANGED) {
- logger_->log_info(
- "Site2Site transaction %s is not at started or exchanged state",
- transactionID.c_str());
+ if (transaction->getState() != TRANSACTION_STARTED && transaction->getState() != DATA_EXCHANGED) {
+ logger_->log_info("Site2Site transaction %s is not at started or exchanged state", transactionID.c_str());
return false;
}
if (transaction->getDirection() != RECEIVE) {
- logger_->log_info("Site2Site transaction %s direction is wrong",
- transactionID.c_str());
+ logger_->log_info("Site2Site transaction %s direction is wrong", transactionID.c_str());
return false;
}
@@ -622,19 +579,13 @@ bool Site2SiteClientProtocol::receive(std::string transactionID,
return false;
}
if (code == CONTINUE_TRANSACTION) {
- logger_->log_info(
- "Site2Site transaction %s peer indicate continue transaction",
- transactionID.c_str());
+ logger_->log_info("Site2Site transaction %s peer indicate continue transaction", transactionID.c_str());
transaction->_dataAvailable = true;
} else if (code == FINISH_TRANSACTION) {
- logger_->log_info(
- "Site2Site transaction %s peer indicate finish transaction",
- transactionID.c_str());
+ logger_->log_info("Site2Site transaction %s peer indicate finish transaction", transactionID.c_str());
transaction->_dataAvailable = false;
} else {
- logger_->log_info(
- "Site2Site transaction %s peer indicate wrong respond code %d",
- transactionID.c_str(), code);
+ logger_->log_info("Site2Site transaction %s peer indicate wrong respond code %d", transactionID.c_str(), code);
return false;
}
}
@@ -664,9 +615,7 @@ bool Site2SiteClientProtocol::receive(std::string transactionID,
return false;
}
packet->_attributes[key] = value;
- logger_->log_info(
- "Site2Site transaction %s receives attribute key %s value %s",
- transactionID.c_str(), key.c_str(), value.c_str());
+ logger_->log_info("Site2Site transaction %s receives attribute key %s value %s", transactionID.c_str(), key.c_str(), value.c_str());
}
uint64_t len;
@@ -679,17 +628,12 @@ bool Site2SiteClientProtocol::receive(std::string transactionID,
transaction->_transfers++;
transaction->_state = DATA_EXCHANGED;
transaction->_bytes += len;
- logger_->log_info(
- "Site2Site transaction %s receives flow record %d, total length %d",
- transactionID.c_str(), transaction->_transfers, transaction->_bytes);
+ logger_->log_info("Site2Site transaction %s receives flow record %d, total length %d", transactionID.c_str(), transaction->_transfers, transaction->_bytes);
return true;
}
-bool Site2SiteClientProtocol::send(std::string transactionID,
- DataPacket *packet,
- std::shared_ptr<FlowFileRecord> flowFile,
- core::ProcessSession *session) {
+bool Site2SiteClientProtocol::send(std::string transactionID, DataPacket *packet, std::shared_ptr<FlowFileRecord> flowFile, core::ProcessSession *session) {
int ret;
Transaction *transaction = NULL;
@@ -701,8 +645,7 @@ bool Site2SiteClientProtocol::send(std::string transactionID,
return false;
}
- std::map<std::string, Transaction *>::iterator it =
- this->_transactionMap.find(transactionID);
+ std::map<std::string, Transaction *>::iterator it = this->_transactionMap.find(transactionID);
if (it == _transactionMap.end()) {
return false;
@@ -710,17 +653,13 @@ bool Site2SiteClientProtocol::send(std::string transactionID,
transaction = it->second;
}
- if (transaction->getState() != TRANSACTION_STARTED
- && transaction->getState() != DATA_EXCHANGED) {
- logger_->log_info(
- "Site2Site transaction %s is not at started or exchanged state",
- transactionID.c_str());
+ if (transaction->getState() != TRANSACTION_STARTED && transaction->getState() != DATA_EXCHANGED) {
+ logger_->log_info("Site2Site transaction %s is not at started or exchanged state", transactionID.c_str());
return false;
}
if (transaction->getDirection() != SEND) {
- logger_->log_info("Site2Site transaction %s direction is wrong",
- transactionID.c_str());
+ logger_->log_info("Site2Site transaction %s direction is wrong", transactionID.c_str());
return false;
}
@@ -739,8 +678,7 @@ bool Site2SiteClientProtocol::send(std::string transactionID,
}
std::map<std::string, std::string>::iterator itAttribute;
- for (itAttribute = packet->_attributes.begin();
- itAttribute != packet->_attributes.end(); itAttribute++) {
+ for (itAttribute = packet->_attributes.begin(); itAttribute != packet->_attributes.end(); itAttribute++) {
ret = transaction->getStream().writeUTF(itAttribute->first, true);
if (ret <= 0) {
@@ -750,9 +688,7 @@ bool Site2SiteClientProtocol::send(std::string transactionID,
if (ret <= 0) {
return false;
}
- logger_->log_info("Site2Site transaction %s send attribute key %s value %s",
- transactionID.c_str(), itAttribute->first.c_str(),
- itAttribute->second.c_str());
+ logger_->log_info("Site2Site transaction %s send attribute key %s value %s", transactionID.c_str(), itAttribute->first.c_str(), itAttribute->second.c_str());
}
uint64_t len = 0;
@@ -777,8 +713,7 @@ bool Site2SiteClientProtocol::send(std::string transactionID,
return false;
}
- ret = transaction->getStream().writeData(
- reinterpret_cast<uint8_t *> (const_cast<char*> (packet->payload_.c_str())), len);
+ ret = transaction->getStream().writeData(reinterpret_cast<uint8_t *>(const_cast<char*>(packet->payload_.c_str())), len);
if (ret != len) {
return false;
}
@@ -788,15 +723,12 @@ bool Site2SiteClientProtocol::send(std::string transactionID,
transaction->_transfers++;
transaction->_state = DATA_EXCHANGED;
transaction->_bytes += len;
- logger_->log_info(
- "Site2Site transaction %s send flow record %d, total length %d",
- transactionID.c_str(), transaction->_transfers, transaction->_bytes);
+ logger_->log_info("Site2Site transaction %s send flow record %d, total length %d", transactionID.c_str(), transaction->_transfers, transaction->_bytes);
return true;
}
-void Site2SiteClientProtocol::receiveFlowFiles(core::ProcessContext *context,
- core::ProcessSession *session) {
+void Site2SiteClientProtocol::receiveFlowFiles(core::ProcessContext *context, core::ProcessSession *session) {
uint64_t bytes = 0;
int transfers = 0;
Transaction *transaction = NULL;
@@ -808,8 +740,7 @@ void Site2SiteClientProtocol::receiveFlowFiles(core::ProcessContext *context,
if (_peerState != READY) {
context->yield();
tearDown();
- throw Exception(SITE2SITE_EXCEPTION,
- "Can not establish handshake with peer");
+ throw Exception(SITE2SITE_EXCEPTION, "Can not establish handshake with peer");
return;
}
@@ -840,8 +771,7 @@ void Site2SiteClientProtocol::receiveFlowFiles(core::ProcessContext *context,
// transaction done
break;
}
- std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<
- FlowFileRecord>(session->create());
+ std::shared_ptr<FlowFileRecord> flowFile = std::static_pointer_cast<FlowFileRecord>(session->create());
if (!flowFile) {
throw Exception(SITE2SITE_EXCEPTION, "Flow File Creation Failed");
@@ -849,8 +779,7 @@ void Site2SiteClientProtocol::receiveFlowFiles(core::ProcessContext *context,
}
std::map<std::string, std::string>::iterator it;
std::string sourceIdentifier;
- for (it = packet._attributes.begin(); it != packet._attributes.end();
- it++) {
+ for (it = packet._attributes.begin(); it != packet._attributes.end(); it++) {
if (it->first == FlowAttributeKey(UUID))
sourceIdentifier = it->second;
flowFile->addAttribute(it->first, it->second);
@@ -867,11 +796,8 @@ void Site2SiteClientProtocol::receiveFlowFiles(core::ProcessContext *context,
core::Relationship relation; // undefined relationship
uint64_t endTime = getTimeMillis();
std::string transitUri = peer_->getURL() + "/" + sourceIdentifier;
- std::string details = "urn:nifi:" + sourceIdentifier + "Remote Host="
- + peer_->getHostName();
- session->getProvenanceReporter()->receive(flowFile, transitUri,
- sourceIdentifier, details,
- endTime - startTime);
+ std::string details = "urn:nifi:" + sourceIdentifier + "Remote Host=" + peer_->getHostName();
+ session->getProvenanceReporter()->receive(flowFile, transitUri, sourceIdentifier, details, endTime - startTime);
session->transfer(flowFile, relation);
// receive the transfer for the flow record
bytes += packet._size;
@@ -886,9 +812,7 @@ void Site2SiteClientProtocol::receiveFlowFiles(core::ProcessContext *context,
throw Exception(SITE2SITE_EXCEPTION, "Complete Transaction Failed");
return;
}
- logger_->log_info(
- "Site2Site transaction %s successfully receive flow record %d, content bytes %d",
- transactionID.c_str(), transfers, bytes);
+ logger_->log_info("Site2Site transaction %s successfully receive flow record %d, content bytes %d", transactionID.c_str(), transfers, bytes);
// we yield the receive if we did not get anything
if (transfers == 0)
context->yield();
@@ -904,8 +828,7 @@ void Site2SiteClientProtocol::receiveFlowFiles(core::ProcessContext *context,
deleteTransaction(transactionID);
context->yield();
tearDown();
- logger_->log_debug(
- "Caught Exception during Site2SiteClientProtocol::receiveFlowFiles");
+ logger_->log_debug("Caught Exception during Site2SiteClientProtocol::receiveFlowFiles");
throw;
}
@@ -926,8 +849,7 @@ bool Site2SiteClientProtocol::confirm(std::string transactionID) {
return false;
}
- std::map<std::string, Transaction *>::iterator it =
- this->_transactionMap.find(transactionID);
+ std::map<std::string, Transaction *>::iterator it = this->_transactionMap.find(transactionID);
if (it == _transactionMap.end()) {
return false;
@@ -935,9 +857,7 @@ bool Site2SiteClientProtocol::confirm(std::string transactionID) {
transaction = it->second;
}
- if (transaction->getState() == TRANSACTION_STARTED
- && !transaction->isDataAvailable()
- && transaction->getDirection() == RECEIVE) {
+ if (transaction->getState() == TRANSACTION_STARTED && !transaction->isDataAvailable() && transaction->getDirection() == RECEIVE) {
transaction->_state = TRANSACTION_CONFIRMED;
return true;
}
@@ -957,8 +877,7 @@ bool Site2SiteClientProtocol::confirm(std::string transactionID) {
// time window involved in the entire transaction, it is reduced to a simple round-trip conversation.
int64_t crcValue = transaction->getCRC();
std::string crc = std::to_string(crcValue);
- logger_->log_info("Site2Site Send confirm with CRC %d to transaction %s",
- transaction->getCRC(), transactionID.c_str());
+ logger_->log_info("Site2Site Send confirm with CRC %d to transaction %s", transaction->getCRC(), transactionID.c_str());
ret = writeRespond(CONFIRM_TRANSACTION, crc);
if (ret <= 0)
return false;
@@ -969,25 +888,21 @@ bool Site2SiteClientProtocol::confirm(std::string transactionID) {
return false;
if (code == CONFIRM_TRANSACTION) {
- logger_->log_info("Site2Site transaction %s peer confirm transaction",
- transactionID.c_str());
+ logger_->log_info("Site2Site transaction %s peer confirm transaction", transactionID.c_str());
transaction->_state = TRANSACTION_CONFIRMED;
return true;
} else if (code == BAD_CHECKSUM) {
- logger_->log_info("Site2Site transaction %s peer indicate bad checksum",
- transactionID.c_str());
+ logger_->log_info("Site2Site transaction %s peer indicate bad checksum", transactionID.c_str());
/*
transaction->_state = TRANSACTION_CONFIRMED;
return true; */
return false;
} else {
- logger_->log_info("Site2Site transaction %s peer unknown respond code %d",
- transactionID.c_str(), code);
+ logger_->log_info("Site2Site transaction %s peer unknown respond code %d", transactionID.c_str(), code);
return false;
}
} else {
- logger_->log_info("Site2Site Send FINISH TRANSACTION for transaction %s",
- transactionID.c_str());
+ logger_->log_info("Site2Site Send FINISH TRANSACTION for transaction %s", transactionID.c_str());
ret = writeRespond(FINISH_TRANSACTION, "FINISH_TRANSACTION");
if (ret <= 0)
return false;
@@ -999,23 +914,19 @@ bool Site2SiteClientProtocol::confirm(std::string transactionID) {
// we've sent a FINISH_TRANSACTION. Now we'll wait for the peer to send a 'Confirm Transaction' response
if (code == CONFIRM_TRANSACTION) {
- logger_->log_info(
- "Site2Site transaction %s peer confirm transaction with CRC %s",
- transactionID.c_str(), message.c_str());
+ logger_->log_info("Site2Site transaction %s peer confirm transaction with CRC %s", transactionID.c_str(), message.c_str());
if (this->_currentVersion > 3) {
int64_t crcValue = transaction->getCRC();
std::string crc = std::to_string(crcValue);
if (message == crc) {
- logger_->log_info("Site2Site transaction %s CRC matched",
- transactionID.c_str());
+ logger_->log_info("Site2Site transaction %s CRC matched", transactionID.c_str());
ret = writeRespond(CONFIRM_TRANSACTION, "CONFIRM_TRANSACTION");
if (ret <= 0)
return false;
transaction->_state = TRANSACTION_CONFIRMED;
return true;
} else {
- logger_->log_info("Site2Site transaction %s CRC not matched %s",
- transactionID.c_str(), crc.c_str());
+ logger_->log_info("Site2Site transaction %s CRC not matched %s", transactionID.c_str(), crc.c_str());
ret = writeRespond(BAD_CHECKSUM, "BAD_CHECKSUM");
/*
ret = writeRespond(CONFIRM_TRANSACTION, "CONFIRM_TRANSACTION");
@@ -1032,8 +943,7 @@ bool Site2SiteClientProtocol::confirm(std::string transactionID) {
transaction->_state = TRANSACTION_CONFIRMED;
return true;
} else {
- logger_->log_info("Site2Site transaction %s peer unknown respond code %d",
- transactionID.c_str(), code);
+ logger_->log_info("Site2Site transaction %s peer unknown respond code %d", transactionID.c_str(), code);
return false;
}
return false;
@@ -1047,8 +957,7 @@ void Site2SiteClientProtocol::cancel(std::string transactionID) {
return;
}
- std::map<std::string, Transaction *>::iterator it =
- this->_transactionMap.find(transactionID);
+ std::map<std::string, Transaction *>::iterator it = this->_transactionMap.find(transactionID);
if (it == _transactionMap.end()) {
return;
@@ -1056,9 +965,7 @@ void Site2SiteClientProtocol::cancel(std::string transactionID) {
transaction = it->second;
}
- if (transaction->getState() == TRANSACTION_CANCELED
- || transaction->getState() == TRANSACTION_COMPLETED
- || transaction->getState() == TRANSACTION_ERROR) {
+ if (transaction->getState() == TRANSACTION_CANCELED || transaction->getState() == TRANSACTION_COMPLETED || transaction->getState() == TRANSACTION_ERROR) {
return;
}
@@ -1072,8 +979,7 @@ void Site2SiteClientProtocol::cancel(std::string transactionID) {
void Site2SiteClientProtocol::deleteTransaction(std::string transactionID) {
Transaction *transaction = NULL;
- std::map<std::string, Transaction *>::iterator it =
- this->_transactionMap.find(transactionID);
+ std::map<std::string, Transaction *>::iterator it = this->_transactionMap.find(transactionID);
if (it == _transactionMap.end()) {
return;
@@ -1081,8 +987,7 @@ void Site2SiteClientProtocol::deleteTransaction(std::string transactionID) {
transaction = it->second;
}
- logger_->log_info("Site2Site delete transaction %s",
- transaction->getUUIDStr().c_str());
+ logger_->log_info("Site2Site delete transaction %s", transaction->getUUIDStr().c_str());
delete transaction;
_transactionMap.erase(transactionID);
}
@@ -1090,8 +995,7 @@ void Site2SiteClientProtocol::deleteTransaction(std::string transactionID) {
void Site2SiteClientProtocol::error(std::string transactionID) {
Transaction *transaction = NULL;
- std::map<std::string, Transaction *>::iterator it =
- this->_transactionMap.find(transactionID);
+ std::map<std::string, Transaction *>::iterator it = this->_transactionMap.find(transactionID);
if (it == _transactionMap.end()) {
return;
@@ -1117,8 +1021,7 @@ bool Site2SiteClientProtocol::complete(std::string transactionID) {
return false;
}
- std::map<std::string, Transaction *>::iterator it =
- this->_transactionMap.find(transactionID);
+ std::map<std::string, Transaction *>::iterator it = this->_transactionMap.find(transactionID);
if (it == _transactionMap.end()) {
return false;
@@ -1135,8 +1038,7 @@ bool Site2SiteClientProtocol::complete(std::string transactionID) {
transaction->_state = TRANSACTION_COMPLETED;
return true;
} else {
- logger_->log_info("Site2Site transaction %s send finished",
- transactionID.c_str());
+ logger_->log_info("Site2Site transaction %s send finished", transactionID.c_str());
ret = this->writeRespond(TRANSACTION_FINISHED, "Finished");
if (ret <= 0) {
return false;
@@ -1156,22 +1058,18 @@ bool Site2SiteClientProtocol::complete(std::string transactionID) {
return false;
if (code == TRANSACTION_FINISHED) {
- logger_->log_info("Site2Site transaction %s peer finished transaction",
- transactionID.c_str());
+ logger_->log_info("Site2Site transaction %s peer finished transaction", transactionID.c_str());
transaction->_state = TRANSACTION_COMPLETED;
return true;
} else {
- logger_->log_info("Site2Site transaction %s peer unknown respond code %d",
- transactionID.c_str(), code);
+ logger_->log_info("Site2Site transaction %s peer unknown respond code %d", transactionID.c_str(), code);
return false;
}
}
}
-void Site2SiteClientProtocol::transferFlowFiles(core::ProcessContext *context,
- core::ProcessSession *session) {
- std::shared_ptr<FlowFileRecord> flow =
- std::static_pointer_cast<FlowFileRecord>(session->get());
+void Site2SiteClientProtocol::transferFlowFiles(core::ProcessContext *context, core::ProcessSession *session) {
+ std::shared_ptr<FlowFileRecord> flow = std::static_pointer_cast<FlowFileRecord>(session->get());
Transaction *transaction = NULL;
@@ -1185,8 +1083,7 @@ void Site2SiteClientProtocol::transferFlowFiles(core::ProcessContext *context,
if (_peerState != READY) {
context->yield();
tearDown();
- throw Exception(SITE2SITE_EXCEPTION,
- "Can not establish handshake with peer");
+ throw Exception(SITE2SITE_EXCEPTION, "Can not establish handshake with peer");
return;
}
@@ -1214,14 +1111,11 @@ void Site2SiteClientProtocol::transferFlowFiles(core::ProcessContext *context,
throw Exception(SITE2SITE_EXCEPTION, "Send Failed");
return;
}
- logger_->log_info("Site2Site transaction %s send flow record %s",
- transactionID.c_str(), flow->getUUIDStr().c_str());
+ logger_->log_info("Site2Site transaction %s send flow record %s", transactionID.c_str(), flow->getUUIDStr().c_str());
uint64_t endTime = getTimeMillis();
std::string transitUri = peer_->getURL() + "/" + flow->getUUIDStr();
- std::string details = "urn:nifi:" + flow->getUUIDStr() + "Remote Host="
- + peer_->getHostName();
- session->getProvenanceReporter()->send(flow, transitUri, details,
- endTime - startTime, false);
+ std::string details = "urn:nifi:" + flow->getUUIDStr() + "Remote Host=" + peer_->getHostName();
+ session->getProvenanceReporter()->send(flow, transitUri, details, endTime - startTime, false);
session->remove(flow);
uint64_t transferNanos = getTimeNano() - startSendingNanos;
@@ -1243,9 +1137,7 @@ void Site2SiteClientProtocol::transferFlowFiles(core::ProcessContext *context,
throw Exception(SITE2SITE_EXCEPTION, "Complete Failed");
return;
}
- logger_->log_info(
- "Site2Site transaction %s successfully send flow record %d, content bytes %d",
- transactionID.c_str(), transaction->_transfers, transaction->_bytes);
+ logger_->log_info("Site2Site transaction %s successfully send flow record %d, content bytes %d", transactionID.c_str(), transaction->_transfers, transaction->_bytes);
} catch (std::exception &exception) {
if (transaction)
deleteTransaction(transactionID);
@@ -1258,8 +1150,7 @@ void Site2SiteClientProtocol::transferFlowFiles(core::ProcessContext *context,
deleteTransaction(transactionID);
context->yield();
tearDown();
- logger_->log_debug(
- "Caught Exception during Site2SiteClientProtocol::transferFlowFiles");
+ logger_->log_debug("Caught Exception during Site2SiteClientProtocol::transferFlowFiles");
throw;
}
@@ -1268,9 +1159,7 @@ void Site2SiteClientProtocol::transferFlowFiles(core::ProcessContext *context,
return;
}
-void Site2SiteClientProtocol::transferString(core::ProcessContext *context,
- core::ProcessSession *session, std::string &payload,
- std::map<std::string, std::string> attributes) {
+void Site2SiteClientProtocol::transferString(core::ProcessContext *context, core::ProcessSession *session, std::string &payload, std::map<std::string, std::string> attributes) {
Transaction *transaction = NULL;
if (payload.length() <= 0)
@@ -1283,8 +1172,7 @@ void Site2SiteClientProtocol::transferString(core::ProcessContext *context,
if (_peerState != READY) {
context->yield();
tearDown();
- throw Exception(SITE2SITE_EXCEPTION,
- "Can not establish handshake with peer");
+ throw Exception(SITE2SITE_EXCEPTION, "Can not establish handshake with peer");
return;
}
@@ -1306,8 +1194,7 @@ void Site2SiteClientProtocol::transferString(core::ProcessContext *context,
throw Exception(SITE2SITE_EXCEPTION, "Send Failed");
return;
}
- logger_->log_info("Site2Site transaction %s send bytes length %d",
- transactionID.c_str(), payload.length());
+ logger_->log_info("Site2Site transaction %s send bytes length %d", transactionID.c_str(), payload.length());
if (!confirm(transactionID)) {
throw Exception(SITE2SITE_EXCEPTION, "Confirm Failed");
@@ -1317,9 +1204,7 @@ void Site2SiteClientProtocol::transferString(core::ProcessContext *context,
throw Exception(SITE2SITE_EXCEPTION, "Complete Failed");
return;
}
- logger_->log_info(
- "Site2Site transaction %s successfully send flow record %d, content bytes %d",
- transactionID.c_str(), transaction->_transfers, transaction->_bytes);
+ logger_->log_info("Site2Site transaction %s successfully send flow record %d, content bytes %d", transactionID.c_str(), transaction->_transfers, transaction->_bytes);
} catch (std::exception &exception) {
if (transaction)
deleteTransaction(transactionID);
@@ -1332,8 +1217,7 @@ void Site2SiteClientProtocol::transferString(core::ProcessContext *context,
deleteTransaction(transactionID);
context->yield();
tearDown();
- logger_->log_debug(
- "Caught Exception during Site2SiteClientProtocol::transferBytes");
+ logger_->log_debug("Caught Exception during Site2SiteClientProtocol::transferBytes");
throw;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/Site2SitePeer.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/Site2SitePeer.cpp b/libminifi/src/Site2SitePeer.cpp
index 551d466..7c46564 100644
--- a/libminifi/src/Site2SitePeer.cpp
+++ b/libminifi/src/Site2SitePeer.cpp
@@ -44,9 +44,7 @@ bool Site2SitePeer::Open() {
uint16_t data_size = sizeof MAGIC_BYTES;
- if (stream_->writeData(
- reinterpret_cast<uint8_t *>(const_cast<char*>(MAGIC_BYTES)), data_size)
- != data_size) {
+ if (stream_->writeData(reinterpret_cast<uint8_t *>(const_cast<char*>(MAGIC_BYTES)), data_size) != data_size) {
return false;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/ThreadedSchedulingAgent.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/ThreadedSchedulingAgent.cpp b/libminifi/src/ThreadedSchedulingAgent.cpp
index 7e9bb03..46a4710 100644
--- a/libminifi/src/ThreadedSchedulingAgent.cpp
+++ b/libminifi/src/ThreadedSchedulingAgent.cpp
@@ -35,103 +35,77 @@ namespace apache {
namespace nifi {
namespace minifi {
-void ThreadedSchedulingAgent::schedule(
- std::shared_ptr<core::Processor> processor) {
+void ThreadedSchedulingAgent::schedule(std::shared_ptr<core::Processor> processor) {
std::lock_guard<std::mutex> lock(mutex_);
admin_yield_duration_ = 0;
std::string yieldValue;
- if (configure_->get(Configure::nifi_administrative_yield_duration,
- yieldValue)) {
+ if (configure_->get(Configure::nifi_administrative_yield_duration, yieldValue)) {
core::TimeUnit unit;
- if (core::Property::StringToTime(yieldValue, admin_yield_duration_, unit)
- && core::Property::ConvertTimeUnitToMS(admin_yield_duration_, unit,
- admin_yield_duration_)) {
- logger_->log_debug("nifi_administrative_yield_duration: [%d] ms",
- admin_yield_duration_);
+ if (core::Property::StringToTime(yieldValue, admin_yield_duration_, unit) && core::Property::ConvertTimeUnitToMS(admin_yield_duration_, unit, admin_yield_duration_)) {
+ logger_->log_debug("nifi_administrative_yield_duration: [%d] ms", admin_yield_duration_);
}
}
bored_yield_duration_ = 0;
if (configure_->get(Configure::nifi_bored_yield_duration, yieldValue)) {
core::TimeUnit unit;
- if (core::Property::StringToTime(yieldValue, bored_yield_duration_, unit)
- && core::Property::ConvertTimeUnitToMS(bored_yield_duration_, unit,
- bored_yield_duration_)) {
- logger_->log_debug("nifi_bored_yield_duration: [%d] ms",
- bored_yield_duration_);
+ if (core::Property::StringToTime(yieldValue, bored_yield_duration_, unit) && core::Property::ConvertTimeUnitToMS(bored_yield_duration_, unit, bored_yield_duration_)) {
+ logger_->log_debug("nifi_bored_yield_duration: [%d] ms", bored_yield_duration_);
}
}
if (processor->getScheduledState() != core::RUNNING) {
- logger_->log_info(
- "Can not schedule threads for processor %s because it is not running",
- processor->getName().c_str());
+ logger_->log_info("Can not schedule threads for processor %s because it is not running", processor->getName().c_str());
return;
}
- std::map<std::string, std::vector<std::thread *>>::iterator it =
- _threads.find(processor->getUUIDStr());
+ std::map<std::string, std::vector<std::thread *>>::iterator it = _threads.find(processor->getUUIDStr());
if (it != _threads.end()) {
- logger_->log_info(
- "Can not schedule threads for processor %s because there are existing threads running");
+ logger_->log_info("Can not schedule threads for processor %s because there are existing threads running");
return;
}
core::ProcessorNode processor_node(processor);
- auto processContext = std::make_shared<core::ProcessContext>(
- processor_node, controller_service_provider_, repo_);
- auto sessionFactory = std::make_shared<core::ProcessSessionFactory>(
- processContext.get());
+ auto processContext = std::make_shared<core::ProcessContext>(processor_node, controller_service_provider_, repo_);
+ auto sessionFactory = std::make_shared<core::ProcessSessionFactory>(processContext.get());
processor->onSchedule(processContext.get(), sessionFactory.get());
std::vector<std::thread *> threads;
for (int i = 0; i < processor->getMaxConcurrentTasks(); i++) {
ThreadedSchedulingAgent *agent = this;
- std::thread *thread = new std::thread(
- [agent, processor, processContext, sessionFactory] () {
- agent->run(processor, processContext.get(), sessionFactory.get());
- });
+ std::thread *thread = new std::thread([agent, processor, processContext, sessionFactory] () {
+ agent->run(processor, processContext.get(), sessionFactory.get());
+ });
thread->detach();
threads.push_back(thread);
- logger_->log_info("Scheduled thread %d running for process %s",
- thread->get_id(), processor->getName().c_str());
+ logger_->log_info("Scheduled thread %d running for process %s", thread->get_id(), processor->getName().c_str());
}
_threads[processor->getUUIDStr().c_str()] = threads;
return;
}
-void ThreadedSchedulingAgent::unschedule(
- std::shared_ptr<core::Processor> processor) {
+void ThreadedSchedulingAgent::unschedule(std::shared_ptr<core::Processor> processor) {
std::lock_guard<std::mutex> lock(mutex_);
- logger_->log_info("Shutting down threads for processor %s/%s",
- processor->getName().c_str(),
- processor->getUUIDStr().c_str());
+ logger_->log_info("Shutting down threads for processor %s/%s", processor->getName().c_str(), processor->getUUIDStr().c_str());
if (processor->getScheduledState() != core::RUNNING) {
- logger_->log_info(
- "Cannot unschedule threads for processor %s because it is not running",
- processor->getName().c_str());
+ logger_->log_info("Cannot unschedule threads for processor %s because it is not running", processor->getName().c_str());
return;
}
- std::map<std::string, std::vector<std::thread *>>::iterator it =
- _threads.find(processor->getUUIDStr());
+ std::map<std::string, std::vector<std::thread *>>::iterator it = _threads.find(processor->getUUIDStr());
if (it == _threads.end()) {
- logger_->log_info(
- "Cannot unschedule threads for processor %s because there are no existing threads running",
- processor->getName().c_str());
+ logger_->log_info("Cannot unschedule threads for processor %s because there are no existing threads running", processor->getName().c_str());
return;
}
- for (std::vector<std::thread *>::iterator itThread = it->second.begin();
- itThread != it->second.end(); ++itThread) {
+ for (std::vector<std::thread *>::iterator itThread = it->second.begin(); itThread != it->second.end(); ++itThread) {
std::thread *thread = *itThread;
- logger_->log_info("Scheduled thread %d deleted for process %s",
- thread->get_id(), processor->getName().c_str());
+ logger_->log_info("Scheduled thread %d deleted for process %s", thread->get_id(), processor->getName().c_str());
delete thread;
}
_threads.erase(processor->getUUIDStr());
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/TimerDrivenSchedulingAgent.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/TimerDrivenSchedulingAgent.cpp b/libminifi/src/TimerDrivenSchedulingAgent.cpp
index 8610e64..b9a41ea 100644
--- a/libminifi/src/TimerDrivenSchedulingAgent.cpp
+++ b/libminifi/src/TimerDrivenSchedulingAgent.cpp
@@ -29,24 +29,17 @@ namespace apache {
namespace nifi {
namespace minifi {
-void TimerDrivenSchedulingAgent::run(
- std::shared_ptr<core::Processor> processor,
- core::ProcessContext *processContext,
- core::ProcessSessionFactory *sessionFactory) {
+void TimerDrivenSchedulingAgent::run(std::shared_ptr<core::Processor> processor, core::ProcessContext *processContext, core::ProcessSessionFactory *sessionFactory) {
while (this->running_) {
- bool shouldYield = this->onTrigger(processor, processContext,
- sessionFactory);
+ bool shouldYield = this->onTrigger(processor, processContext, sessionFactory);
if (processor->isYield()) {
// Honor the yield
- std::this_thread::sleep_for(
- std::chrono::milliseconds(processor->getYieldTime()));
+ std::this_thread::sleep_for(std::chrono::milliseconds(processor->getYieldTime()));
} else if (shouldYield && this->bored_yield_duration_ > 0) {
// No work to do or need to apply back pressure
- std::this_thread::sleep_for(
- std::chrono::milliseconds(this->bored_yield_duration_));
+ std::this_thread::sleep_for(std::chrono::milliseconds(this->bored_yield_duration_));
}
- std::this_thread::sleep_for(
- std::chrono::nanoseconds(processor->getSchedulingPeriodNano()));
+ std::this_thread::sleep_for(std::chrono::nanoseconds(processor->getSchedulingPeriodNano()));
}
return;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/controllers/SSLContextService.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/controllers/SSLContextService.cpp b/libminifi/src/controllers/SSLContextService.cpp
index 51a7cc4..a9450f6 100644
--- a/libminifi/src/controllers/SSLContextService.cpp
+++ b/libminifi/src/controllers/SSLContextService.cpp
@@ -51,10 +51,8 @@ std::unique_ptr<SSLContext> SSLContextService::createSSLContext() {
method = TLSv1_2_client_method();
SSL_CTX *ctx = SSL_CTX_new(method);
- if (SSL_CTX_use_certificate_file(ctx, certificate.c_str(), SSL_FILETYPE_PEM)
- <= 0) {
- logger_->log_error("Could not create load certificate, error : %s",
- std::strerror(errno));
+ if (SSL_CTX_use_certificate_file(ctx, certificate.c_str(), SSL_FILETYPE_PEM) <= 0) {
+ logger_->log_error("Could not create load certificate, error : %s", std::strerror(errno));
return nullptr;
}
if (!IsNullOrEmpty(passphrase_)) {
@@ -62,25 +60,20 @@ std::unique_ptr<SSLContext> SSLContextService::createSSLContext() {
SSL_CTX_set_default_passwd_cb(ctx, pemPassWordCb);
}
- int retp = SSL_CTX_use_PrivateKey_file(ctx, private_key_.c_str(),
- SSL_FILETYPE_PEM);
+ int retp = SSL_CTX_use_PrivateKey_file(ctx, private_key_.c_str(), SSL_FILETYPE_PEM);
if (retp != 1) {
- logger_->log_error("Could not create load private key,%i on %s error : %s",
- retp, private_key_, std::strerror(errno));
+ logger_->log_error("Could not create load private key,%i on %s error : %s", retp, private_key_, std::strerror(errno));
return nullptr;
}
if (!SSL_CTX_check_private_key(ctx)) {
- logger_->log_error(
- "Private key does not match the public certificate, error : %s",
- std::strerror(errno));
+ logger_->log_error("Private key does not match the public certificate, error : %s", std::strerror(errno));
return nullptr;
}
retp = SSL_CTX_load_verify_locations(ctx, ca_certificate_.c_str(), 0);
if (retp == 0) {
- logger_->log_error("Can not load CA certificate, Exiting, error : %s",
- std::strerror(errno));
+ logger_->log_error("Can not load CA certificate, Exiting, error : %s", std::strerror(errno));
}
return std::unique_ptr<SSLContext>(new SSLContext(ctx));
}
@@ -114,20 +107,16 @@ void SSLContextService::onEnable() {
valid_ = true;
core::Property property("Client Certificate", "Client Certificate");
core::Property privKey("Private Key", "Private Key file");
- core::Property passphrase_prop(
- "Passphrase", "Client passphrase. Either a file or unencrypted text");
+ core::Property passphrase_prop("Passphrase", "Client passphrase. Either a file or unencrypted text");
core::Property caCert("CA Certificate", "CA certificate file");
std::string default_dir;
if (nullptr != configuration_)
- configuration_->get(Configure::nifi_default_directory, default_dir);
+ configuration_->get(Configure::nifi_default_directory, default_dir);
logger_->log_trace("onEnable()");
- if (getProperty(property.getName(), certificate)
- && getProperty(privKey.getName(), private_key_)) {
- logger_->log_error(
- "Certificate and Private Key PEM file not configured, error: %s.",
- std::strerror(errno));
+ if (getProperty(property.getName(), certificate) && getProperty(privKey.getName(), private_key_)) {
+ logger_->log_error("Certificate and Private Key PEM file not configured, error: %s.", std::strerror(errno));
std::ifstream cert_file(certificate);
std::ifstream priv_file(private_key_);
@@ -168,17 +157,14 @@ void SSLContextService::onEnable() {
if (passphrase_file.good()) {
passphrase_file_ = passphrase_;
// we should read it from the file
- passphrase_.assign((std::istreambuf_iterator<char>(passphrase_file)),
- std::istreambuf_iterator<char>());
+ passphrase_.assign((std::istreambuf_iterator<char>(passphrase_file)), std::istreambuf_iterator<char>());
} else {
std::string test_passphrase = default_dir + passphrase_;
std::ifstream passphrase_file_test(test_passphrase);
if (passphrase_file_test.good()) {
passphrase_ = test_passphrase;
passphrase_file_ = test_passphrase;
- passphrase_.assign(
- (std::istreambuf_iterator<char>(passphrase_file_test)),
- std::istreambuf_iterator<char>());
+ passphrase_.assign((std::istreambuf_iterator<char>(passphrase_file_test)), std::istreambuf_iterator<char>());
} else {
valid_ = false;
}
@@ -208,8 +194,7 @@ void SSLContextService::onEnable() {
void SSLContextService::initializeTLS() {
core::Property property("Client Certificate", "Client Certificate");
core::Property privKey("Private Key", "Private Key file");
- core::Property passphrase_prop(
- "Passphrase", "Client passphrase. Either a file or unencrypted text");
+ core::Property passphrase_prop("Passphrase", "Client passphrase. Either a file or unencrypted text");
core::Property caCert("CA Certificate", "CA certificate file");
std::set<core::Property> supportedProperties;
supportedProperties.insert(property);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/ClassLoader.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/ClassLoader.cpp b/libminifi/src/core/ClassLoader.cpp
index 72ac80c..9bead0e 100644
--- a/libminifi/src/core/ClassLoader.cpp
+++ b/libminifi/src/core/ClassLoader.cpp
@@ -28,7 +28,9 @@ namespace nifi {
namespace minifi {
namespace core {
-ClassLoader::ClassLoader() : logger_(logging::LoggerFactory<ClassLoader>::getLogger()) {}
+ClassLoader::ClassLoader()
+ : logger_(logging::LoggerFactory<ClassLoader>::getLogger()) {
+}
ClassLoader &ClassLoader::getDefaultClassLoader() {
static ClassLoader ret;
@@ -49,8 +51,7 @@ uint16_t ClassLoader::registerResource(const std::string &resource) {
dlerror();
// load the symbols
- createFactory* create_factory_func = reinterpret_cast<createFactory*>(dlsym(
- resource_ptr, "createFactory"));
+ createFactory* create_factory_func = reinterpret_cast<createFactory*>(dlsym(resource_ptr, "createFactory"));
const char* dlsym_error = dlerror();
if (dlsym_error) {
logger_->log_error("Cannot load library: %s", dlsym_error);
@@ -61,8 +62,7 @@ uint16_t ClassLoader::registerResource(const std::string &resource) {
std::lock_guard<std::mutex> lock(internal_mutex_);
- loaded_factories_[factory->getClassName()] = std::unique_ptr<ObjectFactory>(
- factory);
+ loaded_factories_[factory->getClassName()] = std::unique_ptr<ObjectFactory>(factory);
return RESOURCE_SUCCESS;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/ConfigurableComponent.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/ConfigurableComponent.cpp b/libminifi/src/core/ConfigurableComponent.cpp
index 94fa599..f5247ac 100644
--- a/libminifi/src/core/ConfigurableComponent.cpp
+++ b/libminifi/src/core/ConfigurableComponent.cpp
@@ -33,8 +33,7 @@ ConfigurableComponent::ConfigurableComponent()
: logger_(logging::LoggerFactory<ConfigurableComponent>::getLogger()) {
}
-ConfigurableComponent::ConfigurableComponent(
- const ConfigurableComponent &&other)
+ConfigurableComponent::ConfigurableComponent(const ConfigurableComponent &&other)
: properties_(std::move(other.properties_)),
logger_(logging::LoggerFactory<ConfigurableComponent>::getLogger()) {
}
@@ -42,8 +41,7 @@ ConfigurableComponent::ConfigurableComponent(
ConfigurableComponent::~ConfigurableComponent() {
}
-bool ConfigurableComponent::getProperty(const std::string &name,
- Property &prop) {
+bool ConfigurableComponent::getProperty(const std::string &name, Property &prop) {
std::lock_guard<std::mutex> lock(configuration_mutex_);
auto &&it = properties_.find(name);
@@ -62,16 +60,14 @@ bool ConfigurableComponent::getProperty(const std::string &name,
* @param value value passed in by reference
* @return result of getting property.
*/
-bool ConfigurableComponent::getProperty(const std::string name,
- std::string &value) {
+bool ConfigurableComponent::getProperty(const std::string name, std::string &value) {
std::lock_guard<std::mutex> lock(configuration_mutex_);
auto &&it = properties_.find(name);
if (it != properties_.end()) {
Property item = it->second;
value = item.getValue();
- logger_->log_info("Processor %s property name %s value %s", name,
- item.getName(), value);
+ logger_->log_info("Processor %s property name %s value %s", name, item.getName(), value);
return true;
} else {
return false;
@@ -83,8 +79,7 @@ bool ConfigurableComponent::getProperty(const std::string name,
* @param value property value.
* @return result of setting property.
*/
-bool ConfigurableComponent::setProperty(const std::string name,
- std::string value) {
+bool ConfigurableComponent::setProperty(const std::string name, std::string value) {
std::lock_guard<std::mutex> lock(configuration_mutex_);
auto &&it = properties_.find(name);
@@ -92,8 +87,7 @@ bool ConfigurableComponent::setProperty(const std::string name,
Property item = it->second;
item.setValue(value);
properties_[item.getName()] = item;
- logger_->log_info("Component %s property name %s value %s", name.c_str(),
- item.getName().c_str(), value.c_str());
+ logger_->log_info("Component %s property name %s value %s", name.c_str(), item.getName().c_str(), value.c_str());
return true;
} else {
return false;
@@ -106,8 +100,7 @@ bool ConfigurableComponent::setProperty(const std::string name,
* @param value property value.
* @return result of setting property.
*/
-bool ConfigurableComponent::updateProperty(const std::string &name,
- const std::string &value) {
+bool ConfigurableComponent::updateProperty(const std::string &name, const std::string &value) {
std::lock_guard<std::mutex> lock(configuration_mutex_);
auto &&it = properties_.find(name);
@@ -115,8 +108,7 @@ bool ConfigurableComponent::updateProperty(const std::string &name,
Property item = it->second;
item.addValue(value);
properties_[item.getName()] = item;
- logger_->log_info("Component %s property name %s value %s", name.c_str(),
- item.getName().c_str(), value.c_str());
+ logger_->log_info("Component %s property name %s value %s", name.c_str(), item.getName().c_str(), value.c_str());
return true;
} else {
return false;
@@ -137,14 +129,12 @@ bool ConfigurableComponent::setProperty(Property &prop, std::string value) {
Property item = it->second;
item.setValue(value);
properties_[item.getName()] = item;
- logger_->log_info("property name %s value %s", prop.getName().c_str(),
- item.getName().c_str(), value.c_str());
+ logger_->log_info("property name %s value %s", prop.getName().c_str(), item.getName().c_str(), value.c_str());
return true;
} else {
Property newProp(prop);
newProp.setValue(value);
- properties_.insert(
- std::pair<std::string, Property>(prop.getName(), newProp));
+ properties_.insert(std::pair<std::string, Property>(prop.getName(), newProp));
return true;
}
return false;
@@ -155,8 +145,7 @@ bool ConfigurableComponent::setProperty(Property &prop, std::string value) {
* @param supported properties
* @return result of set operation.
*/
-bool ConfigurableComponent::setSupportedProperties(
- std::set<Property> properties) {
+bool ConfigurableComponent::setSupportedProperties(std::set<Property> properties) {
if (!canEdit()) {
return false;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/ConfigurationFactory.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/ConfigurationFactory.cpp b/libminifi/src/core/ConfigurationFactory.cpp
index 6aa42e3..ea2ed5c 100644
--- a/libminifi/src/core/ConfigurationFactory.cpp
+++ b/libminifi/src/core/ConfigurationFactory.cpp
@@ -39,50 +39,34 @@ namespace core {
class YamlConfiguration;
#endif
-std::unique_ptr<core::FlowConfiguration> createFlowConfiguration(
- std::shared_ptr<core::Repository> repo,
- std::shared_ptr<core::Repository> flow_file_repo,
- std::shared_ptr<Configure> configure,
- std::shared_ptr<io::StreamFactory> stream_factory,
- const std::string configuration_class_name, const std::string path,
- bool fail_safe) {
-
+std::unique_ptr<core::FlowConfiguration> createFlowConfiguration(std::shared_ptr<core::Repository> repo, std::shared_ptr<core::Repository> flow_file_repo, std::shared_ptr<Configure> configure,
+ std::shared_ptr<io::StreamFactory> stream_factory, const std::string configuration_class_name, const std::string path,
+ bool fail_safe) {
std::string class_name_lc = configuration_class_name;
- std::transform(class_name_lc.begin(), class_name_lc.end(),
- class_name_lc.begin(), ::tolower);
+ std::transform(class_name_lc.begin(), class_name_lc.end(), class_name_lc.begin(), ::tolower);
try {
if (class_name_lc == "flowconfiguration") {
// load the base configuration.
- return std::unique_ptr<core::FlowConfiguration>(
- new core::FlowConfiguration(repo, flow_file_repo, stream_factory,
- configure, path));
+ return std::unique_ptr<core::FlowConfiguration>(new core::FlowConfiguration(repo, flow_file_repo, stream_factory, configure, path));
} else if (class_name_lc == "yamlconfiguration") {
// only load if the class is defined.
- return std::unique_ptr<core::FlowConfiguration>(
- instantiate<core::YamlConfiguration>(repo, flow_file_repo,
- stream_factory, configure, path));
+ return std::unique_ptr<core::FlowConfiguration>(instantiate<core::YamlConfiguration>(repo, flow_file_repo, stream_factory, configure, path));
} else {
if (fail_safe) {
- return std::unique_ptr<core::FlowConfiguration>(
- new core::FlowConfiguration(repo, flow_file_repo, stream_factory,
- configure, path));
+ return std::unique_ptr<core::FlowConfiguration>(new core::FlowConfiguration(repo, flow_file_repo, stream_factory, configure, path));
} else {
- throw std::runtime_error(
- "Support for the provided configuration class could not be found");
+ throw std::runtime_error("Support for the provided configuration class could not be found");
}
}
} catch (const std::runtime_error &r) {
if (fail_safe) {
- return std::unique_ptr<core::FlowConfiguration>(
- new core::FlowConfiguration(repo, flow_file_repo, stream_factory,
- configure, path));
+ return std::unique_ptr<core::FlowConfiguration>(new core::FlowConfiguration(repo, flow_file_repo, stream_factory, configure, path));
}
}
- throw std::runtime_error(
- "Support for the provided configuration class could not be found");
+ throw std::runtime_error("Support for the provided configuration class could not be found");
}
} /* namespace core */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/Connectable.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/Connectable.cpp b/libminifi/src/core/Connectable.cpp
index 5bd32e9..cf01f0c 100644
--- a/libminifi/src/core/Connectable.cpp
+++ b/libminifi/src/core/Connectable.cpp
@@ -47,12 +47,9 @@ Connectable::Connectable(const Connectable &&other)
Connectable::~Connectable() {
}
-bool Connectable::setSupportedRelationships(
- std::set<core::Relationship> relationships) {
+bool Connectable::setSupportedRelationships(std::set<core::Relationship> relationships) {
if (isRunning()) {
- logger_->log_info(
- "Can not set processor supported relationship while the process %s is running",
- name_.c_str());
+ logger_->log_info("Can not set processor supported relationship while the process %s is running", name_.c_str());
return false;
}
@@ -61,8 +58,7 @@ bool Connectable::setSupportedRelationships(
relationships_.clear();
for (auto item : relationships) {
relationships_[item.getName()] = item;
- logger_->log_info("Processor %s supported relationship name %s",
- name_.c_str(), item.getName().c_str());
+ logger_->log_info("Processor %s supported relationship name %s", name_.c_str(), item.getName().c_str());
}
return true;
}
@@ -71,10 +67,7 @@ bool Connectable::setSupportedRelationships(
bool Connectable::isSupportedRelationship(core::Relationship relationship) {
const bool requiresLock = isRunning();
- const auto conditionalLock =
- !requiresLock ?
- std::unique_lock<std::mutex>() :
- std::unique_lock<std::mutex>(relationship_mutex_);
+ const auto conditionalLock = !requiresLock ? std::unique_lock<std::mutex>() : std::unique_lock<std::mutex>(relationship_mutex_);
const auto &it = relationships_.find(relationship.getName());
if (it != relationships_.end()) {
@@ -84,12 +77,9 @@ bool Connectable::isSupportedRelationship(core::Relationship relationship) {
}
}
-bool Connectable::setAutoTerminatedRelationships(
- std::set<Relationship> relationships) {
+bool Connectable::setAutoTerminatedRelationships(std::set<Relationship> relationships) {
if (isRunning()) {
- logger_->log_info(
- "Can not set processor auto terminated relationship while the process %s is running",
- name_.c_str());
+ logger_->log_info("Can not set processor auto terminated relationship while the process %s is running", name_.c_str());
return false;
}
@@ -98,8 +88,7 @@ bool Connectable::setAutoTerminatedRelationships(
auto_terminated_relationships_.clear();
for (auto item : relationships) {
auto_terminated_relationships_[item.getName()] = item;
- logger_->log_info("Processor %s auto terminated relationship name %s",
- name_.c_str(), item.getName().c_str());
+ logger_->log_info("Processor %s auto terminated relationship name %s", name_.c_str(), item.getName().c_str());
}
return true;
}
@@ -108,10 +97,7 @@ bool Connectable::setAutoTerminatedRelationships(
bool Connectable::isAutoTerminated(core::Relationship relationship) {
const bool requiresLock = isRunning();
- const auto conditionalLock =
- !requiresLock ?
- std::unique_lock<std::mutex>() :
- std::unique_lock<std::mutex>(relationship_mutex_);
+ const auto conditionalLock = !requiresLock ? std::unique_lock<std::mutex>() : std::unique_lock<std::mutex>(relationship_mutex_);
const auto &it = auto_terminated_relationships_.find(relationship.getName());
if (it != auto_terminated_relationships_.end()) {
@@ -126,8 +112,7 @@ void Connectable::waitForWork(uint64_t timeoutMs) {
if (!has_work_.load()) {
std::unique_lock<std::mutex> lock(work_available_mutex_);
- work_condition_.wait_for(lock, std::chrono::milliseconds(timeoutMs),
- [&] {return has_work_.load();});
+ work_condition_.wait_for(lock, std::chrono::milliseconds(timeoutMs), [&] {return has_work_.load();});
}
}
@@ -146,8 +131,7 @@ void Connectable::notifyWork() {
}
}
-std::set<std::shared_ptr<Connectable>> Connectable::getOutGoingConnections(
- std::string relationship) {
+std::set<std::shared_ptr<Connectable>> Connectable::getOutGoingConnections(std::string relationship) {
std::set<std::shared_ptr<Connectable>> empty;
auto &&it = out_going_connections_.find(relationship);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/FlowConfiguration.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/FlowConfiguration.cpp b/libminifi/src/core/FlowConfiguration.cpp
index 1ed9176..6635701 100644
--- a/libminifi/src/core/FlowConfiguration.cpp
+++ b/libminifi/src/core/FlowConfiguration.cpp
@@ -30,14 +30,12 @@ namespace core {
FlowConfiguration::~FlowConfiguration() {
}
-std::shared_ptr<core::Processor> FlowConfiguration::createProcessor(
- std::string name, uuid_t uuid) {
+std::shared_ptr<core::Processor> FlowConfiguration::createProcessor(std::string name, uuid_t uuid) {
auto ptr = core::ClassLoader::getDefaultClassLoader().instantiate(name, uuid);
if (nullptr == ptr) {
logger_->log_error("No Processor defined for %s", name.c_str());
}
- std::shared_ptr<core::Processor> processor = std::static_pointer_cast<
- core::Processor>(ptr);
+ std::shared_ptr<core::Processor> processor = std::static_pointer_cast<core::Processor>(ptr);
// initialize the processor
processor->initialize();
@@ -48,37 +46,27 @@ std::shared_ptr<core::Processor> FlowConfiguration::createProcessor(
std::shared_ptr<core::Processor> FlowConfiguration::createProvenanceReportTask() {
std::shared_ptr<core::Processor> processor = nullptr;
- processor =
- std::make_shared<
- org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask>(
- stream_factory_);
+ processor = std::make_shared<org::apache::nifi::minifi::core::reporting::SiteToSiteProvenanceReportingTask>(stream_factory_);
// initialize the processor
processor->initialize();
return processor;
}
-std::unique_ptr<core::ProcessGroup> FlowConfiguration::createRootProcessGroup(
- std::string name, uuid_t uuid) {
- return std::unique_ptr<core::ProcessGroup>(
- new core::ProcessGroup(core::ROOT_PROCESS_GROUP, name, uuid));
+std::unique_ptr<core::ProcessGroup> FlowConfiguration::createRootProcessGroup(std::string name, uuid_t uuid) {
+ return std::unique_ptr<core::ProcessGroup>(new core::ProcessGroup(core::ROOT_PROCESS_GROUP, name, uuid));
}
-std::unique_ptr<core::ProcessGroup> FlowConfiguration::createRemoteProcessGroup(
- std::string name, uuid_t uuid) {
- return std::unique_ptr<core::ProcessGroup>(
- new core::ProcessGroup(core::REMOTE_PROCESS_GROUP, name, uuid));
+std::unique_ptr<core::ProcessGroup> FlowConfiguration::createRemoteProcessGroup(std::string name, uuid_t uuid) {
+ return std::unique_ptr<core::ProcessGroup>(new core::ProcessGroup(core::REMOTE_PROCESS_GROUP, name, uuid));
}
-std::shared_ptr<minifi::Connection> FlowConfiguration::createConnection(
- std::string name, uuid_t uuid) {
+std::shared_ptr<minifi::Connection> FlowConfiguration::createConnection(std::string name, uuid_t uuid) {
return std::make_shared<minifi::Connection>(flow_file_repo_, name, uuid);
}
-std::shared_ptr<core::controller::ControllerServiceNode> FlowConfiguration::createControllerService(
- const std::string &class_name, const std::string &name, uuid_t uuid) {
- std::shared_ptr<core::controller::ControllerServiceNode> controllerServicesNode =
- service_provider_->createControllerService(class_name, name, true);
+std::shared_ptr<core::controller::ControllerServiceNode> FlowConfiguration::createControllerService(const std::string &class_name, const std::string &name, uuid_t uuid) {
+ std::shared_ptr<core::controller::ControllerServiceNode> controllerServicesNode = service_provider_->createControllerService(class_name, name, true);
if (nullptr != controllerServicesNode)
controllerServicesNode->setUUID(uuid);
return controllerServicesNode;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/core/FlowFile.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/core/FlowFile.cpp b/libminifi/src/core/FlowFile.cpp
index 8c693bf..af73b91 100644
--- a/libminifi/src/core/FlowFile.cpp
+++ b/libminifi/src/core/FlowFile.cpp
@@ -178,8 +178,7 @@ void FlowFile::setLineageStartDate(const uint64_t date) {
* Sets the original connection with a shared pointer.
* @param connection shared connection.
*/
-void FlowFile::setOriginalConnection(
- std::shared_ptr<core::Connectable> &connection) {
+void FlowFile::setOriginalConnection(std::shared_ptr<core::Connectable> &connection) {
original_connection_ = connection;
}
[9/9] nifi-minifi-cpp git commit: MINIFI-331: Apply formatter with
increased line length to source
Posted by al...@apache.org.
MINIFI-331: Apply formatter with increased line length to source
This closes #111.
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/77a20dbe
Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/77a20dbe
Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/77a20dbe
Branch: refs/heads/master
Commit: 77a20dbe3078d5bccee7bba0d0b4f048f5440420
Parents: feec4ea
Author: Marc Parisi <ph...@apache.org>
Authored: Tue Jun 6 09:22:05 2017 -0400
Committer: Aldrin Piri <al...@apache.org>
Committed: Tue Jun 6 12:32:22 2017 -0400
----------------------------------------------------------------------
libminifi/include/Connection.h | 11 +-
libminifi/include/EventDrivenSchedulingAgent.h | 15 +-
libminifi/include/Exception.h | 5 +-
libminifi/include/FlowControlProtocol.h | 26 +-
libminifi/include/FlowController.h | 54 +--
libminifi/include/FlowFileRecord.h | 17 +-
libminifi/include/RemoteProcessorGroupPort.h | 14 +-
libminifi/include/SchedulingAgent.h | 17 +-
libminifi/include/Site2SiteClientProtocol.h | 161 ++++----
libminifi/include/Site2SitePeer.h | 17 +-
libminifi/include/ThreadedSchedulingAgent.h | 12 +-
libminifi/include/TimerDrivenSchedulingAgent.h | 12 +-
.../include/controllers/SSLContextService.h | 74 ++--
libminifi/include/core/ClassLoader.h | 23 +-
libminifi/include/core/ConfigurationFactory.h | 26 +-
libminifi/include/core/Connectable.h | 7 +-
libminifi/include/core/Core.h | 6 +-
libminifi/include/core/FlowConfiguration.h | 31 +-
libminifi/include/core/FlowFile.h | 4 +-
libminifi/include/core/ProcessContext.h | 14 +-
libminifi/include/core/ProcessGroup.h | 22 +-
libminifi/include/core/ProcessSession.h | 107 +++--
libminifi/include/core/Processor.h | 14 +-
libminifi/include/core/ProcessorNode.h | 15 +-
libminifi/include/core/Property.h | 24 +-
libminifi/include/core/Repository.h | 9 +-
libminifi/include/core/RepositoryFactory.h | 3 +-
libminifi/include/core/Resource.h | 3 +-
.../core/controller/ControllerServiceLookup.h | 6 +-
.../core/controller/ControllerServiceMap.h | 12 +-
.../core/controller/ControllerServiceNode.h | 6 +-
.../core/controller/ControllerServiceProvider.h | 110 ++----
.../controller/StandardControllerServiceNode.h | 15 +-
.../StandardControllerServiceProvider.h | 90 ++---
libminifi/include/core/logging/Logger.h | 40 +-
.../include/core/logging/LoggerConfiguration.h | 63 +--
.../SiteToSiteProvenanceReportingTask.h | 20 +-
.../core/repository/FlowFileRepository.h | 46 +--
.../core/repository/VolatileRepository.h | 41 +-
libminifi/include/core/yaml/YamlConfiguration.h | 59 +--
libminifi/include/io/BaseStream.h | 20 +-
libminifi/include/io/CRCStream.h | 50 +--
libminifi/include/io/ClientSocket.h | 26 +-
libminifi/include/io/DataStream.h | 9 +-
libminifi/include/io/EndianCheck.h | 2 +-
libminifi/include/io/Serializable.h | 18 +-
libminifi/include/io/StreamFactory.h | 6 +-
libminifi/include/io/TLSSocket.h | 12 +-
libminifi/include/io/tls/TLSSocket.h | 49 +--
libminifi/include/io/validation.h | 12 +-
libminifi/include/processors/AppendHostInfo.h | 6 +-
libminifi/include/processors/ExecuteProcess.h | 8 +-
libminifi/include/processors/GenerateFlowFile.h | 3 +-
libminifi/include/processors/GetFile.h | 22 +-
libminifi/include/processors/InvokeHTTP.h | 19 +-
libminifi/include/processors/ListenHTTP.h | 14 +-
libminifi/include/processors/ListenSyslog.h | 9 +-
libminifi/include/processors/LoadProcessors.h | 1 -
libminifi/include/processors/LogAttribute.h | 3 +-
libminifi/include/processors/PutFile.h | 19 +-
libminifi/include/processors/TailFile.h | 6 +-
libminifi/include/properties/Properties.h | 4 +-
libminifi/include/provenance/Provenance.h | 73 ++--
.../include/provenance/ProvenanceRepository.h | 114 +++---
libminifi/include/utils/ByteInputCallBack.h | 6 +-
libminifi/include/utils/StringUtils.h | 22 +-
libminifi/include/utils/ThreadPool.h | 18 +-
libminifi/include/utils/TimeUtil.h | 9 +-
libminifi/src/Configure.cpp | 57 +--
libminifi/src/Connection.cpp | 22 +-
libminifi/src/EventDrivenSchedulingAgent.cpp | 14 +-
libminifi/src/FlowControlProtocol.cpp | 84 ++--
libminifi/src/FlowController.cpp | 147 +++----
libminifi/src/FlowFileRecord.cpp | 43 +-
libminifi/src/Properties.cpp | 13 +-
libminifi/src/RemoteProcessorGroupPort.cpp | 45 +--
libminifi/src/SchedulingAgent.cpp | 21 +-
libminifi/src/Site2SiteClientProtocol.cpp | 396 +++++++------------
libminifi/src/Site2SitePeer.cpp | 4 +-
libminifi/src/ThreadedSchedulingAgent.cpp | 70 ++--
libminifi/src/TimerDrivenSchedulingAgent.cpp | 17 +-
libminifi/src/controllers/SSLContextService.cpp | 41 +-
libminifi/src/core/ClassLoader.cpp | 10 +-
libminifi/src/core/ConfigurableComponent.cpp | 33 +-
libminifi/src/core/ConfigurationFactory.cpp | 36 +-
libminifi/src/core/Connectable.cpp | 36 +-
libminifi/src/core/FlowConfiguration.cpp | 32 +-
libminifi/src/core/FlowFile.cpp | 3 +-
libminifi/src/core/ProcessGroup.cpp | 68 ++--
libminifi/src/core/ProcessSession.cpp | 296 +++++---------
libminifi/src/core/Processor.cpp | 61 +--
libminifi/src/core/ProcessorNode.cpp | 3 +-
libminifi/src/core/RepositoryFactory.cpp | 18 +-
.../core/controller/ControllerServiceNode.cpp | 2 -
.../controller/ControllerServiceProvider.cpp | 3 +-
.../StandardControllerServiceNode.cpp | 9 +-
.../src/core/logging/LoggerConfiguration.cpp | 31 +-
.../SiteToSiteProvenanceReportingTask.cpp | 35 +-
.../src/core/repository/FlowFileRepository.cpp | 29 +-
.../src/core/repository/VolatileRepository.cpp | 7 +-
libminifi/src/core/yaml/YamlConfiguration.cpp | 255 ++++--------
libminifi/src/io/BaseStream.cpp | 47 +--
libminifi/src/io/ClientSocket.cpp | 45 +--
libminifi/src/io/DataStream.cpp | 12 +-
libminifi/src/io/Serializable.cpp | 33 +-
libminifi/src/io/tls/TLSSocket.cpp | 70 ++--
libminifi/src/processors/AppendHostInfo.cpp | 27 +-
libminifi/src/processors/ExecuteProcess.cpp | 83 ++--
libminifi/src/processors/GenerateFlowFile.cpp | 31 +-
libminifi/src/processors/GetFile.cpp | 105 ++---
libminifi/src/processors/InvokeHTTP.cpp | 265 ++++---------
libminifi/src/processors/ListenHTTP.cpp | 120 ++----
libminifi/src/processors/ListenSyslog.cpp | 68 +---
libminifi/src/processors/LogAttribute.cpp | 41 +-
libminifi/src/processors/PutFile.cpp | 62 +--
libminifi/src/processors/TailFile.cpp | 60 +--
libminifi/src/provenance/Provenance.cpp | 109 ++---
.../src/provenance/ProvenanceRepository.cpp | 10 +-
libminifi/test/Server.cpp | 58 +--
libminifi/test/TestBase.h | 67 ++--
.../ControllerServiceIntegrationTests.cpp | 91 ++---
.../test/integration/HttpGetIntegrationTest.cpp | 46 +--
.../integration/HttpPostIntegrationTest.cpp | 41 +-
.../integration/ProvenanceReportingTest.cpp | 48 +--
.../test/integration/TestExecuteProcess.cpp | 56 +--
libminifi/test/nodefs/NoLevelDB.cpp | 6 +-
libminifi/test/unit/CRCTests.cpp | 15 +-
libminifi/test/unit/ClassLoaderTests.cpp | 20 +-
libminifi/test/unit/ControllerServiceTests.cpp | 26 +-
libminifi/test/unit/InvokeHTTPTests.cpp | 120 ++----
.../test/unit/LoggerConfigurationTests.cpp | 4 +-
libminifi/test/unit/LoggerTests.cpp | 30 +-
libminifi/test/unit/MockClasses.h | 11 +-
libminifi/test/unit/ProcessorTests.cpp | 93 ++---
libminifi/test/unit/PropertyTests.cpp | 24 +-
libminifi/test/unit/ProvenanceTestHelper.h | 43 +-
libminifi/test/unit/ProvenanceTests.cpp | 52 +--
libminifi/test/unit/RepoTests.cpp | 15 +-
libminifi/test/unit/Site2SiteTests.cpp | 36 +-
libminifi/test/unit/SiteToSiteHelper.h | 9 +-
libminifi/test/unit/StringUtilsTests.cpp | 11 +-
libminifi/test/unit/YamlConfigurationTests.cpp | 15 +-
142 files changed, 1996 insertions(+), 3881 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/Connection.h
----------------------------------------------------------------------
diff --git a/libminifi/include/Connection.h b/libminifi/include/Connection.h
index 8fe42d0..be51fce 100644
--- a/libminifi/include/Connection.h
+++ b/libminifi/include/Connection.h
@@ -41,17 +41,13 @@ namespace nifi {
namespace minifi {
// Connection Class
-class Connection : public core::Connectable,
- public std::enable_shared_from_this<Connection> {
+class Connection : public core::Connectable, public std::enable_shared_from_this<Connection> {
public:
// Constructor
/*
* Create a new processor
*/
- explicit Connection(std::shared_ptr<core::Repository> flow_repository,
- std::string name, uuid_t uuid = NULL, uuid_t srcUUID =
- NULL,
- uuid_t destUUID = NULL);
+ explicit Connection(std::shared_ptr<core::Repository> flow_repository, std::string name, uuid_t uuid = NULL, uuid_t srcUUID = NULL, uuid_t destUUID = NULL);
// Destructor
virtual ~Connection() {
}
@@ -137,8 +133,7 @@ class Connection : public core::Connectable,
// Put the flow file into queue
void put(std::shared_ptr<core::FlowFile> flow);
// Poll the flow file from queue, the expired flow file record also being returned
- std::shared_ptr<core::FlowFile> poll(
- std::set<std::shared_ptr<core::FlowFile>> &expiredFlowRecords);
+ std::shared_ptr<core::FlowFile> poll(std::set<std::shared_ptr<core::FlowFile>> &expiredFlowRecords);
// Drain the flow records
void drain();
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/EventDrivenSchedulingAgent.h
----------------------------------------------------------------------
diff --git a/libminifi/include/EventDrivenSchedulingAgent.h b/libminifi/include/EventDrivenSchedulingAgent.h
index 2e49ddf..6a63dc5 100644
--- a/libminifi/include/EventDrivenSchedulingAgent.h
+++ b/libminifi/include/EventDrivenSchedulingAgent.h
@@ -38,27 +38,20 @@ class EventDrivenSchedulingAgent : public ThreadedSchedulingAgent {
/*!
* Create a new event driven scheduling agent.
*/
- EventDrivenSchedulingAgent(
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_service_provider,
- std::shared_ptr<core::Repository> repo,
- std::shared_ptr<Configure> configuration)
- : ThreadedSchedulingAgent(controller_service_provider, repo,
- configuration) {
+ EventDrivenSchedulingAgent(std::shared_ptr<core::controller::ControllerServiceProvider> controller_service_provider, std::shared_ptr<core::Repository> repo, std::shared_ptr<Configure> configuration)
+ : ThreadedSchedulingAgent(controller_service_provider, repo, configuration) {
}
// Destructor
virtual ~EventDrivenSchedulingAgent() {
}
// Run function for the thread
- void run(std::shared_ptr<core::Processor> processor,
- core::ProcessContext *processContext,
- core::ProcessSessionFactory *sessionFactory);
+ void run(std::shared_ptr<core::Processor> processor, core::ProcessContext *processContext, core::ProcessSessionFactory *sessionFactory);
private:
// Prevent default copy constructor and assignment operation
// Only support pass by reference or pointer
EventDrivenSchedulingAgent(const EventDrivenSchedulingAgent &parent);
- EventDrivenSchedulingAgent &operator=(
- const EventDrivenSchedulingAgent &parent);
+ EventDrivenSchedulingAgent &operator=(const EventDrivenSchedulingAgent &parent);
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/Exception.h
----------------------------------------------------------------------
diff --git a/libminifi/include/Exception.h b/libminifi/include/Exception.h
index 88a3ed2..080d1bf 100644
--- a/libminifi/include/Exception.h
+++ b/libminifi/include/Exception.h
@@ -44,9 +44,8 @@ enum ExceptionType {
};
// Exception String
-static const char *ExceptionStr[MAX_EXCEPTION] = { "File Operation",
- "Flow File Operation", "Processor Operation", "Process Session Operation",
- "Process Schedule Operation", "Site2Site Protocol", "General Operation" };
+static const char *ExceptionStr[MAX_EXCEPTION] = { "File Operation", "Flow File Operation", "Processor Operation", "Process Session Operation", "Process Schedule Operation", "Site2Site Protocol",
+ "General Operation" };
// Exception Type to String
inline const char *ExceptionTypeToString(ExceptionType type) {
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/FlowControlProtocol.h
----------------------------------------------------------------------
diff --git a/libminifi/include/FlowControlProtocol.h b/libminifi/include/FlowControlProtocol.h
index 73399ae..8992049 100644
--- a/libminifi/include/FlowControlProtocol.h
+++ b/libminifi/include/FlowControlProtocol.h
@@ -58,8 +58,7 @@ typedef enum {
} FlowControlMsgType;
// FlowControl Protocol Msg Type String
-static const char *FlowControlMsgTypeStr[MAX_FLOW_CONTROL_MSG_TYPE] = {
- "REGISTER_REQ", "REGISTER_RESP", "REPORT_REQ", "REPORT_RESP" };
+static const char *FlowControlMsgTypeStr[MAX_FLOW_CONTROL_MSG_TYPE] = { "REGISTER_REQ", "REGISTER_RESP", "REPORT_REQ", "REPORT_RESP" };
// Flow Control Msg Type to String
inline const char *FlowControlMsgTypeToStr(FlowControlMsgType type) {
@@ -91,10 +90,8 @@ typedef enum {
} FlowControlMsgID;
// FlowControl Protocol Msg ID String
-static const char *FlowControlMsgIDStr[MAX_FLOW_MSG_ID] = {
- "FLOW_SERIAL_NUMBER", "FLOW_YAML_NAME", "FLOW_YAML_CONTENT",
- "REPORT_INTERVAL", "PROCESSOR_NAME"
- "PROPERTY_NAME", "PROPERTY_VALUE", "REPORT_BLOB" };
+static const char *FlowControlMsgIDStr[MAX_FLOW_MSG_ID] = { "FLOW_SERIAL_NUMBER", "FLOW_YAML_NAME", "FLOW_YAML_CONTENT", "REPORT_INTERVAL", "PROCESSOR_NAME"
+ "PROPERTY_NAME", "PROPERTY_VALUE", "REPORT_BLOB" };
#define TYPE_HDR_LEN 4 // Fix Hdr Type
#define TLV_HDR_LEN 8 // Type 4 bytes and Len 4 bytes
@@ -130,9 +127,7 @@ typedef enum {
} FlowControlRespCode;
// FlowControl Resp Code str
-static const char *FlowControlRespCodeStr[MAX_RESP_CODE] = { "RESP_SUCCESS",
- "RESP_TRIGGER_REGISTER", "RESP_START_FLOW_CONTROLLER",
- "RESP_STOP_FLOW_CONTROLLER", "RESP_FAILURE" };
+static const char *FlowControlRespCodeStr[MAX_RESP_CODE] = { "RESP_SUCCESS", "RESP_TRIGGER_REGISTER", "RESP_START_FLOW_CONTROLLER", "RESP_STOP_FLOW_CONTROLLER", "RESP_FAILURE" };
// Flow Control Resp Code to String
inline const char *FlowControlRespCodeToStr(FlowControlRespCode code) {
@@ -157,7 +152,8 @@ class FlowControlProtocol {
/*!
* Create a new control protocol
*/
- FlowControlProtocol(FlowController *controller, const std::shared_ptr<Configure> &configure) : logger_(logging::LoggerFactory<FlowControlProtocol>::getLogger()) {
+ FlowControlProtocol(FlowController *controller, const std::shared_ptr<Configure> &configure)
+ : logger_(logging::LoggerFactory<FlowControlProtocol>::getLogger()) {
_controller = controller;
_socket = 0;
_serverName = "localhost";
@@ -175,17 +171,13 @@ class FlowControlProtocol {
_serverName = value;
logger_->log_info("NiFi Server Name %s", _serverName.c_str());
}
- if (configure->get(Configure::nifi_server_port, value)
- && core::Property::StringToInt(value, _serverPort)) {
+ if (configure->get(Configure::nifi_server_port, value) && core::Property::StringToInt(value, _serverPort)) {
logger_->log_info("NiFi Server Port: [%d]", _serverPort);
}
if (configure->get(Configure::nifi_server_report_interval, value)) {
core::TimeUnit unit;
- if (core::Property::StringToTime(value, _reportInterval, unit)
- && core::Property::ConvertTimeUnitToMS(_reportInterval, unit,
- _reportInterval)) {
- logger_->log_info("NiFi server report interval: [%d] ms",
- _reportInterval);
+ if (core::Property::StringToTime(value, _reportInterval, unit) && core::Property::ConvertTimeUnitToMS(_reportInterval, unit, _reportInterval)) {
+ logger_->log_info("NiFi server report interval: [%d] ms", _reportInterval);
}
} else
_reportInterval = 0;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/FlowController.h
----------------------------------------------------------------------
diff --git a/libminifi/include/FlowController.h b/libminifi/include/FlowController.h
index 59865d4..dc0d610 100644
--- a/libminifi/include/FlowController.h
+++ b/libminifi/include/FlowController.h
@@ -58,8 +58,7 @@ namespace minifi {
* Flow Controller class. Generally used by FlowController factory
* as a singleton.
*/
-class FlowController : public core::controller::ControllerServiceProvider,
- public std::enable_shared_from_this<FlowController> {
+class FlowController : public core::controller::ControllerServiceProvider, public std::enable_shared_from_this<FlowController> {
public:
static const int DEFAULT_MAX_TIMER_DRIVEN_THREAD = 10;
static const int DEFAULT_MAX_EVENT_DRIVEN_THREAD = 5;
@@ -67,9 +66,7 @@ class FlowController : public core::controller::ControllerServiceProvider,
/**
* Flow controller constructor
*/
- FlowController(std::shared_ptr<core::Repository> provenance_repo,
- std::shared_ptr<core::Repository> flow_file_repo,
- std::shared_ptr<Configure> configure,
+ FlowController(std::shared_ptr<core::Repository> provenance_repo, std::shared_ptr<core::Repository> flow_file_repo, std::shared_ptr<Configure> configure,
std::unique_ptr<core::FlowConfiguration> flow_configuration,
const std::string name = DEFAULT_ROOT_GROUP_NAME,
bool headless_mode = false);
@@ -125,8 +122,7 @@ class FlowController : public core::controller::ControllerServiceProvider,
// Load new xml
virtual void reload(std::string yamlFile);
// update property value
- void updatePropertyValue(std::string processorName, std::string propertyName,
- std::string propertyValue) {
+ void updatePropertyValue(std::string processorName, std::string propertyName, std::string propertyValue) {
if (root_ != nullptr)
root_->updatePropertyValue(processorName, propertyName, propertyValue);
}
@@ -142,9 +138,8 @@ class FlowController : public core::controller::ControllerServiceProvider,
* @param id service identifier
* @param firstTimeAdded first time this CS was added
*/
- virtual std::shared_ptr<core::controller::ControllerServiceNode> createControllerService(
- const std::string &type, const std::string &id,
- bool firstTimeAdded);
+ virtual std::shared_ptr<core::controller::ControllerServiceNode> createControllerService(const std::string &type, const std::string &id,
+ bool firstTimeAdded);
/**
* controller service provider
@@ -154,29 +149,25 @@ class FlowController : public core::controller::ControllerServiceProvider,
* @param serviceNode service node to be removed.
*/
- virtual void removeControllerService(
- const std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
+ virtual void removeControllerService(const std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
/**
* Enables the controller service services
* @param serviceNode service node which will be disabled, along with linked services.
*/
- virtual void enableControllerService(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
+ virtual void enableControllerService(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
/**
* Enables controller services
* @param serviceNoden vector of service nodes which will be enabled, along with linked services.
*/
- virtual void enableControllerServices(
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> serviceNodes);
+ virtual void enableControllerServices(std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> serviceNodes);
/**
* Disables controller services
* @param serviceNode service node which will be disabled, along with linked services.
*/
- virtual void disableControllerService(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
+ virtual void disableControllerService(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
/**
* Gets all controller services.
@@ -188,38 +179,32 @@ class FlowController : public core::controller::ControllerServiceProvider,
* @param id service identifier
* @return shared pointer to the controller service node or nullptr if it does not exist.
*/
- virtual std::shared_ptr<core::controller::ControllerServiceNode> getControllerServiceNode(
- const std::string &id);
+ virtual std::shared_ptr<core::controller::ControllerServiceNode> getControllerServiceNode(const std::string &id);
- virtual void verifyCanStopReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
+ virtual void verifyCanStopReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
/**
* Unschedules referencing components.
*/
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> unscheduleReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> unscheduleReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
/**
* Verify can disable referencing components
* @param serviceNode service node whose referenced components will be scheduled.
*/
- virtual void verifyCanDisableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
+ virtual void verifyCanDisableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
/**
* Disables referencing components
* @param serviceNode service node whose referenced components will be scheduled.
*/
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> disableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> disableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
/**
* Verify can enable referencing components
* @param serviceNode service node whose referenced components will be scheduled.
*/
- virtual void verifyCanEnableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
+ virtual void verifyCanEnableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
/**
* Determines if the controller service specified by identifier is enabled.
@@ -230,22 +215,19 @@ class FlowController : public core::controller::ControllerServiceProvider,
* Enables referencing components
* @param serviceNode service node whose referenced components will be scheduled.
*/
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> enableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> enableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
/**
* Schedules referencing components
* @param serviceNode service node whose referenced components will be scheduled.
*/
- virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> scheduleReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
+ virtual std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> scheduleReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
/**
* Returns controller service components referenced by serviceIdentifier from the embedded
* controller service provider;
*/
- std::shared_ptr<core::controller::ControllerService> getControllerServiceForComponent(
- const std::string &serviceIdentifier, const std::string &componentId);
+ std::shared_ptr<core::controller::ControllerService> getControllerServiceForComponent(const std::string &serviceIdentifier, const std::string &componentId);
/**
* Enables all controller services for the provider.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/FlowFileRecord.h
----------------------------------------------------------------------
diff --git a/libminifi/include/FlowFileRecord.h b/libminifi/include/FlowFileRecord.h
index 1d41b60..400cedc 100644
--- a/libminifi/include/FlowFileRecord.h
+++ b/libminifi/include/FlowFileRecord.h
@@ -67,9 +67,7 @@ enum FlowAttribute {
};
// FlowFile Attribute Key
-static const char *FlowAttributeKeyArray[MAX_FLOW_ATTRIBUTES] = { "path",
- "absolute.path", "filename", "uuid", "priority", "mime.type",
- "discard.reason", "alternate.identifier" };
+static const char *FlowAttributeKeyArray[MAX_FLOW_ATTRIBUTES] = { "path", "absolute.path", "filename", "uuid", "priority", "mime.type", "discard.reason", "alternate.identifier" };
// FlowFile Attribute Enum to Key
inline const char *FlowAttributeKey(FlowAttribute attribute) {
@@ -96,22 +94,17 @@ class FlowFileRecord : public core::FlowFile, public io::Serializable {
/*
* Create a new flow record
*/
- explicit FlowFileRecord(std::shared_ptr<core::Repository> flow_repository,
- std::map<std::string, std::string> attributes,
- std::shared_ptr<ResourceClaim> claim = nullptr);
+ explicit FlowFileRecord(std::shared_ptr<core::Repository> flow_repository, std::map<std::string, std::string> attributes, std::shared_ptr<ResourceClaim> claim = nullptr);
- explicit FlowFileRecord(std::shared_ptr<core::Repository> flow_repository,
- std::shared_ptr<core::FlowFile> &event);
+ explicit FlowFileRecord(std::shared_ptr<core::Repository> flow_repository, std::shared_ptr<core::FlowFile> &event);
- explicit FlowFileRecord(std::shared_ptr<core::Repository> flow_repository,
- std::shared_ptr<core::FlowFile> &event,
- const std::string &uuidConnection);
+ explicit FlowFileRecord(std::shared_ptr<core::Repository> flow_repository, std::shared_ptr<core::FlowFile> &event, const std::string &uuidConnection);
explicit FlowFileRecord(std::shared_ptr<core::Repository> flow_repository)
: FlowFile(),
flow_repository_(flow_repository),
snapshot_(""),
- logger_(logging::LoggerFactory<FlowFileRecord>::getLogger()) {
+ logger_(logging::LoggerFactory<FlowFileRecord>::getLogger()) {
}
// Destructor
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/RemoteProcessorGroupPort.h
----------------------------------------------------------------------
diff --git a/libminifi/include/RemoteProcessorGroupPort.h b/libminifi/include/RemoteProcessorGroupPort.h
index 1bdbb38..9f89b07 100644
--- a/libminifi/include/RemoteProcessorGroupPort.h
+++ b/libminifi/include/RemoteProcessorGroupPort.h
@@ -42,9 +42,7 @@ class RemoteProcessorGroupPort : public core::Processor {
/*!
* Create a new processor
*/
- RemoteProcessorGroupPort(
- const std::shared_ptr<io::StreamFactory> &stream_factory,
- std::string name, uuid_t uuid = nullptr)
+ RemoteProcessorGroupPort(const std::shared_ptr<io::StreamFactory> &stream_factory, std::string name, uuid_t uuid = nullptr)
: core::Processor(name, uuid),
direction_(SEND),
transmitting_(false),
@@ -59,19 +57,17 @@ class RemoteProcessorGroupPort : public core::Processor {
}
// Processor Name
- static const std::string ProcessorName;
+ static const char *ProcessorName;
// Supported Properties
static core::Property hostName;
static core::Property port;
static core::Property portUUID;
// Supported Relationships
static core::Relationship relation;
- public:
- void onSchedule(core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory);
+ public:
+ void onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory);
// OnTrigger method, implemented by NiFi RemoteProcessorGroupPort
- virtual void onTrigger(core::ProcessContext *context,
- core::ProcessSession *session);
+ virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
// Initialize, over write by NiFi RemoteProcessorGroupPort
virtual void initialize(void);
// Set Direction
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/SchedulingAgent.h
----------------------------------------------------------------------
diff --git a/libminifi/include/SchedulingAgent.h b/libminifi/include/SchedulingAgent.h
index 37e26c6..22f79db 100644
--- a/libminifi/include/SchedulingAgent.h
+++ b/libminifi/include/SchedulingAgent.h
@@ -52,9 +52,7 @@ class SchedulingAgent {
/*!
* Create a new scheduling agent.
*/
- SchedulingAgent(
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_service_provider,
- std::shared_ptr<core::Repository> repo, std::shared_ptr<Configure> configuration)
+ SchedulingAgent(std::shared_ptr<core::controller::ControllerServiceProvider> controller_service_provider, std::shared_ptr<core::Repository> repo, std::shared_ptr<Configure> configuration)
: configure_(configuration),
admin_yield_duration_(0),
bored_yield_duration_(0),
@@ -62,8 +60,7 @@ class SchedulingAgent {
logger_(logging::LoggerFactory<SchedulingAgent>::getLogger()) {
running_ = false;
repo_ = repo;
- utils::ThreadPool<bool> pool = utils::ThreadPool<bool>(
- configure_->getInt(Configure::nifi_flow_engine_threads, 8), true);
+ utils::ThreadPool<bool> pool = utils::ThreadPool<bool>(configure_->getInt(Configure::nifi_flow_engine_threads, 8), true);
component_lifecycle_thread_pool_ = std::move(pool);
component_lifecycle_thread_pool_.start();
}
@@ -72,9 +69,7 @@ class SchedulingAgent {
}
// onTrigger, return whether the yield is need
- bool onTrigger(std::shared_ptr<core::Processor> processor,
- core::ProcessContext *processContext,
- core::ProcessSessionFactory *sessionFactory);
+ bool onTrigger(std::shared_ptr<core::Processor> processor, core::ProcessContext *processContext, core::ProcessSessionFactory *sessionFactory);
// Whether agent has work to do
bool hasWorkToDo(std::shared_ptr<core::Processor> processor);
// Whether the outgoing need to be backpressure
@@ -91,10 +86,8 @@ class SchedulingAgent {
}
public:
- virtual void enableControllerService(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
- virtual void disableControllerService(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
+ virtual void enableControllerService(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
+ virtual void disableControllerService(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode);
// schedule, overwritten by different DrivenSchedulingAgent
virtual void schedule(std::shared_ptr<core::Processor> processor) = 0;
// unschedule, overwritten by different DrivenSchedulingAgent
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/Site2SiteClientProtocol.h
----------------------------------------------------------------------
diff --git a/libminifi/include/Site2SiteClientProtocol.h b/libminifi/include/Site2SiteClientProtocol.h
index 6f5a462..209f6b4 100644
--- a/libminifi/include/Site2SiteClientProtocol.h
+++ b/libminifi/include/Site2SiteClientProtocol.h
@@ -131,9 +131,7 @@ typedef enum {
} RequestType;
// Request Type Str
-static const char *RequestTypeStr[MAX_REQUEST_TYPE] = {
- "NEGOTIATE_FLOWFILE_CODEC", "REQUEST_PEER_LIST", "SEND_FLOWFILES",
- "RECEIVE_FLOWFILES", "SHUTDOWN" };
+static const char *RequestTypeStr[MAX_REQUEST_TYPE] = { "NEGOTIATE_FLOWFILE_CODEC", "REQUEST_PEER_LIST", "SEND_FLOWFILES", "RECEIVE_FLOWFILES", "SHUTDOWN" };
// Respond Code
typedef enum {
@@ -171,32 +169,33 @@ typedef enum {
// Respond Code Class
typedef struct {
RespondCode code;
- const char *description;
- bool hasDescription;
+ const char *description;bool hasDescription;
} RespondCodeContext;
// Respond Code Context
-static RespondCodeContext respondCodeContext[] = { { RESERVED,
- "Reserved for Future Use", false },
- { PROPERTIES_OK, "Properties OK", false }, { UNKNOWN_PROPERTY_NAME,
- "Unknown Property Name", true }, { ILLEGAL_PROPERTY_VALUE,
- "Illegal Property Value", true }, { MISSING_PROPERTY,
- "Missing Property", true }, { CONTINUE_TRANSACTION,
- "Continue Transaction", false }, { FINISH_TRANSACTION,
- "Finish Transaction", false }, { CONFIRM_TRANSACTION,
- "Confirm Transaction", true }, { TRANSACTION_FINISHED,
- "Transaction Finished", false }, {
- TRANSACTION_FINISHED_BUT_DESTINATION_FULL,
- "Transaction Finished But Destination is Full", false }, {
- CANCEL_TRANSACTION, "Cancel Transaction", true }, { BAD_CHECKSUM,
- "Bad Checksum", false }, { MORE_DATA, "More Data Exists", false }, {
- NO_MORE_DATA, "No More Data Exists", false }, { UNKNOWN_PORT,
- "Unknown Port", false }, { PORT_NOT_IN_VALID_STATE,
- "Port Not in a Valid State", true }, { PORTS_DESTINATION_FULL,
- "Port's Destination is Full", false }, { UNAUTHORIZED,
- "User Not Authorized", true }, { ABORT, "Abort", true }, {
- UNRECOGNIZED_RESPONSE_CODE, "Unrecognized Response Code", false }, {
- END_OF_STREAM, "End of Stream", false } };
+static RespondCodeContext respondCodeContext[] = {
+ { RESERVED, "Reserved for Future Use", false },
+ { PROPERTIES_OK, "Properties OK", false },
+ { UNKNOWN_PROPERTY_NAME, "Unknown Property Name", true },
+ { ILLEGAL_PROPERTY_VALUE, "Illegal Property Value", true },
+ { MISSING_PROPERTY, "Missing Property", true },
+ { CONTINUE_TRANSACTION, "Continue Transaction", false },
+ { FINISH_TRANSACTION, "Finish Transaction", false },
+ { CONFIRM_TRANSACTION, "Confirm Transaction", true },
+ { TRANSACTION_FINISHED, "Transaction Finished", false },
+ { TRANSACTION_FINISHED_BUT_DESTINATION_FULL, "Transaction Finished But Destination is Full", false },
+ { CANCEL_TRANSACTION, "Cancel Transaction", true },
+ { BAD_CHECKSUM, "Bad Checksum", false },
+ { MORE_DATA, "More Data Exists", false },
+ { NO_MORE_DATA, "No More Data Exists", false },
+ { UNKNOWN_PORT, "Unknown Port", false },
+ { PORT_NOT_IN_VALID_STATE, "Port Not in a Valid State", true },
+ { PORTS_DESTINATION_FULL, "Port's Destination is Full", false },
+ { UNAUTHORIZED, "User Not Authorized", true },
+ { ABORT, "Abort", true },
+ { UNRECOGNIZED_RESPONSE_CODE, "Unrecognized Response Code", false },
+ { END_OF_STREAM, "End of Stream", false }
+};
// Respond Code Sequence Pattern
static const uint8_t CODE_SEQUENCE_VALUE_1 = (uint8_t) 'R';
@@ -246,54 +245,52 @@ typedef enum {
// HandShakeProperty Str
static const char *HandShakePropertyStr[MAX_HANDSHAKE_PROPERTY] = {
-/**
- * Boolean value indicating whether or not the contents of a FlowFile should
- * be GZipped when transferred.
- */
-"GZIP",
-/**
- * The unique identifier of the port to communicate with
- */
-"PORT_IDENTIFIER",
-/**
- * Indicates the number of milliseconds after the request was made that the
- * client will wait for a response. If no response has been received by the
- * time this value expires, the server can move on without attempting to
- * service the request because the client will have already disconnected.
- */
-"REQUEST_EXPIRATION_MILLIS",
-/**
- * The preferred number of FlowFiles that the server should send to the
- * client when pulling data. This property was introduced in version 5 of
- * the protocol.
- */
-"BATCH_COUNT",
-/**
- * The preferred number of bytes that the server should send to the client
- * when pulling data. This property was introduced in version 5 of the
- * protocol.
- */
-"BATCH_SIZE",
-/**
- * The preferred amount of time that the server should send data to the
- * client when pulling data. This property was introduced in version 5 of
- * the protocol. Value is in milliseconds.
- */
-"BATCH_DURATION" };
+ /**
+ * Boolean value indicating whether or not the contents of a FlowFile should
+ * be GZipped when transferred.
+ */
+ "GZIP",
+ /**
+ * The unique identifier of the port to communicate with
+ */
+ "PORT_IDENTIFIER",
+ /**
+ * Indicates the number of milliseconds after the request was made that the
+ * client will wait for a response. If no response has been received by the
+ * time this value expires, the server can move on without attempting to
+ * service the request because the client will have already disconnected.
+ */
+ "REQUEST_EXPIRATION_MILLIS",
+ /**
+ * The preferred number of FlowFiles that the server should send to the
+ * client when pulling data. This property was introduced in version 5 of
+ * the protocol.
+ */
+ "BATCH_COUNT",
+ /**
+ * The preferred number of bytes that the server should send to the client
+ * when pulling data. This property was introduced in version 5 of the
+ * protocol.
+ */
+ "BATCH_SIZE",
+ /**
+ * The preferred amount of time that the server should send data to the
+ * client when pulling data. This property was introduced in version 5 of
+ * the protocol. Value is in milliseconds.
+ */
+ "BATCH_DURATION" };
class Site2SiteClientProtocol;
// Transaction Class
class Transaction {
friend class Site2SiteClientProtocol;
- public:
+ public:
// Constructor
/*!
* Create a new transaction
*/
- explicit Transaction(
- TransferDirection direction,
- org::apache::nifi::minifi::io::CRCStream<Site2SitePeer> &stream)
+ explicit Transaction(TransferDirection direction, org::apache::nifi::minifi::io::CRCStream<Site2SitePeer> &stream)
: crcStream(std::move(stream)) {
_state = TRANSACTION_STARTED;
_direction = direction;
@@ -375,9 +372,8 @@ class Transaction {
*/
class DataPacket {
public:
- DataPacket(Site2SiteClientProtocol *protocol, Transaction *transaction,
- std::map<std::string, std::string> attributes, std::string &payload) :
- payload_ (payload) {
+ DataPacket(Site2SiteClientProtocol *protocol, Transaction *transaction, std::map<std::string, std::string> attributes, std::string &payload)
+ : payload_(payload) {
_protocol = protocol;
_size = 0;
_transaction = transaction;
@@ -398,7 +394,8 @@ class Site2SiteClientProtocol {
/*!
* Create a new control protocol
*/
- Site2SiteClientProtocol(std::unique_ptr<Site2SitePeer> peer) : logger_(logging::LoggerFactory<Site2SiteClientProtocol>::getLogger()) {
+ Site2SiteClientProtocol(std::unique_ptr<Site2SitePeer> peer)
+ : logger_(logging::LoggerFactory<Site2SiteClientProtocol>::getLogger()) {
peer_ = std::move(peer);
_batchSize = 0;
_batchCount = 0;
@@ -500,8 +497,7 @@ class Site2SiteClientProtocol {
int writeRespond(RespondCode code, std::string message);
// getRespondCodeContext
RespondCodeContext *getRespondCodeContext(RespondCode code) {
- for (unsigned int i = 0;
- i < sizeof(respondCodeContext) / sizeof(RespondCodeContext); i++) {
+ for (unsigned int i = 0; i < sizeof(respondCodeContext) / sizeof(RespondCodeContext); i++) {
if (respondCodeContext[i].code == code) {
return &respondCodeContext[i];
}
@@ -511,16 +507,13 @@ class Site2SiteClientProtocol {
// Creation of a new transaction, return the transaction ID if success,
// Return NULL when any error occurs
- Transaction *createTransaction(std::string &transactionID,
- TransferDirection direction);
+ Transaction *createTransaction(std::string &transactionID, TransferDirection direction);
// Receive the data packet from the transaction
// Return false when any error occurs
bool receive(std::string transactionID, DataPacket *packet, bool &eof);
// Send the data packet from the transaction
// Return false when any error occurs
- bool send(std::string transactionID, DataPacket *packet,
- std::shared_ptr<FlowFileRecord> flowFile,
- core::ProcessSession *session);
+ bool send(std::string transactionID, DataPacket *packet, std::shared_ptr<FlowFileRecord> flowFile, core::ProcessSession *session);
// Confirm the data that was sent or received by comparing CRC32's of the data sent and the data received.
bool confirm(std::string transactionID);
// Cancel the transaction
@@ -530,14 +523,11 @@ class Site2SiteClientProtocol {
// Error the transaction
void error(std::string transactionID);
// Receive flow files for the process session
- void receiveFlowFiles(core::ProcessContext *context,
- core::ProcessSession *session);
+ void receiveFlowFiles(core::ProcessContext *context, core::ProcessSession *session);
// Transfer flow files for the process session
- void transferFlowFiles(core::ProcessContext *context,
- core::ProcessSession *session);
+ void transferFlowFiles(core::ProcessContext *context, core::ProcessSession *session);
//! Transfer string for the process session
- void transferString(core::ProcessContext *context, core::ProcessSession *session, std::string &payload,
- std::map<std::string, std::string> attributes);
+ void transferString(core::ProcessContext *context, core::ProcessSession *session, std::string &payload, std::map<std::string, std::string> attributes);
// deleteTransaction
void deleteTransaction(std::string transactionID);
// Nest Callback Class for write stream
@@ -554,8 +544,7 @@ class Site2SiteClientProtocol {
int size = std::min(len, (int) sizeof(buffer));
int ret = _packet->_transaction->getStream().readData(buffer, size);
if (ret != size) {
- _packet->_protocol->logger_->log_error(
- "Site2Site Receive Flow Size %d Failed %d", size, ret);
+ _packet->_protocol->logger_->log_error("Site2Site Receive Flow Size %d Failed %d", size, ret);
break;
}
stream->write((const char *) buffer, size);
@@ -579,11 +568,9 @@ class Site2SiteClientProtocol {
readSize = stream->gcount();
else
readSize = 8192;
- int ret = _packet->_transaction->getStream().writeData(buffer,
- readSize);
+ int ret = _packet->_transaction->getStream().writeData(buffer, readSize);
if (ret != readSize) {
- _packet->_protocol->logger_->log_error(
- "Site2Site Send Flow Size %d Failed %d", readSize, ret);
+ _packet->_protocol->logger_->log_error("Site2Site Send Flow Size %d Failed %d", readSize, ret);
break;
}
_packet->_size += readSize;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/Site2SitePeer.h
----------------------------------------------------------------------
diff --git a/libminifi/include/Site2SitePeer.h b/libminifi/include/Site2SitePeer.h
index ab8d09b..65a5479 100644
--- a/libminifi/include/Site2SitePeer.h
+++ b/libminifi/include/Site2SitePeer.h
@@ -58,9 +58,7 @@ class Site2SitePeer : public org::apache::nifi::minifi::io::BaseStream {
/*
* Create a new site2site peer
*/
- explicit Site2SitePeer(
- std::unique_ptr<org::apache::nifi::minifi::io::DataStream> injected_socket,
- const std::string host_, uint16_t port_)
+ explicit Site2SitePeer(std::unique_ptr<org::apache::nifi::minifi::io::DataStream> injected_socket, const std::string host_, uint16_t port_)
: host_(host_),
port_(port_),
stream_(injected_socket.release()),
@@ -147,8 +145,7 @@ class Site2SitePeer : public org::apache::nifi::minifi::io::BaseStream {
// whether need be to yield
bool isYield(std::string portId) {
std::lock_guard<std::mutex> lock(mutex_);
- std::map<std::string, uint64_t>::iterator it = this
- ->_yieldExpirationPortIdMap.find(portId);
+ std::map<std::string, uint64_t>::iterator it = this->_yieldExpirationPortIdMap.find(portId);
if (it != _yieldExpirationPortIdMap.end()) {
uint64_t yieldExpiration = it->second;
return (yieldExpiration >= getTimeMillis());
@@ -159,8 +156,7 @@ class Site2SitePeer : public org::apache::nifi::minifi::io::BaseStream {
// clear yield expiration
void clearYield(std::string portId) {
std::lock_guard<std::mutex> lock(mutex_);
- std::map<std::string, uint64_t>::iterator it = this
- ->_yieldExpirationPortIdMap.find(portId);
+ std::map<std::string, uint64_t>::iterator it = this->_yieldExpirationPortIdMap.find(portId);
if (it != _yieldExpirationPortIdMap.end()) {
_yieldExpirationPortIdMap.erase(portId);
}
@@ -219,9 +215,7 @@ class Site2SitePeer : public org::apache::nifi::minifi::io::BaseStream {
return Serializable::read(value, stream_.get());
}
int readUTF(std::string &str, bool widen = false) {
- return org::apache::nifi::minifi::io::Serializable::readUTF(str,
- stream_.get(),
- widen);
+ return org::apache::nifi::minifi::io::Serializable::readUTF(str, stream_.get(), widen);
}
// open connection to the peer
bool Open();
@@ -232,8 +226,7 @@ class Site2SitePeer : public org::apache::nifi::minifi::io::BaseStream {
* Move assignment operator.
*/
Site2SitePeer& operator=(Site2SitePeer&& other) {
- stream_ = std::unique_ptr<org::apache::nifi::minifi::io::DataStream>(
- other.stream_.release());
+ stream_ = std::unique_ptr<org::apache::nifi::minifi::io::DataStream>(other.stream_.release());
host_ = std::move(other.host_);
port_ = std::move(other.port_);
_yieldExpiration = 0;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/ThreadedSchedulingAgent.h
----------------------------------------------------------------------
diff --git a/libminifi/include/ThreadedSchedulingAgent.h b/libminifi/include/ThreadedSchedulingAgent.h
index 21bbbd0..50ab6c9 100644
--- a/libminifi/include/ThreadedSchedulingAgent.h
+++ b/libminifi/include/ThreadedSchedulingAgent.h
@@ -42,20 +42,16 @@ class ThreadedSchedulingAgent : public SchedulingAgent {
/*!
* Create a new threaded scheduling agent.
*/
- ThreadedSchedulingAgent(
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_service_provider,
- std::shared_ptr<core::Repository> repo,
- std::shared_ptr<Configure> configuration)
- : SchedulingAgent(controller_service_provider, repo, configuration), logger_(logging::LoggerFactory<ThreadedSchedulingAgent>::getLogger()) {
+ ThreadedSchedulingAgent(std::shared_ptr<core::controller::ControllerServiceProvider> controller_service_provider, std::shared_ptr<core::Repository> repo, std::shared_ptr<Configure> configuration)
+ : SchedulingAgent(controller_service_provider, repo, configuration),
+ logger_(logging::LoggerFactory<ThreadedSchedulingAgent>::getLogger()) {
}
// Destructor
virtual ~ThreadedSchedulingAgent() {
}
// Run function for the thread
- virtual void run(std::shared_ptr<core::Processor> processor,
- core::ProcessContext *processContext,
- core::ProcessSessionFactory *sessionFactory) = 0;
+ virtual void run(std::shared_ptr<core::Processor> processor, core::ProcessContext *processContext, core::ProcessSessionFactory *sessionFactory) = 0;
public:
// schedule, overwritten by different DrivenTimerDrivenSchedulingAgent
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/TimerDrivenSchedulingAgent.h
----------------------------------------------------------------------
diff --git a/libminifi/include/TimerDrivenSchedulingAgent.h b/libminifi/include/TimerDrivenSchedulingAgent.h
index 74096ee..597dc76 100644
--- a/libminifi/include/TimerDrivenSchedulingAgent.h
+++ b/libminifi/include/TimerDrivenSchedulingAgent.h
@@ -37,10 +37,7 @@ class TimerDrivenSchedulingAgent : public ThreadedSchedulingAgent {
/*!
* Create a new processor
*/
- TimerDrivenSchedulingAgent(
- std::shared_ptr<core::controller::ControllerServiceProvider> controller_service_provider,
- std::shared_ptr<core::Repository> repo,
- std::shared_ptr<Configure> configure)
+ TimerDrivenSchedulingAgent(std::shared_ptr<core::controller::ControllerServiceProvider> controller_service_provider, std::shared_ptr<core::Repository> repo, std::shared_ptr<Configure> configure)
: ThreadedSchedulingAgent(controller_service_provider, repo, configure) {
}
// Destructor
@@ -49,16 +46,13 @@ class TimerDrivenSchedulingAgent : public ThreadedSchedulingAgent {
/**
* Run function that accepts the processor, context and session factory.
*/
- void run(std::shared_ptr<core::Processor> processor,
- core::ProcessContext *processContext,
- core::ProcessSessionFactory *sessionFactory);
+ void run(std::shared_ptr<core::Processor> processor, core::ProcessContext *processContext, core::ProcessSessionFactory *sessionFactory);
private:
// Prevent default copy constructor and assignment operation
// Only support pass by reference or pointer
TimerDrivenSchedulingAgent(const TimerDrivenSchedulingAgent &parent);
- TimerDrivenSchedulingAgent &operator=(
- const TimerDrivenSchedulingAgent &parent);
+ TimerDrivenSchedulingAgent &operator=(const TimerDrivenSchedulingAgent &parent);
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/controllers/SSLContextService.h
----------------------------------------------------------------------
diff --git a/libminifi/include/controllers/SSLContextService.h b/libminifi/include/controllers/SSLContextService.h
index 7de26b4..9093d5f 100644
--- a/libminifi/include/controllers/SSLContextService.h
+++ b/libminifi/include/controllers/SSLContextService.h
@@ -63,13 +63,15 @@ class SSLContextService : public core::controller::ControllerService {
: ControllerService(name, id),
initialized_(false),
valid_(false),
- logger_(logging::LoggerFactory<SSLContextService>::getLogger()) {}
+ logger_(logging::LoggerFactory<SSLContextService>::getLogger()) {
+ }
explicit SSLContextService(const std::string &name, uuid_t uuid = 0)
: ControllerService(name, uuid),
initialized_(false),
valid_(false),
- logger_(logging::LoggerFactory<SSLContextService>::getLogger()) {}
+ logger_(logging::LoggerFactory<SSLContextService>::getLogger()) {
+ }
virtual void initialize();
@@ -97,43 +99,35 @@ class SSLContextService : public core::controller::ControllerService {
return false;
}
- bool configure_ssl_context(SSL_CTX *ctx)
- {
- if (SSL_CTX_use_certificate_file(ctx, certificate.c_str(), SSL_FILETYPE_PEM)
- <= 0) {
- logger_->log_error("Could not create load certificate, error : %s",
- std::strerror(errno));
- return false;
- }
- if (!IsNullOrEmpty(passphrase_)) {
- SSL_CTX_set_default_passwd_cb_userdata(ctx, &passphrase_);
- SSL_CTX_set_default_passwd_cb(ctx, pemPassWordCb);
- }
-
- int retp = SSL_CTX_use_PrivateKey_file(ctx, private_key_.c_str(),
- SSL_FILETYPE_PEM);
- if (retp != 1) {
- logger_->log_error("Could not create load private key,%i on %s error : %s",
- retp, private_key_, std::strerror(errno));
- return false;
- }
-
- if (!SSL_CTX_check_private_key(ctx)) {
- logger_->log_error(
- "Private key does not match the public certificate, error : %s",
- std::strerror(errno));
- return false;
- }
-
- retp = SSL_CTX_load_verify_locations(ctx, ca_certificate_.c_str(), 0);
- if (retp == 0) {
- logger_->log_error("Can not load CA certificate, Exiting, error : %s",
- std::strerror(errno));
- return false;
- }
-
- return true;
- }
+ bool configure_ssl_context(SSL_CTX *ctx) {
+ if (SSL_CTX_use_certificate_file(ctx, certificate.c_str(), SSL_FILETYPE_PEM) <= 0) {
+ logger_->log_error("Could not create load certificate, error : %s", std::strerror(errno));
+ return false;
+ }
+ if (!IsNullOrEmpty(passphrase_)) {
+ SSL_CTX_set_default_passwd_cb_userdata(ctx, &passphrase_);
+ SSL_CTX_set_default_passwd_cb(ctx, pemPassWordCb);
+ }
+
+ int retp = SSL_CTX_use_PrivateKey_file(ctx, private_key_.c_str(), SSL_FILETYPE_PEM);
+ if (retp != 1) {
+ logger_->log_error("Could not create load private key,%i on %s error : %s", retp, private_key_, std::strerror(errno));
+ return false;
+ }
+
+ if (!SSL_CTX_check_private_key(ctx)) {
+ logger_->log_error("Private key does not match the public certificate, error : %s", std::strerror(errno));
+ return false;
+ }
+
+ retp = SSL_CTX_load_verify_locations(ctx, ca_certificate_.c_str(), 0);
+ if (retp == 0) {
+ logger_->log_error("Can not load CA certificate, Exiting, error : %s", std::strerror(errno));
+ return false;
+ }
+
+ return true;
+ }
protected:
@@ -164,7 +158,7 @@ class SSLContextService : public core::controller::ControllerService {
std::string ca_certificate_;
private:
- std::shared_ptr<logging::Logger> logger_;
+ std::shared_ptr<logging::Logger> logger_;
};
typedef int (SSLContextService::*ptr)(char *, int, int, void *);
REGISTER_RESOURCE(SSLContextService);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/ClassLoader.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/ClassLoader.h b/libminifi/include/core/ClassLoader.h
index 9f8fcae..31292b2 100644
--- a/libminifi/include/core/ClassLoader.h
+++ b/libminifi/include/core/ClassLoader.h
@@ -62,8 +62,7 @@ class ObjectFactory {
/**
* Create a shared pointer to a new processor.
*/
- virtual std::shared_ptr<Connectable> create(const std::string &name,
- uuid_t uuid) {
+ virtual std::shared_ptr<Connectable> create(const std::string &name, uuid_t uuid) {
return nullptr;
}
@@ -111,8 +110,7 @@ class DefautObjectFactory : public ObjectFactory {
/**
* Create a shared pointer to a new processor.
*/
- virtual std::shared_ptr<Connectable> create(const std::string &name,
- uuid_t uuid) {
+ virtual std::shared_ptr<Connectable> create(const std::string &name, uuid_t uuid) {
std::shared_ptr<T> ptr = std::make_shared<T>(name, uuid);
return std::static_pointer_cast<Connectable>(ptr);
}
@@ -177,15 +175,13 @@ class ClassLoader {
/**
* Register a class with the give ProcessorFactory
*/
- void registerClass(const std::string &name,
- std::unique_ptr<ObjectFactory> factory) {
- if (loaded_factories_.find(name) != loaded_factories_.end()){
+ void registerClass(const std::string &name, std::unique_ptr<ObjectFactory> factory) {
+ if (loaded_factories_.find(name) != loaded_factories_.end()) {
return;
}
std::lock_guard<std::mutex> lock(internal_mutex_);
-
loaded_factories_.insert(std::make_pair(name, std::move(factory)));
}
@@ -196,8 +192,7 @@ class ClassLoader {
* @return nullptr or object created from class_name definition.
*/
template<class T = Connectable>
- std::shared_ptr<T> instantiate(const std::string &class_name,
- const std::string &name);
+ std::shared_ptr<T> instantiate(const std::string &class_name, const std::string &name);
/**
* Instantiate object based on class_name
@@ -217,12 +212,11 @@ class ClassLoader {
std::vector<void *> dl_handles_;
private:
- std::shared_ptr<logging::Logger> logger_;
+ std::shared_ptr<logging::Logger> logger_;
};
template<class T>
-std::shared_ptr<T> ClassLoader::instantiate(const std::string &class_name,
- const std::string &name) {
+std::shared_ptr<T> ClassLoader::instantiate(const std::string &class_name, const std::string &name) {
std::lock_guard<std::mutex> lock(internal_mutex_);
auto factory_entry = loaded_factories_.find(class_name);
if (factory_entry != loaded_factories_.end()) {
@@ -234,8 +228,7 @@ std::shared_ptr<T> ClassLoader::instantiate(const std::string &class_name,
}
template<class T>
-std::shared_ptr<T> ClassLoader::instantiate(const std::string &class_name,
- uuid_t uuid) {
+std::shared_ptr<T> ClassLoader::instantiate(const std::string &class_name, uuid_t uuid) {
std::lock_guard<std::mutex> lock(internal_mutex_);
auto factory_entry = loaded_factories_.find(class_name);
if (factory_entry != loaded_factories_.end()) {
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/ConfigurationFactory.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/ConfigurationFactory.h b/libminifi/include/core/ConfigurationFactory.h
index ed0bdb5..b58c170 100644
--- a/libminifi/include/core/ConfigurationFactory.h
+++ b/libminifi/include/core/ConfigurationFactory.h
@@ -29,19 +29,16 @@ namespace minifi {
namespace core {
template<typename T>
-typename std::enable_if<!class_operations<T>::value, T*>::type instantiate(
- const std::shared_ptr<core::Repository> &repo,
- const std::shared_ptr<core::Repository> &flow_file_repo,
- std::shared_ptr<Configure> configuration, const std::string path) {
+typename std::enable_if<!class_operations<T>::value, T*>::type instantiate(const std::shared_ptr<core::Repository> &repo, const std::shared_ptr<core::Repository> &flow_file_repo,
+ std::shared_ptr<Configure> configuration,
+ const std::string path) {
throw std::runtime_error("Cannot instantiate class");
}
template<typename T>
-typename std::enable_if<class_operations<T>::value, T*>::type instantiate(
- const std::shared_ptr<core::Repository> &repo,
- const std::shared_ptr<core::Repository> &flow_file_repo,
- const std::shared_ptr<io::StreamFactory> &stream_factory,
- std::shared_ptr<Configure> configuration, const std::string path) {
+typename std::enable_if<class_operations<T>::value, T*>::type instantiate(const std::shared_ptr<core::Repository> &repo, const std::shared_ptr<core::Repository> &flow_file_repo,
+ const std::shared_ptr<io::StreamFactory> &stream_factory,
+ std::shared_ptr<Configure> configuration, const std::string path) {
return new T(repo, flow_file_repo, stream_factory, configuration, path);
}
@@ -49,13 +46,10 @@ typename std::enable_if<class_operations<T>::value, T*>::type instantiate(
* Configuration factory is used to create a new FlowConfiguration
* object.
*/
-std::unique_ptr<core::FlowConfiguration> createFlowConfiguration(
- std::shared_ptr<core::Repository> repo,
- std::shared_ptr<core::Repository> flow_file_repo,
- std::shared_ptr<Configure> configure,
- std::shared_ptr<io::StreamFactory> stream_factory,
- const std::string configuration_class_name, const std::string path = "",
- bool fail_safe = false);
+std::unique_ptr<core::FlowConfiguration> createFlowConfiguration(std::shared_ptr<core::Repository> repo, std::shared_ptr<core::Repository> flow_file_repo, std::shared_ptr<Configure> configure,
+ std::shared_ptr<io::StreamFactory> stream_factory,
+ const std::string configuration_class_name, const std::string path = "",
+ bool fail_safe = false);
} /* namespace core */
} /* namespace minifi */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/Connectable.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/Connectable.h b/libminifi/include/core/Connectable.h
index 76536f4..150b5fc 100644
--- a/libminifi/include/core/Connectable.h
+++ b/libminifi/include/core/Connectable.h
@@ -68,8 +68,7 @@ class Connectable : public CoreComponent {
* Get outgoing connection based on relationship
* @return set of outgoing connections.
*/
- std::set<std::shared_ptr<Connectable>> getOutGoingConnections(
- std::string relationship);
+ std::set<std::shared_ptr<Connectable>> getOutGoingConnections(std::string relationship);
/**
* Get next incoming connection
@@ -147,7 +146,7 @@ class Connectable : public CoreComponent {
// Incoming connections
std::set<std::shared_ptr<Connectable>> _incomingConnections;
// Outgoing connections map based on Relationship name
- std::map<std::string, std::set<std::shared_ptr<Connectable>>> out_going_connections_;
+ std::map<std::string, std::set<std::shared_ptr<Connectable>>>out_going_connections_;
// Mutex for protection
std::mutex relationship_mutex_;
@@ -163,7 +162,7 @@ class Connectable : public CoreComponent {
// Concurrent condition variable for whether there is incoming work to do
std::condition_variable work_condition_;
- private:
+private:
std::shared_ptr<logging::Logger> logger_;
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/Core.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/Core.h b/libminifi/include/core/Core.h
index a9fb435..f100d8b 100644
--- a/libminifi/include/core/Core.h
+++ b/libminifi/include/core/Core.h
@@ -74,10 +74,9 @@ typename std::enable_if<!class_operations<T>::value, std::shared_ptr<T>>::type i
template<typename T>
typename std::enable_if<class_operations<T>::value, std::shared_ptr<T>>::type instantiate(const std::string name = "") {
- if (name.length() == 0){
+ if (name.length() == 0) {
return std::make_shared<T>();
- }
- else{
+ } else {
return std::make_shared<T>(name);
}
}
@@ -107,7 +106,6 @@ class CoreComponent {
uuidStr_ = uuidStr;
}
-
/**
* Move Constructor.
*/
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/FlowConfiguration.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/FlowConfiguration.h b/libminifi/include/core/FlowConfiguration.h
index 1fee8c5..edcb2b6 100644
--- a/libminifi/include/core/FlowConfiguration.h
+++ b/libminifi/include/core/FlowConfiguration.h
@@ -58,9 +58,7 @@ class FlowConfiguration : public CoreComponent {
* Constructor that will be used for configuring
* the flow controller.
*/
- explicit FlowConfiguration(std::shared_ptr<core::Repository> repo,
- std::shared_ptr<core::Repository> flow_file_repo,
- std::shared_ptr<io::StreamFactory> stream_factory,
+ explicit FlowConfiguration(std::shared_ptr<core::Repository> repo, std::shared_ptr<core::Repository> flow_file_repo, std::shared_ptr<io::StreamFactory> stream_factory,
std::shared_ptr<Configure> configuration,
const std::string path)
: CoreComponent(core::getClassName<FlowConfiguration>()),
@@ -68,31 +66,23 @@ class FlowConfiguration : public CoreComponent {
config_path_(path),
stream_factory_(stream_factory),
logger_(logging::LoggerFactory<FlowConfiguration>::getLogger()) {
- controller_services_ = std::make_shared<
- core::controller::ControllerServiceMap>();
- service_provider_ = std::make_shared<
- core::controller::StandardControllerServiceProvider>(
- controller_services_, nullptr, configuration);
+ controller_services_ = std::make_shared<core::controller::ControllerServiceMap>();
+ service_provider_ = std::make_shared<core::controller::StandardControllerServiceProvider>(controller_services_, nullptr, configuration);
}
virtual ~FlowConfiguration();
// Create Processor (Node/Input/Output Port) based on the name
- std::shared_ptr<core::Processor> createProcessor(std::string name,
- uuid_t uuid);
+ std::shared_ptr<core::Processor> createProcessor(std::string name, uuid_t uuid);
// Create Root Processor Group
- std::unique_ptr<core::ProcessGroup> createRootProcessGroup(std::string name,
- uuid_t uuid);
+ std::unique_ptr<core::ProcessGroup> createRootProcessGroup(std::string name, uuid_t uuid);
- std::shared_ptr<core::controller::ControllerServiceNode> createControllerService(
- const std::string &class_name, const std::string &name, uuid_t uuid);
+ std::shared_ptr<core::controller::ControllerServiceNode> createControllerService(const std::string &class_name, const std::string &name, uuid_t uuid);
// Create Remote Processor Group
- std::unique_ptr<core::ProcessGroup> createRemoteProcessGroup(std::string name,
- uuid_t uuid);
+ std::unique_ptr<core::ProcessGroup> createRemoteProcessGroup(std::string name, uuid_t uuid);
// Create Connection
- std::shared_ptr<minifi::Connection> createConnection(std::string name,
- uuid_t uuid);
+ std::shared_ptr<minifi::Connection> createConnection(std::string name, uuid_t uuid);
// Create Provenance Report Task
std::shared_ptr<core::Processor> createProvenanceReportTask(void);
@@ -113,8 +103,7 @@ class FlowConfiguration : public CoreComponent {
* @return Extensions should return a non-null pointer in order to
* properly configure flow controller.
*/
- virtual std::unique_ptr<core::ProcessGroup> getRoot(
- const std::string &from_config) {
+ virtual std::unique_ptr<core::ProcessGroup> getRoot(const std::string &from_config) {
return nullptr;
}
@@ -134,7 +123,7 @@ class FlowConfiguration : public CoreComponent {
std::shared_ptr<core::Repository> flow_file_repo_;
// stream factory
std::shared_ptr<io::StreamFactory> stream_factory_;
-
+
private:
std::shared_ptr<logging::Logger> logger_;
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/FlowFile.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/FlowFile.h b/libminifi/include/core/FlowFile.h
index 050d15f..a0b8dec 100644
--- a/libminifi/include/core/FlowFile.h
+++ b/libminifi/include/core/FlowFile.h
@@ -191,9 +191,7 @@ class FlowFile {
// Check whether it is still being penalized
bool isPenalized() {
- return (
- penaltyExpiration_ms_ > 0 ?
- penaltyExpiration_ms_ > getTimeMillis() : false);
+ return (penaltyExpiration_ms_ > 0 ? penaltyExpiration_ms_ > getTimeMillis() : false);
}
/**
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/ProcessContext.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/ProcessContext.h b/libminifi/include/core/ProcessContext.h
index 8094e05..48e0108 100644
--- a/libminifi/include/core/ProcessContext.h
+++ b/libminifi/include/core/ProcessContext.h
@@ -46,12 +46,10 @@ class ProcessContext : public controller::ControllerServiceLookup {
/*!
* Create a new process context associated with the processor/controller service/state manager
*/
- ProcessContext(
- ProcessorNode &processor,
- std::shared_ptr<controller::ControllerServiceProvider> &controller_service_provider,
- std::shared_ptr<core::Repository> repo)
+ ProcessContext(ProcessorNode &processor, std::shared_ptr<controller::ControllerServiceProvider> &controller_service_provider, std::shared_ptr<core::Repository> repo)
: processor_node_(processor),
- controller_service_provider_(controller_service_provider), logger_(logging::LoggerFactory<ProcessContext>::getLogger()) {
+ controller_service_provider_(controller_service_provider),
+ logger_(logging::LoggerFactory<ProcessContext>::getLogger()) {
repo_ = repo;
}
// Destructor
@@ -106,10 +104,8 @@ class ProcessContext : public controller::ControllerServiceLookup {
* @return the ControllerService that is registered with the given
* identifier
*/
- std::shared_ptr<core::controller::ControllerService> getControllerService(
- const std::string &identifier) {
- return controller_service_provider_->getControllerServiceForComponent(
- identifier, processor_node_.getUUIDStr());
+ std::shared_ptr<core::controller::ControllerService> getControllerService(const std::string &identifier) {
+ return controller_service_provider_->getControllerServiceForComponent(identifier, processor_node_.getUUIDStr());
}
/**
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/ProcessGroup.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/ProcessGroup.h b/libminifi/include/core/ProcessGroup.h
index ccf744e..f54f5b4 100644
--- a/libminifi/include/core/ProcessGroup.h
+++ b/libminifi/include/core/ProcessGroup.h
@@ -55,8 +55,7 @@ class ProcessGroup {
/*!
* Create a new process group
*/
- ProcessGroup(ProcessGroupType type, std::string name, uuid_t uuid = NULL,
- ProcessGroup *parent = NULL);
+ ProcessGroup(ProcessGroupType type, std::string name, uuid_t uuid = NULL, ProcessGroup *parent = NULL);
// Destructor
virtual ~ProcessGroup();
// Set Processor Name
@@ -111,11 +110,9 @@ class ProcessGroup {
return false;
}
// Start Processing
- void startProcessing(TimerDrivenSchedulingAgent *timeScheduler,
- EventDrivenSchedulingAgent *eventScheduler);
+ void startProcessing(TimerDrivenSchedulingAgent *timeScheduler, EventDrivenSchedulingAgent *eventScheduler);
// Stop Processing
- void stopProcessing(TimerDrivenSchedulingAgent *timeScheduler,
- EventDrivenSchedulingAgent *eventScheduler);
+ void stopProcessing(TimerDrivenSchedulingAgent *timeScheduler, EventDrivenSchedulingAgent *eventScheduler);
// Whether it is root process group
bool isRootProcessGroup();
// set parent process group
@@ -147,26 +144,21 @@ class ProcessGroup {
* @param nodeId node identifier
* @param node controller service node.
*/
- void addControllerService(
- const std::string &nodeId,
- std::shared_ptr<core::controller::ControllerServiceNode> &node);
+ void addControllerService(const std::string &nodeId, std::shared_ptr<core::controller::ControllerServiceNode> &node);
/**
* Find controllerservice node will search child groups until the nodeId is found.
* @param node node identifier
* @return controller service node, if it exists.
*/
- std::shared_ptr<core::controller::ControllerServiceNode> findControllerService(
- const std::string &nodeId);
+ std::shared_ptr<core::controller::ControllerServiceNode> findControllerService(const std::string &nodeId);
// removeConnection
void removeConnection(std::shared_ptr<Connection> connection);
// update property value
- void updatePropertyValue(std::string processorName, std::string propertyName,
- std::string propertyValue);
+ void updatePropertyValue(std::string processorName, std::string propertyName, std::string propertyValue);
- void getConnections(
- std::map<std::string, std::shared_ptr<Connection>> &connectionMap);
+ void getConnections(std::map<std::string, std::shared_ptr<Connection>> &connectionMap);
protected:
// A global unique identifier
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/ProcessSession.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/ProcessSession.h b/libminifi/include/core/ProcessSession.h
index 1f6f234..4d20f59 100644
--- a/libminifi/include/core/ProcessSession.h
+++ b/libminifi/include/core/ProcessSession.h
@@ -48,13 +48,11 @@ class ProcessSession {
* Create a new process session
*/
ProcessSession(ProcessContext *processContext = NULL)
- : process_context_(processContext), logger_(logging::LoggerFactory<ProcessSession>::getLogger()) {
- logger_->log_trace("ProcessSession created for %s",
- process_context_->getProcessorNode().getName().c_str());
+ : process_context_(processContext),
+ logger_(logging::LoggerFactory<ProcessSession>::getLogger()) {
+ logger_->log_trace("ProcessSession created for %s", process_context_->getProcessorNode().getName().c_str());
auto repo = processContext->getProvenanceRepository();
- provenance_report_ = new provenance::ProvenanceReporter(
- repo, process_context_->getProcessorNode().getUUIDStr(),
- process_context_->getProcessorNode().getName());
+ provenance_report_ = new provenance::ProvenanceReporter(repo, process_context_->getProcessorNode().getUUIDStr(), process_context_->getProcessorNode().getName());
}
// Destructor
@@ -64,9 +62,9 @@ class ProcessSession {
}
// Commit the session
void commit();
-// Roll Back the session
+ // Roll Back the session
void rollback();
-// Get Provenance Report
+ // Get Provenance Report
provenance::ProvenanceReporter *getProvenanceReporter() {
return provenance_report_;
}
@@ -76,54 +74,39 @@ class ProcessSession {
// Create a new UUID FlowFile with no content resource claim and without parent
std::shared_ptr<core::FlowFile> create();
// Create a new UUID FlowFile with no content resource claim and inherit all attributes from parent
- std::shared_ptr<core::FlowFile> create(
- std::shared_ptr<core::FlowFile> &&parent);
+ std::shared_ptr<core::FlowFile> create(std::shared_ptr<core::FlowFile> &&parent);
// Create a new UUID FlowFile with no content resource claim and inherit all attributes from parent
- std::shared_ptr<core::FlowFile> create(
- std::shared_ptr<core::FlowFile> &parent) {
+ std::shared_ptr<core::FlowFile> create(std::shared_ptr<core::FlowFile> &parent) {
return create(parent);
}
// Clone a new UUID FlowFile from parent both for content resource claim and attributes
- std::shared_ptr<core::FlowFile> clone(
- std::shared_ptr<core::FlowFile> &parent);
-// Clone a new UUID FlowFile from parent for attributes and sub set of parent content resource claim
- std::shared_ptr<core::FlowFile> clone(std::shared_ptr<core::FlowFile> &parent,
- int64_t offset, int64_t size);
-// Duplicate a FlowFile with the same UUID and all attributes and content resource claim for the roll back of the session
- std::shared_ptr<core::FlowFile> duplicate(
- std::shared_ptr<core::FlowFile> &original);
-// Transfer the FlowFile to the relationship
- void transfer(std::shared_ptr<core::FlowFile> &flow,
- Relationship relationship);
- void transfer(std::shared_ptr<core::FlowFile> &&flow,
- Relationship relationship);
-// Put Attribute
- void putAttribute(std::shared_ptr<core::FlowFile> &flow, std::string key,
- std::string value);
- void putAttribute(std::shared_ptr<core::FlowFile> &&flow, std::string key,
- std::string value);
-// Remove Attribute
+ std::shared_ptr<core::FlowFile> clone(std::shared_ptr<core::FlowFile> &parent);
+ // Clone a new UUID FlowFile from parent for attributes and sub set of parent content resource claim
+ std::shared_ptr<core::FlowFile> clone(std::shared_ptr<core::FlowFile> &parent, int64_t offset, int64_t size);
+ // Duplicate a FlowFile with the same UUID and all attributes and content resource claim for the roll back of the session
+ std::shared_ptr<core::FlowFile> duplicate(std::shared_ptr<core::FlowFile> &original);
+ // Transfer the FlowFile to the relationship
+ void transfer(std::shared_ptr<core::FlowFile> &flow, Relationship relationship);
+ void transfer(std::shared_ptr<core::FlowFile> &&flow, Relationship relationship);
+ // Put Attribute
+ void putAttribute(std::shared_ptr<core::FlowFile> &flow, std::string key, std::string value);
+ void putAttribute(std::shared_ptr<core::FlowFile> &&flow, std::string key, std::string value);
+ // Remove Attribute
void removeAttribute(std::shared_ptr<core::FlowFile> &flow, std::string key);
void removeAttribute(std::shared_ptr<core::FlowFile> &&flow, std::string key);
-// Remove Flow File
+ // Remove Flow File
void remove(std::shared_ptr<core::FlowFile> &flow);
void remove(std::shared_ptr<core::FlowFile> &&flow);
-// Execute the given read callback against the content
- void read(std::shared_ptr<core::FlowFile> &flow,
- InputStreamCallback *callback);
- void read(std::shared_ptr<core::FlowFile> &&flow,
- InputStreamCallback *callback);
-// Execute the given write callback against the content
- void write(std::shared_ptr<core::FlowFile> &flow,
- OutputStreamCallback *callback);
- void write(std::shared_ptr<core::FlowFile> &&flow,
- OutputStreamCallback *callback);
-// Execute the given write/append callback against the content
- void append(std::shared_ptr<core::FlowFile> &flow,
- OutputStreamCallback *callback);
- void append(std::shared_ptr<core::FlowFile> &&flow,
- OutputStreamCallback *callback);
-// Penalize the flow
+ // Execute the given read callback against the content
+ void read(std::shared_ptr<core::FlowFile> &flow, InputStreamCallback *callback);
+ void read(std::shared_ptr<core::FlowFile> &&flow, InputStreamCallback *callback);
+ // Execute the given write callback against the content
+ void write(std::shared_ptr<core::FlowFile> &flow, OutputStreamCallback *callback);
+ void write(std::shared_ptr<core::FlowFile> &&flow, OutputStreamCallback *callback);
+ // Execute the given write/append callback against the content
+ void append(std::shared_ptr<core::FlowFile> &flow, OutputStreamCallback *callback);
+ void append(std::shared_ptr<core::FlowFile> &&flow, OutputStreamCallback *callback);
+ // Penalize the flow
void penalize(std::shared_ptr<core::FlowFile> &flow);
void penalize(std::shared_ptr<core::FlowFile> &&flow);
@@ -132,13 +115,14 @@ class ProcessSession {
* @param stream incoming data stream that contains the data to store into a file
* @param flow flow file
*/
- void importFrom(io::DataStream &stream,
- std::shared_ptr<core::FlowFile> &&flow);
+ void importFrom(io::DataStream &stream, std::shared_ptr<core::FlowFile> &&flow);
// import from the data source.
void import(std::string source, std::shared_ptr<core::FlowFile> &flow,
- bool keepSource = true, uint64_t offset = 0);
+ bool keepSource = true,
+ uint64_t offset = 0);
void import(std::string source, std::shared_ptr<core::FlowFile> &&flow,
- bool keepSource = true, uint64_t offset = 0);
+ bool keepSource = true,
+ uint64_t offset = 0);
// Prevent default copy constructor and assignment operation
// Only support pass by reference or pointer
@@ -148,26 +132,25 @@ class ProcessSession {
protected:
// FlowFiles being modified by current process session
std::map<std::string, std::shared_ptr<core::FlowFile> > _updatedFlowFiles;
-// Copy of the original FlowFiles being modified by current process session as above
+ // Copy of the original FlowFiles being modified by current process session as above
std::map<std::string, std::shared_ptr<core::FlowFile> > _originalFlowFiles;
-// FlowFiles being added by current process session
+ // FlowFiles being added by current process session
std::map<std::string, std::shared_ptr<core::FlowFile> > _addedFlowFiles;
-// FlowFiles being deleted by current process session
+ // FlowFiles being deleted by current process session
std::map<std::string, std::shared_ptr<core::FlowFile> > _deletedFlowFiles;
-// FlowFiles being transfered to the relationship
+ // FlowFiles being transfered to the relationship
std::map<std::string, Relationship> _transferRelationship;
-// FlowFiles being cloned for multiple connections per relationship
+ // FlowFiles being cloned for multiple connections per relationship
std::map<std::string, std::shared_ptr<core::FlowFile> > _clonedFlowFiles;
private:
// Clone the flow file during transfer to multiple connections for a relationship
- std::shared_ptr<core::FlowFile> cloneDuringTransfer(
- std::shared_ptr<core::FlowFile> &parent);
-// ProcessContext
+ std::shared_ptr<core::FlowFile> cloneDuringTransfer(std::shared_ptr<core::FlowFile> &parent);
+ // ProcessContext
ProcessContext *process_context_;
-// Logger
+ // Logger
std::shared_ptr<logging::Logger> logger_;
-// Provenance Report
+ // Provenance Report
provenance::ProvenanceReporter *provenance_report_;
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/Processor.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/Processor.h b/libminifi/include/core/Processor.h
index 9a19072..251ec47 100644
--- a/libminifi/include/core/Processor.h
+++ b/libminifi/include/core/Processor.h
@@ -62,8 +62,7 @@ namespace core {
#define DEFAULT_PENALIZATION_PERIOD_SECONDS 30
// Processor Class
-class Processor : public Connectable, public ConfigurableComponent,
- public std::enable_shared_from_this<Processor> {
+class Processor : public Connectable, public ConfigurableComponent, public std::enable_shared_from_this<Processor> {
public:
// Constructor
@@ -192,8 +191,7 @@ class Processor : public Connectable, public ConfigurableComponent,
bool flowFilesOutGoingFull();
// Get outgoing connections based on relationship name
- std::set<std::shared_ptr<Connection> > getOutGoingConnections(
- std::string relationship);
+ std::set<std::shared_ptr<Connection> > getOutGoingConnections(std::string relationship);
// Add connection
bool addConnection(std::shared_ptr<Connectable> connection);
// Remove connection
@@ -205,8 +203,7 @@ class Processor : public Connectable, public ConfigurableComponent,
// Get the Next RoundRobin incoming connection
std::shared_ptr<Connection> getNextIncomingConnection();
// On Trigger
- void onTrigger(ProcessContext *context,
- ProcessSessionFactory *sessionFactory);
+ void onTrigger(ProcessContext *context, ProcessSessionFactory *sessionFactory);
virtual bool canEdit() {
return !isRunning();
@@ -220,8 +217,7 @@ class Processor : public Connectable, public ConfigurableComponent,
virtual void initialize() {
}
// Scheduled event hook, overridden by NiFi Process Designer
- virtual void onSchedule(ProcessContext *context,
- ProcessSessionFactory *sessionFactory) {
+ virtual void onSchedule(ProcessContext *context, ProcessSessionFactory *sessionFactory) {
}
protected:
@@ -243,7 +239,7 @@ class Processor : public Connectable, public ConfigurableComponent,
// Trigger the Processor even if the incoming connection is empty
std::atomic<bool> _triggerWhenEmpty;
- private:
+ private:
// Mutex for protection
std::mutex mutex_;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/core/ProcessorNode.h
----------------------------------------------------------------------
diff --git a/libminifi/include/core/ProcessorNode.h b/libminifi/include/core/ProcessorNode.h
index 8836f62..9bf1f52 100644
--- a/libminifi/include/core/ProcessorNode.h
+++ b/libminifi/include/core/ProcessorNode.h
@@ -60,8 +60,7 @@ class ProcessorNode : public ConfigurableComponent, public Connectable {
* @return result of getting property.
*/
bool getProperty(const std::string name, std::string &value) {
- const std::shared_ptr<ConfigurableComponent> processor_cast =
- std::dynamic_pointer_cast<ConfigurableComponent>(processor_);
+ const std::shared_ptr<ConfigurableComponent> processor_cast = std::dynamic_pointer_cast<ConfigurableComponent>(processor_);
if (nullptr != processor_cast)
return processor_cast->getProperty(name, value);
else {
@@ -75,8 +74,7 @@ class ProcessorNode : public ConfigurableComponent, public Connectable {
* @return result of setting property.
*/
bool setProperty(const std::string name, std::string value) {
- const std::shared_ptr<ConfigurableComponent> processor_cast =
- std::dynamic_pointer_cast<ConfigurableComponent>(processor_);
+ const std::shared_ptr<ConfigurableComponent> processor_cast = std::dynamic_pointer_cast<ConfigurableComponent>(processor_);
bool ret = ConfigurableComponent::setProperty(name, value);
if (nullptr != processor_cast)
ret = processor_cast->setProperty(name, value);
@@ -92,8 +90,7 @@ class ProcessorNode : public ConfigurableComponent, public Connectable {
* @return whether property was set or not
*/
bool setProperty(Property &prop, std::string value) {
- const std::shared_ptr<ConfigurableComponent> processor_cast =
- std::dynamic_pointer_cast<ConfigurableComponent>(processor_);
+ const std::shared_ptr<ConfigurableComponent> processor_cast = std::dynamic_pointer_cast<ConfigurableComponent>(processor_);
bool ret = ConfigurableComponent::setProperty(prop, value);
if (nullptr != processor_cast)
ret = processor_cast->setProperty(prop, value);
@@ -107,8 +104,7 @@ class ProcessorNode : public ConfigurableComponent, public Connectable {
* @return result of set operation.
*/
bool setSupportedProperties(std::set<Property> properties) {
- const std::shared_ptr<ConfigurableComponent> processor_cast =
- std::dynamic_pointer_cast<ConfigurableComponent>(processor_);
+ const std::shared_ptr<ConfigurableComponent> processor_cast = std::dynamic_pointer_cast<ConfigurableComponent>(processor_);
bool ret = ConfigurableComponent::setSupportedProperties(properties);
if (nullptr != processor_cast)
ret = processor_cast->setSupportedProperties(properties);
@@ -164,8 +160,7 @@ class ProcessorNode : public ConfigurableComponent, public Connectable {
* Get outgoing connection based on relationship
* @return set of outgoing connections.
*/
- std::set<std::shared_ptr<Connectable>> getOutGoingConnections(
- std::string relationship) {
+ std::set<std::shared_ptr<Connectable>> getOutGoingConnections(std::string relationship) {
return processor_->getOutGoingConnections(relationship);
}
[7/9] nifi-minifi-cpp git commit: MINIFI-331: Apply formatter with
increased line length to source
Posted by al...@apache.org.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/tls/TLSSocket.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/tls/TLSSocket.h b/libminifi/include/io/tls/TLSSocket.h
index c56f6c8..b8915a6 100644
--- a/libminifi/include/io/tls/TLSSocket.h
+++ b/libminifi/include/io/tls/TLSSocket.h
@@ -38,27 +38,24 @@ namespace io {
#define TLS_ERROR_KEY_ERROR 4
#define TLS_ERROR_CERT_ERROR 5
-class OpenSSLInitializer
-{
+class OpenSSLInitializer {
public:
static OpenSSLInitializer *getInstance() {
- OpenSSLInitializer* atomic_context = context_instance.load(
- std::memory_order_relaxed);
- std::atomic_thread_fence(std::memory_order_acquire);
- if (atomic_context == nullptr) {
- std::lock_guard<std::mutex> lock(context_mutex);
- atomic_context = context_instance.load(std::memory_order_relaxed);
- if (atomic_context == nullptr) {
- atomic_context = new OpenSSLInitializer();
- std::atomic_thread_fence(std::memory_order_release);
- context_instance.store(atomic_context, std::memory_order_relaxed);
- }
- }
- return atomic_context;
- }
-
- OpenSSLInitializer()
- {
+ OpenSSLInitializer* atomic_context = context_instance.load(std::memory_order_relaxed);
+ std::atomic_thread_fence(std::memory_order_acquire);
+ if (atomic_context == nullptr) {
+ std::lock_guard<std::mutex> lock(context_mutex);
+ atomic_context = context_instance.load(std::memory_order_relaxed);
+ if (atomic_context == nullptr) {
+ atomic_context = new OpenSSLInitializer();
+ std::atomic_thread_fence(std::memory_order_release);
+ context_instance.store(atomic_context, std::memory_order_relaxed);
+ }
+ }
+ return atomic_context;
+ }
+
+ OpenSSLInitializer() {
SSL_library_init();
OpenSSL_add_all_algorithms();
SSL_load_error_strings();
@@ -68,11 +65,11 @@ class OpenSSLInitializer
static std::mutex context_mutex;
};
-class TLSContext: public SocketContext {
+class TLSContext : public SocketContext {
public:
TLSContext(const std::shared_ptr<Configure> &configure);
-
+
virtual ~TLSContext() {
if (0 != ctx)
SSL_CTX_free(ctx);
@@ -93,8 +90,7 @@ class TLSContext: public SocketContext {
static int pemPassWordCb(char *buf, int size, int rwflag, void *configure) {
std::string passphrase;
- if (static_cast<Configure*>(configure)->get(
- Configure::nifi_security_client_pass_phrase, passphrase)) {
+ if (static_cast<Configure*>(configure)->get(Configure::nifi_security_client_pass_phrase, passphrase)) {
std::ifstream file(passphrase.c_str(), std::ifstream::in);
if (!file.good()) {
@@ -103,8 +99,7 @@ class TLSContext: public SocketContext {
}
std::string password;
- password.assign((std::istreambuf_iterator<char>(file)),
- std::istreambuf_iterator<char>());
+ password.assign((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
file.close();
memset(buf, 0x00, size);
memcpy(buf, password.c_str(), password.length() - 1);
@@ -114,7 +109,6 @@ class TLSContext: public SocketContext {
return 0;
}
-
std::shared_ptr<logging::Logger> logger_;
std::shared_ptr<Configure> configure_;
SSL_CTX *ctx;
@@ -133,8 +127,7 @@ class TLSSocket : public Socket {
* @param port connecting port
* @param listeners number of listeners in the queue
*/
- explicit TLSSocket(const std::shared_ptr<TLSContext> &context, const std::string &hostname, const uint16_t port,
- const uint16_t listeners);
+ explicit TLSSocket(const std::shared_ptr<TLSContext> &context, const std::string &hostname, const uint16_t port, const uint16_t listeners);
/**
* Constructor that creates a client socket.
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/io/validation.h
----------------------------------------------------------------------
diff --git a/libminifi/include/io/validation.h b/libminifi/include/io/validation.h
index a5e1bc5..70de439 100644
--- a/libminifi/include/io/validation.h
+++ b/libminifi/include/io/validation.h
@@ -45,8 +45,7 @@ class size_function_functor_checker {
* Determines if the variable is null or ::size() == 0
*/
template<typename T>
-static auto IsNullOrEmpty(
- T &object) -> typename std::enable_if<size_function_functor_checker<T>::has_size_function==1, bool>::type {
+static auto IsNullOrEmpty(T &object) -> typename std::enable_if<size_function_functor_checker<T>::has_size_function==1, bool>::type {
return object.size() == 0;
}
@@ -54,8 +53,7 @@ static auto IsNullOrEmpty(
* Determines if the variable is null or ::size() == 0
*/
template<typename T>
-static auto IsNullOrEmpty(
- T *object) -> typename std::enable_if<size_function_functor_checker<T>::has_size_function==1, bool>::type {
+static auto IsNullOrEmpty(T *object) -> typename std::enable_if<size_function_functor_checker<T>::has_size_function==1, bool>::type {
return (nullptr == object || object->size() == 0);
}
@@ -63,8 +61,7 @@ static auto IsNullOrEmpty(
* Determines if the variable is null or ::size() == 0
*/
template<typename T>
-static auto IsNullOrEmpty(
- T *object) -> typename std::enable_if<not size_function_functor_checker<T>::has_size_function , bool>::type {
+static auto IsNullOrEmpty(T *object) -> typename std::enable_if<not size_function_functor_checker<T>::has_size_function , bool>::type {
return (nullptr == object);
}
@@ -72,8 +69,7 @@ static auto IsNullOrEmpty(
* Determines if the variable is null or ::size() == 0
*/
template<typename T>
-static auto IsNullOrEmpty(
- std::shared_ptr<T> object) -> typename std::enable_if<not size_function_functor_checker<T>::has_size_function , bool>::type {
+static auto IsNullOrEmpty(std::shared_ptr<T> object) -> typename std::enable_if<not size_function_functor_checker<T>::has_size_function , bool>::type {
return (nullptr == object || nullptr == object.get());
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/processors/AppendHostInfo.h
----------------------------------------------------------------------
diff --git a/libminifi/include/processors/AppendHostInfo.h b/libminifi/include/processors/AppendHostInfo.h
index 610251f..e7c90ac 100644
--- a/libminifi/include/processors/AppendHostInfo.h
+++ b/libminifi/include/processors/AppendHostInfo.h
@@ -43,7 +43,7 @@ class AppendHostInfo : public core::Processor {
*/
AppendHostInfo(std::string name, uuid_t uuid = NULL)
: core::Processor(name, uuid),
- logger_(logging::LoggerFactory<AppendHostInfo>::getLogger()){
+ logger_(logging::LoggerFactory<AppendHostInfo>::getLogger()) {
}
// Destructor
virtual ~AppendHostInfo() {
@@ -60,8 +60,7 @@ class AppendHostInfo : public core::Processor {
public:
// OnTrigger method, implemented by NiFi AppendHostInfo
- virtual void onTrigger(core::ProcessContext *context,
- core::ProcessSession *session);
+ virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
// Initialize, over write by NiFi AppendHostInfo
virtual void initialize(void);
@@ -74,7 +73,6 @@ class AppendHostInfo : public core::Processor {
REGISTER_RESOURCE(AppendHostInfo);
-
} /* namespace processors */
} /* namespace minifi */
} /* namespace nifi */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/processors/ExecuteProcess.h
----------------------------------------------------------------------
diff --git a/libminifi/include/processors/ExecuteProcess.h b/libminifi/include/processors/ExecuteProcess.h
index c719405..28dcf76 100644
--- a/libminifi/include/processors/ExecuteProcess.h
+++ b/libminifi/include/processors/ExecuteProcess.h
@@ -53,7 +53,7 @@ class ExecuteProcess : public core::Processor {
*/
ExecuteProcess(std::string name, uuid_t uuid = NULL)
: Processor(name, uuid),
- logger_(logging::LoggerFactory<ExecuteProcess>::getLogger()){
+ logger_(logging::LoggerFactory<ExecuteProcess>::getLogger()) {
_redirectErrorStream = false;
_batchDuration = 0;
_workingDir = ".";
@@ -93,8 +93,7 @@ class ExecuteProcess : public core::Processor {
public:
// OnTrigger method, implemented by NiFi ExecuteProcess
- virtual void onTrigger(core::ProcessContext *context,
- core::ProcessSession *session);
+ virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
// Initialize, over write by NiFi ExecuteProcess
virtual void initialize(void);
@@ -107,8 +106,7 @@ class ExecuteProcess : public core::Processor {
std::string _command;
std::string _commandArgument;
std::string _workingDir;
- int64_t _batchDuration;
- bool _redirectErrorStream;
+ int64_t _batchDuration;bool _redirectErrorStream;
// Full command
std::string _fullCommand;
// whether the process is running
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/processors/GenerateFlowFile.h
----------------------------------------------------------------------
diff --git a/libminifi/include/processors/GenerateFlowFile.h b/libminifi/include/processors/GenerateFlowFile.h
index 2f24e64..abb5740 100644
--- a/libminifi/include/processors/GenerateFlowFile.h
+++ b/libminifi/include/processors/GenerateFlowFile.h
@@ -76,8 +76,7 @@ class GenerateFlowFile : public core::Processor {
public:
// OnTrigger method, implemented by NiFi GenerateFlowFile
- virtual void onTrigger(core::ProcessContext *context,
- core::ProcessSession *session);
+ virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
// Initialize, over write by NiFi GenerateFlowFile
virtual void initialize(void);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/processors/GetFile.h
----------------------------------------------------------------------
diff --git a/libminifi/include/processors/GetFile.h b/libminifi/include/processors/GetFile.h
index 8864601..df8f775 100644
--- a/libminifi/include/processors/GetFile.h
+++ b/libminifi/include/processors/GetFile.h
@@ -33,14 +33,11 @@ namespace minifi {
namespace processors {
struct GetFileRequest {
- std::string directory = ".";
- bool recursive = true;
- bool keepSourceFile = false;
+ std::string directory = ".";bool recursive = true;bool keepSourceFile = false;
int64_t minAge = 0;
int64_t maxAge = 0;
int64_t minSize = 0;
- int64_t maxSize = 0;
- bool ignoreHiddenFile = true;
+ int64_t maxSize = 0;bool ignoreHiddenFile = true;
int64_t pollInterval = 0;
int64_t batchSize = 10;
std::string fileFilter = "[^\\.].*";
@@ -54,7 +51,8 @@ class GetFile : public core::Processor {
* Create a new processor
*/
explicit GetFile(std::string name, uuid_t uuid = NULL)
- : Processor(name, uuid), logger_(logging::LoggerFactory<GetFile>::getLogger()) {
+ : Processor(name, uuid),
+ logger_(logging::LoggerFactory<GetFile>::getLogger()) {
}
// Destructor
@@ -84,15 +82,13 @@ class GetFile : public core::Processor {
* @param sessionFactory process session factory that is used when creating
* ProcessSession objects.
*/
- void onSchedule(core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory);
+ void onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory);
/**
* Execution trigger for the GetFile Processor
* @param context processor context
* @param session processor session reference.
*/
- virtual void onTrigger(core::ProcessContext *context,
- core::ProcessSession *session);
+ virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
// Initialize, over write by NiFi GetFile
virtual void initialize(void);
@@ -119,11 +115,9 @@ class GetFile : public core::Processor {
// Put full path file name into directory listing
void putListing(std::string fileName);
// Poll directory listing for files
- void pollListing(std::queue<std::string> &list,
- const GetFileRequest &request);
+ void pollListing(std::queue<std::string> &list, const GetFileRequest &request);
// Check whether file can be added to the directory listing
- bool acceptFile(std::string fullName, std::string name,
- const GetFileRequest &request);
+ bool acceptFile(std::string fullName, std::string name, const GetFileRequest &request);
// Get file request object.
GetFileRequest request_;
// Mutex for protection of the directory listing
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/processors/InvokeHTTP.h
----------------------------------------------------------------------
diff --git a/libminifi/include/processors/InvokeHTTP.h b/libminifi/include/processors/InvokeHTTP.h
index 59bc2bd..ab78fd5 100644
--- a/libminifi/include/processors/InvokeHTTP.h
+++ b/libminifi/include/processors/InvokeHTTP.h
@@ -53,10 +53,8 @@ struct HTTPRequestResponse {
/**
* Receive HTTP Response.
*/
- static size_t recieve_write(char * data, size_t size, size_t nmemb,
- void * p) {
- return static_cast<HTTPRequestResponse*>(p)->write_content(data, size,
- nmemb);
+ static size_t recieve_write(char * data, size_t size, size_t nmemb, void * p) {
+ return static_cast<HTTPRequestResponse*>(p)->write_content(data, size, nmemb);
}
/**
@@ -160,8 +158,7 @@ class InvokeHTTP : public core::Processor {
void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
void initialize();
- void onSchedule(core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory);
+ void onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory);
protected:
@@ -194,9 +191,7 @@ class InvokeHTTP : public core::Processor {
*/
void set_request_method(CURL *curl, const std::string &);
- struct curl_slist *build_header_list(
- CURL *curl, std::string regex,
- const std::map<std::string, std::string> &);
+ struct curl_slist *build_header_list(CURL *curl, std::string regex, const std::map<std::string, std::string> &);
bool matches(const std::string &value, const std::string &sregex);
@@ -209,10 +204,8 @@ class InvokeHTTP : public core::Processor {
* @param isSuccess success code or not
* @param statuscode http response code.
*/
- void route(std::shared_ptr<FlowFileRecord> &request,
- std::shared_ptr<FlowFileRecord> &response,
- core::ProcessSession *session, core::ProcessContext *context,
- bool isSuccess,
+ void route(std::shared_ptr<FlowFileRecord> &request, std::shared_ptr<FlowFileRecord> &response, core::ProcessSession *session, core::ProcessContext *context,
+ bool isSuccess,
int statusCode);
/**
* Determine if we should emit a new flowfile based on our activity
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/processors/ListenHTTP.h
----------------------------------------------------------------------
diff --git a/libminifi/include/processors/ListenHTTP.h b/libminifi/include/processors/ListenHTTP.h
index 03fe03d..c9e42bc 100644
--- a/libminifi/include/processors/ListenHTTP.h
+++ b/libminifi/include/processors/ListenHTTP.h
@@ -68,17 +68,13 @@ class ListenHTTP : public core::Processor {
void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
void initialize();
- void onSchedule(core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory);
+ void onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory);
// HTTP request handler
class Handler : public CivetHandler {
public:
- Handler(core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory,
- std::string &&authDNPattern,
- std::string &&headersAsAttributesPattern);
- bool handlePost(CivetServer *server, struct mg_connection *conn);
+ Handler(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory, std::string &&authDNPattern, std::string &&headersAsAttributesPattern);bool handlePost(
+ CivetServer *server, struct mg_connection *conn);
private:
// Send HTTP 500 error response to client
@@ -95,8 +91,7 @@ class ListenHTTP : public core::Processor {
// Write callback for transferring data from HTTP request to content repo
class WriteCallback : public OutputStreamCallback {
public:
- WriteCallback(struct mg_connection *conn,
- const struct mg_request_info *reqInfo);
+ WriteCallback(struct mg_connection *conn, const struct mg_request_info *reqInfo);
void process(std::ofstream *stream);
private:
@@ -115,7 +110,6 @@ class ListenHTTP : public core::Processor {
std::unique_ptr<Handler> _handler;
};
-
REGISTER_RESOURCE(ListenHTTP);
} /* namespace processors */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/processors/ListenSyslog.h
----------------------------------------------------------------------
diff --git a/libminifi/include/processors/ListenSyslog.h b/libminifi/include/processors/ListenSyslog.h
index f0380db..ed54b44 100644
--- a/libminifi/include/processors/ListenSyslog.h
+++ b/libminifi/include/processors/ListenSyslog.h
@@ -127,8 +127,7 @@ class ListenSyslog : public core::Processor {
public:
// OnTrigger method, implemented by NiFi ListenSyslog
- virtual void onTrigger(core::ProcessContext *context,
- core::ProcessSession *session);
+ virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
// Initialize, over write by NiFi ListenSyslog
virtual void initialize(void);
@@ -193,8 +192,7 @@ class ListenSyslog : public core::Processor {
int64_t _maxBatchSize;
std::string _messageDelimiter;
std::string _protocol;
- int64_t _port;
- bool _parseMessages;
+ int64_t _port;bool _parseMessages;
int _serverSocket;
std::vector<int> _clientSockets;
int _maxFds;
@@ -202,8 +200,7 @@ class ListenSyslog : public core::Processor {
// thread
std::thread *_thread;
// whether to reset the server socket
- bool _resetServerSocket;
- bool _serverTheadRunning;
+ bool _resetServerSocket;bool _serverTheadRunning;
// buffer for read socket
char _buffer[2048];
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/processors/LoadProcessors.h
----------------------------------------------------------------------
diff --git a/libminifi/include/processors/LoadProcessors.h b/libminifi/include/processors/LoadProcessors.h
index 7a16773..3e6cfcf 100644
--- a/libminifi/include/processors/LoadProcessors.h
+++ b/libminifi/include/processors/LoadProcessors.h
@@ -30,5 +30,4 @@
#include "PutFile.h"
#include "TailFile.h"
-
#endif /* LIBMINIFI_INCLUDE_PROCESSORS_LOADPROCESSORS_H_ */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/processors/LogAttribute.h
----------------------------------------------------------------------
diff --git a/libminifi/include/processors/LogAttribute.h b/libminifi/include/processors/LogAttribute.h
index cbb8f1a..88230f7 100644
--- a/libminifi/include/processors/LogAttribute.h
+++ b/libminifi/include/processors/LogAttribute.h
@@ -110,8 +110,7 @@ class LogAttribute : public core::Processor {
public:
// OnTrigger method, implemented by NiFi LogAttribute
- virtual void onTrigger(core::ProcessContext *context,
- core::ProcessSession *session);
+ virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
// Initialize, over write by NiFi LogAttribute
virtual void initialize(void);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/processors/PutFile.h
----------------------------------------------------------------------
diff --git a/libminifi/include/processors/PutFile.h b/libminifi/include/processors/PutFile.h
index 3918d0a..d08ebbc 100644
--- a/libminifi/include/processors/PutFile.h
+++ b/libminifi/include/processors/PutFile.h
@@ -48,7 +48,8 @@ class PutFile : public core::Processor {
* Create a new processor
*/
PutFile(std::string name, uuid_t uuid = NULL)
- : core::Processor(name, uuid), logger_(logging::LoggerFactory<PutFile>::getLogger()) {
+ : core::Processor(name, uuid),
+ logger_(logging::LoggerFactory<PutFile>::getLogger()) {
}
// Destructor
virtual ~PutFile() {
@@ -67,12 +68,10 @@ class PutFile : public core::Processor {
* @param sessionFactory process session factory that is used when creating
* ProcessSession objects.
*/
- virtual void onSchedule(core::ProcessContext *context,
- core::ProcessSessionFactory *sessionFactory);
+ virtual void onSchedule(core::ProcessContext *context, core::ProcessSessionFactory *sessionFactory);
// OnTrigger method, implemented by NiFi PutFile
- virtual void onTrigger(core::ProcessContext *context,
- core::ProcessSession *session);
+ virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
// Initialize, over write by NiFi PutFile
virtual void initialize(void);
@@ -80,13 +79,11 @@ class PutFile : public core::Processor {
public:
ReadCallback(const std::string &tmpFile, const std::string &destFile);
~ReadCallback();
- virtual void process(std::ifstream *stream);
- bool commit();
+ virtual void process(std::ifstream *stream);bool commit();
private:
std::shared_ptr<logging::Logger> logger_;
- std::ofstream _tmpFileOs;
- bool _writeSucceeded = false;
+ std::ofstream _tmpFileOs;bool _writeSucceeded = false;
std::string _tmpFile;
std::string _destFile;
};
@@ -100,9 +97,7 @@ class PutFile : public core::Processor {
// conflict resolution type.
std::string conflict_resolution_;
- bool putFile(core::ProcessSession *session,
- std::shared_ptr<FlowFileRecord> flowFile,
- const std::string &tmpFile, const std::string &destFile);
+ bool putFile(core::ProcessSession *session, std::shared_ptr<FlowFileRecord> flowFile, const std::string &tmpFile, const std::string &destFile);
std::shared_ptr<logging::Logger> logger_;
};
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/processors/TailFile.h
----------------------------------------------------------------------
diff --git a/libminifi/include/processors/TailFile.h b/libminifi/include/processors/TailFile.h
index 47ec3fb..59cf224 100644
--- a/libminifi/include/processors/TailFile.h
+++ b/libminifi/include/processors/TailFile.h
@@ -41,7 +41,8 @@ class TailFile : public core::Processor {
* Create a new processor
*/
explicit TailFile(std::string name, uuid_t uuid = NULL)
- : core::Processor(name, uuid), logger_(logging::LoggerFactory<TailFile>::getLogger()) {
+ : core::Processor(name, uuid),
+ logger_(logging::LoggerFactory<TailFile>::getLogger()) {
_stateRecovered = false;
}
// Destructor
@@ -58,8 +59,7 @@ class TailFile : public core::Processor {
public:
// OnTrigger method, implemented by NiFi TailFile
- virtual void onTrigger(core::ProcessContext *context,
- core::ProcessSession *session);
+ virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
// Initialize, over write by NiFi TailFile
virtual void initialize(void);
// recoverState
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/properties/Properties.h
----------------------------------------------------------------------
diff --git a/libminifi/include/properties/Properties.h b/libminifi/include/properties/Properties.h
index 8d08e8d..8797c19 100644
--- a/libminifi/include/properties/Properties.h
+++ b/libminifi/include/properties/Properties.h
@@ -38,11 +38,11 @@ namespace minifi {
class Properties {
public:
Properties();
-
+
virtual ~Properties() {
}
-
+
// Clear the load config
void clear() {
std::lock_guard<std::mutex> lock(mutex_);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/provenance/Provenance.h
----------------------------------------------------------------------
diff --git a/libminifi/include/provenance/Provenance.h b/libminifi/include/provenance/Provenance.h
index 86ee713..1fa4a72 100644
--- a/libminifi/include/provenance/Provenance.h
+++ b/libminifi/include/provenance/Provenance.h
@@ -49,8 +49,7 @@ namespace provenance {
#define PROVENANCE_EVENT_RECORD_SEG_SIZE 2048
// Provenance Event Record
-class ProvenanceEventRecord :
- protected org::apache::nifi::minifi::io::Serializable {
+class ProvenanceEventRecord : protected org::apache::nifi::minifi::io::Serializable {
public:
enum ProvenanceEventType {
@@ -155,14 +154,14 @@ class ProvenanceEventRecord :
*/
REPLAY
};
- static const char *ProvenanceEventTypeStr[REPLAY+1];
- public:
+ static const char *ProvenanceEventTypeStr[REPLAY + 1];
+ public:
// Constructor
/*!
* Create a new provenance event record
*/
- ProvenanceEventRecord(ProvenanceEventType event, std::string componentId,
- std::string componentType): logger_(logging::LoggerFactory<ProvenanceEventRecord>::getLogger()) {
+ ProvenanceEventRecord(ProvenanceEventType event, std::string componentId, std::string componentType)
+ : logger_(logging::LoggerFactory<ProvenanceEventRecord>::getLogger()) {
_eventType = event;
_componentId = componentId;
_componentType = componentType;
@@ -174,7 +173,8 @@ class ProvenanceEventRecord :
_eventIdStr = eventIdStr;
}
- ProvenanceEventRecord(): logger_(logging::LoggerFactory<ProvenanceEventRecord>::getLogger()) {
+ ProvenanceEventRecord()
+ : logger_(logging::LoggerFactory<ProvenanceEventRecord>::getLogger()) {
_eventTime = getTimeMillis();
}
@@ -271,8 +271,7 @@ class ProvenanceEventRecord :
}
// Add Parent UUID
void addParentUuid(std::string uuid) {
- if (std::find(_parentUuids.begin(), _parentUuids.end(), uuid)
- != _parentUuids.end())
+ if (std::find(_parentUuids.begin(), _parentUuids.end(), uuid) != _parentUuids.end())
return;
else
_parentUuids.push_back(uuid);
@@ -284,9 +283,7 @@ class ProvenanceEventRecord :
}
// Remove Parent UUID
void removeParentUuid(std::string uuid) {
- _parentUuids.erase(
- std::remove(_parentUuids.begin(), _parentUuids.end(), uuid),
- _parentUuids.end());
+ _parentUuids.erase(std::remove(_parentUuids.begin(), _parentUuids.end(), uuid), _parentUuids.end());
}
// Remove Parent Flow File
void removeParentFlowFile(std::shared_ptr<core::FlowFile> flow) {
@@ -299,8 +296,7 @@ class ProvenanceEventRecord :
}
// Add Child UUID
void addChildUuid(std::string uuid) {
- if (std::find(_childrenUuids.begin(), _childrenUuids.end(), uuid)
- != _childrenUuids.end())
+ if (std::find(_childrenUuids.begin(), _childrenUuids.end(), uuid) != _childrenUuids.end())
return;
else
_childrenUuids.push_back(uuid);
@@ -312,9 +308,7 @@ class ProvenanceEventRecord :
}
// Remove Child UUID
void removeChildUuid(std::string uuid) {
- _childrenUuids.erase(
- std::remove(_childrenUuids.begin(), _childrenUuids.end(), uuid),
- _childrenUuids.end());
+ _childrenUuids.erase(std::remove(_childrenUuids.begin(), _childrenUuids.end(), uuid), _childrenUuids.end());
}
// Remove Child Flow File
void removeChildFlowFile(std::shared_ptr<core::FlowFile> flow) {
@@ -369,8 +363,7 @@ class ProvenanceEventRecord :
return DeSerialize(stream.getBuffer(), stream.getSize());
}
// DeSerialize
- bool DeSerialize(const std::shared_ptr<core::Repository> &repo,
- std::string key);
+ bool DeSerialize(const std::shared_ptr<core::Repository> &repo, std::string key);
protected:
@@ -440,8 +433,8 @@ class ProvenanceReporter {
/*!
* Create a new provenance reporter associated with the process session
*/
- ProvenanceReporter(std::shared_ptr<core::Repository> repo,
- std::string componentId, std::string componentType) : logger_(logging::LoggerFactory<ProvenanceReporter>::getLogger()) {
+ ProvenanceReporter(std::shared_ptr<core::Repository> repo, std::string componentId, std::string componentType)
+ : logger_(logging::LoggerFactory<ProvenanceReporter>::getLogger()) {
_componentId = componentId;
_componentType = componentType;
repo_ = repo;
@@ -474,12 +467,8 @@ class ProvenanceReporter {
_events.clear();
}
// allocate
- ProvenanceEventRecord *allocate(
- ProvenanceEventRecord::ProvenanceEventType eventType,
- std::shared_ptr<core::FlowFile> flow) {
- ProvenanceEventRecord *event = new ProvenanceEventRecord(eventType,
- _componentId,
- _componentType);
+ ProvenanceEventRecord *allocate(ProvenanceEventRecord::ProvenanceEventType eventType, std::shared_ptr<core::FlowFile> flow) {
+ ProvenanceEventRecord *event = new ProvenanceEventRecord(eventType, _componentId, _componentType);
if (event)
event->fromFlowFile(flow);
@@ -490,39 +479,27 @@ class ProvenanceReporter {
// create
void create(std::shared_ptr<core::FlowFile> flow, std::string detail);
// route
- void route(std::shared_ptr<core::FlowFile> flow, core::Relationship relation,
- std::string detail, uint64_t processingDuration);
+ void route(std::shared_ptr<core::FlowFile> flow, core::Relationship relation, std::string detail, uint64_t processingDuration);
// modifyAttributes
- void modifyAttributes(std::shared_ptr<core::FlowFile> flow,
- std::string detail);
+ void modifyAttributes(std::shared_ptr<core::FlowFile> flow, std::string detail);
// modifyContent
- void modifyContent(std::shared_ptr<core::FlowFile> flow, std::string detail,
- uint64_t processingDuration);
+ void modifyContent(std::shared_ptr<core::FlowFile> flow, std::string detail, uint64_t processingDuration);
// clone
- void clone(std::shared_ptr<core::FlowFile> parent,
- std::shared_ptr<core::FlowFile> child);
+ void clone(std::shared_ptr<core::FlowFile> parent, std::shared_ptr<core::FlowFile> child);
// join
- void join(std::vector<std::shared_ptr<core::FlowFile> > parents,
- std::shared_ptr<core::FlowFile> child, std::string detail,
- uint64_t processingDuration);
+ void join(std::vector<std::shared_ptr<core::FlowFile> > parents, std::shared_ptr<core::FlowFile> child, std::string detail, uint64_t processingDuration);
// fork
- void fork(std::vector<std::shared_ptr<core::FlowFile> > child,
- std::shared_ptr<core::FlowFile> parent, std::string detail,
- uint64_t processingDuration);
+ void fork(std::vector<std::shared_ptr<core::FlowFile> > child, std::shared_ptr<core::FlowFile> parent, std::string detail, uint64_t processingDuration);
// expire
void expire(std::shared_ptr<core::FlowFile> flow, std::string detail);
// drop
void drop(std::shared_ptr<core::FlowFile> flow, std::string reason);
// send
- void send(std::shared_ptr<core::FlowFile> flow, std::string transitUri,
- std::string detail, uint64_t processingDuration, bool force);
+ void send(std::shared_ptr<core::FlowFile> flow, std::string transitUri, std::string detail, uint64_t processingDuration, bool force);
// fetch
- void fetch(std::shared_ptr<core::FlowFile> flow, std::string transitUri,
- std::string detail, uint64_t processingDuration);
+ void fetch(std::shared_ptr<core::FlowFile> flow, std::string transitUri, std::string detail, uint64_t processingDuration);
// receive
- void receive(std::shared_ptr<core::FlowFile> flow, std::string transitUri,
- std::string sourceSystemFlowFileIdentifier, std::string detail,
- uint64_t processingDuration);
+ void receive(std::shared_ptr<core::FlowFile> flow, std::string transitUri, std::string sourceSystemFlowFileIdentifier, std::string detail, uint64_t processingDuration);
protected:
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/provenance/ProvenanceRepository.h
----------------------------------------------------------------------
diff --git a/libminifi/include/provenance/ProvenanceRepository.h b/libminifi/include/provenance/ProvenanceRepository.h
index 8bcc316..dd2c5ec 100644
--- a/libminifi/include/provenance/ProvenanceRepository.h
+++ b/libminifi/include/provenance/ProvenanceRepository.h
@@ -36,20 +36,16 @@ namespace provenance {
#define MAX_PROVENANCE_ENTRY_LIFE_TIME (60000) // 1 minute
#define PROVENANCE_PURGE_PERIOD (2500) // 2500 msec
-class ProvenanceRepository : public core::Repository,
- public std::enable_shared_from_this<ProvenanceRepository> {
+class ProvenanceRepository : public core::Repository, public std::enable_shared_from_this<ProvenanceRepository> {
public:
// Constructor
/*!
* Create a new provenance repository
*/
- ProvenanceRepository(const std::string repo_name = "", std::string directory = PROVENANCE_DIRECTORY,
- int64_t maxPartitionMillis =
- MAX_PROVENANCE_ENTRY_LIFE_TIME,
- int64_t maxPartitionBytes = MAX_PROVENANCE_STORAGE_SIZE,
- uint64_t purgePeriod = PROVENANCE_PURGE_PERIOD)
- : Repository(repo_name.length() > 0 ? repo_name : core::getClassName<ProvenanceRepository>(), directory,
- maxPartitionMillis, maxPartitionBytes, purgePeriod),
+ ProvenanceRepository(const std::string repo_name = "", std::string directory = PROVENANCE_DIRECTORY, int64_t maxPartitionMillis =
+ MAX_PROVENANCE_ENTRY_LIFE_TIME,
+ int64_t maxPartitionBytes = MAX_PROVENANCE_STORAGE_SIZE, uint64_t purgePeriod = PROVENANCE_PURGE_PERIOD)
+ : Repository(repo_name.length() > 0 ? repo_name : core::getClassName<ProvenanceRepository>(), directory, maxPartitionMillis, maxPartitionBytes, purgePeriod),
logger_(logging::LoggerFactory<ProvenanceRepository>::getLogger()) {
db_ = NULL;
@@ -60,53 +56,42 @@ class ProvenanceRepository : public core::Repository,
if (db_)
delete db_;
}
-
+
void start() {
- if (this->purge_period_ <= 0)
- return;
- if (running_)
- return;
- thread_ = std::thread(&ProvenanceRepository::run, shared_from_this());
- thread_.detach();
- running_ = true;
- logger_->log_info("%s Repository Monitor Thread Start", name_.c_str());
-}
+ if (this->purge_period_ <= 0)
+ return;
+ if (running_)
+ return;
+ thread_ = std::thread(&ProvenanceRepository::run, shared_from_this());
+ thread_.detach();
+ running_ = true;
+ logger_->log_info("%s Repository Monitor Thread Start", name_.c_str());
+ }
// initialize
virtual bool initialize(const std::shared_ptr<org::apache::nifi::minifi::Configure> &config) {
std::string value;
- if (config->get(Configure::nifi_provenance_repository_directory_default,
- value)) {
+ if (config->get(Configure::nifi_provenance_repository_directory_default, value)) {
directory_ = value;
}
- logger_->log_info("NiFi Provenance Repository Directory %s",
- directory_.c_str());
- if (config->get(Configure::nifi_provenance_repository_max_storage_size,
- value)) {
+ logger_->log_info("NiFi Provenance Repository Directory %s", directory_.c_str());
+ if (config->get(Configure::nifi_provenance_repository_max_storage_size, value)) {
core::Property::StringToInt(value, max_partition_bytes_);
}
- logger_->log_info("NiFi Provenance Max Partition Bytes %d",
- max_partition_bytes_);
- if (config->get(Configure::nifi_provenance_repository_max_storage_time,
- value)) {
+ logger_->log_info("NiFi Provenance Max Partition Bytes %d", max_partition_bytes_);
+ if (config->get(Configure::nifi_provenance_repository_max_storage_time, value)) {
core::TimeUnit unit;
- if (core::Property::StringToTime(value, max_partition_millis_, unit)
- && core::Property::ConvertTimeUnitToMS(max_partition_millis_, unit,
- max_partition_millis_)) {
+ if (core::Property::StringToTime(value, max_partition_millis_, unit) && core::Property::ConvertTimeUnitToMS(max_partition_millis_, unit, max_partition_millis_)) {
}
}
- logger_->log_info("NiFi Provenance Max Storage Time: [%d] ms",
- max_partition_millis_);
+ logger_->log_info("NiFi Provenance Max Storage Time: [%d] ms", max_partition_millis_);
leveldb::Options options;
options.create_if_missing = true;
- leveldb::Status status = leveldb::DB::Open(options, directory_.c_str(),
- &db_);
+ leveldb::Status status = leveldb::DB::Open(options, directory_.c_str(), &db_);
if (status.ok()) {
- logger_->log_info("NiFi Provenance Repository database open %s success",
- directory_.c_str());
+ logger_->log_info("NiFi Provenance Repository database open %s success", directory_.c_str());
} else {
- logger_->log_error("NiFi Provenance Repository database open %s fail",
- directory_.c_str());
+ logger_->log_error("NiFi Provenance Repository database open %s fail", directory_.c_str());
return false;
}
@@ -115,8 +100,8 @@ class ProvenanceRepository : public core::Repository,
// Put
virtual bool Put(std::string key, uint8_t *buf, int bufLen) {
- if (repo_full_)
- return false;
+ if (repo_full_)
+ return false;
// persistent to the DB
leveldb::Slice value((const char *) buf, bufLen);
@@ -147,40 +132,33 @@ class ProvenanceRepository : public core::Repository,
}
// Persistent event
void registerEvent(std::shared_ptr<ProvenanceEventRecord> &event) {
- event->Serialize(
- std::static_pointer_cast<core::Repository>(shared_from_this()));
+ event->Serialize(std::static_pointer_cast<core::Repository>(shared_from_this()));
}
// Remove event
void removeEvent(ProvenanceEventRecord *event) {
Delete(event->getEventId());
}
//! get record
- void getProvenanceRecord(std::vector<std::shared_ptr<ProvenanceEventRecord>> &records, int maxSize)
- {
- std::lock_guard<std::mutex> lock(mutex_);
- leveldb::Iterator* it = db_->NewIterator(
- leveldb::ReadOptions());
- for (it->SeekToFirst(); it->Valid(); it->Next()) {
- std::shared_ptr<ProvenanceEventRecord> eventRead = std::make_shared<ProvenanceEventRecord>();
- std::string key = it->key().ToString();
- if (records.size() >= maxSize)
- break;
- if (eventRead->DeSerialize((uint8_t *) it->value().data(),
- (int) it->value().size()))
- {
- records.push_back(eventRead);
- }
- }
- delete it;
+ void getProvenanceRecord(std::vector<std::shared_ptr<ProvenanceEventRecord>> &records, int maxSize) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ leveldb::Iterator* it = db_->NewIterator(leveldb::ReadOptions());
+ for (it->SeekToFirst(); it->Valid(); it->Next()) {
+ std::shared_ptr<ProvenanceEventRecord> eventRead = std::make_shared<ProvenanceEventRecord>();
+ std::string key = it->key().ToString();
+ if (records.size() >= maxSize)
+ break;
+ if (eventRead->DeSerialize((uint8_t *) it->value().data(), (int) it->value().size())) {
+ records.push_back(eventRead);
+ }
+ }
+ delete it;
}
//! purge record
- void purgeProvenanceRecord(std::vector<std::shared_ptr<ProvenanceEventRecord>> &records)
- {
- std::lock_guard<std::mutex> lock(mutex_);
- for (auto record : records)
- {
- Delete(record->getEventId());
- }
+ void purgeProvenanceRecord(std::vector<std::shared_ptr<ProvenanceEventRecord>> &records) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ for (auto record : records) {
+ Delete(record->getEventId());
+ }
}
// destroy
void destroy() {
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/utils/ByteInputCallBack.h
----------------------------------------------------------------------
diff --git a/libminifi/include/utils/ByteInputCallBack.h b/libminifi/include/utils/ByteInputCallBack.h
index 72303ff..a2b7838 100644
--- a/libminifi/include/utils/ByteInputCallBack.h
+++ b/libminifi/include/utils/ByteInputCallBack.h
@@ -41,8 +41,7 @@ class ByteInputCallBack : public InputStreamCallback {
virtual void process(std::ifstream *stream) {
- std::vector<char> nv = std::vector<char>(std::istreambuf_iterator<char>(*stream),
- std::istreambuf_iterator<char>());
+ std::vector<char> nv = std::vector<char>(std::istreambuf_iterator<char>(*stream), std::istreambuf_iterator<char>());
vec = std::move(nv);
ptr = &vec[0];
@@ -53,9 +52,6 @@ class ByteInputCallBack : public InputStreamCallback {
return ptr;
}
-
-
-
const size_t getBufferSize() {
return vec.size();
}
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/utils/StringUtils.h
----------------------------------------------------------------------
diff --git a/libminifi/include/utils/StringUtils.h b/libminifi/include/utils/StringUtils.h
index 0fc1996..b754467 100644
--- a/libminifi/include/utils/StringUtils.h
+++ b/libminifi/include/utils/StringUtils.h
@@ -66,11 +66,7 @@ class StringUtils {
* @returns modified string
*/
static inline std::string trimLeft(std::string s) {
- s.erase(
- s.begin(),
- std::find_if(
- s.begin(), s.end(),
- std::not1(std::pointer_to_unary_function<int, int>(std::isspace))));
+ s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::pointer_to_unary_function<int, int>(std::isspace))));
return s;
}
@@ -81,15 +77,10 @@ class StringUtils {
*/
static inline std::string trimRight(std::string s) {
- s.erase(
- std::find_if(
- s.rbegin(), s.rend(),
- std::not1(std::pointer_to_unary_function<int, int>(std::isspace)))
- .base(),
- s.end());
+ s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::pointer_to_unary_function<int, int>(std::isspace))).base(), s.end());
return s;
}
-
+
static std::vector<std::string> split(const std::string &str, const std::string &delimiter) {
std::vector<std::string> result;
int last = 0;
@@ -108,14 +99,13 @@ class StringUtils {
* @param output output float
* @param cp failure policy
*/
- static bool StringToFloat(std::string input, float &output, FailurePolicy cp =
- RETURN) {
+ static bool StringToFloat(std::string input, float &output, FailurePolicy cp = RETURN) {
try {
output = std::stof(input);
} catch (const std::invalid_argument &ie) {
switch (cp) {
case RETURN:
- case NOTHING:
+ case NOTHING:
return false;
case EXIT:
exit(1);
@@ -125,7 +115,7 @@ class StringUtils {
} catch (const std::out_of_range &ofr) {
switch (cp) {
case RETURN:
- case NOTHING:
+ case NOTHING:
return false;
case EXIT:
exit(1);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/utils/ThreadPool.h
----------------------------------------------------------------------
diff --git a/libminifi/include/utils/ThreadPool.h b/libminifi/include/utils/ThreadPool.h
index 4c399a7..77772cd 100644
--- a/libminifi/include/utils/ThreadPool.h
+++ b/libminifi/include/utils/ThreadPool.h
@@ -185,23 +185,23 @@ class ThreadPool {
}
// determines if threads are detached
bool daemon_threads_;
-// max worker threads
+ // max worker threads
int max_worker_threads_;
-// current worker tasks.
+ // current worker tasks.
std::atomic<int> current_workers_;
-// thread queue
+ // thread queue
std::vector<std::thread> thread_queue_;
-// manager thread
+ // manager thread
std::thread manager_thread_;
-// atomic running boolean
+ // atomic running boolean
std::atomic<bool> running_;
-// worker queue of worker objects
+ // worker queue of worker objects
moodycamel::ConcurrentQueue<Worker<T>> worker_queue_;
-// notification for available work
+ // notification for available work
std::condition_variable tasks_available_;
-// manager mutex
+ // manager mutex
std::recursive_mutex manager_mutex_;
-// work queue mutex
+ // work queue mutex
std::mutex worker_queue_mutex_;
/**
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/include/utils/TimeUtil.h
----------------------------------------------------------------------
diff --git a/libminifi/include/utils/TimeUtil.h b/libminifi/include/utils/TimeUtil.h
index 6805419..19c2566 100644
--- a/libminifi/include/utils/TimeUtil.h
+++ b/libminifi/include/utils/TimeUtil.h
@@ -33,8 +33,7 @@
* @returns milliseconds since epoch
*/
inline uint64_t getTimeMillis() {
- return std::chrono::duration_cast<std::chrono::milliseconds>(
- std::chrono::system_clock::now().time_since_epoch()).count();
+ return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
}
/**
@@ -43,8 +42,7 @@ inline uint64_t getTimeMillis() {
*/
inline uint64_t getTimeNano() {
- return std::chrono::duration_cast<std::chrono::nanoseconds>(
- std::chrono::system_clock::now().time_since_epoch()).count();
+ return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
}
@@ -58,8 +56,7 @@ inline std::string getTimeStr(uint64_t msec, bool enforce_locale = false) {
char date[120];
time_t second = (time_t) (msec / 1000);
msec = msec % 1000;
- strftime(date, sizeof(date) / sizeof(*date), TIME_FORMAT,
- (enforce_locale == true ? gmtime(&second) : localtime(&second)));
+ strftime(date, sizeof(date) / sizeof(*date), TIME_FORMAT, (enforce_locale == true ? gmtime(&second) : localtime(&second)));
std::string ret = date;
date[0] = '\0';
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/Configure.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/Configure.cpp b/libminifi/src/Configure.cpp
index 5c62a8d..d8e049c 100644
--- a/libminifi/src/Configure.cpp
+++ b/libminifi/src/Configure.cpp
@@ -23,50 +23,31 @@ namespace nifi {
namespace minifi {
const char *Configure::nifi_default_directory = "nifi.default.directory";
-const char *Configure::nifi_flow_configuration_file =
- "nifi.flow.configuration.file";
+const char *Configure::nifi_flow_configuration_file = "nifi.flow.configuration.file";
const char *Configure::nifi_flow_engine_threads = "nifi.flow.engine.threads";
-const char *Configure::nifi_administrative_yield_duration =
- "nifi.administrative.yield.duration";
+const char *Configure::nifi_administrative_yield_duration = "nifi.administrative.yield.duration";
const char *Configure::nifi_bored_yield_duration = "nifi.bored.yield.duration";
-const char *Configure::nifi_graceful_shutdown_seconds =
- "nifi.flowcontroller.graceful.shutdown.period";
+const char *Configure::nifi_graceful_shutdown_seconds = "nifi.flowcontroller.graceful.shutdown.period";
const char *Configure::nifi_log_level = "nifi.log.level";
const char *Configure::nifi_server_name = "nifi.server.name";
-const char *Configure::nifi_configuration_class_name =
- "nifi.flow.configuration.class.name";
-const char *Configure::nifi_flow_repository_class_name =
- "nifi.flow.repository.class.name";
-const char *Configure::nifi_volatile_repository_options =
- "nifi.volatile.repository.options.";
-const char *Configure::nifi_provenance_repository_class_name =
- "nifi.provenance.repository.class.name";
+const char *Configure::nifi_configuration_class_name = "nifi.flow.configuration.class.name";
+const char *Configure::nifi_flow_repository_class_name = "nifi.flow.repository.class.name";
+const char *Configure::nifi_volatile_repository_options = "nifi.volatile.repository.options.";
+const char *Configure::nifi_provenance_repository_class_name = "nifi.provenance.repository.class.name";
const char *Configure::nifi_server_port = "nifi.server.port";
-const char *Configure::nifi_server_report_interval =
- "nifi.server.report.interval";
-const char *Configure::nifi_provenance_repository_max_storage_size =
- "nifi.provenance.repository.max.storage.size";
-const char *Configure::nifi_provenance_repository_max_storage_time =
- "nifi.provenance.repository.max.storage.time";
-const char *Configure::nifi_provenance_repository_directory_default =
- "nifi.provenance.repository.directory.default";
-const char *Configure::nifi_flowfile_repository_max_storage_size =
- "nifi.flowfile.repository.max.storage.size";
-const char *Configure::nifi_flowfile_repository_max_storage_time =
- "nifi.flowfile.repository.max.storage.time";
-const char *Configure::nifi_flowfile_repository_directory_default =
- "nifi.flowfile.repository.directory.default";
+const char *Configure::nifi_server_report_interval = "nifi.server.report.interval";
+const char *Configure::nifi_provenance_repository_max_storage_size = "nifi.provenance.repository.max.storage.size";
+const char *Configure::nifi_provenance_repository_max_storage_time = "nifi.provenance.repository.max.storage.time";
+const char *Configure::nifi_provenance_repository_directory_default = "nifi.provenance.repository.directory.default";
+const char *Configure::nifi_flowfile_repository_max_storage_size = "nifi.flowfile.repository.max.storage.size";
+const char *Configure::nifi_flowfile_repository_max_storage_time = "nifi.flowfile.repository.max.storage.time";
+const char *Configure::nifi_flowfile_repository_directory_default = "nifi.flowfile.repository.directory.default";
const char *Configure::nifi_remote_input_secure = "nifi.remote.input.secure";
-const char *Configure::nifi_security_need_ClientAuth =
- "nifi.security.need.ClientAuth";
-const char *Configure::nifi_security_client_certificate =
- "nifi.security.client.certificate";
-const char *Configure::nifi_security_client_private_key =
- "nifi.security.client.private.key";
-const char *Configure::nifi_security_client_pass_phrase =
- "nifi.security.client.pass.phrase";
-const char *Configure::nifi_security_client_ca_certificate =
- "nifi.security.client.ca.certificate";
+const char *Configure::nifi_security_need_ClientAuth = "nifi.security.need.ClientAuth";
+const char *Configure::nifi_security_client_certificate = "nifi.security.client.certificate";
+const char *Configure::nifi_security_client_private_key = "nifi.security.client.private.key";
+const char *Configure::nifi_security_client_pass_phrase = "nifi.security.client.pass.phrase";
+const char *Configure::nifi_security_client_ca_certificate = "nifi.security.client.ca.certificate";
} /* namespace minifi */
} /* namespace nifi */
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/Connection.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/Connection.cpp b/libminifi/src/Connection.cpp
index bc76044..0901a30 100644
--- a/libminifi/src/Connection.cpp
+++ b/libminifi/src/Connection.cpp
@@ -39,9 +39,7 @@ namespace apache {
namespace nifi {
namespace minifi {
-Connection::Connection(std::shared_ptr<core::Repository> flow_repository,
- std::string name, uuid_t uuid, uuid_t srcUUID,
- uuid_t destUUID)
+Connection::Connection(std::shared_ptr<core::Repository> flow_repository, std::string name, uuid_t uuid, uuid_t srcUUID, uuid_t destUUID)
: core::Connectable(name, uuid),
flow_repository_(flow_repository),
logger_(logging::LoggerFactory<Connection>::getLogger()) {
@@ -91,8 +89,7 @@ void Connection::put(std::shared_ptr<core::FlowFile> flow) {
queued_data_size_ += flow->getSize();
- logger_->log_debug("Enqueue flow file UUID %s to connection %s",
- flow->getUUIDStr().c_str(), name_.c_str());
+ logger_->log_debug("Enqueue flow file UUID %s to connection %s", flow->getUUIDStr().c_str(), name_.c_str());
}
if (!flow->isStored()) {
@@ -109,8 +106,7 @@ void Connection::put(std::shared_ptr<core::FlowFile> flow) {
}
}
-std::shared_ptr<core::FlowFile> Connection::poll(
- std::set<std::shared_ptr<core::FlowFile>> &expiredFlowRecords) {
+std::shared_ptr<core::FlowFile> Connection::poll(std::set<std::shared_ptr<core::FlowFile>> &expiredFlowRecords) {
std::lock_guard<std::mutex> lock(mutex_);
while (!queue_.empty()) {
@@ -134,11 +130,9 @@ std::shared_ptr<core::FlowFile> Connection::poll(
queued_data_size_ += item->getSize();
break;
}
- std::shared_ptr<Connectable> connectable = std::static_pointer_cast<
- Connectable>(shared_from_this());
+ std::shared_ptr<Connectable> connectable = std::static_pointer_cast<Connectable>(shared_from_this());
item->setOriginalConnection(connectable);
- logger_->log_debug("Dequeue flow file UUID %s from connection %s",
- item->getUUIDStr().c_str(), name_.c_str());
+ logger_->log_debug("Dequeue flow file UUID %s from connection %s", item->getUUIDStr().c_str(), name_.c_str());
// delete from the flowfile repo
if (flow_repository_->Delete(item->getUUIDStr())) {
@@ -155,11 +149,9 @@ std::shared_ptr<core::FlowFile> Connection::poll(
queued_data_size_ += item->getSize();
break;
}
- std::shared_ptr<Connectable> connectable = std::static_pointer_cast<
- Connectable>(shared_from_this());
+ std::shared_ptr<Connectable> connectable = std::static_pointer_cast<Connectable>(shared_from_this());
item->setOriginalConnection(connectable);
- logger_->log_debug("Dequeue flow file UUID %s from connection %s",
- item->getUUIDStr().c_str(), name_.c_str());
+ logger_->log_debug("Dequeue flow file UUID %s from connection %s", item->getUUIDStr().c_str(), name_.c_str());
// delete from the flowfile repo
if (flow_repository_->Delete(item->getUUIDStr())) {
item->setStoredToRepository(false);
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/EventDrivenSchedulingAgent.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/EventDrivenSchedulingAgent.cpp b/libminifi/src/EventDrivenSchedulingAgent.cpp
index fa2171b..8a2a874 100644
--- a/libminifi/src/EventDrivenSchedulingAgent.cpp
+++ b/libminifi/src/EventDrivenSchedulingAgent.cpp
@@ -32,22 +32,16 @@ namespace apache {
namespace nifi {
namespace minifi {
-void EventDrivenSchedulingAgent::run(
- std::shared_ptr<core::Processor> processor,
- core::ProcessContext *processContext,
- core::ProcessSessionFactory *sessionFactory) {
+void EventDrivenSchedulingAgent::run(std::shared_ptr<core::Processor> processor, core::ProcessContext *processContext, core::ProcessSessionFactory *sessionFactory) {
while (this->running_) {
- bool shouldYield = this->onTrigger(processor, processContext,
- sessionFactory);
+ bool shouldYield = this->onTrigger(processor, processContext, sessionFactory);
if (processor->isYield()) {
// Honor the yield
- std::this_thread::sleep_for(
- std::chrono::milliseconds(processor->getYieldTime()));
+ std::this_thread::sleep_for(std::chrono::milliseconds(processor->getYieldTime()));
} else if (shouldYield && this->bored_yield_duration_ > 0) {
// No work to do or need to apply back pressure
- std::this_thread::sleep_for(
- std::chrono::milliseconds(this->bored_yield_duration_));
+ std::this_thread::sleep_for(std::chrono::milliseconds(this->bored_yield_duration_));
}
// Block until work is available
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/FlowControlProtocol.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/FlowControlProtocol.cpp b/libminifi/src/FlowControlProtocol.cpp
index 69f482f..dbe27e8 100644
--- a/libminifi/src/FlowControlProtocol.cpp
+++ b/libminifi/src/FlowControlProtocol.cpp
@@ -65,18 +65,18 @@ int FlowControlProtocol::connectServer(const char *host, uint16_t port) {
}
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
reinterpret_cast<char*>(&opt), sizeof(opt)) < 0) {
- logger_->log_error("setsockopt() SO_REUSEADDR failed");
- close(sock);
- return 0;
- }
- }
+ logger_->log_error("setsockopt() SO_REUSEADDR failed");
+ close(sock);
+ return 0;
+ }
+ }
- int sndsize = 256*1024;
- if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<char*>(&sndsize), sizeof(sndsize)) < 0) {
- logger_->log_error("setsockopt() SO_SNDBUF failed");
- close(sock);
- return 0;
- }
+ int sndsize = 256*1024;
+ if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, reinterpret_cast<char*>(&sndsize), sizeof(sndsize)) < 0) {
+ logger_->log_error("setsockopt() SO_SNDBUF failed");
+ close(sock);
+ return 0;
+ }
#endif
struct sockaddr_in sa;
@@ -108,9 +108,7 @@ int FlowControlProtocol::connectServer(const char *host, uint16_t port) {
return 0;
}
- logger_->log_info(
- "Flow Control Protocol socket %d connect to server %s port %d success",
- sock, host, port);
+ logger_->log_info("Flow Control Protocol socket %d connect to server %s port %d success", sock, host, port);
return sock;
}
@@ -224,8 +222,7 @@ void FlowControlProtocol::stop() {
void FlowControlProtocol::run(FlowControlProtocol *protocol) {
while (protocol->running_) {
- std::this_thread::sleep_for(
- std::chrono::milliseconds(protocol->_reportInterval));
+ std::this_thread::sleep_for(std::chrono::milliseconds(protocol->_reportInterval));
if (!protocol->_registered) {
// if it is not register yet
protocol->sendRegisterReq();
@@ -251,9 +248,7 @@ int FlowControlProtocol::sendRegisterReq() {
return -1;
// Calculate the total payload msg size
- uint32_t payloadSize = FlowControlMsgIDEncodingLen(FLOW_SERIAL_NUMBER, 0)
- + FlowControlMsgIDEncodingLen(FLOW_YML_NAME,
- this->_controller->getName().size() + 1);
+ uint32_t payloadSize = FlowControlMsgIDEncodingLen(FLOW_SERIAL_NUMBER, 0) + FlowControlMsgIDEncodingLen(FLOW_YML_NAME, this->_controller->getName().size() + 1);
uint32_t size = sizeof(FlowControlProtocolHeader) + payloadSize;
uint8_t *data = new uint8_t[size];
@@ -294,17 +289,13 @@ int FlowControlProtocol::sendRegisterReq() {
if (status <= 0) {
close(_socket);
_socket = 0;
- logger_->log_error(
- "Flow Control Protocol Read Register Resp header failed");
+ logger_->log_error("Flow Control Protocol Read Register Resp header failed");
return -1;
}
- logger_->log_info("Flow Control Protocol receive MsgType %s",
- FlowControlMsgTypeToStr((FlowControlMsgType) hdr.msgType));
+ logger_->log_info("Flow Control Protocol receive MsgType %s", FlowControlMsgTypeToStr((FlowControlMsgType) hdr.msgType));
logger_->log_info("Flow Control Protocol receive Seq Num %d", hdr.seqNumber);
- logger_->log_info("Flow Control Protocol receive Resp Code %s",
- FlowControlRespCodeToStr((FlowControlRespCode) hdr.status));
- logger_->log_info("Flow Control Protocol receive Payload len %d",
- hdr.payloadLen);
+ logger_->log_info("Flow Control Protocol receive Resp Code %s", FlowControlRespCodeToStr((FlowControlRespCode) hdr.status));
+ logger_->log_info("Flow Control Protocol receive Payload len %d", hdr.payloadLen);
if (hdr.status == RESP_SUCCESS && hdr.seqNumber == this->_seqNumber) {
this->_registered = true;
@@ -327,8 +318,7 @@ int FlowControlProtocol::sendRegisterReq() {
// Fixed 4 bytes
uint32_t reportInterval;
payloadPtr = this->decode(payloadPtr, reportInterval);
- logger_->log_info("Flow Control Protocol receive report interval %d ms",
- reportInterval);
+ logger_->log_info("Flow Control Protocol receive report interval %d ms", reportInterval);
this->_reportInterval = reportInterval;
} else {
break;
@@ -356,8 +346,7 @@ int FlowControlProtocol::sendReportReq() {
return -1;
// Calculate the total payload msg size
- uint32_t payloadSize = FlowControlMsgIDEncodingLen(
- FLOW_YML_NAME, this->_controller->getName().size() + 1);
+ uint32_t payloadSize = FlowControlMsgIDEncodingLen(FLOW_YML_NAME, this->_controller->getName().size() + 1);
uint32_t size = sizeof(FlowControlProtocolHeader) + payloadSize;
uint8_t *data = new uint8_t[size];
@@ -397,13 +386,10 @@ int FlowControlProtocol::sendReportReq() {
logger_->log_error("Flow Control Protocol Read Report Resp header failed");
return -1;
}
- logger_->log_info("Flow Control Protocol receive MsgType %s",
- FlowControlMsgTypeToStr((FlowControlMsgType) hdr.msgType));
+ logger_->log_info("Flow Control Protocol receive MsgType %s", FlowControlMsgTypeToStr((FlowControlMsgType) hdr.msgType));
logger_->log_info("Flow Control Protocol receive Seq Num %d", hdr.seqNumber);
- logger_->log_info("Flow Control Protocol receive Resp Code %s",
- FlowControlRespCodeToStr((FlowControlRespCode) hdr.status));
- logger_->log_info("Flow Control Protocol receive Payload len %d",
- hdr.payloadLen);
+ logger_->log_info("Flow Control Protocol receive Resp Code %s", FlowControlRespCodeToStr((FlowControlRespCode) hdr.status));
+ logger_->log_info("Flow Control Protocol receive Payload len %d", hdr.payloadLen);
if (hdr.status == RESP_SUCCESS && hdr.seqNumber == this->_seqNumber) {
this->_seqNumber++;
@@ -428,27 +414,20 @@ int FlowControlProtocol::sendReportReq() {
payloadPtr = this->decode(payloadPtr, len);
processor = (const char *) payloadPtr;
payloadPtr += len;
- logger_->log_info(
- "Flow Control Protocol receive report resp processor %s",
- processor.c_str());
+ logger_->log_info("Flow Control Protocol receive report resp processor %s", processor.c_str());
} else if (((FlowControlMsgID) msgID) == PROPERTY_NAME) {
uint32_t len;
payloadPtr = this->decode(payloadPtr, len);
propertyName = (const char *) payloadPtr;
payloadPtr += len;
- logger_->log_info(
- "Flow Control Protocol receive report resp property name %s",
- propertyName.c_str());
+ logger_->log_info("Flow Control Protocol receive report resp property name %s", propertyName.c_str());
} else if (((FlowControlMsgID) msgID) == PROPERTY_VALUE) {
uint32_t len;
payloadPtr = this->decode(payloadPtr, len);
propertyValue = (const char *) payloadPtr;
payloadPtr += len;
- logger_->log_info(
- "Flow Control Protocol receive report resp property value %s",
- propertyValue.c_str());
- this->_controller->updatePropertyValue(processor, propertyName,
- propertyValue);
+ logger_->log_info("Flow Control Protocol receive report resp property value %s", propertyValue.c_str());
+ this->_controller->updatePropertyValue(processor, propertyName, propertyValue);
} else {
break;
}
@@ -457,24 +436,21 @@ int FlowControlProtocol::sendReportReq() {
close(_socket);
_socket = 0;
return 0;
- } else if (hdr.status == RESP_TRIGGER_REGISTER
- && hdr.seqNumber == this->_seqNumber) {
+ } else if (hdr.status == RESP_TRIGGER_REGISTER && hdr.seqNumber == this->_seqNumber) {
logger_->log_info("Flow Control Protocol trigger reregister");
this->_registered = false;
this->_seqNumber++;
close(_socket);
_socket = 0;
return 0;
- } else if (hdr.status == RESP_STOP_FLOW_CONTROLLER
- && hdr.seqNumber == this->_seqNumber) {
+ } else if (hdr.status == RESP_STOP_FLOW_CONTROLLER && hdr.seqNumber == this->_seqNumber) {
logger_->log_info("Flow Control Protocol stop flow controller");
this->_controller->stop(true);
this->_seqNumber++;
close(_socket);
_socket = 0;
return 0;
- } else if (hdr.status == RESP_START_FLOW_CONTROLLER
- && hdr.seqNumber == this->_seqNumber) {
+ } else if (hdr.status == RESP_START_FLOW_CONTROLLER && hdr.seqNumber == this->_seqNumber) {
logger_->log_info("Flow Control Protocol start flow controller");
this->_controller->start();
this->_seqNumber++;
http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/77a20dbe/libminifi/src/FlowController.cpp
----------------------------------------------------------------------
diff --git a/libminifi/src/FlowController.cpp b/libminifi/src/FlowController.cpp
index c7df2e7..62cf21c 100644
--- a/libminifi/src/FlowController.cpp
+++ b/libminifi/src/FlowController.cpp
@@ -48,14 +48,9 @@ namespace minifi {
#define DEFAULT_CONFIG_NAME "conf/flow.yml"
-FlowController::FlowController(
- std::shared_ptr<core::Repository> provenance_repo,
- std::shared_ptr<core::Repository> flow_file_repo,
- std::shared_ptr<Configure> configure,
- std::unique_ptr<core::FlowConfiguration> flow_configuration,
- const std::string name, bool headless_mode)
- : core::controller::ControllerServiceProvider(
- core::getClassName<FlowController>()),
+FlowController::FlowController(std::shared_ptr<core::Repository> provenance_repo, std::shared_ptr<core::Repository> flow_file_repo, std::shared_ptr<Configure> configure,
+ std::unique_ptr<core::FlowConfiguration> flow_configuration, const std::string name, bool headless_mode)
+ : core::controller::ControllerServiceProvider(core::getClassName<FlowController>()),
root_(nullptr),
max_timer_driven_threads_(0),
max_event_driven_threads_(0),
@@ -64,14 +59,13 @@ FlowController::FlowController(
provenance_repo_(provenance_repo),
flow_file_repo_(flow_file_repo),
protocol_(0),
- controller_service_map_(
- std::make_shared<core::controller::ControllerServiceMap>()),
+ controller_service_map_(std::make_shared<core::controller::ControllerServiceMap>()),
timer_scheduler_(nullptr),
event_scheduler_(nullptr),
controller_service_provider_(nullptr),
flow_configuration_(std::move(flow_configuration)),
configuration_(configure),
- logger_(logging::LoggerFactory<FlowController>::getLogger()) {
+ logger_(logging::LoggerFactory<FlowController>::getLogger()) {
if (provenance_repo == nullptr)
throw std::runtime_error("Provenance Repo should not be null");
if (flow_file_repo == nullptr)
@@ -96,8 +90,7 @@ FlowController::FlowController(
if (!headless_mode) {
std::string rawConfigFileString;
- configure->get(Configure::nifi_flow_configuration_file,
- rawConfigFileString);
+ configure->get(Configure::nifi_flow_configuration_file, rawConfigFileString);
if (!rawConfigFileString.empty()) {
configuration_filename_ = rawConfigFileString;
@@ -107,8 +100,7 @@ FlowController::FlowController(
if (!configuration_filename_.empty()) {
// perform a naive determination if this is a relative path
if (configuration_filename_.c_str()[0] != '/') {
- adjustedFilename = adjustedFilename + configure->getHome() + "/"
- + configuration_filename_;
+ adjustedFilename = adjustedFilename + configure->getHome() + "/" + configuration_filename_;
} else {
adjustedFilename = configuration_filename_;
}
@@ -124,19 +116,16 @@ void FlowController::initializePaths(const std::string &adjustedFilename) {
path = realpath(adjustedFilename.c_str(), full_path);
if (path == NULL) {
- throw std::runtime_error(
- "Path is not specified. Either manually set MINIFI_HOME or ensure ../conf exists");
+ throw std::runtime_error("Path is not specified. Either manually set MINIFI_HOME or ensure ../conf exists");
}
std::string pathString(path);
configuration_filename_ = pathString;
- logger_->log_info("FlowController NiFi Configuration file %s",
- pathString.c_str());
+ logger_->log_info("FlowController NiFi Configuration file %s", pathString.c_str());
// Create the content repo directory if needed
struct stat contentDirStat;
- if (stat(ResourceClaim::default_directory_path, &contentDirStat)
- != -1&& S_ISDIR(contentDirStat.st_mode)) {
+ if (stat(ResourceClaim::default_directory_path, &contentDirStat) != -1 && S_ISDIR(contentDirStat.st_mode)) {
path = realpath(ResourceClaim::default_directory_path, full_path);
logger_->log_info("FlowController content directory %s", full_path);
} else {
@@ -149,9 +138,7 @@ void FlowController::initializePaths(const std::string &adjustedFilename) {
std::string clientAuthStr;
if (!path) {
- logger_->log_error(
- "Could not locate path from provided configuration file name (%s). Exiting.",
- full_path);
+ logger_->log_error("Could not locate path from provided configuration file name (%s). Exiting.", full_path);
exit(1);
}
}
@@ -179,8 +166,7 @@ void FlowController::stop(bool force) {
// Wait for sometime for thread stop
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
if (this->root_)
- this->root_->stopProcessing(this->timer_scheduler_.get(),
- this->event_scheduler_.get());
+ this->root_->stopProcessing(this->timer_scheduler_.get(), this->event_scheduler_.get());
}
}
@@ -196,13 +182,10 @@ void FlowController::stop(bool force) {
void FlowController::waitUnload(const uint64_t timeToWaitMs) {
if (running_) {
// use the current time and increment with the provided argument.
- std::chrono::system_clock::time_point wait_time =
- std::chrono::system_clock::now()
- + std::chrono::milliseconds(timeToWaitMs);
+ std::chrono::system_clock::time_point wait_time = std::chrono::system_clock::now() + std::chrono::milliseconds(timeToWaitMs);
// create an asynchronous future.
- std::future<void> unload_task = std::async(std::launch::async,
- [this]() {unload();});
+ std::future<void> unload_task = std::async(std::launch::async, [this]() {unload();});
if (std::future_status::ready == unload_task.wait_until(wait_time)) {
running_ = false;
@@ -233,32 +216,21 @@ void FlowController::load() {
if (!initialized_) {
logger_->log_info("Initializing timers");
if (nullptr == timer_scheduler_) {
- timer_scheduler_ = std::make_shared<TimerDrivenSchedulingAgent>(
- std::static_pointer_cast<core::controller::ControllerServiceProvider>(
- shared_from_this()),
- provenance_repo_, configuration_);
+ timer_scheduler_ = std::make_shared<TimerDrivenSchedulingAgent>(std::static_pointer_cast<core::controller::ControllerServiceProvider>(shared_from_this()), provenance_repo_, configuration_);
}
if (nullptr == event_scheduler_) {
- event_scheduler_ = std::make_shared<EventDrivenSchedulingAgent>(
- std::static_pointer_cast<core::controller::ControllerServiceProvider>(
- shared_from_this()),
- provenance_repo_, configuration_);
+ event_scheduler_ = std::make_shared<EventDrivenSchedulingAgent>(std::static_pointer_cast<core::controller::ControllerServiceProvider>(shared_from_this()), provenance_repo_, configuration_);
}
- logger_->log_info("Load Flow Controller from file %s",
- configuration_filename_.c_str());
+ logger_->log_info("Load Flow Controller from file %s", configuration_filename_.c_str());
- this->root_ = std::shared_ptr<core::ProcessGroup>(
- flow_configuration_->getRoot(configuration_filename_));
+ this->root_ = std::shared_ptr<core::ProcessGroup>(flow_configuration_->getRoot(configuration_filename_));
logger_->log_info("Loaded root processor Group");
- controller_service_provider_ = flow_configuration_
- ->getControllerServiceProvider();
+ controller_service_provider_ = flow_configuration_->getControllerServiceProvider();
- std::static_pointer_cast<core::controller::StandardControllerServiceProvider>(
- controller_service_provider_)->setRootGroup(root_);
- std::static_pointer_cast<core::controller::StandardControllerServiceProvider>(
- controller_service_provider_)->setSchedulingAgent(
+ std::static_pointer_cast<core::controller::StandardControllerServiceProvider>(controller_service_provider_)->setRootGroup(root_);
+ std::static_pointer_cast<core::controller::StandardControllerServiceProvider>(controller_service_provider_)->setSchedulingAgent(
std::static_pointer_cast<minifi::SchedulingAgent>(event_scheduler_));
logger_->log_info("Loaded controller service provider");
@@ -271,8 +243,7 @@ void FlowController::load() {
void FlowController::reload(std::string yamlFile) {
std::lock_guard<std::recursive_mutex> flow_lock(mutex_);
- logger_->log_info("Starting to reload Flow Controller with yaml %s",
- yamlFile.c_str());
+ logger_->log_info("Starting to reload Flow Controller with yaml %s", yamlFile.c_str());
stop(true);
unload();
std::string oldYamlFile = this->configuration_filename_;
@@ -281,8 +252,7 @@ void FlowController::reload(std::string yamlFile) {
start();
if (this->root_ != nullptr) {
this->configuration_filename_ = oldYamlFile;
- logger_->log_info("Rollback Flow Controller to YAML %s",
- oldYamlFile.c_str());
+ logger_->log_info("Rollback Flow Controller to YAML %s", oldYamlFile.c_str());
stop(true);
unload();
load();
@@ -297,10 +267,8 @@ void FlowController::loadFlowRepo() {
if (this->root_ != nullptr) {
this->root_->getConnections(connectionMap);
}
- logger_->log_debug("Number of connections from connectionMap %d",
- connectionMap.size());
- auto rep = std::dynamic_pointer_cast<core::repository::FlowFileRepository>(
- flow_file_repo_);
+ logger_->log_debug("Number of connections from connectionMap %d", connectionMap.size());
+ auto rep = std::dynamic_pointer_cast<core::repository::FlowFileRepository>(flow_file_repo_);
if (nullptr != rep) {
rep->setConnectionMap(connectionMap);
}
@@ -313,8 +281,7 @@ void FlowController::loadFlowRepo() {
bool FlowController::start() {
std::lock_guard<std::recursive_mutex> flow_lock(mutex_);
if (!initialized_) {
- logger_->log_error(
- "Can not start Flow Controller because it has not been initialized");
+ logger_->log_error("Can not start Flow Controller because it has not been initialized");
return false;
} else {
if (!running_) {
@@ -323,8 +290,7 @@ bool FlowController::start() {
this->timer_scheduler_->start();
this->event_scheduler_->start();
if (this->root_ != nullptr) {
- this->root_->startProcessing(this->timer_scheduler_.get(),
- this->event_scheduler_.get());
+ this->root_->startProcessing(this->timer_scheduler_.get(), this->event_scheduler_.get());
}
running_ = true;
this->protocol_->start();
@@ -346,11 +312,9 @@ bool FlowController::start() {
* @param id service identifier
* @param firstTimeAdded first time this CS was added
*/
-std::shared_ptr<core::controller::ControllerServiceNode> FlowController::createControllerService(
- const std::string &type, const std::string &id,
- bool firstTimeAdded) {
- return controller_service_provider_->createControllerService(type, id,
- firstTimeAdded);
+std::shared_ptr<core::controller::ControllerServiceNode> FlowController::createControllerService(const std::string &type, const std::string &id,
+bool firstTimeAdded) {
+ return controller_service_provider_->createControllerService(type, id, firstTimeAdded);
}
/**
@@ -361,8 +325,7 @@ std::shared_ptr<core::controller::ControllerServiceNode> FlowController::createC
* @param serviceNode service node to be removed.
*/
-void FlowController::removeControllerService(
- const std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+void FlowController::removeControllerService(const std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
controller_map_->removeControllerService(serviceNode);
}
@@ -370,8 +333,7 @@ void FlowController::removeControllerService(
* Enables the controller service services
* @param serviceNode service node which will be disabled, along with linked services.
*/
-void FlowController::enableControllerService(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+void FlowController::enableControllerService(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
return controller_service_provider_->enableControllerService(serviceNode);
}
@@ -379,16 +341,14 @@ void FlowController::enableControllerService(
* Enables controller services
* @param serviceNoden vector of service nodes which will be enabled, along with linked services.
*/
-void FlowController::enableControllerServices(
- std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> serviceNodes) {
+void FlowController::enableControllerServices(std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> serviceNodes) {
}
/**
* Disables controller services
* @param serviceNode service node which will be disabled, along with linked services.
*/
-void FlowController::disableControllerService(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+void FlowController::disableControllerService(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
controller_service_provider_->disableControllerService(serviceNode);
}
@@ -404,40 +364,33 @@ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> FlowContro
* @param id service identifier
* @return shared pointer to the controller service node or nullptr if it does not exist.
*/
-std::shared_ptr<core::controller::ControllerServiceNode> FlowController::getControllerServiceNode(
- const std::string &id) {
+std::shared_ptr<core::controller::ControllerServiceNode> FlowController::getControllerServiceNode(const std::string &id) {
return controller_service_provider_->getControllerServiceNode(id);
}
-void FlowController::verifyCanStopReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+void FlowController::verifyCanStopReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
}
/**
* Unschedules referencing components.
*/
-std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> FlowController::unscheduleReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- return controller_service_provider_->unscheduleReferencingComponents(
- serviceNode);
+std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> FlowController::unscheduleReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ return controller_service_provider_->unscheduleReferencingComponents(serviceNode);
}
/**
* Verify can disable referencing components
* @param serviceNode service node whose referenced components will be scheduled.
*/
-void FlowController::verifyCanDisableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- controller_service_provider_->verifyCanDisableReferencingServices(
- serviceNode);
+void FlowController::verifyCanDisableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ controller_service_provider_->verifyCanDisableReferencingServices(serviceNode);
}
/**
* Disables referencing components
* @param serviceNode service node whose referenced components will be scheduled.
*/
-std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> FlowController::disableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> FlowController::disableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
return controller_service_provider_->disableReferencingServices(serviceNode);
}
@@ -445,8 +398,7 @@ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> FlowContro
* Verify can enable referencing components
* @param serviceNode service node whose referenced components will be scheduled.
*/
-void FlowController::verifyCanEnableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+void FlowController::verifyCanEnableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
controller_service_provider_->verifyCanEnableReferencingServices(serviceNode);
}
@@ -461,8 +413,7 @@ bool FlowController::isControllerServiceEnabled(const std::string &identifier) {
* Enables referencing components
* @param serviceNode service node whose referenced components will be scheduled.
*/
-std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> FlowController::enableReferencingServices(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> FlowController::enableReferencingServices(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
return controller_service_provider_->enableReferencingServices(serviceNode);
}
@@ -470,20 +421,16 @@ std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> FlowContro
* Schedules referencing components
* @param serviceNode service node whose referenced components will be scheduled.
*/
-std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> FlowController::scheduleReferencingComponents(
- std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
- return controller_service_provider_->scheduleReferencingComponents(
- serviceNode);
+std::vector<std::shared_ptr<core::controller::ControllerServiceNode>> FlowController::scheduleReferencingComponents(std::shared_ptr<core::controller::ControllerServiceNode> &serviceNode) {
+ return controller_service_provider_->scheduleReferencingComponents(serviceNode);
}
/**
* Returns controller service components referenced by serviceIdentifier from the embedded
* controller service provider;
*/
-std::shared_ptr<core::controller::ControllerService> FlowController::getControllerServiceForComponent(
- const std::string &serviceIdentifier, const std::string &componentId) {
- return controller_service_provider_->getControllerServiceForComponent(
- serviceIdentifier, componentId);
+std::shared_ptr<core::controller::ControllerService> FlowController::getControllerServiceForComponent(const std::string &serviceIdentifier, const std::string &componentId) {
+ return controller_service_provider_->getControllerServiceForComponent(serviceIdentifier, componentId);
}
/**