Skip to content

Commit

Permalink
HPCC-30809 Add ESP WsSasha service and implement 4 methods
Browse files Browse the repository at this point in the history
Part 1: add ws_sasha framework

Signed-off-by: wangkx <[email protected]>
  • Loading branch information
wangkx committed Dec 4, 2023
1 parent b330baf commit efcd747
Show file tree
Hide file tree
Showing 10 changed files with 235 additions and 0 deletions.
1 change: 1 addition & 0 deletions esp/applications/eclwatch/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ application:
- ws_codesign
- ws_resources
- WSDali
- WSSasha
- ws_logaccess
- WsCloud
5 changes: 5 additions & 0 deletions esp/applications/eclwatch/ldap_authorization_map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions esp/applications/eclwatch/plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
1 change: 1 addition & 0 deletions esp/scm/espscm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
1 change: 1 addition & 0 deletions esp/services/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
67 changes: 67 additions & 0 deletions esp/services/ws_sasha/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
62 changes: 62 additions & 0 deletions esp/services/ws_sasha/ws_sashaplugin.cpp
Original file line number Diff line number Diff line change
@@ -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 <servicetype>_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);
}

};
29 changes: 29 additions & 0 deletions esp/services/ws_sasha/ws_sashaservice.cpp
Original file line number Diff line number Diff line change
@@ -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)
{
}
32 changes: 32 additions & 0 deletions esp/services/ws_sasha/ws_sashaservice.hpp
Original file line number Diff line number Diff line change
@@ -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__
35 changes: 35 additions & 0 deletions initfiles/componentfiles/configxml/@temp/esp_service_WsSMC.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ This is required by its binding with ESP service '<xsl:value-of select="$espServ
<xsl:with-param name="bindingNode" select="$bindingNode"/>
<xsl:with-param name="authNode" select="$authNode"/>
</xsl:apply-templates>
<xsl:apply-templates select="." mode="ws_sasha">
<xsl:with-param name="bindingNode" select="$bindingNode"/>
<xsl:with-param name="authNode" select="$authNode"/>
</xsl:apply-templates>
<xsl:apply-templates select="." mode="ws_logaccess">
<xsl:with-param name="bindingNode" select="$bindingNode"/>
<xsl:with-param name="authNode" select="$authNode"/>
Expand Down Expand Up @@ -776,6 +780,37 @@ This is required by its binding with ESP service '<xsl:value-of select="$espServ
</xsl:copy>
</xsl:template>

<!-- ws_sasha -->
<xsl:template match="EspService" mode="ws_sasha">
<xsl:param name="bindingNode"/>
<xsl:param name="authNode"/>

<xsl:variable name="serviceType" select="'WSSasha'"/>
<xsl:variable name="serviceName" select="concat($serviceType, '_', @name, '_', $process)"/>
<xsl:variable name="bindName" select="concat($serviceType, '_', $bindingNode/@name, '_', $process)"/>
<xsl:variable name="bindType" select="'ws_sashaSoapBinding'"/>
<xsl:variable name="servicePlugin">
<xsl:call-template name="defineServicePlugin">
<xsl:with-param name="plugin" select="'ws_sasha'"/>
</xsl:call-template>
</xsl:variable>
<EspService name="{$serviceName}" type="{$serviceType}" plugin="{$servicePlugin}">
</EspService>
<EspBinding name="{$bindName}" service="{$serviceName}" protocol="{$bindingNode/@protocol}" type="{$bindType}"
plugin="{$servicePlugin}" netAddress="0.0.0.0" port="{$bindingNode/@port}">
<xsl:call-template name="bindAuthentication">
<xsl:with-param name="bindingNode" select="$bindingNode"/>
<xsl:with-param name="authMethod" select="$authNode/@method"/>
<xsl:with-param name="service" select="'ws_sasha'"/>
</xsl:call-template>
</EspBinding>
</xsl:template>
<xsl:template match="*" mode="copy">
<xsl:copy>
<xsl:apply-templates select="@*[string(.) != '']|node()" mode="copy"/>
</xsl:copy>
</xsl:template>

<!-- ws_dfsservice -->
<xsl:template match="EspService" mode="ws_dfsservice">
<xsl:param name="bindingNode"/>
Expand Down

0 comments on commit efcd747

Please sign in to comment.