ws_smcService.hpp 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*##############################################################################
  2. Copyright (C) 2011 HPCC Systems.
  3. All rights reserved. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ############################################################################## */
  14. #ifndef _ESPWIZ_WsSMC_HPP__
  15. #define _ESPWIZ_WsSMC_HPP__
  16. #include "ws_smc_esp.ipp"
  17. #include "TpWrapper.hpp"
  18. #include "WUXMLInfo.hpp"
  19. class CWsSMCEx : public CWsSMC
  20. {
  21. long m_counter;
  22. CTpWrapper m_ClusterStatus;
  23. CWUXMLInfo m_WuidInfo;
  24. StringBuffer m_ChatURL;
  25. StringBuffer m_Banner;
  26. StringBuffer m_BannerSize;
  27. StringBuffer m_BannerColor;
  28. StringBuffer m_BannerScroll;
  29. StringBuffer m_PortalURL;
  30. int m_BannerAction;
  31. bool m_EnableChatURL;
  32. public:
  33. IMPLEMENT_IINTERFACE;
  34. CWsSMCEx(){}
  35. virtual ~CWsSMCEx(){};
  36. virtual void init(IPropertyTree *cfg, const char *process, const char *service);
  37. bool onMoveJobDown(IEspContext &context, IEspSMCJobRequest &req, IEspSMCJobResponse &resp);
  38. bool onMoveJobUp(IEspContext &context, IEspSMCJobRequest &req, IEspSMCJobResponse &resp);
  39. bool onMoveJobBack(IEspContext &context, IEspSMCJobRequest &req, IEspSMCJobResponse &resp);
  40. bool onMoveJobFront(IEspContext &context, IEspSMCJobRequest &req, IEspSMCJobResponse &resp);
  41. bool onRemoveJob(IEspContext &context, IEspSMCJobRequest &req, IEspSMCJobResponse &resp);
  42. bool onStopQueue(IEspContext &context, IEspSMCQueueRequest &req, IEspSMCQueueResponse &resp);
  43. bool onResumeQueue(IEspContext &context, IEspSMCQueueRequest &req, IEspSMCQueueResponse &resp);
  44. bool onPauseQueue(IEspContext &context, IEspSMCQueueRequest &req, IEspSMCQueueResponse &resp);
  45. bool onClearQueue(IEspContext &context, IEspSMCQueueRequest &req, IEspSMCQueueResponse &resp);
  46. bool onIndex(IEspContext &context, IEspSMCIndexRequest &req, IEspSMCIndexResponse &resp);
  47. bool onActivity(IEspContext &context, IEspActivityRequest &req, IEspActivityResponse &resp);
  48. bool onSetJobPriority(IEspContext &context, IEspSMCPriorityRequest &req, IEspSMCPriorityResponse &resp);
  49. bool onGetThorQueueAvailability(IEspContext &context, IEspGetThorQueueAvailabilityRequest &req, IEspGetThorQueueAvailabilityResponse& resp);
  50. bool onSetBanner(IEspContext &context, IEspSetBannerRequest &req, IEspSetBannerResponse& resp);
  51. bool onNotInCommunityEdition(IEspContext &context, IEspNotInCommunityEditionRequest &req, IEspNotInCommunityEditionResponse &resp);
  52. virtual bool onBrowseResources(IEspContext &context, IEspBrowseResourcesRequest & req, IEspBrowseResourcesResponse & resp);
  53. private:
  54. void addCapabilities( IPropertyTree* pFeatureNode, const char* access,
  55. IArrayOf<IEspCapability>& capabilities);
  56. bool isInWuList(IArrayOf<IEspActiveWorkunit>& aws, const char* wuid);
  57. };
  58. class CWsSMCSoapBindingEx : public CWsSMCSoapBinding
  59. {
  60. public:
  61. CWsSMCSoapBindingEx(){}
  62. CWsSMCSoapBindingEx(IPropertyTree* cfg, const char *bindname=NULL, const char *procname=NULL):CWsSMCSoapBinding(cfg, bindname, procname){}
  63. virtual ~CWsSMCSoapBindingEx(){}
  64. virtual int onGetRoot(IEspContext &context, CHttpRequest* request, CHttpResponse* response)
  65. {
  66. return onGetInstantQuery(context, request, response, "WsSMC", "Activity");
  67. }
  68. virtual int onGetIndex(IEspContext &context, CHttpRequest* request, CHttpResponse* response, const char *service)
  69. {
  70. return onGetInstantQuery(context, request, response, "WsSMC", "Activity");
  71. }
  72. virtual void getNavigationData(IEspContext &context, IPropertyTree & data)
  73. {
  74. data.setProp("@appName", "EclWatch");
  75. data.setProp("@start_page", "/WsSMC/Activity");
  76. IPropertyTree *folder = ensureNavFolder(data, "Clusters", "Clusters", NULL, false, 1);
  77. ensureNavLink(*folder, "Activity", "/WsSMC/Activity", "View Activity", NULL, NULL, 1);
  78. ensureNavLink(*folder, "Scheduler", "/WsWorkunits/WUShowScheduled", "Show Scheduled WUs", NULL, NULL, 2);
  79. IPropertyTree *folderTools = ensureNavFolder(data, "Resources", "HPCC Resources", NULL, false, 8);
  80. ensureNavLink(*folderTools, "Browse", "/WsSMC/BrowseResources", "List HPCC Resources for Download", NULL, NULL, 1);
  81. }
  82. virtual void getNavSettings(int &width, bool &resizable, bool &scroll)
  83. {
  84. width=168;
  85. resizable=false;
  86. scroll=true;
  87. }
  88. virtual int onGetForm(IEspContext &context, CHttpRequest* request, CHttpResponse* response, const char *service, const char *method);
  89. };
  90. #endif //_ESPWIZ_WsSMC_HPP__