Summary of the invention
The technical problem to be solved in the present invention is, the defective of, search performance difference single at the said structure of prior art provides the method for the structure topological tree that a kind of structure is abundant, search performance is good.
The technical solution adopted for the present invention to solve the technical problems is: construct a kind of method of constructing topological tree in the server/customer end structure, comprise the steps:
A) according to the attribute data of the managed devices that links to each other, define the topological tree structure, and be stored in the described server database;
B) make user and at least one topological tree structurally associated connection;
C) from server database, read network element data and associated topological tree structured data, and create topological tree node data collection;
D) by the topological tree structure construction topological tree of definition, corresponding each node in construction process is concentrated the adding corresponding data at the topological tree node data, is used for locating fast the node of described topological tree.
In the method for structure topological tree of the present invention, described steps A) further comprise the steps:
A1) definition comprises the description of topological tree: tree numbering, tree title;
A2) structure of definition topological tree comprises: tree numbering, node level, network element attribute.
In the method for structure of the present invention topological tree, described steps A 2) network element attribute in comprises the attribute that is comprised in the attribute data of managed devices.
In the method for structure of the present invention topological tree, described step B) interrelational form comprises Customs Assigned Number, tree numbering, DISPLAY ORDER in.
In the method for structure of the present invention topological tree, described step C) packet purse rope meta-attribute name, network element attribute value and tree node pointer to object that the topological tree node data collection described in is comprised.
In the method for structure topological tree of the present invention, described step C) further comprise the steps:
C1) according to described topological tree structure, the data directory that creates NE by described index order, obtains the network element data collection with the network element data that reads;
C2) the structure objects chained list that creates NE.
The form of the network element data index in the method for structure of the present invention topological tree, described step C1) comprises: node level 1 network element attribute+node level 2 network element attributes+... + node level N network element attribute.
The attribute of the network element structure objects in the method for structure of the present invention topological tree, described step C2) comprises: tree numbering, node level, network element attribute, node pointer, father node pointer and a last value.
In the method for structure topological tree of the present invention, described step D) further comprise the steps:
D1) network element data pointer and network element structure objects pointer and initial value thereof are set, the initial value of network element data pointer points to first row of network element data collection, the initial value of network element structure objects pointer is 0, points to first the network element structure objects of coming of network element structure objects chained list;
D2) judge whether the network element data that network element data is concentrated travels through, as finish that then the structure of topological tree, execution in step D8 are finished in expression); As unfinished, execution in step D3);
D3) judge whether the network element structure objects in the network element structure objects chained list travels through, and in this way, the network element data pointer adds 1, and execution in step D2), as not, carry out next step D4);
D4) from this network element structure objects, obtain the network element attribute value, concentrate the field value that takes out field described network element attribute value by name in the current line at network element data, be worth relatively with last one in the network element structure objects, if do not wait, then carry out next step D5), otherwise execution in step D7);
D5) a newly-built in the tree network element node, its father node is the father node pointer in the current network structure objects, a last value of current network structure objects is replaced with the field value of described field described network element attribute value by name, the father node pointer that begins from the next object of the network element structure objects of network element structure objects pointed in the network element structure objects chained list is pointed to this newly-built node entirely, and a last value then all is set to initial value;
D6) concentrate the insertion data line to described topological tree node data, its network element attribute is called described network element attribute value, and the network element attribute value is the field value of field described network element attribute value by name in the current line, and the tree node pointer to object points to newly-built node;
D7) described network element structure objects pointer adds 1, returns step D3);
DS) finish.
In the method for structure topological tree of the present invention, at described step D5) in, when described father node pointer was nil, this newly-built network element node was a root node.
Implement method of in the server/customer end structure, constructing topological tree of the present invention, the structure of topological tree has following beneficial effect: owing to can be set by user oneself, and the user can select the topological tree structure that is associated with oneself, simultaneously also owing to be provided with topological tree node data collection, and all corresponding data is put into the topological tree node data and concentrate when network node of every establishment, so the topological tree structure of constructing with this method is abundant, search performance is good.
Embodiment
Below with realizing in the repeater management system in communication that method of the present invention as embodiment, specifies the specific embodiment of the present invention.As shown in Figure 1, in the server/customer end structure, construct among the method embodiment of topological tree, comprise the steps: in the present invention
S11 is according to the network element attribute data, definition topological tree structure, be stored in the server database: server is collected the various attributes with its managed devices that links to each other by network in this step, as: affiliated area, device type, supplier, Dai Wei manufacturer, power, user mode, running status or the like, the summation of these attributes constitutes the network element attribute data; In addition, the user need be defined in the structure of the topological tree of using in the native system, comprise description of topological tree and the formation of topological tree, in the present embodiment, be described as [tree numbering] to topological tree adds [tree title], promptly describe topological tree with two fields, first is variable [a tree numbering], and second is variable [tree title]; (every promptly be stored in the one or more bytes in the computer herein, indicate no longer especially later on by the variable that is of symbol [] mark.) definition to the topological tree structure in the present embodiment is: [tree numbering], [node level], [network element attribute].Wherein [network element attribute] must be the attribute that repeater equipment possesses, and promptly can only choose from the repeater equipment attribute.In the present embodiment, we define one " manufacturer's topology " tree, and its primary structure is " center-manufacturer-area-logical station ".
S12 associated user and at least one topological tree structure: the topological tree structure that can show when the user being set logining, its interrelational form are [Customs Assigned Number], [tree numbering], [DISPLAY ORDER].Owing to allow a user to show many topological trees simultaneously,, then need to be provided with [DISPLAY ORDER] so will show many trees simultaneously if a user is provided with.
S13 reads network element data and associated topological tree structured data, data set and topological tree node data collection create NE: in this step, the user accesses the data of storing or defining automatically in step S11 and S12 in system after client or the server log, and utilize these data, generate network element data collection and topological tree node data collection, in the present embodiment, the user is by after the client login, the above-mentioned data of reading back from the data in server storehouse, and these data are temporarily stored in the internal memory of client.
S14 expands into tree by setting structure with network element data, and in expansion process corresponding each network node, concentrate to add corresponding data at the topological tree node data: the data that obtain according to preceding step, setting according to the user who accesses, to expand into the tree type by the network element data that server end reads, and in above-mentioned expansion process when setting up node each time, it is concentrated to deposit corresponding data in above-mentioned topological tree node data, thereby can find the position of this node in the Tree Network metadata of launching in needs rapidly.
As shown in Figure 2, in the present embodiment, step S13 further comprises the steps:
S21 reads network element data: the network element data of client reading and saving in server database, and be kept in the internal memory of client with the form of a data set.
S22 reads associated topological tree structure: client is according to the incidence relation of user who sets among the step S12 and topological tree, the topological tree structure of reading and saving in server database, and formula is kept in the internal memory of client; When comprising DISPLAY ORDER in the incidence relation among the step S12, also to read a plurality of topological tree structures by DISPLAY ORDER.
S23 the create NE data directory and the network element data that sorts, obtain the network element data collection: the above-mentioned network element data that is stored in client is set up index by the tree structure that will show, index is: node level 1 network element attribute+node level 2 network element attributes+... + node level N network element attribute, after obtaining this index, network element data is resequenced by this index, thereby obtain the network element data collection.
The S24 structure objects chained list that creates NE: construct a network element structure objects chained list, the network element construction packages is become object, be pressed into this network element structure objects chained list, the network element structure objects is by [the node level] of the topological tree organization definition that will show ordering in this chained list.The network element structure objects comprises attribute: [tree numbering], [node level], [network element attribute], [node pointer], [father node pointer], [a last value].[node pointer] of all network element structure objects is nil with [father node pointer] in the initialization chained list, and [a last value] is made as a special initial value, and this particular value must guarantee can not appear in the property value of equipment.
S25 creates topological tree node data collection: the internal storage data collection of a sky of dynamic creation, i.e. and topological tree node data collection, its structure is: [network element attribute name], [network element attribute value], [tree node pointer to object].It mainly acts on is to use for searching for the locating tree node fast.At this moment, its data are empty.
Step S14 further comprises the steps: equally, in the present embodiment
S301 is provided with network element data pointer and network element structure objects pointer and initial value thereof, wherein the network element data pointer is meant that the network element data when pre-treatment is to be in the position that the said network element structured data is concentrated, network element structure objects pointer is meant position in the network element structure chained list at its place of network element structure objects when pre-treatment (in network element structure objects chained list, the network element structure objects is by [node level] ordering of the topological tree organization definition that will show); Its initial value is represented its original position respectively, and in the present embodiment, the initial value of network element data pointer points to first row of network element data collection, and the initial value of network element structure objects pointer is 0, points to first the network element structure objects of coming of network element structure objects chained list.
Does S302 finish the network element data traversal? judge whether to finish the traversal of network element data, in this way, the expression topological tree has constructed and has finished execution in step S311; As denying execution in step S304.
S303 network element data pointer adds one: the network element data pointer is added one point to next line, and return execution in step S302
Does S304 finish the traversal of network element structure objects chained list? judge whether to finish the traversal of network element structure objects, in this way, show that current network data pointer network element data pointed disposes, then execution in step S303; As denying execution in step S306.
S306 obtains the field value of network element attribute value by name and the last value in the network element structure: in this step, at first obtain from the network element structure objects [network element attribute], establish its value and be P1; Afterwards, concentrate the field value that takes out field P1 by name in the current line, establish its value and be V1 at network element data; Simultaneously, from this network element structure objects, obtain [a last value], establish its value and be V2.
The more above-mentioned two-value of S307 is with denying: more above-mentioned V1 and V2, if the two does not wait, then carry out S308; Otherwise jumping to step S310 continues to carry out.
The newly-built network element node of S308, the father node pointer of the network element object after it in its attribute and this network element structure objects chained list is set: a newly-built network element node on topological tree, its father node are [the father node pointer] in the network element structure objects.Then the field value V2 in [a last value] of current network structure objects is replaced with field value V1.[the father node pointer] of the network element structure objects that begins from K+1 in the network element structure objects chained list pointed to newly-built node entirely, and [a last value] then all is changed to initial value.
S309 concentrates to the topological tree node data and inserts newly-built node data: concentrate toward above-mentioned topological tree node data and insert data line, wherein [network element attribute name] equals P1, and [network element attribute value] equals V1, and [tree node pointer to object] points to newly-built node.
The position of S310 network element structure objects in its chained list adds 1: the position of network element structure objects in its chained list to one of pusher, be about to K and become K+1, and then execution in step S304.
S311 finishes:
Form with form specifies the variation of network element structure objects chained list in the process of implementation below:
Behind execution in step S23, obtain network element data collection such as following table:
| The center | Supplier | The area | Logical station | ... |
| Network management center | Compatriots | The Feitian | CI scape X hotel | ? |
| Network management center | Compatriots | The Feitian | The blue X stone of CI home | ? |
| Network management center | Compatriots | Luohu | C1 name X mansion | ? |
| Network management center | Capital X | The Feitian | Mountain villa, CI X mountain | ? |
Behind execution in step S24, it is as follows to obtain network element structure objects chained list:
| The tree numbering | The node level | Network element attribute | The father node pointer | A last value |
| 1 | 1 | The center | nil | NULL |
| 1 | 2 | Supplier | nil | NULL |
| 1 | 3 | The area | nil | NULL |
| 1 | 4 | Logical station | nil | NULL |
Behind execution in step S25, it is as follows to obtain topological tree node data collection:
| The network element attribute name | The network element attribute value | The tree node pointer |
| ? | ? | ? |
After execution instep 301, first row of network element data pointed network element data, first network element structured data in the network element structure objects pointed network element structure objects chained list, promptly the node level is 1 network element structure objects.
In step S306, can obtain P1 according to said network element structure objects chained list is " " center "; V1 is the field " value of " center ": " network management center " by name in the said network element data centralization current line; V2 is NULL.
In step S308, a newly-built tree node N (network management center) (following replace all newly-built nodes) with N (XX); Because [father node pointer] in the table 5 item is nil, so N (network management center) is a root node; Then [a last value] is revised as " network management center ".[the father node pointer] of the network element structure objects that begins from K+1 in the network element structure objects chained list pointed to newly-built node entirely, and [a last value] is changed to initial value entirely.After executing this step, the data in the network element structure objects chained list become as following table:
| The tree numbering | The node level | Network element attribute | The father node pointer | A last value |
| 1 | 1 | The center | ?nil | Network management center |
| 1 | 2 | Supplier | N (network management center) | NULL |
| 1 | 3 | The area | N (network management center) | NULL |
| 1 | 4 | Logical station | N (network management center) | NULL |
Concentrate insertion delegation corresponding data to the topological tree node data, topological tree node data collection becomes:
| The network element attribute name | The network element attribute value | The tree node pointer |
| The center | Network management center | Tree node N (network management center) address pointer |
So far, first network element structure objects in the network element structure objects chained list is finished dealing with, and at step S310, network element structure objects pointer adds 1, execution in step S304-S309, so network element structure objects chained list and topological tree node data collection become respectively:
| The tree numbering | The node level | Network element attribute | The father node pointer | A last value |
| 1 | 1 | The center | ?nil | Network management center |
| 1 | 2 | Supplier | N (network management center) | Compatriots |
| The tree numbering | The node level | Network element attribute | The father node pointer | A last value |
| 1 | 3 | The area | N (compatriots) | NULL |
| 1 | 4 | Logical station | N (compatriots) | NULL |
| The network element attribute name | The network element attribute value | The tree node pointer |
| The center | Network management center | Tree node N (network management center) address pointer |
| Supplier | Compatriots | Tree node N (compatriots) address pointer |
The network element structure objects of remainder in the processing net element structure objects chained list, network element structure objects chained list becomes:
So far, network element data concentrates first row to dispose, execution in step S303, the network element data pointer adds 1, points to second row that network element data is concentrated, repeat above-mentioned steps after, it is as follows to obtain network element structure objects chained list:
| The tree numbering | The node level | Network element attribute | The father node pointer | A last value |
| 1 | 1 | The center | ?nil | Network management center |
| 1 | 2 | Supplier | N (network management center) | Compatriots |
| 1 | 3 | The area | N (compatriots) | The Feitian |
| 1 | 4 | Logical station | N (Feitian) | The blue X stone of CI home |
Equally, behind processing net element data set the third line, it is as follows to obtain network element structure objects linked list data:
| The tree numbering | The node level | Network element attribute | The father node pointer | A last value |
| 1 | 1 | The center | ?nil | Network management center |
| 1 | 2 | Supplier | N (network management center) | Compatriots |
| 1 | 3 | The area | N (compatriots) | Luohu |
| 1 | 4 | Logical station | N (Luohu) | CI name X mansion |
Similarly, during processing net element data centralization fourth line data, because supplier's variation, so need newly-built supplier node.This moment, network element structure objects linked list data became:
| The tree numbering | The node level | Network element attribute | The father node pointer | A last value |
| 1 | 1 | The center | ?Nil | Network management center |
| 1 | 2 | Supplier | N (network management center) | Capital X |
| 1 | 3 | The area | N (capital X) | NULL |
| 1 | 4 | Logical station | N (capital X) | NULL |
Last value owing to the area is reset then, and regional node needs newly-built again, but the superior node of this time newly-built regional node is N (capital X).Last newly-built logical station node.So network element data concentrates whole 4 line data just to dispose.
Because every newly-built node all can be concentrated toward memory table topological tree node data to add data line.Therefore when the user has the Search and Orientation of needs node, only need to search in this memory table, just can obtain this node pointer rapidly, efficient is higher.
Though above description the specific embodiment of the present invention, those of ordinary skills should be known in that these only for illustrating, can make numerous variations or modification to these execution modes, and not deviate from principle of the present invention and essence.