configenvhelper.hpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. #if !defined(AFX_DEPLOYUTILS_CONFIGENVHELPER_HPP__INCLUDED_)
  14. #define AFX_DEPLOYUTILS_CONFIGENVHELPER_HPP__INCLUDED_
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif // _MSC_VER > 1000
  18. //#include "jliball.hpp"
  19. interface IPropertyTree;
  20. #include <vector>
  21. using namespace std;
  22. typedef vector<IPropertyTree*> IPropertyTreePtrArray;
  23. #include "Constants.h"
  24. class CConfigEnvHelper
  25. {
  26. public:
  27. CConfigEnvHelper(IPropertyTree* pRoot):m_numDataCopies(0),m_numChannels(0){m_pRoot.set(pRoot);}
  28. ~CConfigEnvHelper(){}
  29. bool handleRoxieOperation(const char* cmd, const char* xmlStr);
  30. void addComponent(const char* pszBuildSet, StringBuffer& sbNewName, IPropertyTree* pCompTree);
  31. bool handleThorTopologyOp(const char* cmd, const char* xmlStr, StringBuffer& sMsg);
  32. private:
  33. IPropertyTree* getSoftwareNode(const char* compType, const char* compName);
  34. bool addRoxieServers(const char* xmlStr);
  35. bool checkComputerUse(/*IPropertyTree* pComputerNode*/ const char* szComputer, IPropertyTree* pParentNode) const;
  36. IPropertyTree* addLegacyServer(const char* name, IPropertyTree* pServer, IPropertyTree*pFarm, const char* roxieClusterName);
  37. void setComputerState(IPropertyTree* pNode, COMPUTER_STATE state);
  38. void setAttribute(IPropertyTree* pNode, const char* szName, const char* szValue);
  39. void mergeServiceAuthenticationWithBinding(IPropertyTree* pBinding,
  40. IPropertyTree* pProperties,
  41. IPropertyTree* pNewProperties,
  42. const char* NodeName);
  43. IPropertyTree* lookupComputerByName(const char* szName) const;
  44. void createUniqueName(const char* szPrefix, const char* parent, StringBuffer& sbName);
  45. IPropertyTree* addNode(const char* szTag, IPropertyTree* pParentNode, IPropertyTree* pInsertAfterNode=NULL);
  46. IPropertyTree* addNode(IPropertyTree*& pNode, IPropertyTree* pParentNode, IPropertyTree* pInsertAfterNode=NULL);
  47. void renameInstances(IPropertyTree* pRoxieCluster);
  48. IPropertyTree* findLegacyServer(IPropertyTree* pRoxieCluster, const char* name);
  49. void deleteFarm(IPropertyTree* pRoxieCluster, const char* pszFarm);
  50. void deleteServer(IPropertyTree* pRoxieCluster, const char* pszFarm, const char* pszServer);
  51. bool deleteRoxieServers(const char* xmlArg);
  52. bool deleteRoxiePorts(const char* xmlArg);
  53. bool EnsureInRange(const char* psz, UINT low, UINT high, const char* caption);
  54. bool handleRoxieSlaveConfig(const char* params);
  55. bool handleReplaceRoxieServer(const char* xmlArg);
  56. void RemoveSlaves(IPropertyTree* pRoxie, bool bLegacySlaves/*=false*/);
  57. void RenameThorInstances(IPropertyTree* pThor);
  58. void UpdateThorAttributes(IPropertyTree* pParentNode);
  59. bool AddNewNodes(IPropertyTree* pThor, const char* szType, int nPort, IPropertyTreePtrArray& computers, bool validate, bool skipExisting, StringBuffer& usageList);
  60. bool CheckTopologyComputerUse(IPropertyTree* pComputerNode, IPropertyTree* pParentNode, StringBuffer& usageList) const;
  61. IPropertyTree* GetProcessNode(IPropertyTree* pThor, const char* szProcess) const;
  62. Linked<IPropertyTree> m_pRoot;
  63. int m_numDataCopies;
  64. int m_numChannels;
  65. };
  66. #endif // !defined(AFX_DEPLOYUTILS_CONFIGENVHELPER_HPP__INCLUDED_)