ws_sqlPlugin.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2014 HPCC Systems.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #include "ws_sql_esp.ipp"
  14. //ESP Bindings
  15. #include "http/platform/httpprot.hpp"
  16. //ESP Service
  17. #include "ws_sqlService.hpp"
  18. #include "espplugin.hpp"
  19. extern "C"
  20. {
  21. //when we aren't loading dynamically
  22. // Change the function names when we stick with dynamic loading.
  23. ESP_FACTORY IEspService * esp_service_factory(const char *name, const char* type, IPropertyTree *cfg, const char *process)
  24. {
  25. if (strcmp(type, "ws_sql")==0)
  26. {
  27. CwssqlEx* service = new CwssqlEx;
  28. service->init(cfg, process, name);
  29. return service;
  30. }
  31. return NULL;
  32. }
  33. ESP_FACTORY IEspRpcBinding * esp_binding_factory(const char *name, const char* type, IPropertyTree *cfg, const char *process)
  34. {
  35. if (strcmp(type, "ws_sqlSoapBinding")==0)
  36. {
  37. CwssqlSoapBinding* binding = new CwssqlSoapBindingEx(cfg, name, process);
  38. return binding;
  39. }
  40. return NULL;
  41. }
  42. ESP_FACTORY IEspProtocol * esp_protocol_factory(const char *name, const char* type, IPropertyTree *cfg, const char *process)
  43. {
  44. if (strcmp(type, "http_protocol")==0)
  45. {
  46. return new CHttpProtocol;
  47. }
  48. else if(strcmp(type, "secure_http_protocol") == 0)
  49. {
  50. IPropertyTree *sslSettings;
  51. sslSettings = cfg->getPropTree(StringBuffer("Software/EspProcess[@name=\"").append(process).append("\"]").append("/EspProtocol[@name=\"").append(name).append("\"]").str());
  52. if(sslSettings != NULL)
  53. {
  54. return new CSecureHttpProtocol(sslSettings);
  55. }
  56. }
  57. return NULL;
  58. }
  59. };