arpadboda commented on a change in pull request #573: minificpp-873 Implmented. URL: https://github.com/apache/nifi-minifi-cpp/pull/573#discussion_r288947245
########## File path: extensions/windows-event-log/CollectorInitiatedSubscription.cpp ########## @@ -0,0 +1,789 @@ +/** + * @file CollectorInitiatedSubscription.cpp + CollectorInitiatedSubscription class implementation + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "CollectorInitiatedSubscription.h" +#include <vector> +#include <queue> +#include <map> +#include <vector> +#include <set> +#include <sstream> +#include <stdio.h> +#include <string> +#include <iostream> +#include <memory> +#include <codecvt> + +#include "io/DataStream.h" +#include "core/ProcessContext.h" +#include "core/ProcessSession.h" +#include "utils/ScopeGuard.h" + +#pragma comment(lib, "wevtapi.lib") +#pragma comment(lib, "Wecapi.lib") + +namespace org { +namespace apache { +namespace nifi { +namespace minifi { +namespace processors { + +#define LOG_SUBSCRIPTION_ERROR(error) logError(__LINE__, error) +#define LOG_SUBSCRIPTION_WINDOWS_ERROR(info) logWindowsError(__LINE__, info) + +struct ISupportedProperty { + void virtual Init(const std::shared_ptr<core::ProcessContext>& context) = 0; +}; + +class SuportedProperties { + std::vector<ISupportedProperty*> vISupportedProperty_; + std::set<core::Property> sSupportedProperties_; + +public: + template <typename T> + void add(T& t) + { + vISupportedProperty_.emplace_back(&t); + sSupportedProperties_.insert(t); + } + + void init(const std::shared_ptr<core::ProcessContext>& context) { + for (auto pProp : vISupportedProperty_) { + pProp->Init(context); + } + } + + operator std::set<core::Property>() const + { + return sSupportedProperties_; + } +}; + +static SuportedProperties s_supportedProperties; Review comment: Why do we need this as a global static? Another concern I have here is someone configuring two of these processors. As all the properties are shared that's not gonna work as expected. In case the goal is to to have at most one of this, we should: -Clearly state that in docs -Avoid instantiation of a 2nd one -Have to think over how this gonna work via C2 manifest as it should also block designing a flow that contains two of this. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
