wizardInputs.hpp 5.6 KB

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