wizardInputs.hpp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. /////////////////////////////////////////////////////////////////////////////
  15. //
  16. // WizardInputs.h : interface of the WizardInputs class
  17. //
  18. /////////////////////////////////////////////////////////////////////////////
  19. #ifndef WIZARDINPUTS_HPP_INCL
  20. #define WIZARDINPUTS_HPP_INCL
  21. #if _MSC_VER > 1000
  22. #pragma once
  23. #endif // _MSC_VER > 1000
  24. #include <string>
  25. #include <vector>
  26. #include <map>
  27. #include "jptree.hpp"
  28. #include "jliball.hpp"
  29. #include "jiface.hpp"
  30. #include "computerpicker.hpp"
  31. #include "deployutils.hpp"
  32. interface IPropertyTree;
  33. using std::string;
  34. using std::map;
  35. typedef enum GenOptional_
  36. {
  37. GENOPTIONAL_ALL,
  38. GENOPTIONAL_NONE,
  39. GENOPTIONAL_COMPS
  40. } GenOptional;
  41. class CInstDetails : public CInterface, implements IInterface
  42. {
  43. public:
  44. CInstDetails(){};
  45. CInstDetails(StringBuffer compName, StringBuffer ipAssigned):m_compName(compName)
  46. {
  47. m_ipAssigned.append(ipAssigned.str());
  48. };
  49. virtual ~CInstDetails(){};
  50. IMPLEMENT_IINTERFACE;
  51. StringArray& getIpAssigned() { return m_ipAssigned;}
  52. StringBuffer getCompName() { return m_compName; }
  53. void setParams(const char* compName, const char* value)
  54. {
  55. m_compName.clear().append(compName);
  56. if(m_ipAssigned.length() > 0)
  57. m_ipAssigned.kill();
  58. m_ipAssigned.append(value);
  59. }
  60. private :
  61. StringArray m_ipAssigned;
  62. StringBuffer m_compName;
  63. };
  64. //CInstDetails* getInstDetails(const char* buildSetName, const char* compName);
  65. //---------------------------------------------------------------------------
  66. // WizardInputs class declaration
  67. //---------------------------------------------------------------------------
  68. class CWizardInputs : public CInterface, implements IInterface
  69. {
  70. // Construction
  71. public:
  72. CWizardInputs(){};
  73. CWizardInputs(const char* xmlArg, const char* service, IPropertyTree* cfg, MapStringTo<StringBuffer>* dirMap);
  74. virtual ~CWizardInputs();
  75. void setEnvironment();
  76. void setWizardIPList(const StringArray ipArray);
  77. void setWizardRules();
  78. CInstDetails* getServerIPMap(const char* compName, const char* buildSetName,const IPropertyTree* pEnvTree, unsigned numOfNode = 1);
  79. void applyOverlappingRules(const char* compName, const char* buildSetName);
  80. count_t getNumOfInstForIP(StringBuffer ip);
  81. void generateSoftwareTree(IPropertyTree* pTree);
  82. void addInstanceToTree(IPropertyTree* pTree, StringBuffer attrName, const char* processName, const char* buildSetName, const char* instName);
  83. void getDefaultsForWizard(IPropertyTree* pTree);
  84. void addRoxieThorClusterToEnv(IPropertyTree* pNewEnvTree, CInstDetails* pInstDetails, const char* buildSetName, bool genRoxieOnDemand = false);
  85. unsigned getCntForAlreadyAssignedIPS();
  86. void addToCompIPMap(const char* buildSetName, const char* value, const char* compName);
  87. void getEspBindingInformation(IPropertyTree* pNewEnvTree);
  88. StringBuffer& getDbUser() { return m_dbuser;}
  89. StringBuffer& getDbPassword() { return m_dbpassword;}
  90. void addTopology(IPropertyTree* pNewEnvTree);
  91. IPropertyTree* createTopologyForComp(IPropertyTree* pNewEnvTree, const char* component);
  92. IPropertyTree* getConfig() { return m_cfg;}
  93. StringBuffer& getService() { return m_service;}
  94. void checkForDependencies();
  95. void checkAndAddDependComponent(const char* key);
  96. unsigned getNumOfNodes(const char* compName);
  97. void setTopologyParam();
  98. IMPLEMENT_IINTERFACE;
  99. bool generateEnvironment(StringBuffer& envXml);
  100. IPropertyTree* createEnvironment();
  101. private:
  102. typedef StringArray* StringArrayPtr;
  103. typedef MapStringTo<StringArrayPtr> MapStringToStringArray;
  104. //for rules
  105. count_t m_maxCompOnNode;
  106. StringArray m_doNotGenComp;
  107. StringArray m_compOnAllNodes;
  108. StringArray m_doNotGenOptOnComps;
  109. StringArray m_clusterForTopology;
  110. MapStringToStringArray m_compForTopology;
  111. GenOptional m_genOptForAllComps;
  112. MapStringToStringArray m_invalidServerCombo;
  113. unsigned m_roxieNodes;
  114. unsigned m_thorNodes;
  115. unsigned m_thorSlavesPerNode;
  116. unsigned m_roxieAgentRedChannels;
  117. unsigned m_roxieAgentRedOffset;
  118. bool m_roxieOnDemand;
  119. StringArray m_ipaddress;
  120. MapStringToMyClass<CInstDetails> m_compIpMap;
  121. Owned<IPropertyTree> m_pXml;
  122. IPropertyTree* m_cfg;
  123. StringBuffer m_service;
  124. StringBuffer m_dbuser;
  125. StringBuffer m_dbpassword;
  126. StringBuffer m_roxieAgentRedType;
  127. Owned<IPropertyTree> m_buildSetTree;
  128. Owned<IProperties> m_algProp;
  129. MapStringTo<StringBuffer>* m_overrideDirs;
  130. };
  131. #endif // !defined(WIZARDINPUTS_HPP__INCLUDED_)