IConfigEnv.hpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 _ICONFIGENV_HPP_
  14. #define _ICONFIGENV_HPP_
  15. //#include "ConfigEnvError.hpp"
  16. #ifdef CONFIGENV_EXPORTS
  17. #define configenv_decl DECL_EXPORT
  18. #else
  19. #define configenv_decl DECL_IMPORT
  20. #endif
  21. //Output format
  22. //XML_SortTags | XML_Format
  23. #ifndef ATTR_SEP
  24. #define ATTR_SEP "^"
  25. #endif
  26. #ifdef ATTR_V_SEP
  27. #define ATTR_V_SEP "|"
  28. #endif
  29. interface IPropertyTree;
  30. interface IEnvSettings;
  31. //interface configenv_decl IConfigEnv: extends IConfigComp
  32. template <class PTTYPE, class SB>
  33. interface configenv_decl IConfigEnv
  34. {
  35. virtual void create(PTTYPE *params) = 0;
  36. // return the id of the added node
  37. virtual unsigned add(PTTYPE *params) = 0;
  38. virtual void modify(PTTYPE *params) = 0;
  39. virtual void remove(PTTYPE *params) = 0;
  40. //run a group a updat tasks: <Config><Task/><Task/>...</Config>
  41. virtual void runUpdateTasks(PTTYPE *params) = 0;
  42. virtual const char* queryAttribute(const char *xpath) = 0;
  43. virtual void setAttribute(const char *xpath, const char* attrName, const char* attrValue) = 0;
  44. // xpath NULL will get whole environment
  45. virtual void getContent(const char *xpath, SB& out, int format) = 0;
  46. // Default format is XML. This will be direct action. No checking and relationship will be applied.
  47. virtual void addContent(const char *xpath, StringBuffer& in, int type) = 0;
  48. virtual bool isEnvironmentValid(SB& env) = 0;
  49. virtual PTTYPE * getNode(const char *xpath) = 0;
  50. virtual PTTYPE * getNode(unsigned id) = 0;
  51. virtual unsigned getNodeId(const char *xpath) = 0;
  52. // validate value from env tree or schema, xpath and schema
  53. virtual bool isAttributeValid(const char* xpath, const char* schema, const char* key, const char* value, bool src) = 0;
  54. };
  55. #endif