From efcd7473280866b16eb068686ed70302b235e8ac Mon Sep 17 00:00:00 2001 From: wangkx Date: Tue, 3 Oct 2023 10:19:26 -0400 Subject: [PATCH] HPCC-30809 Add ESP WsSasha service and implement 4 methods Part 1: add ws_sasha framework Signed-off-by: wangkx --- esp/applications/eclwatch/application.yaml | 1 + .../eclwatch/ldap_authorization_map.yaml | 5 ++ esp/applications/eclwatch/plugins.yaml | 2 + esp/scm/espscm.cmake | 1 + esp/services/CMakeLists.txt | 1 + esp/services/ws_sasha/CMakeLists.txt | 67 +++++++++++++++++++ esp/services/ws_sasha/ws_sashaplugin.cpp | 62 +++++++++++++++++ esp/services/ws_sasha/ws_sashaservice.cpp | 29 ++++++++ esp/services/ws_sasha/ws_sashaservice.hpp | 32 +++++++++ .../configxml/@temp/esp_service_WsSMC.xsl | 35 ++++++++++ 10 files changed, 235 insertions(+) create mode 100644 esp/services/ws_sasha/CMakeLists.txt create mode 100644 esp/services/ws_sasha/ws_sashaplugin.cpp create mode 100644 esp/services/ws_sasha/ws_sashaservice.cpp create mode 100644 esp/services/ws_sasha/ws_sashaservice.hpp diff --git a/esp/applications/eclwatch/application.yaml b/esp/applications/eclwatch/application.yaml index 9d6a59e419e..21d1f967ef5 100644 --- a/esp/applications/eclwatch/application.yaml +++ b/esp/applications/eclwatch/application.yaml @@ -17,5 +17,6 @@ application: - ws_codesign - ws_resources - WSDali + - WSSasha - ws_logaccess - WsCloud diff --git a/esp/applications/eclwatch/ldap_authorization_map.yaml b/esp/applications/eclwatch/ldap_authorization_map.yaml index 84c2a8e3a9a..aa2a373f171 100644 --- a/esp/applications/eclwatch/ldap_authorization_map.yaml +++ b/esp/applications/eclwatch/ldap_authorization_map.yaml @@ -163,3 +163,8 @@ ldap: - path: WsLogAccess resource: WsLogAccess description: Access to HPCC component log + WSSasha: + Feature: + - path: SashaAccess + resource: SashaAccess + description: Access to HPCC Archive diff --git a/esp/applications/eclwatch/plugins.yaml b/esp/applications/eclwatch/plugins.yaml index 1f627ea4922..5eea9912281 100644 --- a/esp/applications/eclwatch/plugins.yaml +++ b/esp/applications/eclwatch/plugins.yaml @@ -21,6 +21,7 @@ service_plugins: ws_codesign: ws_codesign ws_resources: ws_resources WSDali: ws_dali + WSSasha: ws_sasha WsCloud: ws_cloud ws_logaccess: ws_logaccess @@ -43,5 +44,6 @@ binding_plugins: ws_codesign: ws_codesign ws_resources: ws_resources WSDali: ws_dali + WSSasha: ws_sasha WsCloud: ws_cloud ws_logaccess: ws_logaccess diff --git a/esp/scm/espscm.cmake b/esp/scm/espscm.cmake index 57e2bdd063c..a81791a83b4 100644 --- a/esp/scm/espscm.cmake +++ b/esp/scm/espscm.cmake @@ -43,6 +43,7 @@ set ( ESPSCM_SRCS ws_codesign.ecm ws_decoupledlogging.ecm ws_dali.ecm + ws_sasha.ecm ws_resources.ecm ws_logaccess.ecm ) diff --git a/esp/services/CMakeLists.txt b/esp/services/CMakeLists.txt index 43923d81f0a..007317d16ff 100644 --- a/esp/services/CMakeLists.txt +++ b/esp/services/CMakeLists.txt @@ -46,6 +46,7 @@ HPCC_ADD_SUBDIRECTORY (ws_store "PLATFORM") HPCC_ADD_SUBDIRECTORY (ws_codesign "PLATFORM") HPCC_ADD_SUBDIRECTORY (ws_resources "PLATFORM") HPCC_ADD_SUBDIRECTORY (ws_dali "PLATFORM") +HPCC_ADD_SUBDIRECTORY (ws_sasha "PLATFORM") if (CONTAINERIZED) HPCC_ADD_SUBDIRECTORY (ws_cloud "PLATFORM") else () diff --git a/esp/services/ws_sasha/CMakeLists.txt b/esp/services/ws_sasha/CMakeLists.txt new file mode 100644 index 00000000000..499efe4f55d --- /dev/null +++ b/esp/services/ws_sasha/CMakeLists.txt @@ -0,0 +1,67 @@ +################################################################################ +# HPCC SYSTEMS software Copyright (C) 2023 HPCC Systems. +# +# 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. +################################################################################ + +# Component: ws_sasha +##################################################### +# Description: +# ------------ +# Cmake Input File for ws_sasha +##################################################### + +project( ws_sasha ) + +include(${HPCC_SOURCE_DIR}/esp/scm/espscm.cmake) + +set ( SRCS + ${ESPSCM_GENERATED_DIR}/ws_sasha_esp.cpp + ws_sashaplugin.cpp + ws_sashaservice.cpp + ) + +include_directories ( + ${HPCC_SOURCE_DIR}/esp/platform + ${HPCC_SOURCE_DIR}/esp/bindings + ${HPCC_SOURCE_DIR}/esp/bindings/SOAP/xpp + ${HPCC_SOURCE_DIR}/esp/clients + ${HPCC_SOURCE_DIR}/esp/smc/SMCLib + ${HPCC_SOURCE_DIR}/system/include + ${HPCC_SOURCE_DIR}/system/jlib + ${HPCC_SOURCE_DIR}/system/xmllib + ${HPCC_SOURCE_DIR}/system/security/securesocket + ${HPCC_SOURCE_DIR}/system/security/LdapSecurity + ${HPCC_SOURCE_DIR}/system/security/shared + ${HPCC_SOURCE_DIR}/system/mp + ${HPCC_SOURCE_DIR}/common/thorhelper + ${HPCC_SOURCE_DIR}/dali/base + ${HPCC_SOURCE_DIR}/dali/sasha + ) + +ADD_DEFINITIONS( -D_USRDLL -DWSSasha_API_LOCAL -DESP_SERVICE_WSSasha) + +HPCC_ADD_LIBRARY( ws_sasha SHARED ${SRCS} ) +install ( TARGETS ws_sasha RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} ) +target_link_libraries ( ws_sasha + jlib + xmllib + esphttp + ${COMMON_ESP_SERVICE_LIBS} + ) + +IF (USE_OPENSSL) + target_link_libraries ( ws_sasha + securesocket + ) +ENDIF() diff --git a/esp/services/ws_sasha/ws_sashaplugin.cpp b/esp/services/ws_sasha/ws_sashaplugin.cpp new file mode 100644 index 00000000000..a5c3c34cc45 --- /dev/null +++ b/esp/services/ws_sasha/ws_sashaplugin.cpp @@ -0,0 +1,62 @@ +/*############################################################################## + + HPCC SYSTEMS software Copyright (C) 2023 HPCC Systems. + + 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. +############################################################################## */ + +#pragma warning (disable : 4786) + +//ESP Bindings +#include "http/platform/httpprot.hpp" + +//ESP Service +#include "ws_sashaservice.hpp" + +#include "espplugin.hpp" + +extern "C" +{ + +//when we aren't loading dynamically +// Change the function names when we stick with dynamic loading. +ESP_FACTORY IEspService* esp_service_factory(const char* name, const char* type, IPropertyTree* cfg, const char* process) +{ + if (strieq(type, "WSSasha")) + { + CWSSashaEx* service = new CWSSashaEx; + service->init(cfg, process, name); + return service; + } + return nullptr; +} + +ESP_FACTORY IEspRpcBinding* esp_binding_factory(const char* name, const char* type, IPropertyTree* cfg, const char* process) +{ + //binding names of the form _http are being added so the names can be made more consistent and can therefore be automatically generated + // the name also better reflects that these bindings are for all HTTP based protocols, not just SOAP + // both "SoapBinding" and "_http" names instantiate the same objects. + if (strieq(type, "ws_sashaSoapBinding") || strieq(type, "WSSasha_http")) + { + return new CWSSashaSoapBinding(cfg, name, process); + } + + return nullptr; +} + +ESP_FACTORY IEspProtocol* esp_protocol_factory(const char* name, const char* type, IPropertyTree* cfg, const char* process) +{ + return http_protocol_factory(name, type, cfg, process); +} + +}; diff --git a/esp/services/ws_sasha/ws_sashaservice.cpp b/esp/services/ws_sasha/ws_sashaservice.cpp new file mode 100644 index 00000000000..ef1a51990d6 --- /dev/null +++ b/esp/services/ws_sasha/ws_sashaservice.cpp @@ -0,0 +1,29 @@ +/*############################################################################## + + HPCC SYSTEMS software Copyright (C) 2023 HPCC Systems. + + 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. +############################################################################## */ + +#ifdef _USE_OPENLDAP +#include "ldapsecurity.ipp" +#endif + +#include "ws_sashaservice.hpp" +#include "jlib.hpp" + +using namespace ws_sasha; + +void CWSSashaEx::init(IPropertyTree* cfg, const char* process, const char* service) +{ +} diff --git a/esp/services/ws_sasha/ws_sashaservice.hpp b/esp/services/ws_sasha/ws_sashaservice.hpp new file mode 100644 index 00000000000..25354498ca3 --- /dev/null +++ b/esp/services/ws_sasha/ws_sashaservice.hpp @@ -0,0 +1,32 @@ +/*############################################################################## + + HPCC SYSTEMS software Copyright (C) 2023 HPCC Systems. + + 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 _ESPWIZ_ws_sasha_HPP__ +#define _ESPWIZ_ws_sasha_HPP__ + +#include "ws_sasha_esp.ipp" +#include "exception_util.hpp" + +class CWSSashaEx : public CWSSasha +{ +public: + IMPLEMENT_IINTERFACE; + + virtual void init(IPropertyTree* cfg, const char* process, const char* service) override; +}; + +#endif //_ESPWIZ_ws_sasha_HPP__ diff --git a/initfiles/componentfiles/configxml/@temp/esp_service_WsSMC.xsl b/initfiles/componentfiles/configxml/@temp/esp_service_WsSMC.xsl index 0269f62a35b..28093ef6946 100755 --- a/initfiles/componentfiles/configxml/@temp/esp_service_WsSMC.xsl +++ b/initfiles/componentfiles/configxml/@temp/esp_service_WsSMC.xsl @@ -137,6 +137,10 @@ This is required by its binding with ESP service ' + + + + @@ -776,6 +780,37 @@ This is required by its binding with ESP service ' + + + + + + + + + + + + + + + + + + + + + + + + + + + +