fgerlits commented on code in PR #2152:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2152#discussion_r3155534324
##########
extension-framework/cpp-extension-lib/include/api/utils/ProcessorConfigUtils.h:
##########
@@ -167,4 +167,28 @@ std::optional<T> parseOptionalEnumProperty(const
core::ProcessContext& context,
return result.value();
}
+template<typename ControllerServiceType>
+ControllerServiceType* parseOptionalControllerService(const
core::ProcessContext& context, const minifi::core::PropertyReference& prop) {
+ const auto controller_service_name = context.getProperty(prop.name);
+ if (!controller_service_name || controller_service_name->empty()) {
+ return nullptr;
+ }
+
+ nonstd::expected<MinifiControllerService*, std::error_code> service =
context.getControllerService(*controller_service_name,
minifi::core::className<ControllerServiceType>());
Review Comment:
this will need to be fixed on rebase: `nonstd` -> `std`
##########
extension-framework/cpp-extension-lib/src/core/ProcessContext.cpp:
##########
@@ -38,4 +38,17 @@ bool ProcessContext::hasNonEmptyProperty(std::string_view
name) const {
return MinifiProcessContextHasNonEmptyProperty(impl_,
utils::toStringView(name));
}
+nonstd::expected<MinifiControllerService*, std::error_code>
ProcessContext::getControllerService(const std::string_view
controller_service_name,
+ const std::string_view controller_service_class) const {
+ void* controller_service = nullptr;
Review Comment:
I think this is another thing that you'll fix during rebase without me
commenting, but this should be `MinifiControllerService*` instead of `void*`.
##########
extension-framework/cpp-extension-lib/include/api/core/Resource.h:
##########
@@ -145,4 +150,43 @@ void useProcessorClassDescription(Fn&& fn) {
fn(description);
}
+template<typename Class, typename Fn>
+void useControllerServiceClassDescription(Fn&& fn) {
+ std::vector<std::vector<MinifiStringView>> string_vector_cache;
+
+ const auto full_name = minifi::core::className<Class>();
+
+ std::vector<MinifiPropertyDefinition> class_properties =
utils::toProperties(Class::Properties, string_vector_cache);
+
+ MinifiControllerServiceClassDefinition description{.full_name =
utils::toStringView(full_name),
Review Comment:
I know it doesn't matter, but it hurts my OCD that this kind of object is
called a "description" everywhere, but the name of the class is "...Definition".
If it's not too much work to change it, it would be better if this was a
"definition" everywhere or a "description" everywhere, including the class name.
##########
libminifi/test/libtest/unit/TestBase.cpp:
##########
@@ -360,6 +360,27 @@ minifi::Connection*
TestPlan::addConnection(minifi::core::Processor* source_proc
return retVal;
}
+std::shared_ptr<minifi::core::controller::ControllerServiceNode>
TestPlan::addController(const std::string& name, const
std::shared_ptr<core::controller::ControllerService>& cs) {
Review Comment:
Why do we need this new version of `addController`? We only seem to be using
the old version.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]