mgmt: refactor management modules to use ControlCommand
Change-Id: Icf5e10f2f2d0b95c85fd871e6484c3ed58ed6c46
diff --git a/daemon/mgmt/manager-base.cpp b/daemon/mgmt/manager-base.cpp
index af5fc37..08d845c 100644
--- a/daemon/mgmt/manager-base.cpp
+++ b/daemon/mgmt/manager-base.cpp
@@ -77,6 +77,24 @@
m_face->put(*responseData);
}
+bool
+ManagerBase::validateParameters(const ControlCommand& command,
+ ControlParameters& parameters)
+{
+ try
+ {
+ command.validateRequest(parameters);
+ }
+ catch (const ControlCommand::ArgumentError& error)
+ {
+ return false;
+ }
+
+ command.applyDefaultsToRequest(parameters);
+
+ return true;
+}
+
void
ManagerBase::onCommandValidationFailed(const shared_ptr<const Interest>& command,
const std::string& error)