From 8cf41b1d02e33c86169469ea138b8035fd7622aa Mon Sep 17 00:00:00 2001 From: Will Sobel Date: Thu, 22 May 2025 16:03:48 -0400 Subject: [PATCH] checkpoint --- agent_lib/CMakeLists.txt | 2 ++ error.cpp | 37 ++++++++++++++++++++++++++++++ error.hpp | 49 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 error.cpp create mode 100644 error.hpp diff --git a/agent_lib/CMakeLists.txt b/agent_lib/CMakeLists.txt index bf25989d4..37cfdef25 100644 --- a/agent_lib/CMakeLists.txt +++ b/agent_lib/CMakeLists.txt @@ -260,6 +260,7 @@ set(AGENT_SOURCES # src/sink/rest_sink HEADER_FILE_ONLY "${SOURCE_DIR}/sink/rest_sink/cached_file.hpp" + "${SOURCE_DIR}/sink/rest_sink/error.hpp" "${SOURCE_DIR}/sink/rest_sink/file_cache.hpp" "${SOURCE_DIR}/sink/rest_sink/parameter.hpp" "${SOURCE_DIR}/sink/rest_sink/request.hpp" @@ -274,6 +275,7 @@ set(AGENT_SOURCES # src/sink/rest_sink SOURCE_FILES_ONLY + "${SOURCE_DIR}/sink/rest_sink/error.cpp" "${SOURCE_DIR}/sink/rest_sink/file_cache.cpp" "${SOURCE_DIR}/sink/rest_sink/rest_service.cpp" "${SOURCE_DIR}/sink/rest_sink/server.cpp" diff --git a/error.cpp b/error.cpp new file mode 100644 index 000000000..ddf80c038 --- /dev/null +++ b/error.cpp @@ -0,0 +1,37 @@ +// +// Copyright Copyright 2009-2024, AMT – The Association For Manufacturing Technology (“AMT”) +// 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 "error.hpp" +#include "mtconnect/entity/factory.hpp" + +namespace mtconnect::sink::rest_sink { + using namespace mtconnect::entity; + using namespace std; + + entity::FactoryPtr Error::getFactory() + { + static auto error = make_shared(Requirements {{"errorCode", true}, + {"URI", true}, + {"ErrorMessage", false}}); + + return error; + } + + + +} + diff --git a/error.hpp b/error.hpp new file mode 100644 index 000000000..5fcf5f7bb --- /dev/null +++ b/error.hpp @@ -0,0 +1,49 @@ +// +// Copyright Copyright 2009-2024, AMT – The Association For Manufacturing Technology (“AMT”) +// 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 "mtconnect/entity/entity.hpp" + +namespace mtconnect::sink::rest_sink { + + class QueryParameter : public mtconnect::entity::Entity + { + + + }; + + class AGENT_LIB_API Error : public mtconnect::entity::Entity { + public: + Error(const std::string &name, const entity::Properties &props) + : entity::Entity(name, props) + { + } + ~Error() override = default; + + /// @brief get the static error factory + /// @return shared pointer to the factory + static entity::FactoryPtr getFactory(); + }; + + class InvalidParameterValue : public Error + { + + + }; + + +} +