espbinding.hpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 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. #ifndef _ESPBINDING_HPP__
  14. #define _ESPBINDING_HPP__
  15. //Jlib
  16. #include "jliball.hpp"
  17. //SCM Interfaces
  18. #include "esp.hpp"
  19. //#include "IAEsp.hpp"
  20. #include "soapesp.hpp"
  21. #include "espprotocol.hpp"
  22. #include "../bindings/http/platform/httpbinding.hpp"
  23. class esp_http_decl CEspBinding : public CInterface,
  24. implements IEspSoapBinding
  25. {
  26. protected:
  27. IEspProtocol* m_protocol;
  28. Owned<IEspService> m_service;
  29. IEspContainer* m_container;
  30. public:
  31. IMPLEMENT_IINTERFACE;
  32. CEspBinding()
  33. {
  34. m_container = NULL;
  35. //m_service = NULL;
  36. m_protocol = NULL;
  37. }
  38. virtual ~CEspBinding(){}
  39. virtual const char * getRpcType(){return "Unknown";}
  40. virtual const char * getTransportType(){return "Unknown";}
  41. IPropertyTree *ensureNavMenu(IPropertyTree &root, const char *name);
  42. IPropertyTree *ensureNavMenuItem(IPropertyTree &root, const char *name, const char *tooltip, const char *action);
  43. IPropertyTree *ensureNavFolder(IPropertyTree &root, const char *name, const char *tooltip, const char *menu=NULL, bool sort=false, unsigned relPosition = 0);
  44. IPropertyTree *ensureNavDynFolder(IPropertyTree &root, const char *name, const char *tooltip, const char *parms, const char *menu=NULL);
  45. IPropertyTree *addNavException(IPropertyTree &root, const char *message=NULL, int code=0, const char *source=NULL);
  46. IPropertyTree *ensureNavLink(IPropertyTree &folder, const char *name, const char *path, const char *tooltip, const char *menu=NULL, const char *navPath=NULL, unsigned relPosition = 0, bool force = false);
  47. virtual void getNavigationData(IEspContext &context, IPropertyTree & data);
  48. virtual void getDynNavData(IEspContext &context, IProperties *params, IPropertyTree & data);
  49. virtual bool showSchemaLinks() { return false; }
  50. virtual void addService(const char * name, const char * host, unsigned short port, IEspService & service)
  51. {
  52. m_service.set(&service);
  53. }
  54. virtual void addProtocol(const char * name, IEspProtocol & prot)
  55. {
  56. m_protocol = &prot;
  57. }
  58. virtual ISocketSelectNotify * queryListener()
  59. {
  60. if (m_protocol)
  61. return dynamic_cast<ISocketSelectNotify*>(m_protocol);
  62. IERRLOG("protocol is NULL");
  63. return NULL;
  64. }
  65. virtual int run(){return 0;}
  66. virtual int stop(){return 0;}
  67. virtual void setContainer(IEspContainer * ic)
  68. {
  69. m_container = ic;
  70. }
  71. IEspContainer *queryContainer(IEspContainer * ic)
  72. {
  73. return m_container;
  74. }
  75. virtual int processRequest(IRpcMessage* rpc_call, IRpcMessage* rpc_response)
  76. {
  77. return 0;
  78. }
  79. virtual IEspService *getService()
  80. {
  81. return m_service.getLink();
  82. }
  83. virtual bool isValidServiceName(IEspContext & context, const char * name){return false;}
  84. virtual bool qualifyServiceName(IEspContext & context, const char * servname, const char * methname, StringBuffer & servQName, StringBuffer * methQName){return false;}
  85. virtual IRpcRequestBinding *createReqBinding(IEspContext &context, IHttpMessage *request, const char *service, const char *method){return NULL;}
  86. virtual bool isDynamicBinding() const { return false; }
  87. virtual bool isBound() const { return false; }
  88. };
  89. #endif