SWProcess.hpp 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2018 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 _SWPROCESS_HPP_
  14. #define _SWPROCESS_HPP_
  15. #include "EnvHelper.hpp"
  16. #include "ComponentBase.hpp"
  17. #include "SWComponentBase.hpp"
  18. namespace ech
  19. {
  20. class SWProcess : public SWComponentBase
  21. {
  22. public:
  23. SWProcess(const char* name, EnvHelper * envHelper);
  24. virtual ~SWProcess() {}
  25. virtual void create(IPropertyTree *params);
  26. virtual unsigned add(IPropertyTree *params);
  27. virtual void addOtherSelector(IPropertyTree *compTree, IPropertyTree *params);
  28. virtual void modify(IPropertyTree *params);
  29. //virtual void remove(IPropertyTree *params);
  30. virtual IPropertyTree * addComponent(IPropertyTree *params);
  31. virtual IPropertyTree * cloneComponent(IPropertyTree *params);
  32. virtual void computerAdded(IPropertyTree *computerNode, const char* instanceXMLTagName=NULL);
  33. virtual void computerUpdated(IPropertyTree *computerNode, const char *oldName, const char *oldIp, const char* instanceXMLTagName=NULL);
  34. virtual void computerDeleted(const char *ipAddress, const char *computerName, const char* instanceXMLTagName=NULL);
  35. virtual void checkInstanceAttributes(IPropertyTree *instanceNode, IPropertyTree *parent);
  36. virtual void processNameChanged(const char* process, const char *newName, const char* oldName);
  37. virtual void resolveSelector(const char* selector, const char* key, StringBuffer& out);
  38. virtual void removeInstancesFromComponent(IPropertyTree *compNode);
  39. virtual void addInstances(IPropertyTree *parent, IPropertyTree *params);
  40. virtual void addInstance(IPropertyTree *computerNode, IPropertyTree *parent, IPropertyTree *attrs, const char* instanceTagXMLName);
  41. void modifyInstance(IPropertyTree *parent, IPropertyTree *params);
  42. virtual const char * getInstanceXMLTagName(const char* name) { return m_instanceElemName.str(); }
  43. IPropertyTree * addComputer(const char* ip);
  44. virtual IPropertyTree * findInstance(IPropertyTree *comp, IPropertyTree* computerNode);
  45. IConfigComp* getInstanceNetAddresses(StringArray& ipList, const char* clusterName=NULL);
  46. unsigned getInstanceCount(const char* clusterName=NULL);
  47. IPropertyTree * getPortDefinition();
  48. bool portIsRequired();
  49. int getDefaultPort();
  50. protected:
  51. StringBuffer m_instanceElemName;
  52. StringBuffer m_ipAttribute;
  53. StringArray m_notifyTopologyList;
  54. // only one instance should be active
  55. // if instances alraedy exist add/modify will be applied to the first instance
  56. StringArray m_singleInstanceList;
  57. };
  58. }
  59. #endif