The preservation of multi-process configuration file and loading method
Technical field
The invention belongs to the communication system technical field, relate to the preservation and the loading method of the configuration file of process in the multi-user unit system, particularly be configured the method for modification, verification and preservation on the foreground.
Background technology
In communication technique field, because systemic-function from strength to strength, the functional module in system is also more and more, and the module of operation also can be a lot of simultaneously in each system, these modules all are to move in the mode of process or thread, and each intermodule is not certain existence alternately.If use the method for a configuration file of a module, will cause configuration file quantity many, the fractionation of file and the integration of file when deriving when being not easy to import.Solution to this problem is that these modules configured are tried every possible means to unite at present, manage by another intermediate module, design Configuration Manager by research and development, can be good at by Configuration Manager that configuration file with a plurality of processes carries out the subregion storage and management is called.
Though each process has had unified management, what increase is a large amount of processing procedures thereupon.The general multi-user unit system configuration that in communication system, all adopts server and client to form, each client all can be carried out functional configuration according to the needs of oneself, and so many user needs to handle by background server in the process of client configuration, for example, the user makes amendment, standardizes in client to edit and disposes, standardization editor, verification, and the preservation process all finish at server, code in the configuration file that generates after preserving is very numerous and diverse, and the error rate also just increased when server carried out verification.Prior art is general to adopt two kinds of contents that form is write configuration file: 1), defined parameters, and parameter=value; 2), adopt the XML form.Though the form of defined parameters is simple when writing, in various configuration file repeatability clearly, the user is not easy to understand when revising code, parameter can not embody its real connotation.Simultaneously, the parameter of each function is not fully independently, and the value of certain parameter may have influence on another parameter range.When a plurality of parameters import respectively, if some makeing mistakes then cause the configuration file disappearance, thereby functional block can not be moved normally.So for the customer, separation instrumentation carries out off-line ground configuration specification editor, has become can not finishing of a task.Adopt the XML mode, this mode is understood than being easier to, for the customer because the form of XML has standard definition.But when making in this way, then need oneself to realize or use three parts's XML parsing module, rewrite concrete XML resolving code at the situation of oneself then.In the time of can causing XML node type or nodal community additions and deletions or modification like this, just must revise the change that the XML resolving code adapts to XML, error rate is bigger.
More than Shuo Ming problems of the prior art are: at first, the verification of configuration file is in background process, owing to code, the various code that causes of parameter repeat, can accurately verification when verification, be subjected to the influence of the parameter value range problem of configuration file in addition, system can influence the stability of system when loading configuration; In order to cooperate modification, verification, preservation and the loading procedure to configuration file, the mode of writing of configuration file content can not solve well in the prior art.
Summary of the invention
The objective of the invention is to solve and in the multi-user unit system, avoid in configuration file modification, verification and loading procedure, causing the situation of system's omission or flase drop to take place owing to code is various, the preservation and the loading method of multi-process configuration file have been designed, with the modification of configuration file, be kept at foreground client and carry out, when reducing the operating pressure of background server, improve the stability of process configuration file.
The present invention for realizing the technical scheme that goal of the invention adopts is, the preservation of multi-process configuration file and loading method, above method is applied in the multi-user unit system that is made up of background server and one group of foreground client, the configuration file of process is kept in the private memory, the preservation of configuration file realizes by Configuration Manager with loading, comprises in the concrete steps of above method:
1., after system start-up finishes, at first background server loads the initial configuration file of storing in the private memory;
2., foreground client reads configuration file in the private memory by serial ports instruction, and to the configuration file editor that standardizes;
3., by parsing module in the foreground client and software kit program vector table is resolved, generated to standardization editor's configuration file, mate verification with registered code commands, and proper configuration file after the verification is issued to background server with coding form by communication module;
4., background server extracts the configuration file coding by Configuration Manager, after the decoding configuration file upgraded being kept in the private memory.
The user was to carry out verification and preservation by server when revising and preserve configuration file in the past, key of the present invention is the verification on backstage and preservation are adjusted into the foreground client processing, be provided with intermediate storage unit and supporting verification software program in foreground client, be transferred in the private memory of background server by communication module again, so that the system loads configuration file.In addition, by adopting the write form of order line CLI to configuration file, strengthened user's readability, make the user convenient and swift when standardization editor configuration, the verification software that while is provided with by foreground client, when revising, increased the inspection when configuration file imports, do not needed to do extra deploy content and check code.Owing to adopt order line to write configuration file, when the background server loading configuration file, directly call content, the repeatability of order is lower, has increased the stability of system in loading procedure, increases the consistency and the integrality of development progress and data.
Embodiment
The preservation of multi-process configuration file and loading method, above method is applied in the multi-user unit system that is made up of background server and one group of foreground client, the configuration file of process is kept in the private memory, the preservation of configuration file realizes that by Configuration Manager the concrete steps of above method are with loading:
1., after system start-up finishes, at first background server loads the initial configuration file of storing in the private memory;
2., foreground client reads configuration file in the private memory by serial ports instruction, and to the configuration file editor that standardizes;
3., by parsing module in the foreground client and software kit program vector table is resolved, generated to standardization editor's configuration file, mate verification with registered code commands, and proper configuration file after the verification is issued to background server with coding form by communication module;
4., background server extracts the configuration file coding by Configuration Manager, after the decoding configuration file upgraded being kept in the private memory.
The mode of writing of above-mentioned configuration file adopts the form of the capable CLI of command interface.
Above-mentioned step 2. in, foreground client directly shows by the message distribution module the result that standardization editor's configuration file carries out verification, if configuration error, the request user is configured again.
The configuration file that foreground client reads in the private memory by serial ports instruction is connected with serial line interface by PC, online order line to the configuration file editor that standardizes.
Foreground client reads configuration file in the private memory by the serial line interface download configuration file by serial ports instruction, and off-line is to the order line of the configuration file editor that standardizes.
The content of standardization editor configuration file comprises: user cipher configuration, quality of service configuration, VLAN, the configuration of group of networks management agreement and port status configuration.
Method of the present invention is in specific implementation process, after system start-up, the user is at first by foreground client need make amendment to configuration file according to oneself, wherein revise is that user's utility command row standardizes according to the function that oneself will realize and updates, correct errors by direct verification of the verification software of foregrounding and prompting when revising, carry out configuration by external interface after modification is finished and preserve, and be saved in intermediate storage unit.External interface will send message behind the coding to the message distribution module, and store the appointed area of intermediate storage unit into.This message is self-defining by internal system, use be three layer protocols (UDP or TCP).
By communication module that the private memory that the configuration file of preserving in the intermediate storage unit is sent to background server is medium to be loaded then.During the loading configuration file content, the content in the configuration file reads line by line.
The present invention is the mode of writing that adopts order line, and the parsing and the processing procedure of order are:
Whether 1) at first want the grammer of resolve command legal, this part can be finished by the fractionation of command string.Can pass through some spcial characters during fractionation, such as the space, left and right sides angle brackets, left and right sides bracket, left and right sides braces, center.If do not match before and after the bracket, perhaps certain bracket is placed on the place that should not put, all belongs to syntax error.
2) after parsing is finished, can generate a vector table.Mate by vector table and the order line of in code, having registered.If the match is successful, then be a legal order line, otherwise can't find entrance function.This is a very complicated process.Need a large amount of logical codes to finish.
3) parameter verification.