A method for generating and parsing a property configuration file
By generating attribute configuration files containing judgment conditions, it solves the management problems caused by numerous configuration files in large projects, achieves simplification and efficient analysis of configuration files, and improves the applicability and stability of the system.
Patent Information
- Application Number
- CN202110384905.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-09
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-04-09
AI Technical Summary
In large projects, because the system needs to be compatible with different databases, cache services, and message queues, there are a large number of attribute configuration files. Management and maintenance personnel need to write a large number of repetitive and error-prone configuration files, leading to system failures and schedule risks.
By obtaining the attribute configuration information of the same service in different business scenarios, we can generate configuration segments containing judgment conditions, and use preset connectives to generate attribute configuration files, simplifying the writing of configuration files and dynamically selecting applicable configuration segments.
It reduces the workload and error probability of writing configuration files, improves work efficiency, simplifies the management of attribute configuration, and enhances the flexibility and scope of application of the system.
Smart Images

Figure CN113190231B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of information processing, and in particular to a method for generating and parsing an attribute configuration file. Background Art
[0002] Each system has one or more property configuration files. The so-called property configuration file is a file formed by configurations organized in the form of Key-Value, where Key represents an attribute and Value represents the value corresponding to the attribute. One or more configurations are gathered together to form a property configuration file, such as a configuration file in the ini format.
[0003] There are often many attribute configurations in a large project, such as database service attribute configuration, cache service attribute configuration, message queue service attribute configuration, etc., so the number of system configurations may reach dozens or even hundreds. Not only that, a system often needs to be compatible with different databases, different cache services, and different message queues. For each different service, there are different configurations. System management and maintenance personnel need to write different configuration files according to different configurations, which is a huge and cumbersome workload. In actual work, due to the above reasons, system management and maintenance personnel often make mistakes or omissions, which directly lead to system failures. The R&D team needs to spend a lot of time and energy to locate and analyze the problem, which brings great interference and risks to the project progress and project results. Summary of the invention
[0004] In order to solve any of the above technical problems, an embodiment of the present application provides a method for generating and parsing an attribute configuration file.
[0005] In order to achieve the purpose of the embodiment of the present application, the embodiment of the present application provides a method for generating an attribute configuration file, including:
[0006] Get the attribute configuration information of the same service in different business scenarios;
[0007] Generate a configuration segment corresponding to the respective attribute configuration information for each business scenario, wherein each configuration segment includes a first judgment condition that needs to be satisfied to allow reading of the attribute configuration information in the configuration segment;
[0008] The attribute configuration file corresponding to the service is obtained by using the configuration segment corresponding to each business scenario and the pre-set connection words, wherein the connection words are used to trigger the execution of the first judgment condition in the next configuration segment after the first judgment condition in one configuration segment is executed.
[0009] A method for parsing a property configuration file, comprising:
[0010] Obtain the attribute configuration file generated by the method described above;
[0011] Matching the pre-received characteristic information of the target business scenario with the condition information of the configuration segment in the attribute configuration file to obtain the configuration segment of the target business scenario;
[0012] The attribute configuration information is read from the configuration section of the target business scenario.
[0013] A storage medium stores a computer program, wherein the computer program is configured to execute the method described above when running.
[0014] An electronic device comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the method described above.
[0015] One of the above technical solutions has the following advantages or beneficial effects:
[0016] The attribute configuration information of the same service in different business scenarios is obtained, and a configuration segment corresponding to the respective attribute configuration information is generated for each business scenario, wherein each configuration segment includes a first judgment condition that needs to be satisfied to allow reading of the attribute configuration information in the configuration segment. The attribute configuration file corresponding to the service is obtained by using the configuration segment corresponding to each business scenario and the pre-set connection words, and the configuration of the service in different business scenarios is controlled by the conditional information in an attribute configuration file, which simplifies the workload of writing the attribute configuration file, reduces the probability of errors, and improves work efficiency.
[0017] Other features and advantages of the embodiments of the present application will be described in the subsequent description, and partly become apparent from the description, or can be understood by implementing the embodiments of the present application. The purpose and other advantages of the embodiments of the present application can be achieved and obtained by the structures specifically pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings are used to provide further understanding of the technical solutions of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the embodiments of the present application, they are used to explain the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0019] Figure 1 A flowchart of a method for generating a property configuration file provided in an embodiment of the present application;
[0020] Figure 2 A flowchart of a method for parsing a property configuration file provided in an embodiment of the present application;
[0021] Figure 3 Another flowchart of the method for parsing the attribute configuration file provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the embodiments of the present application more clear, the embodiments of the present application will be described in detail in conjunction with the accompanying drawings. It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other arbitrarily.
[0023] Figure 1 Flow chart of the method for generating a property configuration file provided in the embodiment of the present application. Figure 1 As shown, the method includes:
[0024] Step 101: Obtain attribute configuration information of the same service in different business scenarios;
[0025] In an exemplary embodiment, the service may be a database service, a cache service, or a message queue service, etc. Taking the database service as an example, the business scenario may be database configurations of different database vendors, or database configurations of different cluster access modes of the same database vendor.
[0026] Step 102: Generate a configuration segment corresponding to each business scenario, wherein each configuration segment includes a first judgment condition that needs to be met to allow reading of the attribute configuration information in the configuration segment;
[0027] In an exemplary embodiment, the attribute configuration file can be designed using a programming language, and the configuration sections corresponding to each business scenario are independent of each other, and the attribute configuration information in the configuration section of each business scenario can only be read when the condition information is met.
[0028] Step 103: Obtain an attribute configuration file corresponding to the service using the configuration segment corresponding to each business scenario and the pre-set connector, wherein the connector is used to trigger the execution of the first judgment condition in the next configuration segment after the first judgment condition in one configuration segment is executed.
[0029] In an exemplary embodiment, the configuration segments of each business scenario are combined together through conjunctions to obtain a property configuration file of the service, which can be applicable to applications in different business scenarios.
[0030] The method provided in the embodiment of the present application obtains the attribute configuration information of the same service in different business scenarios, generates a configuration segment corresponding to the respective attribute configuration information for each business scenario, wherein each configuration segment includes condition information that needs to be satisfied to allow the attribute configuration information in the configuration segment to be read, and uses the configuration segment corresponding to each business scenario to obtain the attribute configuration file corresponding to the service, and uses the condition information in an attribute configuration file to control the configuration of the service in different business scenarios, thereby simplifying the workload of writing the attribute configuration file, reducing the probability of errors, and improving work efficiency.
[0031] The method provided in the embodiment of the present application is described below:
[0032] In an exemplary embodiment, the first judgment condition is whether the value of the preset keyword is an identifier of the business scenario corresponding to the configuration segment;
[0033] If the value of the keyword meets the first judgment condition in the current configuration segment, the attribute configuration information in the current configuration segment is allowed to be read, and the process ends;
[0034] If the value of the keyword does not meet the first judgment condition in the current configuration segment, a comparison is performed with the first judgment condition in the next configuration segment, and so on, until a configuration segment where the first judgment condition is met appears or the judgment conditions in all configuration segments are executed, and the process ends.
[0035] Different from the related art that uses a sequential method to process attribute configuration files, the method provided in the embodiment of the present application introduces conditional expressions in the attribute configuration file for different business scenarios, turning sequential processing into conditional processing, thereby achieving the purpose of dynamically selecting configuration segments based on conditions.
[0036] In an exemplary embodiment, for at least two configuration segments in the attribute configuration file, the characters if in the conditional expression are used as the starting information of the first judgment condition in the first configuration segment, and the characters elseif are used as the starting information of the first judgment condition in the second configuration segment, and so on, until the characters else are set in the last configuration segment, wherein the content after the characters else is used as the operation to be performed when all the first judgment conditions are not met, and ends with the characters endif.
[0037] The following is an explanation with specific application examples:
[0038] if=(${db.type}=='DatabaseType1')
[0039] jdbc.driver=DatabaseType1Driver
[0040] elseif=(${db.type}=='DatabaseType2')
[0041] jdbc.driver=DatabaseType2Driver
[0042] else=
[0043] jdbc.driver=DatabaseType3Driver
[0044] endif=
[0045] From the above examples, it can be seen that the attribute configuration file provided in the embodiment of the present application adds four keywords based on the attribute configuration file in the related art: if, endif, elseif, else. Among them, each conditional statement must start with if and end with endif, and elseif and else can be inserted in the middle to realize multiple consecutive branch judgments. Among them:
[0046] The value corresponding to the if keyword is the result of the conditional expression calculation, that is, if = conditional expression, or if (conditional expression), such as if = true, if = a>b and other grammatical formats.
[0047] The value corresponding to the endif keyword is empty and can be defined as endif= or endif.
[0048] The value corresponding to the elseif keyword is the result of the conditional expression calculation, that is, elseif = conditional expression, or elseif (conditional expression), such as elseif = false, elseif = c! = 1, or elseif = (c! = 1).
[0049] The value corresponding to the else keyword is empty and can be defined as else= or else.
[0050] In an exemplary embodiment, the attribute configuration information in each configuration segment uses the expression of keywords and values to record the attribute name and attribute value.
[0051] From the above examples, we can see that each keyword corresponds to a KEY. In different conditional expressions, the VALU value of the same KEY is different. The Value in the expression and KEY-Value can reference other KEYs. The format of referencing other KEYs is ${KEY}. It can also be defined in other formats, such as [KEY], *(KEY), etc. ${KEY} represents the value corresponding to the KEY.
[0052] The entire configuration file is configured in the form of key=value, which can simplify the parsing of the configuration file and add processing for predefined keywords based on the original configuration file parsing.
[0053] In an exemplary embodiment, wherein the record has two attribute configuration information with different values and is provided with a second judgment condition, the second judgment condition being used to judge whether the external constraint information satisfies the constraint condition of the attribute configuration combination of the current value of the record;
[0054] If the external constraint information satisfies the second judgment condition of the current attribute configuration combination, the attribute configuration information in the attribute configuration combination is allowed to be read, and the process ends;
[0055] If the external constraint information does not meet the second judgment condition of the current attribute configuration combination, a comparison is performed with the second judgment condition in the next attribute configuration combination, and so on, until an attribute configuration combination in which the second judgment condition is met appears or the second judgment conditions in all attribute configuration combinations are executed, and the process ends.
[0056] The method provided in the embodiment of the present application introduces conditional expressions for different constraint information in the attribute configuration information of the same business scenario, so as to achieve the purpose of dynamically selecting attribute configuration information with different values according to the conditions.
[0057] In an exemplary embodiment, for multiple attribute configuration combinations of the same business scenario, the character if is used as the starting information of the second judgment condition in the first attribute configuration combination, and the character elseif is used as the starting information of the second judgment condition in the second attribute configuration combination, and so on, until the character else is set in the last attribute configuration combination, wherein the content after the character else is used as the operation to be performed when all the second judgment conditions are not met, and ends with the character endif.
[0058] In an exemplary embodiment, a conditional expression is described using preset symbols to indicate the magnitude relationship and operation method of the values in the judgment condition used, including:
[0059] ==: two values are equal and TRUE
[0060] !=: TRUE if the two values are not equal
[0061] >: The value on the left is greater than the value on the right, which is TRUE
[0062] >=: The value on the left is greater than or equal to the value on the right, which is TRUE
[0063] <: The value on the left is less than the value on the right.
[0064] <=: The value on the left is less than or equal to the value on the right, which is TRUE
[0065] ||: If one of the expressions on the left and right is TRUE, then it is TRUE
[0066] &&: TRUE if both the expressions on the left and right are TRUE
[0067] Figure 2 Flow chart of the method for parsing the attribute configuration file provided in the embodiment of the present application. Figure 2 As shown, the method includes:
[0068] Step 201: Obtain an attribute configuration file generated by any of the methods described above;
[0069] Step 202: Match the pre-received characteristic information of the target business scenario with the condition information of the configuration segment in the attribute configuration file to obtain the configuration segment of the target business scenario;
[0070] Step 203: Read attribute configuration information from the configuration section of the target business scenario.
[0071] The method provided in the embodiment of the present application obtains an attribute configuration file, matches the characteristic information of the target business scenario received in advance with the condition information of the configuration segment in the attribute configuration file, obtains the configuration segment of the target business scenario, and then reads the attribute configuration information from the configuration segment of the target business scenario, thereby realizing the configuration of the attributes of various business scenarios using the attribute configuration file of the service, thereby improving the scope of application of the attribute configuration file.
[0072] The method provided in the embodiment of the present application is described below:
[0073] In an exemplary embodiment, matching the pre-received characteristic information of the target business scenario with the condition information of the configuration segment in the attribute configuration file to obtain the configuration segment of the target business scenario includes:
[0074] Reading a first judgment condition in a first configuration section in the attribute configuration file;
[0075] Determine whether the characteristic information of the target business scenario meets the first determination condition in the first configuration section;
[0076] If the characteristic information of the target business scenario meets the first judgment condition in the first configuration segment, the record of the attribute configuration information in the first configuration segment is read, and the process ends;
[0077] If the characteristic information of the target business scenario does not meet the first judgment condition in the first configuration segment, determine whether the characteristic information of the target business scenario meets the first judgment condition in the second configuration segment, and so on, until a configuration segment that meets the first judgment condition appears or the judgment conditions in all configuration segments are executed, and the process ends.
[0078] In the above exemplary embodiment, the configuration segment corresponding to the attribute parsing is controlled by a conditional expression. When performing attribute parsing, one or more preset keywords are first obtained, and the keywords are used to compare with the first judgment condition. If the conditional expression is TRUE, the parser will parse the subsequent attributes, and if it is FALSE, the subsequent attributes will not be parsed.
[0079] In the related art, attribute configuration files are all in the form of KEY-VALUE, sequentially parsed, without branch control, and there are a lot of redundant configurations and shielded configurations. The embodiment of the present application provides a configuration parsing branch processing function for the attribute configuration file in the related art, which can control which attributes need to be parsed later based on the attributes that have been parsed.
[0080] By performing a judgment operation based on the first judgment condition in each configuration segment, the configuration segment required for the current parsing operation can be determined, so as to obtain the attribute configuration information under the corresponding business scenario in a targeted manner and realize selective parsing. Compared with the sequential parsing configuration file used in related technologies, the parsing efficiency is effectively improved.
[0081] In an exemplary embodiment, the reading of attribute configuration information from the configuration segment of the target business scenario includes:
[0082] If the attribute configuration information in the same business scenario includes at least two attribute configuration combinations with different values corresponding to different external constraint conditions, then read the second judgment condition in the first attribute configuration combination in the attribute configuration information;
[0083] Determining whether the pre-received target constraint condition satisfies the second determination condition in the first attribute configuration combination;
[0084] If the target constraint condition satisfies the second judgment condition in the first attribute configuration combination, the attribute configuration information in the first attribute configuration combination is read, and the process ends;
[0085] If the target constraint condition does not meet the second judgment condition in the first attribute configuration combination, continue to judge whether the pre-received target constraint condition meets the second judgment condition in the second attribute configuration combination, and so on, until an attribute configuration combination that can meet the second judgment condition appears or the second judgment conditions in all attribute configuration combinations are executed, and the process ends.
[0086] By performing a judgment operation based on the second judgment condition in each attribute configuration combination, the attribute configuration combination required for the current parsing operation can be determined, thereby obtaining the attribute configuration combination corresponding to different constraint information in a targeted manner and realizing selective parsing.
[0087] In an exemplary embodiment, if the characters if, elseif, else, and endif in the conditional expression are used to express the judgment condition, the following parsing operation is performed, including:
[0088] Search the attribute configuration file with the keyword "if" to obtain the judgment condition after the character "if";
[0089] If the judgment condition after the character if is established, the characters after the judgment condition after if and before the characters elseif, else or endif are taken as the extraction object of the attribute configuration information for parsing operation;
[0090] If the judgment condition after the character if is not established, search the attribute configuration file with the keyword elseif to obtain the first occurrence of the character elseif, and obtain the judgment condition after the first occurrence of the character elseif;
[0091] If the judgment condition after the first appearing character elseif is established, the characters after the judgment condition after elseif and before the character else or endif are taken as the extraction object of the attribute configuration information for parsing operation;
[0092] If the judgment condition after the first occurrence of the character elseif is not satisfied, then find the judgment condition after the second occurrence of the character elseif, and continue the judgment operation until the judgment condition after the character elseif is satisfied;
[0093] If the judgment condition after the last character elseif is not satisfied, the attribute configuration file is searched with the keyword else as the keyword to obtain the position of the character else, and the content after the character else and before the character endif is used as the extraction object of the attribute configuration information for parsing operation.
[0094] In the following embodiments, the attribute configuration information is described in the form of KEY-Value, and the conditional expression used also adopts KEY-VAlUE, that is, if, elseif, else and endif are used as KEY, and the judgment condition used is used as Value, which is consistent with the recording method of the attribute configuration information in the attribute configuration file, facilitating data parsing.
[0095] Figure 3Another flow chart of the method for parsing the attribute configuration file provided in the embodiment of the present application. Figure 3 As shown, the method includes:
[0096] Set the initial running state tag runTag = RUN, and set the if execution tag ifExeTag = FALSE;
[0097] Step 301, read the content of a line in the configuration file;
[0098] Step 302: determine whether the read content is a comment;
[0099] The comment content starts with the character "#";
[0100] If the read content is gaze, execute step 301; otherwise, execute step 304;
[0101] Step 303: parse the attribute name and attribute value from the code information;
[0102] If the attribute value is a reference to another KEY (${KEY}), get the attribute value of the referenced KEY and replace it with the Value corresponding to the KEY;
[0103] Step 304: If KEY is if, calculate the result of the expression in Value;
[0104] If the Value result of the if statement is FALSE, set the statement execution tag runTag = RUN, otherwise set runTag = SKIP;
[0105] If only one section between if and endif can be executed, if runTag = RUN, set the if execution tag ifExeTag = TRUE, and return to step 301;
[0106] Step 305: If KEY is not if, determine whether KEY is elseif;
[0107] If KEY is elseif, determine whether ifExeTag is TRUE. If it is TRUE, it means that if has been executed and all subsequent statements are skipped. Set runTag = SKIP and return to step 301.
[0108] Calculate the value of elseif. If Value is FALSE, set the statement execution tag runTag = RUN. Otherwise, set runTag = SKIP. If runTag = RUN, set if execution tag ifExeTag = TRUE and return to 1.
[0109] Step 306: If KEY is not elseif, determine whether KEY is else;
[0110] If it is else, determine whether ifExeTag is TRUE, if it is TRUE, if has been executed, runTag = SKIP, otherwise runTag = RUN, return to step 301;
[0111] Step 307: If KEY is not else, determine whether KEY is endif
[0112] If it is endif, the subsequent statements return to normal, runTag = RUN, ifExeTag = FALSE, and return to step 301;
[0113] If it is not endif, it means it is a common KEY, then execute step 308;
[0114] Step 308: Determine whether the value of the running status runTag is TRUE
[0115] If runTag == FALSE, skip this KEY processing and return to step 301;
[0116] If runTag==TRUE, execute step 309;
[0117] Step 309 , save the KEY and the corresponding Value into the corresponding HASH structure, and return to step 301 .
[0118] From the above process, we can see that 4 keywords are predefined in the property configuration file: if, elseif, else, and endif. The syntax rules are defined in the form of KEY=VALUE to set the judgment conditions and dynamically select the configuration segment. In addition, the value mechanism of the KEY that has been parsed is referenced in the conditional expression, and the value is dynamically replaced by the parser to compare different judgment conditions.
[0119] Based on the above content, it can be seen that the embodiment of the present application provides an efficient and fast configuration file reading mechanism, and this mechanism is essentially different from the related technology.
[0120] The definition and usage of existing configuration files can meet the needs of most business scenarios, but when faced with more complex businesses, the configuration becomes complicated, difficult to maintain, and prone to errors. For example, for database configuration, there are database configurations of different database manufacturers and database configurations of different cluster access methods of the same database manufacturer, and the contents are different.
[0121] Unlike the related art, for databases from different manufacturers, the embodiments of the present application only need to provide a basic database manufacturer type attribute configuration, and then use this configuration to control the selection of which attributes need to be configured later and what values should be configured. For different cluster access methods of the same database manufacturer, the present invention only needs to provide a basic cluster mode attribute configuration, and the corresponding attribute configuration data will be selected based on this configuration later. When using different databases, system management and maintenance personnel only need to modify the database manufacturer type, and no other modifications are required. For different cluster access methods of the same database manufacturer, system management and maintenance personnel only need to modify the cluster mode, and no other modifications are required. In this way, only a small amount of configuration in the attribute configuration file needs to be modified, and the parser will automatically select the corresponding other configuration items.
[0122] Through the above comparison, it can be seen that the attribute configuration file in the related art and the attribute configuration file provided in the embodiment of the present application have the following differences:
[0123] Difference 1: The attribute configuration file in the related art is composed of a series of KEY-VALUE pairs, which does not have the conditional processing function and is a sequential processing. The attribute configuration file provided in the embodiment of the present application introduces conditional processing statements and conditional expressions, and defines a parser to change the sequential processing into conditional processing.
[0124] Difference 2: The attribute configuration file in the related art adopts sequential processing. If there are multiple configurations to be selected, the comment opening / closing method is usually adopted. If the configuration is required, the comment is closed, and if the configuration is not required, the comment is opened. This method is cumbersome to operate and is far less flexible than conditional processing. The method provided in the embodiment of the present application is to dynamically select the configuration segment based on whether the condition is met, which is more flexible to use and simple to operate.
[0125] An embodiment of the present application provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute any of the methods described above when running.
[0126] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute any of the methods described above.
[0127] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
Claims
1. A method for generating an attribute configuration file, wherein the attribute configuration file is a file formed by configuration organized in the form of Key-Value, wherein: Key represents an attribute, Value represents the value corresponding to the attribute, and the method includes: Acquire attribute configuration information of the same service in different business scenarios, wherein the service includes at least one of a database service, a cache service, and a message queue service; Generate a configuration segment corresponding to the respective attribute configuration information for each business scenario, wherein each configuration segment includes a first judgment condition that needs to be satisfied to allow reading of the attribute configuration information in the configuration segment, wherein the first judgment condition of each configuration segment includes characteristic information of the respective corresponding business scenario; Utilizing the configuration segments corresponding to each business scenario and pre-set connectors, an attribute configuration file corresponding to the service is obtained, wherein the attribute configuration file is used to provide attribute configuration information for different business scenarios of the service, and according to the first judgment in the attribute configuration condition information, the service is controlled to dynamically select the required attribute configuration information according to the business scenario, wherein the connector is used to trigger the execution of the first judgment condition in the next configuration segment after the first judgment condition in one configuration segment is executed.
2. The method according to claim 1, characterized in that: The first judgment condition is whether the value of the preset keyword is an identifier of the business scenario corresponding to the configuration segment; If the value of the keyword meets the first judgment condition in the current configuration segment, the attribute configuration information in the current configuration segment is allowed to be read, and the process ends; If the value of the keyword does not meet the first judgment condition in the current configuration segment, a comparison is performed with the first judgment condition in the next configuration segment, and so on, until a configuration segment where the first judgment condition is met appears or the judgment conditions in all configuration segments are executed, and the process ends.
3. The method according to claim 2, characterized in that: For at least two configuration sections in the property configuration file, the characters if in the conditional expression are used as the starting information of the first judgment condition in the first configuration section, and the characters elseif are used as the starting information of the first judgment condition in the second configuration section, and so on, until the characters else are set in the last configuration section, wherein the content after the characters else is used as the operation to be performed after all the first judgment conditions are not met, and ends with the characters endif.
4. The method according to claim 1, characterized in that: include: The attribute configuration information in the same business scenario includes at least two attribute configuration combinations with different values corresponding to different external constraints; Wherein, the record has two attribute configuration information with different values and is provided with a second judgment condition, wherein the second judgment condition is used to judge whether the external constraint information satisfies the constraint condition of the attribute configuration combination of the current value of the record; If the external constraint information satisfies the second judgment condition of the current attribute configuration combination, the attribute configuration information in the attribute configuration combination is allowed to be read, and the process ends; If the external constraint information does not meet the second judgment condition of the current attribute configuration combination, a comparison is performed with the second judgment condition in the next attribute configuration combination, and so on, until an attribute configuration combination in which the second judgment condition is met appears or the second judgment conditions in all attribute configuration combinations are executed, and the process ends.
5. The method according to claim 4, characterized in that: For multiple attribute configuration combinations of the same business scenario, the character if is used as the starting information of the second judgment condition in the first attribute configuration combination, and the character elseif is used as the starting information of the second judgment condition in the second attribute configuration combination, and so on, until the character else is set in the last attribute configuration combination, where the content after the character else is used as the operation to be performed when all the second judgment conditions are not met, and ends with the character endif.
6. The method according to claim 3 or 5, characterized in that: The preset symbols are used to represent the magnitude relationship and operation method of the values in the judgment conditions used, including at least one of the following: The symbols "==" and "!=" are used to indicate that the values are equal and unequal respectively; The symbols ">", "<""<="">=" are used to indicate the magnitude relationship of numerical values; The symbols "&&" and "||" are used to represent "AND" and "OR" operations.
7. The method according to claim 1, characterized in that include: The attribute configuration information in each configuration section uses keywords and values to record the attribute name and attribute value.
8. A method for parsing a property configuration file, comprising: Obtaining a property configuration file generated by using the method described in any one of claims 1 to 7; Matching the pre-received characteristic information of the target business scenario with the condition information of the configuration segment in the attribute configuration file to obtain the configuration segment of the target business scenario; The attribute configuration information is read from the configuration section of the target business scenario.
9. The method according to claim 8, characterized in that The matching of the pre-received characteristic information of the target business scenario with the condition information of the configuration segment in the attribute configuration file to obtain the configuration segment of the target business scenario includes: Reading a first judgment condition in a first configuration section in the attribute configuration file; Determine whether the characteristic information of the target business scenario meets the first determination condition in the first configuration section; If the characteristic information of the target business scenario meets the first judgment condition in the first configuration segment, the record of the attribute configuration information in the first configuration segment is read, and the process ends; If the characteristic information of the target business scenario does not meet the first judgment condition in the first configuration segment, determine whether the characteristic information of the target business scenario meets the first judgment condition in the second configuration segment, and so on, until a configuration segment that meets the first judgment condition appears or the judgment conditions in all configuration segments are executed, and the process ends.
10. The method according to claim 8, characterized in that The reading of attribute configuration information from the configuration segment of the target business scenario includes: If the attribute configuration information in the same business scenario includes at least two attribute configuration combinations with different values corresponding to different external constraint conditions, then read the second judgment condition in the first attribute configuration combination in the attribute configuration information; Determining whether the pre-received target constraint condition satisfies the second determination condition in the first attribute configuration combination; If the target constraint condition satisfies the second judgment condition in the first attribute configuration combination, the attribute configuration information in the first attribute configuration combination is read, and the process ends; If the target constraint condition does not meet the second judgment condition in the first attribute configuration combination, continue to judge whether the pre-received target constraint condition meets the second judgment condition in the second attribute configuration combination, and so on, until an attribute configuration combination that can meet the second judgment condition appears or the second judgment conditions in all attribute configuration combinations are executed, and the process ends.
11. The method according to claim 8 or 9, characterized in that: If the characters if, elseif, else, and endif in the conditional expression are used to express the judgment condition, the following parsing operations are performed, including: Search the attribute configuration file with the keyword "if" to obtain the judgment condition after the character "if"; If the judgment condition after the character if is established, the characters after the judgment condition after if and before the characters elseif, else or endif are taken as the extraction object of the attribute configuration information for parsing operation; If the judgment condition after the character if is not established, the attribute configuration file is searched with the keyword elseif to obtain the first occurrence of the character elseif, and the judgment condition after the first occurrence of the character elseif is obtained; If the judgment condition after the first appearing character elseif is established, the characters after the judgment condition after elseif and before the character else or endif are taken as the extraction object of the attribute configuration information for parsing operation; If the judgment condition after the first occurrence of the character elseif is not satisfied, then find the judgment condition after the second occurrence of the character elseif, and continue the judgment operation until the judgment condition after the character elseif is satisfied; If the judgment condition after the last character elseif is not satisfied, the attribute configuration file is searched with the keyword else as the keyword to obtain the position of the character else, and the content after the character else and before the character endif is used as the extraction object of the attribute configuration information for parsing operation.
12. The method according to claim 8, characterized in that The reading of attribute configuration information from the configuration segment of the target business scenario includes: If the attribute configuration information is described by using a keyword and a value expression, and the attribute value of an attribute name is described by using an expression of calling another attribute name, then the value of the called other attribute is obtained; Save the obtained value as the attribute value corresponding to the attribute name.
13. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 7 when executed.
14. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 7.
15. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 8 to 12 when executed.
16. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 8 to 12.
