CN114490889A - Configuration information processing method, device, equipment, medium and program product - Google Patents

Configuration information processing method, device, equipment, medium and program product Download PDF

Info

Publication number
CN114490889A
CN114490889A CN202210087618.0A CN202210087618A CN114490889A CN 114490889 A CN114490889 A CN 114490889A CN 202210087618 A CN202210087618 A CN 202210087618A CN 114490889 A CN114490889 A CN 114490889A
Authority
CN
China
Prior art keywords
configuration
configuration file
xml
java
application
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210087618.0A
Other languages
Chinese (zh)
Inventor
王征
彭京
郑长松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Public Security Research Center
Chengdu TD Tech Ltd
Original Assignee
Sichuan Public Security Research Center
Chengdu TD Tech Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Public Security Research Center, Chengdu TD Tech Ltd filed Critical Sichuan Public Security Research Center
Priority to CN202210087618.0A priority Critical patent/CN114490889A/en
Publication of CN114490889A publication Critical patent/CN114490889A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/81Indexing, e.g. XML tags; Data structures therefor; Storage structures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/082Configuration setting characterised by the conditions triggering a change of settings the condition being updates or upgrades of network functionality

Abstract

The application provides a configuration information processing method, device, equipment, medium and program product. The method is applied to a server and comprises the following steps: updating the first configuration file of the application to obtain a second configuration file of the application; the first configuration file comprises configuration information of a first version of the application, and the second configuration file comprises configuration information of a second version of the application; analyzing the second configuration file to obtain a second configuration Java class describing the second configuration file; acquiring a first configuration Java class describing a first configuration file; generating an XML incremental document according to the second configuration Java class and the first configuration Java class; the XML delta document includes: configuration information that is different between the first configuration file and the second configuration file; and sending the XML incremental document to the first client of the application, wherein the XML incremental document is used for updating the first configuration file of the first client into the second configuration file, so that the efficiency of obtaining the XML incremental document is improved.

Description

Configuration information processing method, device, equipment, medium and program product
Technical Field
The present application relates to communications technologies, and in particular, to a method, an apparatus, a device, a medium, and a program product for processing configuration information.
Background
Extensible Markup Language (XML) is a Markup Language for Markup electronic documents to have a structure. It can be used to mark data, define data types, and is a source language that allows a user to define his or her own markup language. In the field of communications, configuration information interaction between a client and a server typically uses XML documents. The XML document is used for keeping information synchronization between the client and the configuration server under the scene of multi-user simultaneous online cooperative communication.
In the prior art, when a user state or configuration such as personalized information of a certain client changes, the client will actively report the configuration change condition to a server. The server compares the XML document cached before the configuration change with the XML document generated after the configuration change line by line, generates a comparison result, generates an XML incremental configuration document according to the comparison result, and issues the XML incremental configuration document to one or more clients. The one or more clients may synchronously modify the configuration according to the XML delta configuration document, thereby maintaining synchronization of configuration information between the clients and the configuration server.
However, the above-mentioned way of using XML document comparison is inefficient in obtaining XML incremental configuration documents.
Disclosure of Invention
The application provides a method, a device, equipment, a medium and a program product for processing configuration information, which are used for solving the problem that the efficiency of acquiring an XML incremental configuration document is low by using an XML document comparison mode in the prior art.
In a first aspect, the present application provides a method for processing configuration information, the method including:
updating a first configuration file of an application to obtain a second configuration file of the application; the first configuration file comprises configuration information of a first version of the application, and the second configuration file comprises configuration information of a second version of the application;
analyzing the second configuration file to obtain a second configuration Java class describing the second configuration file;
acquiring a first configuration Java class describing the first configuration file;
generating an XML incremental document according to the second configuration Java class and the first configuration Java class; the XML delta document includes: configuration information that is different between the first configuration file and the second configuration file;
sending the XML delta document to a first client of the application, the XML delta document being used to update a first configuration file of the first client to the second configuration file.
Optionally, the analyzing the second configuration file to obtain a second configuration Java class describing the second configuration file includes:
analyzing the second configuration file according to a preset mapping relation to obtain a second configuration Java class describing the second configuration file;
wherein the mapping relationship comprises: the corresponding relation between the elements and the classes included in the configuration file, and the corresponding relation between the attributes of the elements and the attributes of the classes; the correspondence between the child elements included in the element and the objects of the class, and the correspondence between the attributes of the child elements and the attributes of the objects.
Optionally, the generating an XML incremental document according to the second configuration Java class and the first configuration Java class describing the first configuration file includes:
constructing an initial XML increment difference object;
sequentially traversing Java objects in the second configured Java class and the first configured Java class, and filling the description information of the Java objects with differences obtained by traversing into the initial XML increment difference object; wherein the description information includes: the new value of the element corresponding to the Java object, the query path of the element corresponding to the Java object in the first configuration file, and the corresponding operation type of the Java object;
and obtaining the XML increment document according to the initial XML increment difference object obtained by filling.
Optionally, the initial XML delta difference object includes a root element; the step of filling the description information of the Java object with difference obtained by traversal into the initial XML incremental difference object includes:
and updating the corresponding operation type according to the Java object, adding an element corresponding to the operation type under the root element, and taking a new value of the element corresponding to the Java object and a query path of the element corresponding to the Java object in the first configuration file as attributes of the element corresponding to the operation type.
Optionally, the updating the first configuration file of the application to obtain the second configuration file of the application includes:
receiving a configuration modification request sent by a second client of the application; the configuration modification request is used for requesting to update the first configuration file;
and modifying the first configuration file according to the configuration modification request to obtain the second configuration file.
Optionally, the sending the incremental configuration information to the first client of the application includes:
and sending the incremental configuration information to the first client by adopting a message in a preset format.
Optionally, the obtaining a first configuration Java class describing the first configuration file includes:
reading the first configuration Java class from the cache;
after the obtaining of the first configuration Java class, the method further includes:
replacing, in the cache, the first configuration Java class with the second configuration Java class.
In a second aspect, the present application provides a configuration information processing apparatus, which is applied to the server, the apparatus including:
the processing module is used for updating a first configuration file of an application to obtain a second configuration file of the application; the first configuration file comprises configuration information of a first version of the application, and the second configuration file comprises configuration information of a second version of the application;
the analysis module is used for analyzing the second configuration file to obtain a second configuration Java class describing the second configuration file;
the acquisition module is used for acquiring a first configuration Java class describing the first configuration file;
the generating module is used for generating an XML incremental document according to the second configuration Java class and the first configuration Java class; the XML delta document includes: configuration information that is different between the first configuration file and the second configuration file;
and the sending module is used for sending the XML incremental document to a first client of the application, wherein the XML incremental document is used for updating the first configuration file of the first client into the second configuration file.
In a third aspect, the present application provides a server, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory to implement the method of any of the first aspects.
In a fourth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and the computer-executable instructions are executed by a processor to implement the configuration information processing method according to any one of the first aspect.
In a fifth aspect, the present application provides a computer program product comprising a computer program that, when executed by a processor, implements the method of any of the first aspects.
According to the configuration information processing method, device, equipment, storage medium and program product, the server can convert the configuration information into the corresponding Java object according to the Java reflection mechanism. By comparing the Java objects corresponding to the updated configuration information before and after updating, a difference file is generated, and the XML incremental message is further generated, so that a fixed template does not need to be preset, and the efficiency of generating the XML incremental message is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic architecture diagram of a communication system according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a configuration information processing method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of another configuration information processing method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a configuration information processing apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a server according to the present application.
With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
For ease of understanding, the application scenario and the technical solution of the present application are first explained.
Fig. 1 is a schematic architecture diagram of a possible communication system according to an embodiment of the present application, as shown in fig. 1, the communication system includes: the system comprises a server positioned at the back end, a database positioned at the back end and a plurality of clients positioned at the user side. The server is in communication connection with each client and the database respectively.
The client may be an interactive front-end deployed on a user terminal as a service for the communication system to provide a certain application to a user. In some embodiments, the client deployed on the user side may also be referred to as a client of the application.
The server can be connected with a plurality of clients for data interaction with the clients so as to provide the service of the application for the user through the clients. The application may be Voice over IP (VoIP), Instant Messaging (IM), or the like.
The database at the back end stores the state and configuration information of all clients, and the database can be any one-to-one single type of database such as Microsoft Access, SQL Server, MySQL, Oracle and the like.
When the configuration information of a certain client is changed, the server can receive the configuration information change request of the client, update the states and the configuration information of all the clients stored in the database, and send a configuration information change notification to other clients so that the other clients and the server keep the configuration information synchronous. The configuration information change may be one or more of addition, deletion, search, modification, and the like.
Configuration information interaction between a client and a server in the communication field generally uses an XML document, and for example, in a multi-user simultaneous online collaborative communication scenario, it is required to keep configuration information synchronization between a user and a configuration server by using the XML document. That is, after the server receives the configuration information change message of one client, the server updates the configuration information of the user stored in the database, generates an XML document corresponding to the updated configuration information, and transmits the XML document to the other clients associated with the client, so that the other clients perform information synchronization of the configuration information. At present, the change notification usually adopts the form of XML incremental messages, namely, only the configuration information content which generates the change is sent to the client.
The prior art generation of XML delta documents typically uses two schemes:
scheme 1: and the server correspondingly updates the configuration information of the client stored in the database according to the received configuration change information. And the server generates a corresponding XML document according to the configuration information of the user before updating, compares the XML document with the XML document generated correspondingly to the updated configuration information of the user line by line, records the difference, splices the difference result according to a character string splicing mode, and generates an XML incremental message.
When the XML incremental document is generated by using the scheme, the following problems exist:
1. because the XML document has good openness and expandability, the content structure of the document can be dynamically changed according to the requirements of a client, and the change of the content of the document can be generated at any position, the position where the change occurs can not be quickly determined by comparing the document row by row, so that the efficiency of generating the XML incremental document is low.
2. For applications with more complex business scenes and more contents, the XML document is larger, and the possibility of the changed position is higher. Therefore, the above-mentioned method of generating XML incremental documents by line-by-line comparison is less efficient.
3. The difference results of the XML documents are different in size, and the efficiency of generating the XML incremental document in the character string splicing mode is low, so that the service performance is influenced.
Scheme 2: the server defines a common XML Document template with fixed Type and format Definition through a template defined in advance, for example, based on an XML Document specification such as Document Type Definition (DTD) or XML Schema. And filling data which conforms to the fixed type and the format definition into the XML document template. For example, through a predefined DTD document, the configuration information is filled into the DTD document according to its type and format definition, and an XML document conforming to the predefined DTD is generated. And generating the XML increment message by comparing the XML documents which are correspondingly generated by the configuration information before and after updating and accord with the preset DTD. For another example, the data structure body conforming to the specification may be generated in sequence by using parameters such as a namespace and a data type set by an XML Schema, the configuration information may be filled into a data structure header conforming to the specification in a predetermined sequence, and the data structure header may be converted into an XML document, and the comparison process may be performed as described above to generate an XML incremental message.
Although the scheme 2 can improve the contrast efficiency through the preset template, and avoid the problem of low efficiency caused by line-by-line contrast, when the scheme is used for generating the XML incremental document, the following problems exist:
1. the content structure of the document is developed and defined by an application program, and can be dynamically changed according to needs, the positions of the XML temperature configuration information changes of the two versions before and after updating are not consistent in a fixed mode, and the templates are difficult to unify and fix.
2. The generation of elements and attributes in the XML incremental message document is determined according to the change of the user personalized data, and the changed elements and attributes do not necessarily conform to the format of a preset template. Therefore, creating a common static template is difficult to accommodate personalized changes to the configuration information.
In view of the above, the present application provides a method for processing configuration information. And converting the configuration information into a corresponding Java object according to a Java reflection mechanism. And generating a difference file by comparing the Java objects corresponding to the updated configuration information before updating with the Java objects corresponding to the updated configuration information, and further generating the XML incremental message. Because the configuration information is stored by using the JavaBean compared with the XML document, redundant information can be reduced, and based on the characteristics of the Java language, the efficiency of directly comparing Java objects is higher than that of comparing XML documents line by line. Therefore, even if the change of the document content occurs at any position and/or the application with more configuration content is applied, the configuration information processing method provided by the application can effectively improve the efficiency of generating the XML incremental message. In addition, the method and the device do not need to set a fixed template in advance, so that even if the scene of the configuration information is changed in a personalized mode, the method and the device can generate the XML increment message quickly.
The following takes the application scenario shown in fig. 1 as an example, and details how to solve the technical problem and the technical solution of the present application are described with reference to specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 2 is a schematic flowchart of a configuration information processing method provided in an embodiment of the present application, where an execution main body of the method may be a server or a chip in the server in fig. 1, and as shown in fig. 2, the method of the present embodiment includes the following steps:
s201, updating a first configuration file of an application to obtain a second configuration file of the application; the first configuration file includes configuration information for a first version of the application and the second configuration file includes configuration information for a second version of the application.
Optionally, the application may be an application program in a scenario of simultaneous online collaborative communication by multiple clients, for example, an application program such as Voice over Internet Protocol (VoIP) and Instant Messaging (IM).
Optionally, the configuration file may be a file storing configuration information of the application program, and the configuration file is stored in a database of the server, where the configuration information may include configuration information such as user information, authority, group, priority, communication service, and the like. The database of the Server can be any one-to-one single type of database such as MySQL, Microsoft Access, SQL Server, Oracle and the like, and the Server can directly use a Java reflection mechanism to convert the data stored in the database into corresponding Java classes. The configuration information of the first version of the application may be configuration information before the application program performs the configuration modification operation, and the configuration information of the second version of the application may be configuration information after the application program performs the configuration modification operation.
Optionally, the server may receive a configuration modification request sent by the second client of the application, where the configuration modification request may be sent to the server by the second client of the application in the form of an http message. The configuration modification request sent by the second client of the application can be used for requesting the server to update the first configuration file, and the server modifies the configuration information of the first configuration file according to the received configuration modification request to obtain a second configuration file.
Illustratively, a user uses a client 2 of an application to modify a nickname of an own account in the application, and the client 2 sends a user information configuration modification request to a server in the form of an http message. After receiving a user information configuration modification request sent by the client 2, the server modifies the user information configuration file of the user in the database of the server according to the content of the user information configuration modification request, that is, modifies the configuration information of the first configuration file, thereby generating a new version of the user information configuration file, that is, obtaining a second configuration file.
Optionally, the server may also actively modify the configuration information of the first configuration file to obtain the second configuration file. For example, the server may actively update the version of the application, and update the configuration information that needs to be modified to obtain an updated configuration file.
S202, the second configuration file is analyzed, and a second configuration Java class describing the second configuration file is obtained.
And the server analyzes the second configuration file according to the preset mapping relation to obtain a second configuration Java class describing the second configuration file. The mapping relationship may include, for example: the corresponding relation between the elements and the classes included in the configuration file, and the corresponding relation between the attributes of the elements and the attributes of the classes; the correspondence between the child elements included in the element and the objects of the class, and the correspondence between the attributes of the child elements and the attributes of the objects.
In one possible implementation, the configuration information synchronization involves storage, reading, and modification operations of a large number of XML documents. The preset mapping relationship can be established through an XML binding Architecture jaxb (Java Architecture for XML binding) interface provided in Java EE. The JAXB interface comprises @ XMLRootElement, @ XMLEement, @ XMLAttribute and other annotations. For example, the root element in the XML file content can be parsed by the annotation @ XMLRootElement; the method comprises the steps of analyzing each element in an XML file through annotation @ XMLEment, analyzing the attribute of each element in the XML file content through annotation @ XMLAttribute, analyzing the XML file content corresponding to an application program configuration file into a Java object, namely a corresponding XML class, and achieving storage, reading and modification operations of configuration information in an application through various means of adding, accessing, deleting and modifying the attribute and the sub-element provided in JAXB. In addition, after a preset mapping relation is established through a JAXB interface, an XML class corresponding to the configuration information of the application program can be quickly associated with a client operation event which is randomly generated by utilizing a Java reflection mechanism, so that the operation of modifying the configuration information by the client can be associated with the updating of the XML class. For example, one possible application scenario may be the synchronization of configuration information between multiple network users and multiple clients in the communication field.
Illustratively, the UserProfileXML is a configuration document for maintaining personal information and friend grouping conditions of all users in an application, and the root node of the configuration document is < mcpt-user-profile >. Wherein the configuration document comprises < userAccount > representing personal information of all users and < groupSet > subelement representing grouping situation. According to the JAXB annotation and the specification, the root node < mcpt-user-profile > is analyzed into the corresponding Java class UserProfile through the @ XMLRootElement annotation. Through @ XMLEment annotation, < userAccount > representing personal information of all users and < groupSet > subelements representing grouping situations are resolved into userAccount objects and groupSet objects in corresponding Java classes. And analyzing fields in the < userAccount > representing personal information of all users and the < groupSet > representing grouping conditions to obtain specific contents in the userAccount object and the groupSet object, such as nicknames, ages and gender values in the userAccount object. The attribute information of the fields of < userAccount > indicating all the user personal information and < groupSet > indicating the grouping situation is parsed by @ xmlattributton annotation. Therefore, various means for adding, accessing, deleting and modifying attributes and sub-elements provided by JAXB can be called to modify the generated UserProfile class.
The JAXB interface is an XML binding structure interface provided in Java EE, and therefore, how to parse an XML file into Java objects through the JAXB interface may refer to how to use the JAXB interface in the prior art, which is not described herein again.
S203, a first configuration Java class describing a first configuration file is obtained.
In one possible embodiment, before updating the first configuration file, the server generates a first configuration Java class corresponding to the first configuration file according to the first configuration file.
In another possible embodiment, the first configuration Java class of the first configuration file is the first configuration Java class generated and stored when the configuration is changed to the first configuration file last time. In this implementation manner, the server may read the first configuration Java class from a pre-stored location, where the first configuration Java class may be obtained by analyzing, by the server, the configuration information in the database of the server before being updated according to the preset mapping relationship in step S202, and the first configuration Java class may be stored in a cache of the server.
Optionally, after the server acquires the first configuration Java class, the server may further replace the first configuration Java class with a second configuration Java class, so that the configuration information corresponding to the stored Java class is the updated configuration information. If the first configuration Java class is stored in the cache of the server, the replacing replaces the first configuration Java class with the second configuration Java class in the cache.
S204, generating an XML incremental document according to the second configuration Java class and the first configuration Java class; the XML delta document includes: there is differential configuration information between the first configuration file and the second configuration file.
For example, the second configuration Java class may be compared with the first configuration Java class to obtain an object with a difference between the two Java classes. Then, an XML delta document is generated based on the objects that are differentiated. The difference existing between the two Java class objects may be a difference in the attributes of the objects, a difference in the values of the objects, a difference in the positions of the objects, and the like.
S205, sending an XML incremental document to the first client of the application, wherein the XML incremental document is used for updating the first configuration file of the first client into a second configuration file.
In one possible implementation manner, the server converts the generated XML incremental document into a message in a format convenient for the client to access, for example, the XML incremental document may be converted into a Session Initiation Protocol (SIP) message, and the XML incremental document is sent to the first client. And the first client updates the first configuration file of the application of the first client into a second configuration file according to the received XML incremental document.
Taking the example that the server modifies the first configuration file based on the configuration modification request sent by the second client to obtain the second configuration file, the first client and the second client may include the following two cases:
the first method comprises the following steps: the first client and the second client are the same client, the client sends a configuration modification request at the moment, and the server correspondingly modifies the configuration information in the database according to the received configuration modification request. And sending the XML incremental document corresponding to the modified configuration information to the client, so that the client can update the first configuration file into a second configuration file. In this way, for example, configuration information that does not need to be synchronized with other clients, such as modifying the personal privacy configuration information of the user, which may include a user password, a network record, and the like.
And secondly, the first client and the second client are different clients, the second client sends a configuration modification request, and the server correspondingly modifies the configuration information in the database according to the received configuration modification request. And sending the XML incremental document corresponding to the modified configuration information to a first client except a second client in the system, and updating the first configuration file of the first client into a second configuration file. Optionally, in this implementation, the XML delta document may also be sent to the second client. The XML delta document is sent to the second client for use in granting and acknowledging the second client's configuration modification request, and for the second client to update the first configuration file to the second configuration file. Optionally, in this implementation, other manners may also be used to communicate with the second client, so as to agree and confirm the configuration modification request of the second client, and enable the second client to update the first configuration file to the second configuration file. Other ways may be, for example, to communicate a message in the form of a message agreeing to and acknowledging the configuration modification request.
According to the configuration information processing method provided by the embodiment of the application, the server can analyze the applied XML document into the Java object, and the XML document before the updating of the configuration information in the comparison database and the XML document after the updating of the configuration information are converted into the Java object before the updating of the configuration information in the comparison database and the Java object after the updating of the configuration information through a Java reflection mechanism. Since the configuration information is stored using the JavaBean, redundant information can be reduced compared to storing the configuration information using an XML document. Based on the peculiarity of Java language itself, the efficiency of directly comparing Java objects is higher than that of comparing XML documents line by line. Furthermore, the XML document is analyzed into the Java object, and even if the modification of the configuration information is determined according to the change of the user personalized data, the XML document can be analyzed into the corresponding Java object without a preset data format. Therefore, the configuration information processing method provided by the embodiment of the application can improve the data comparison efficiency, improve the speed of generating the XML incremental document, and adapt to the personalized configuration information modification of the user.
The following describes in detail how to generate an XML incremental document based on the second configured Java class and the first configured Java class. Fig. 3 is a schematic flowchart of another configuration information processing method provided in the embodiment of the present application, and as shown in fig. 3, step S203 may include:
s301, constructing an initial XML increment difference object.
The server builds an initial XML delta difference object, which may be, for example, a Java object that conforms to the standards of the XCAP diff document defined by RFC 5874, and may include a root element and corresponding attributes. The initial XML increment difference object is used for storing Java objects with differences in the comparison results of the second configuration Java class and the Java objects in the first configuration Java class.
It will be appreciated what standards the initial XML delta difference object described above specifically needs to conform to, is relevant to the standards of XML delta documents that are currently followed by the communication system.
S302, sequentially traversing Java objects in the second configuration Java class and the first configuration Java class, and filling the description information of the Java objects with difference obtained by traversing into the initial XML increment difference object.
Through a Java reflection mechanism, the server can acquire all the child elements and the attributes thereof in the XML class, and then traverse to acquire the fields of all the child elements in the XML class, and judge the data types of all the child element fields one by one. Judging whether the Java object with the difference exists or not through the value and the attribute of the sub-element, updating the corresponding operation type according to the Java object with the difference, adding an element corresponding to the operation type under the XML increment difference object root element, and filling the description information of the Java object with the difference into the initial XML increment difference object. Wherein the description information includes: the new value of the element corresponding to the Java object, the query path of the element corresponding to the Java object in the first configuration file, and the corresponding operation type of the Java object are updated.
Optionally, if the data type of the sub-element field in the XML class is Java basic data and type, for example, Integer, Boolean, double, or other data types, the values and attributes of the sub-elements in the second configured Java class and the first configured Java class are obtained, and whether the values and attributes are equal is determined. And if the Java objects are not equal, writing the value, the query path and the operation type of the Java object in the second configured Java class into the initial XML increment difference object for the Java object with difference. The query path may be determined by determining an Xpath query path of a child element in the XML class, where Xpath is an XML path language and is capable of determining the location of a node in an XML document. The operation types can be classified into the following three cases:
when the values of the current sub-elements and/or attributes in the second configuration Java class are not equal to the values of the current sub-elements and/or attributes in the first configuration Java class, the operation type is updated;
when the value of the current sub-element and/or attribute in the first configuration Java class is not null, and when the value of the second configuration Java class is null, the operation type is deletion;
and when the value of the current sub-element and/or attribute is null in the first configuration Java class, the operation type is newly increased when the value of the second configuration Java class is not null.
Optionally, if the data type of the sub-element field in the obtained XML class is a List type, a List object of values of sub-elements in the second configuration Java class and the first configuration Java class is obtained. By traversing the List object, the data type of each element in the List object is determined. And determining the value, attribute and arrangement sequence of each element in the List object according to the data type, and judging whether the values are equal. And if the difference exists, writing the value, the query path and the operation type of the List object in the second configuration Java class into the initial XML increment difference object for the Java object with the difference.
And taking all sub-elements or attributes, query paths, operation types and the like with differences as parameters, and classifying and writing the parameters into the initial XML increment difference object according to the operation types.
S303, obtaining an XML incremental document according to the initial XML incremental difference object obtained by filling.
And the database analyzes the initial XML increment difference object into an XML document format by utilizing a Java reflection mechanism and a preset mapping relation according to the filled initial XML increment difference object to generate an XML increment document. The preset mapping relationship refers to the inverse mapping of the mapping relationship of the second configuration Java class describing the second configuration file obtained by analyzing the second configuration file in step S202. All the child elements in the XML incremental document have a sel attribute, which may be set correspondingly according to the query path described above, to indicate the location path of the child element changed in the original XML document, so that the client can quickly locate and modify the configuration information.
According to the method for generating the XML incremental document according to the second configuration Java class and the first configuration Java class, the server can classify and fill the second configuration Java class and the objects with the differences in the first configuration Java class into the initial XML incremental difference objects according to the operation types by constructing the initial XML incremental difference objects. And after the filling of all the difference objects is finished, analyzing the filled XML increment difference objects into XML increment documents through a reflection mechanism of Java and a preset mapping relation. The efficiency of generating the XML incremental document is improved by converting the compared XML document into a more efficient mode of comparing the corresponding Java classes. By setting the sel attribute, the efficiency of the client for quickly positioning the change position of the configuration information is improved.
Fig. 4 is a schematic structural diagram of a configuration information processing apparatus according to an embodiment of the present application. As shown in fig. 4, the configuration information processing apparatus includes: the device comprises a processing module, an analysis module, an acquisition module, a generation module and a sending module. Optionally, the configuration information processing apparatus may further include, for example: and a receiving module.
And the processing module 11 is configured to update the first configuration file of the application to obtain a second configuration file of the application. The first configuration file includes configuration information for a first version of the application and the second configuration file includes configuration information for a second version of the application.
And the analysis module 12 is configured to analyze the second configuration file to obtain a second configuration Java class describing the second configuration file.
An obtaining module 13, configured to obtain a first configuration Java class describing a first configuration file.
And the generating module 14 is used for generating the XML incremental document according to the second configuration Java class and the first configuration Java class. The XML delta document includes: there is differential configuration information between the first configuration file and the second configuration file.
A sending module 15, configured to send an XML delta document to the first client of the application, where the XML delta document is used to update the first configuration file of the first client to the second configuration file. For example, the sending module 15 is specifically configured to send the incremental configuration information to the first client by using a message in a preset format.
As a possible implementation manner, the parsing module 12 is specifically configured to parse the second configuration file according to a preset mapping relationship to obtain a second configuration Java class describing the second configuration file. Wherein, the mapping relation comprises: the corresponding relation between the elements and the classes included in the configuration file, and the corresponding relation between the attributes of the elements and the attributes of the classes. The correspondence between the child elements included in the element and the objects of the class, and the correspondence between the attributes of the child elements and the attributes of the objects.
In this implementation, optionally, the generating module 14 is specifically configured to construct an initial XML delta difference object. Sequentially traversing Java objects in the second configuration Java class and the first configuration Java class, filling the description information of the Java objects with difference obtained by traversing into the initial XML increment difference object, and obtaining the XML increment document according to the initial XML increment difference object by a Java reflection mechanism. Wherein the description information includes: the new value of the element corresponding to the Java object, the query path of the element corresponding to the Java object in the first configuration file, and the corresponding operation type of the Java object are updated. For example, the initial XML incremental difference object includes a root element, and the generating module 14 may update the corresponding operation type according to the Java object, add an element corresponding to the operation type under the root element, and use a new value of the element corresponding to the Java object and a query path of the element corresponding to the Java object in the first configuration file as attributes of the element corresponding to the operation type.
As a possible implementation manner, the receiving module 16 is configured to receive a configuration modification request sent by a second client of the application. The processing module 11 is specifically configured to use the configuration modification request received by the receiving module to request to update the first configuration file. And modifying the first configuration file according to the configuration modification request to obtain a second configuration file. Optionally, the obtaining module 13 is specifically configured to read the first configuration Java class from the cache. The processing module 11 is further configured to replace the first configuration Java class with the second configuration Java class in the cache after the obtaining module 13 obtains the first configuration Java class.
The configuration information processing apparatus provided in the embodiment of the present application may execute the configuration information processing method shown in fig. 2 to 3 in the above method embodiments, and the implementation principle and the technical effect are similar, and are not described herein again. The configuration information processing device may be, for example, the server, or may be a chip of the server, such as a processor.
Fig. 5 is a schematic structural diagram of a server according to the present application. The server may be, for example, the aforementioned server for exchanging configuration information in the communication field. As shown in fig. 5, the server 500 may include: at least one processor 501, a memory 502.
The memory 502 is used for storing programs. In particular, the program may include program code including computer operating instructions.
Memory 502 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 501 is used to execute the computer executable instructions stored in the memory 502 to implement the configuration information processing method described in the foregoing method embodiments. The processor 501 may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement the embodiments of the present Application.
Optionally, the electronic device 500 may further include a communication interface 503 to enable communication interaction with an external device through the communication interface 503, the external device may be a client of an application, for example, in a specific implementation, if the communication interface 503, the memory 502 and the processor 501 are implemented independently, the communication interface 503, the memory 502 and the processor 501 may be connected to each other through a bus and may complete communication therebetween. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. Buses may be classified as address buses, data buses, control buses, etc., but do not represent only one bus or type of bus.
Optionally, in a specific implementation, if the communication interface 503, the memory 502, and the processor 501 are integrated into a chip, the communication interface 503, the memory 502, and the processor 501 may complete communication through an internal interface.
The present application also provides a computer-readable storage medium, which may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and in particular, the computer-readable storage medium stores program instructions, and the program instructions are used in the method in the foregoing embodiments.
The present application also provides a program product comprising execution instructions stored in a readable storage medium. The at least one processor of the electronic device may read the execution instruction from the readable storage medium, and the execution of the execution instruction by the at least one processor causes the electronic device to implement the device monitoring method provided by the various embodiments described above.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (11)

1. A method for processing configuration information, the method comprising:
updating a first configuration file of an application to obtain a second configuration file of the application; the first configuration file comprises configuration information of a first version of the application, and the second configuration file comprises configuration information of a second version of the application;
analyzing the second configuration file to obtain a second configuration Java class describing the second configuration file;
acquiring a first configuration Java class describing the first configuration file;
generating an XML incremental document according to the second configuration Java class and the first configuration Java class; the XML delta document includes: configuration information that is different between the first configuration file and the second configuration file;
sending the XML delta document to a first client of the application, the XML delta document being used to update a first configuration file of the first client to the second configuration file.
2. The method according to claim 1, wherein said parsing the second configuration file to obtain a second configuration Java class describing the second configuration file comprises:
analyzing the second configuration file according to a preset mapping relation to obtain a second configuration Java class describing the second configuration file;
wherein the mapping relationship comprises: the corresponding relation between the elements and the classes included in the configuration file, and the corresponding relation between the attributes of the elements and the attributes of the classes; the correspondence between the child elements included in the element and the objects of the class, and the correspondence between the attributes of the child elements and the attributes of the objects.
3. The method of claim 2, wherein generating an XML delta document based on the second configuration Java class and the first configuration Java class describing the first configuration file comprises:
constructing an initial XML increment difference object;
sequentially traversing Java objects in the second configured Java class and the first configured Java class, and filling the description information of the Java objects with differences obtained by traversing into the initial XML increment difference object; wherein the description information includes: the new value of the element corresponding to the Java object, the query path of the element corresponding to the Java object in the first configuration file, and the corresponding operation type of the Java object;
and obtaining the XML increment document according to the initial XML increment difference object obtained by filling.
4. The method of claim 3, wherein the initial XML delta difference object comprises a root element;
the step of filling the description information of the Java object with difference obtained by traversal into the initial XML incremental difference object includes:
and updating the corresponding operation type according to the Java object, adding an element corresponding to the operation type under the root element, and taking a new value of the element corresponding to the Java object and a query path of the element corresponding to the Java object in the first configuration file as attributes of the element corresponding to the operation type.
5. The method according to any of claims 1-4, wherein the updating the first configuration file of the application to obtain the second configuration file of the application comprises:
receiving a configuration modification request sent by a second client of the application; the configuration modification request is used for requesting to update the first configuration file;
and modifying the first configuration file according to the configuration modification request to obtain the second configuration file.
6. The method of any of claims 1-4, wherein sending the incremental configuration information to the first client of the application comprises:
and sending the incremental configuration information to the first client by adopting a message in a preset format.
7. The method according to any of claims 1-4, wherein said obtaining a first configuration Java class describing said first configuration file comprises:
reading the first configuration Java class from the cache;
after the obtaining of the first configuration Java class, the method further includes:
replacing, in the cache, the first configuration Java class with the second configuration Java class.
8. A configuration information processing apparatus, wherein the apparatus is applied to the server, the apparatus comprising:
the processing module is used for updating a first configuration file of an application to obtain a second configuration file of the application; the first configuration file comprises configuration information of a first version of the application, and the second configuration file comprises configuration information of a second version of the application;
the analysis module is used for analyzing the second configuration file to obtain a second configuration Java class describing the second configuration file;
the acquisition module is used for acquiring a first configuration Java class describing the first configuration file;
the generating module is used for generating an XML incremental document according to the second configuration Java class and the first configuration Java class; the XML delta document includes: configuration information that is different between the first configuration file and the second configuration file;
and the sending module is used for sending the XML incremental document to a first client of the application, wherein the XML incremental document is used for updating the first configuration file of the first client into the second configuration file.
9. A server, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer execution instructions;
the processor executes computer-executable instructions stored by the memory to implement the method of any of claims 1 to 7.
10. A computer-readable storage medium having stored therein computer-executable instructions for implementing the configuration information processing method according to any one of claims 1 to 7 when executed by a processor.
11. A computer program product, characterized in that it comprises a computer program which, when executed by a processor, implements the method of any one of claims 1 to 7.
CN202210087618.0A 2022-01-25 2022-01-25 Configuration information processing method, device, equipment, medium and program product Pending CN114490889A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210087618.0A CN114490889A (en) 2022-01-25 2022-01-25 Configuration information processing method, device, equipment, medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210087618.0A CN114490889A (en) 2022-01-25 2022-01-25 Configuration information processing method, device, equipment, medium and program product

Publications (1)

Publication Number Publication Date
CN114490889A true CN114490889A (en) 2022-05-13

Family

ID=81474764

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210087618.0A Pending CN114490889A (en) 2022-01-25 2022-01-25 Configuration information processing method, device, equipment, medium and program product

Country Status (1)

Country Link
CN (1) CN114490889A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113722007A (en) * 2021-08-24 2021-11-30 杭州迪普科技股份有限公司 Configuration method, device and system of VPN branch equipment
CN115174387A (en) * 2022-06-30 2022-10-11 中国联合网络通信集团有限公司 Configuration access management method, ISIM card, terminal and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101699397A (en) * 2009-10-09 2010-04-28 上海宝信软件股份有限公司 Method for binding Java and XML data
CN105653554A (en) * 2014-11-14 2016-06-08 卓望数码技术(深圳)有限公司 File data comparison method and system
CN108255849A (en) * 2016-12-29 2018-07-06 北京京东尚科信息技术有限公司 JavaBean is converted into the method, apparatus and system of XML file
CN112217656A (en) * 2019-07-11 2021-01-12 奇安信科技集团股份有限公司 Method and device for synchronizing configuration information of network equipment in SD-WAN (secure digital-to-Wide area network) system
CN113094063A (en) * 2021-03-02 2021-07-09 厦门亿联网络技术股份有限公司 Configuration file updating method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101699397A (en) * 2009-10-09 2010-04-28 上海宝信软件股份有限公司 Method for binding Java and XML data
CN105653554A (en) * 2014-11-14 2016-06-08 卓望数码技术(深圳)有限公司 File data comparison method and system
CN108255849A (en) * 2016-12-29 2018-07-06 北京京东尚科信息技术有限公司 JavaBean is converted into the method, apparatus and system of XML file
CN112217656A (en) * 2019-07-11 2021-01-12 奇安信科技集团股份有限公司 Method and device for synchronizing configuration information of network equipment in SD-WAN (secure digital-to-Wide area network) system
CN113094063A (en) * 2021-03-02 2021-07-09 厦门亿联网络技术股份有限公司 Configuration file updating method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113722007A (en) * 2021-08-24 2021-11-30 杭州迪普科技股份有限公司 Configuration method, device and system of VPN branch equipment
CN113722007B (en) * 2021-08-24 2023-11-03 杭州迪普科技股份有限公司 Configuration method, device and system of VPN branch equipment
CN115174387A (en) * 2022-06-30 2022-10-11 中国联合网络通信集团有限公司 Configuration access management method, ISIM card, terminal and system
CN115174387B (en) * 2022-06-30 2023-06-13 中国联合网络通信集团有限公司 Configuration access management method, ISIM card, terminal and system

Similar Documents

Publication Publication Date Title
US11176160B2 (en) SQL interceptor for use with third party data analytics packages
CA2802746C (en) System and methods for facilitating the synchronization of data
CN110399388A (en) Data query method, system and equipment
CN114490889A (en) Configuration information processing method, device, equipment, medium and program product
WO2019154353A1 (en) System running parameter query method, matching method and apparatus, and node device
US7509422B2 (en) System and method for locating web services
US8713368B2 (en) Methods for testing OData services
US20160072927A1 (en) Odata enabled mobile software applications
CN110727417B (en) Data processing method and device
EP3217632A1 (en) Oid configuration, parsing method, client, node, database and storage medium
US20220245588A1 (en) Providing a binary data file to a client application using a document model
US20070180143A1 (en) Translation Web Services For Localizing Resources
US8341212B2 (en) Service description refinement based on actual service use
Eatmon et al. Data Forms
US8001212B2 (en) Method and data processing system for providing XML data
CN112835573B (en) Data query method and device, electronic equipment and storage medium
US7571196B2 (en) Type evolution
US11341154B2 (en) Normalizing encodings of requested data from a common data schema to a target data schema
CN114817794A (en) Webpage content control method, device, equipment and medium
KR20170125665A (en) Semantic Information Management Method for a M2M/IoT platform
CN108809900B (en) Framework and method for unified resource access
KR20100113975A (en) Method of an xml document management to cancel a specific past operation selectively, and system using the same
Tamayo et al. Dealing with large schema sets in mobile SOS-based applications
Eatmon et al. JEP-0004: Data Forms
WO2023230797A1 (en) Cross-system test method and apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination