From: Changgyu Choi Date: Tue, 22 Apr 2025 05:54:39 +0000 (+0900) Subject: Modify json schema X-Git-Tag: accepted/tizen/unified/20250514.114137~18^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2f215e9431f103b9a8d4b93349e63100c3606d02;p=platform%2Fcore%2Fappfw%2Ftizen-action.git Modify json schema packageid has been deleted. Signed-off-by: Changgyu Choi --- diff --git a/CMakeLists.txt b/CMakeLists.txt index bf9f709..2e99f32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,7 @@ PKG_CHECK_MODULES(PKGMGR_INFO_DEPS REQUIRED pkgmgr-info) PKG_CHECK_MODULES(PKGMGR_INSTALLER_DEPS REQUIRED pkgmgr-installer) PKG_CHECK_MODULES(RPC_PORT_DEPS REQUIRED rpc-port) PKG_CHECK_MODULES(TIZEN_DATABASE_DEPS REQUIRED tizen-database) +PKG_CHECK_MODULES(RAPID_JSON_DEPS REQUIRED RapidJSON) ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(tool) diff --git a/packaging/tizen-action-framework.spec b/packaging/tizen-action-framework.spec index 014f77f..fcb87e7 100644 --- a/packaging/tizen-action-framework.spec +++ b/packaging/tizen-action-framework.spec @@ -27,6 +27,7 @@ BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(pkgmgr-installer) BuildRequires: pkgconfig(rpc-port) BuildRequires: pkgconfig(tizen-database) +BuildRequires: pkgconfig(RapidJSON) %if 0%{?gcov:1} BuildRequires: lcov diff --git a/src/action/CMakeLists.txt b/src/action/CMakeLists.txt index 43e09a9..7aa6a96 100644 --- a/src/action/CMakeLists.txt +++ b/src/action/CMakeLists.txt @@ -17,6 +17,7 @@ APPLY_PKG_CONFIG(${TARGET_TIZEN_ACTION} PUBLIC PKGMGR_INFO_DEPS TIZEN_DATABASE_DEPS RPC_PORT_DEPS + RAPID_JSON_DEPS ) TARGET_LINK_LIBRARIES(${TARGET_TIZEN_ACTION} PUBLIC ${TARGET_TIZEN_ACTION_COMMON} "-ldl") diff --git a/src/action/action_request_handler.cc b/src/action/action_request_handler.cc index f943ddd..37127c7 100755 --- a/src/action/action_request_handler.cc +++ b/src/action/action_request_handler.cc @@ -25,10 +25,10 @@ #include "action/action_request_handler.hh" #include "action/service.hh" #include "action/sqlite_db.hh" +#include "action/utils/action_model_converter.hh" +#include "action/utils/action_validator.hh" #include "action_request_handler.hh" #include "common/utils/logging.hh" -#include "utils/action_model_converter.hh" -#include "utils/action_model_validator.hh" namespace { @@ -115,6 +115,21 @@ std::string GetStringFromParameterType(common::ParameterType type) { return ""; } +void FillActionModelInfo(common::ActionModel& model, + const common::ActionSchema& schema) { + model.SetType(schema.GetType()); + switch (schema.GetType()) { + case common::ActionType::AppControl: + model.SetExtraInfo(schema.GetAppId()); + break; + case common::ActionType::Plugin: + model.SetExtraInfo("plugin-path"); // TODO: Set plugin path + break; + default: + break; + } +} + } // namespace namespace action { @@ -136,10 +151,9 @@ std::vector ActionRequestHandler::OnListActions() { common::ActionSchema schema(item); rpc::ActionSchema action; action.Setaction_id(schema.GetActionId()); - action.Setpackage_id(schema.GetPackageId()); action.Setcategory(schema.GetCategory()); action.Setdescription(schema.GetDescription()); - action.Settype("app_control"); // TODO + action.Settype(ActionModelConverter().ActionTypeToString(schema.GetType())); // action.Setparameters(); // action.Setprivileges(); actions.push_back(action); @@ -154,17 +168,17 @@ rpc::ActionSchema ActionRequestHandler::OnGetAction(const std::string& id) { rpc::ActionSchema action; action.Setaction_id(schema.GetActionId()); - action.Setpackage_id(schema.GetPackageId()); action.Setcategory(schema.GetCategory()); action.Setdescription(schema.GetDescription()); - action.Settype("app_control"); // TODO + action.Settype(ActionModelConverter().ActionTypeToString(schema.GetType())); std::vector actionparams; auto params = schema.GetParameters(); for (auto const& iter : params) { - auto param = rpc::Parameter(iter.GetName(), GetStringFromParameterType(iter.GetType()), - "", iter.GetDescription(), iter.GetIsRequired()); + auto param = rpc::Parameter(iter.GetName(), + GetStringFromParameterType(iter.GetType()), + iter.GetDescription(), iter.GetIsRequired()); actionparams.push_back(param); } @@ -182,22 +196,27 @@ void ActionRequestHandler::OnExecute(const std::string& instance, pid_t pid, uid_t uid, rpc::ActionModel& action) { auto db = std::make_unique(); std::string schema_json = db->GetAction(action.Getaction_id()); - common::ActionSchema schema(schema_json); - LOG(DEBUG) << "OnExecute action : " << schema.GetActionId() << " appid: " << schema.GetPackageId(); + std::string error; - common::ActionModel model(action.Getjson()); - if (!ActionModelValidator().CheckValid(schema, model)) { - LOG(ERROR) << "Invalid model : " << action.Getjson(); + if (!ActionValidator().CheckModelValid(schema_json, action.Getjson(), + error)) { + LOG(ERROR) << "Invalid model. error: " << error; return; } + common::ActionSchema schema(schema_json); + LOG(DEBUG) << "OnExecute action : " << schema.GetActionId(); + + common::ActionModel model(action.Getjson()); + model.SetType(schema.GetType()); + FillActionModelInfo(model, schema); + auto required_privileges = db->GetRequiredPrivileges(model.GetId()); if (!CheckPrivileges(pid, uid, required_privileges)) { LOG(ERROR) << "Not allowed to execute action due to missing privileges"; return; } - model.SetType(schema.GetType()); auto executor = ActionExecutorFactory::CreateExecutor(instance, model); executor->SetResultHandler(this); executor->Execute(model); @@ -205,16 +224,17 @@ void ActionRequestHandler::OnExecute(const std::string& instance, pid_t pid, } void ActionRequestHandler::RegisterRequestReplyHandler( - const std::string& requester, IRequestReplyHandler* handler) { + const std::string& requester, + IRequestReplyHandler* handler) { reply_handlers_.emplace(requester, handler); } void ActionRequestHandler::UnregisterRequestReplyHandler( const std::string& requester) { auto it = std::find_if(reply_handlers_.begin(), reply_handlers_.end(), - [requester](const auto& iterator) { - return iterator.first == requester; - }); + [requester](const auto& iterator) { + return iterator.first == requester; + }); if (it != reply_handlers_.end()) reply_handlers_.erase(it); else @@ -225,10 +245,10 @@ void ActionRequestHandler::OnResult(const std::string& requester, const std::string& result) { LOG(DEBUG) << "OnResult : " << result << ", from : " << requester; auto it = std::find_if(reply_handlers_.begin(), reply_handlers_.end(), - [requester](const auto& iterator) { - return iterator.first == requester; - }); - if (it!= reply_handlers_.end()) + [requester](const auto& iterator) { + return iterator.first == requester; + }); + if (it != reply_handlers_.end()) it->second->SendRequestReply(result); else LOG(WARNING) << "No handler found for requester :" << requester; diff --git a/src/action/app_control_executor.cc b/src/action/app_control_executor.cc index 5929b20..af33147 100644 --- a/src/action/app_control_executor.cc +++ b/src/action/app_control_executor.cc @@ -35,14 +35,12 @@ app_control_h ConvertToAppControl(const common::ActionModel& action_model) { } // TODO: Convert to app_control handle from action model - app_control_set_app_id(handle, action_model.GetPackageId().c_str()); + app_control_set_app_id(handle, action_model.GetAppId().c_str()); auto params = action_model.GetParameters(); - for (auto const& [key, value] : params) { + for (auto const& [key, value] : params) LOG(DEBUG) << "param name : " << key << ", val : " << value; - app_control_add_extra_data(handle, key.c_str(), value.c_str()); - } return handle; } diff --git a/src/action/utils/action_model_converter.cc b/src/action/utils/action_model_converter.cc index 8b0d1ae..27c39b3 100644 --- a/src/action/utils/action_model_converter.cc +++ b/src/action/utils/action_model_converter.cc @@ -9,7 +9,6 @@ plugin_proxy::ActionModel ActionModelConverter::ConvertToAction( const common::ActionModel& model) { plugin_proxy::ActionModel action; action.Setaction_id(model.GetId()); - action.Setpackage_id(model.GetPackageId()); action.Setjson(model.GetJson()); // action.Setresults(); diff --git a/src/action/utils/action_model_validator.cc b/src/action/utils/action_model_validator.cc deleted file mode 100644 index 5a02381..0000000 --- a/src/action/utils/action_model_validator.cc +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed 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 "action_model_validator.hh" - -namespace action { - -bool ActionModelValidator::CheckValid( - const common::ActionSchema& schema, - const common::ActionModel& model) const { - // TODO: Implement this. - return false; -} - -} // namespace action diff --git a/src/action/utils/action_model_validator.hh b/src/action/utils/action_model_validator.hh deleted file mode 100644 index e72332b..0000000 --- a/src/action/utils/action_model_validator.hh +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed 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. - */ - -#ifndef ACTION_ACTION_MODEL_VALIDATOR_HH_ -#define ACTION_ACTION_MODEL_VALIDATOR_HH_ - -#include "common/action_model.h" -#include "common/action_schema.h" - -namespace action { - -class ActionModelValidator { - public: - ActionModelValidator() = default; - - bool CheckValid(const common::ActionSchema& schema, - const common::ActionModel& model) const; -}; - -} // namespace action - -#endif // ACTION_ACTION_MODEL_VALIDATOR_HH_ diff --git a/src/action/utils/action_validator.cc b/src/action/utils/action_validator.cc new file mode 100644 index 0000000..7e74118 --- /dev/null +++ b/src/action/utils/action_validator.cc @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed 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 "action_validator.hh" + +#include +#include +#include + +namespace action { +bool ActionValidator::CheckSchemaValid(const std::string& schemajson) const { + // TODO: implement this. + return false; +} + +bool ActionValidator::CheckModelValid(const std::string& schemajson, + const std::string& modeljson, + std::string& errMsg) const { + // TODO: implement this. + return true; +} + +} // namespace action diff --git a/src/action/utils/action_validator.hh b/src/action/utils/action_validator.hh new file mode 100644 index 0000000..72f3a53 --- /dev/null +++ b/src/action/utils/action_validator.hh @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed 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. + */ + +#ifndef ACTION_ACTION_VALIDATOR_HH_ +#define ACTION_ACTION_VALIDATOR_HH_ + +#include + +namespace action { + +class ActionValidator { + public: + ActionValidator() = default; + bool CheckSchemaValid(const std::string& schemajson) const; + bool CheckModelValid(const std::string& schemajson, + const std::string& modeljson, std::string& errMsg) const; +}; + +} // namespace action + +#endif // ACTION_ACTION_VALIDATOR_HH_ diff --git a/src/common/action_model.cc b/src/common/action_model.cc index 2582052..a384fd5 100644 --- a/src/common/action_model.cc +++ b/src/common/action_model.cc @@ -44,7 +44,6 @@ ActionModel::ActionModel(std::string json_str) : json_str_(std::move(json_str)) { Json::Value root = ParseJsonFromString(json_str_); action_id_ = root["name"].asString(); - package_id_ = root["packageId"].asString(); for (auto const& it : root["params"].getMemberNames()) { std::string key = it; std::string value = root["params"][key].asString(); @@ -56,8 +55,18 @@ const std::string& ActionModel::GetId() const { return action_id_; } -const std::string& ActionModel::GetPackageId() const { - return package_id_; +std::string ActionModel::GetAppId() const { + if (type_ != ActionType::AppControl) + return ""; + + return extra_info_; +} + +std::string ActionModel::GetPluginPath() const { + if (type_ != ActionType::Plugin) + return ""; + + return extra_info_; } const ActionType ActionModel::GetType() const { @@ -77,4 +86,12 @@ const std::string& ActionModel::GetJson() const { return json_str_; } +const std::string& ActionModel::GetExtraInfo() const { + return extra_info_; +} + +void ActionModel::SetExtraInfo(std::string info) { + extra_info_ = std::move(info); +} + } // namespace common diff --git a/src/common/action_model.h b/src/common/action_model.h index 28c061c..b9e5996 100644 --- a/src/common/action_model.h +++ b/src/common/action_model.h @@ -30,15 +30,19 @@ class ActionModel { ActionModel() = default; explicit ActionModel(std::string json_str); const std::string& GetId() const; - const std::string& GetPackageId() const; + std::string GetAppId() const; + std::string GetPluginPath() const; const ActionType GetType() const; void SetType(ActionType type); const std::vector>& GetParameters() const; const std::string& GetJson() const; + const std::string& GetExtraInfo() const; + void SetExtraInfo(std::string info); + private: std::string action_id_; - std::string package_id_; + std::string extra_info_; // app_control: appid, plugin: plugin path std::string json_str_; ActionType type_ = ActionType::InvalidType; std::vector> parameters_; diff --git a/src/common/action_schema.cc b/src/common/action_schema.cc index 100f985..d1c0dd8 100644 --- a/src/common/action_schema.cc +++ b/src/common/action_schema.cc @@ -74,7 +74,7 @@ ActionSchema::ActionSchema(const std::string& json_str) { Json::Value root = ParseJsonFromString(json_str); action_id_ = root["name"].asString(); - package_id_ = root["appId"].asString(); // TODO: Change to packageId. + appid_ = root["appId"].asString(); // TODO: Change to details::appId category_ = root["category"].asString(); description_ = root["desc"].asString(); type_ = GetActionTypeFromString(root["type"].asString()); @@ -107,11 +107,11 @@ ActionSchema::ActionSchema(const std::string& json_str) { } } -ActionSchema::ActionSchema(std::string action_id, std::string package_id, +ActionSchema::ActionSchema(std::string action_id, std::string appid, std::string category, std::string description, std::vector parameters, std::vector privileges) - : action_id_(std::move(action_id)), package_id_(std::move(package_id)), + : action_id_(std::move(action_id)), appid_(std::move(appid)), category_(std::move(category)), description_(std::move(description)), parameters_(std::move(parameters)), privileges_(std::move(privileges)) { } @@ -124,12 +124,12 @@ void ActionSchema::SetActionId(std::string action_id) { action_id_ = std::move(action_id); } -const std::string& ActionSchema::GetPackageId() const { - return package_id_; +const std::string& ActionSchema::GetAppId() const { + return appid_; } -void ActionSchema::SetPackageId(std::string package_id) { - package_id_ = std::move(package_id); +void ActionSchema::SetAppId(std::string appid) { + appid_ = std::move(appid); } const std::string& ActionSchema::GetCategory() const { diff --git a/src/common/action_schema.h b/src/common/action_schema.h index dee77bf..ea26e1b 100644 --- a/src/common/action_schema.h +++ b/src/common/action_schema.h @@ -29,7 +29,7 @@ class ActionSchema { public: ActionSchema(); explicit ActionSchema(const std::string& json_str); - explicit ActionSchema(std::string action_id, std::string package_id, + explicit ActionSchema(std::string action_id, std::string appid, std::string category, std::string description, std::vector parameters, std::vector privileges); @@ -37,8 +37,8 @@ class ActionSchema { const std::string& GetActionId() const; void SetActionId(std::string action_id); - const std::string& GetPackageId() const; - void SetPackageId(std::string package_id); + const std::string& GetAppId() const; + void SetAppId(std::string app_id); const std::string& GetCategory() const; void SetCategory(std::string category); @@ -60,7 +60,7 @@ class ActionSchema { private: std::string action_id_; - std::string package_id_; + std::string appid_; std::string category_; ActionType type_ = ActionType::InvalidType; std::string description_; diff --git a/src/plugin-daemon/main.cc b/src/plugin-daemon/main.cc index 8d24427..df2f3bb 100644 --- a/src/plugin-daemon/main.cc +++ b/src/plugin-daemon/main.cc @@ -78,8 +78,7 @@ class PluginService private: void PrintAction(const rpc_port::plugin_manager_stub::ActionModel& action) { - LOG(INFO) << "Action id: " << action.Getaction_id(); - LOG(INFO) << "Package id: " << action.Getpackage_id(); + LOG(INFO) << "Action name: " << action.Getaction_id(); LOG(INFO) << "Json: " << action.Getjson(); } }; diff --git a/test/unit_tests/action_model_converter_test.cc b/test/unit_tests/action_model_converter_test.cc index 1b52544..b621b6a 100644 --- a/test/unit_tests/action_model_converter_test.cc +++ b/test/unit_tests/action_model_converter_test.cc @@ -7,7 +7,6 @@ TEST(ActionModelConverterTest, ConvertToAction) { std::string json = R"({ "name": "test_action", - "packageId": "com.example.test", "params": { "param": "value", } @@ -18,7 +17,6 @@ TEST(ActionModelConverterTest, ConvertToAction) { ActionModelConverter().ConvertToAction(common_model); EXPECT_EQ(action.Getaction_id(), "test_action"); - EXPECT_EQ(action.Getpackage_id(), "com.example.test"); EXPECT_EQ(action.Getjson(), json); } diff --git a/test/unit_tests/action_model_test.cc b/test/unit_tests/action_model_test.cc index 23f83dc..8bda090 100644 --- a/test/unit_tests/action_model_test.cc +++ b/test/unit_tests/action_model_test.cc @@ -6,7 +6,6 @@ using namespace common; TEST(ActionModelTest, JsonInitialization) { ActionModel model(R"({ "name": "new_action", - "packageId": "new_package", "params": { "param1": "hello1", "param2": "hello2", @@ -16,7 +15,6 @@ TEST(ActionModelTest, JsonInitialization) { model.SetType(ActionType::AppControl); EXPECT_EQ("new_action", model.GetId()); - EXPECT_EQ("new_package", model.GetPackageId()); EXPECT_EQ(2, model.GetParameters().size()); const auto& parameters = model.GetParameters(); EXPECT_EQ(2, parameters.size()); @@ -30,7 +28,7 @@ TEST(ActionModelTest, JsonInitialization) { TEST(ActionModelTest, EmptyInitialization) { ActionModel model; EXPECT_EQ("", model.GetId()); - EXPECT_EQ("", model.GetPackageId()); + EXPECT_EQ("", model.GetAppId()); EXPECT_EQ(0, model.GetParameters().size()); EXPECT_EQ(ActionType::InvalidType, model.GetType()); } diff --git a/test/unit_tests/action_schema_test.cc b/test/unit_tests/action_schema_test.cc index 05afaf8..82ef9e0 100644 --- a/test/unit_tests/action_schema_test.cc +++ b/test/unit_tests/action_schema_test.cc @@ -42,7 +42,7 @@ protected: TEST_F(ActionSchemaTest, ValidJsonParsing) { ActionSchema schema(valid_json_); EXPECT_EQ(schema.GetActionId(), "test_action"); - EXPECT_EQ(schema.GetPackageId(), "com.example.app"); + EXPECT_EQ(schema.GetAppId(), "com.example.app"); EXPECT_EQ(schema.GetCategory(), "test_category"); EXPECT_EQ(schema.GetDescription(), "Test action description"); EXPECT_EQ(schema.GetType(), ActionType::AppControl); @@ -67,7 +67,7 @@ TEST_F(ActionSchemaTest, ValidJsonParsing) { TEST_F(ActionSchemaTest, InvalidJsonParsing) { ActionSchema invalid_schema(invalid_json_); EXPECT_EQ(invalid_schema.GetActionId().empty(), true); - EXPECT_EQ(invalid_schema.GetPackageId().empty(), true); + EXPECT_EQ(invalid_schema.GetAppId().empty(), true); EXPECT_EQ(invalid_schema.GetCategory().empty(), true); EXPECT_EQ(invalid_schema.GetDescription().empty(), true); EXPECT_EQ(invalid_schema.GetType(), ActionType::InvalidType); @@ -76,13 +76,13 @@ TEST_F(ActionSchemaTest, InvalidJsonParsing) { TEST_F(ActionSchemaTest, SettersAndGetters) { ActionSchema schema; schema.SetActionId("new_id"); - schema.SetPackageId("new_package"); + schema.SetAppId("new_package"); schema.SetCategory("new_category"); schema.SetDescription("new_desc"); schema.SetType(ActionType::Plugin); EXPECT_EQ(schema.GetActionId(), "new_id"); - EXPECT_EQ(schema.GetPackageId(), "new_package"); + EXPECT_EQ(schema.GetAppId(), "new_package"); EXPECT_EQ(schema.GetCategory(), "new_category"); EXPECT_EQ(schema.GetDescription(), "new_desc"); EXPECT_EQ(schema.GetType(), ActionType::Plugin); @@ -101,7 +101,7 @@ TEST_F(ActionSchemaTest, ParameterTypeConversion) { TEST_F(ActionSchemaTest, DefaultConstructor) { ActionSchema default_schema; EXPECT_TRUE(default_schema.GetActionId().empty()); - EXPECT_TRUE(default_schema.GetPackageId().empty()); + EXPECT_TRUE(default_schema.GetAppId().empty()); EXPECT_TRUE(default_schema.GetCategory().empty()); EXPECT_TRUE(default_schema.GetDescription().empty()); EXPECT_EQ(default_schema.GetType(), ActionType::InvalidType); diff --git a/tidl/tizen_action_datatype.tidl b/tidl/tizen_action_datatype.tidl index e3cbb7d..fbe76f8 100644 --- a/tidl/tizen_action_datatype.tidl +++ b/tidl/tizen_action_datatype.tidl @@ -3,7 +3,6 @@ protocol 2 struct Parameter { string key; string type; - string value; string description; bool is_requied; } @@ -15,7 +14,6 @@ struct Result { struct ActionSchema { string action_id; - string package_id; string category; string description; string type; @@ -27,7 +25,6 @@ struct ActionSchema { struct ActionModel { string action_id; - string package_id; string json; } diff --git a/tool/action_tool/tools/execute.cc b/tool/action_tool/tools/execute.cc index 534ed63..030dbbb 100644 --- a/tool/action_tool/tools/execute.cc +++ b/tool/action_tool/tools/execute.cc @@ -60,7 +60,7 @@ class Execute : public ActionTool, IEventListener { public: Execute() - : ActionTool("execute", "Execute", "execute "), + : ActionTool("execute", "Execute", "execute "), proxy_(this, kStubAppId) {} virtual ~Execute() {} @@ -95,7 +95,7 @@ class Execute : public ActionTool, } int Run(int argc, char** argv) override { - if (argc < 4) { + if (argc < 3) { Usage(); return -1; } @@ -104,12 +104,10 @@ class Execute : public ActionTool, std::vector actionparams; std::string action_id = std::string(argv[2]); - std::string package_id = std::string(argv[3]); - std::string json = std::string(argv[4]); + std::string json = std::string(argv[3]); action.Setaction_id(action_id); - action.Setpackage_id(package_id); - _E("id : %s, package_id : %s", action_id.c_str(), package_id.c_str()); + _E("action name: %s", action_id.c_str()); action.Setjson(json); try { int ret = proxy_.Execute(action); diff --git a/tool/action_tool/tools/get_action.cc b/tool/action_tool/tools/get_action.cc index f869309..89d2d65 100644 --- a/tool/action_tool/tools/get_action.cc +++ b/tool/action_tool/tools/get_action.cc @@ -71,7 +71,6 @@ class GetAction : public ActionTool, try { auto action = proxy_.GetAction(std::move(action_id)); _D("id: %s --------------------", action.Getaction_id().c_str()); - _D("package: %s", action.Getpackage_id().c_str()); _D("category: %s", action.Getcategory().c_str()); _D("description: %s", action.Getdescription().c_str()); diff --git a/tool/action_tool/tools/list_actions.cc b/tool/action_tool/tools/list_actions.cc index e7db487..51d6503 100644 --- a/tool/action_tool/tools/list_actions.cc +++ b/tool/action_tool/tools/list_actions.cc @@ -64,7 +64,7 @@ class ListActions : public ActionTool, _D("Actions cnt(%zu)", actions.size()); for (auto action : actions) { _D("id: %s --------------------", action.Getaction_id().c_str()); - _D("package_id: %s", action.Getpackage_id().c_str()); + _D("type: %s", action.Gettype().c_str()); _D("category: %s", action.Getcategory().c_str()); _D("description: %s", action.Getdescription().c_str());