confighelper.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef CONFIGHELPER_HPP_INCL
  2. #define CONFIGHELPER_HPP_INCL
  3. #ifdef CONFIGUTILS_EXPORTS
  4. #define CONFIGUTILS_API DECL_EXPORT
  5. #else
  6. #define CONFIGUTILS_API DECL_IMPORT
  7. #endif
  8. #define STANDARD_CONFIG_ALGORITHMFILE "genenvrules.conf"
  9. #include "jmutex.hpp"
  10. #include "jstring.hpp"
  11. interface IDeploymentCallback;
  12. interface IPropertyTree;
  13. class StringArray;
  14. interface IPropertyTree;
  15. interface IProperties;
  16. class CONFIGUTILS_API CConfigHelper
  17. {
  18. public:
  19. virtual ~CConfigHelper();
  20. static CConfigHelper* getInstance(const IPropertyTree *cfg = NULL, const char* esp_name = NULL, IDeploymentCallback *pCallBack = NULL);
  21. bool isInBuildSet(const char* comp_process_name, const char* comp_name) const;
  22. const char* getConfigXMLDir() const
  23. {
  24. return m_strConfigXMLDir.str();
  25. }
  26. const char* getBuildSetFileName() const
  27. {
  28. return m_strBuildSetFileName.str();
  29. }
  30. const char* getEnvConfFile() const
  31. {
  32. return m_strEnvConfFile.str();
  33. }
  34. const char* getConfFile() const
  35. {
  36. return m_strConfFile.str();
  37. }
  38. const char* getBuildSetFilePath() const
  39. {
  40. return m_strBuildSetFilePath.str();
  41. }
  42. void getNewComponentListFromBuildSet(const IPropertyTree *pEnvTree, StringArray &sCompArray) const;
  43. void addNewComponentsFromBuildSetToEnv(IPropertyTree *pEnvTree) const;
  44. void addPluginsToConfigGenCompList(IPropertyTree *pCGenComplist, const char *pPath = NULL) const;
  45. void addPluginsToGenEnvRules(IProperties *pGenEnvRulesProps) const;
  46. IPropertyTree* getBuildSetTree();
  47. protected:
  48. CConfigHelper(IDeploymentCallback *m_cbDeployment = NULL);
  49. static CriticalSection m_critSect;
  50. Owned<IPropertyTree> m_pDefBldSet;
  51. Linked<IDeploymentCallback> m_cbDeployment;
  52. StringBuffer m_strConfigXMLDir;
  53. StringBuffer m_strBuildSetFileName;
  54. StringBuffer m_strEnvConfFile;
  55. StringBuffer m_strConfFile;
  56. StringBuffer m_strBuildSetFilePath;
  57. void appendBuildSetFromPlugins();
  58. };
  59. #endif // CONFIGHELPER_HPP_INCL