Summary of the invention
In view of this, main purpose of the present invention is to provide a kind of management object creation method and device, to solve existing management object creation method, makes the Operation and Maintenance agency lack the problem of flexibility.
For achieving the above object, technical scheme of the present invention is achieved in that
The invention provides a kind of management object MO creation method, comprising:
According to the globally unique identifier of all kinds of unit, create and the corresponding structure in described all kinds of unit;
The static function of creating MO is set in the structure of being created, and the static function pointer is kept in the described structure;
According to the globally unique identifier of the administrative unit of importing, the corresponding structure of globally unique identifier of searching Yu being imported, and according to the static function pointer in the structure of being searched, call described static function and create and the corresponding MO of described administrative unit.
The corresponding structure of described establishment and all kinds of unit further comprises: the structure of being created is linked into single-track link table, and stores the head pointer of described single-track link table; The corresponding structure of the then described globally unique identifier of searching and being imported is that head pointer according to described single-track link table travels through described single-track link table and searches.
The corresponding structure of described establishment and all kinds of unit further comprises: adopt the title of described all kinds of unit to add that the mode of fixing prefix or suffix names the structure of being created.
The mode of the globally unique identifier of described input manager unit is webmaster input or configuration file input.
Described globally unique identifier comprises at least a among the class name character string of described all kinds of unit and the type identification ID.
The present invention also provides a kind of MO creation apparatus, comprising:
The structure creation module is used for the globally unique identifier according to all kinds of unit, creates and the corresponding structure in described all kinds of unit;
Static function is provided with module, is used at the structure of being created the static function of creating MO being set, and the static function pointer is kept in the described structure;
The MO creation module, be used for globally unique identifier according to the administrative unit of input, the corresponding structure of the globally unique identifier of searching and being imported, and according to the static function pointer in the structure of being searched, call described static function and create and the corresponding MO of described administrative unit.
Described structure creation module comprises:
Structure is created submodule, is used for the globally unique identifier according to all kinds of unit, creates and the corresponding structure in described all kinds of unit;
Chained list constructor module, the structure that is used for being created is linked into single-track link table, and stores the head pointer of described single-track link table.
Described MO creation module comprises:
Chained list travels through submodule, is used for traveling through according to the head pointer of described single-track link table each structure of described single-track link table, the corresponding structure of globally unique identifier of searching Yu being imported;
MO creates submodule, is used for the static function pointer according to the structure of being searched, and calls described static function and creates and the corresponding MO of described administrative unit.
Described globally unique identifier comprises at least a among the class name character string of described all kinds of unit and the object type sign ID.
Management object creation method provided by the present invention and device, establishment comprises the structure of globally unique identifier, and the static function of creating MO is set in structure; When needing the MO of creative management unit correspondence, call the establishment that static function in the structure can realize MO according to the globally unique identifier of dynamic input.The present invention utilizes globally unique identifier to create MO, makes the Operation and Maintenance agency have better flexibility; And the present invention need not to write code, and is simple to operate; In addition, the structure among the present invention is linked into single-track link table, is easy to expansion.
Embodiment
The technical solution of the present invention is further elaborated below in conjunction with the drawings and specific embodiments.
A kind of MO creation method provided by the present invention, as shown in Figure 1, this method mainly may further comprise the steps:
Step 101 according to the globally unique identifier of all kinds of unit, is created and the corresponding structure in all kinds of unit.
On network element management device,, create and the corresponding structure in all kinds of unit according to the globally unique identifier of all kinds of unit in the network element device.Structure is the core of dynamic creation mechanism, the structure that various inhomogeneous unit are corresponding different respectively, the globally unique identifier of corresponding certain the class unit of storage in the structure.
Globally unique identifier among the present invention is meant the sign that is used for distinguishing the variety classes unit, in actual applications, the class name character string of all kinds of unit and type i D can be used to distinguish different types of unit, and pairing class name character string in different types of unit and type i D are inequality, therefore, can be with at least a globally unique identifier among class name character string and the type i D as all kinds of unit.The globally unique identifier that it is pointed out that indication of the present invention is not limited only to class name character string and type i D, comprises that also other can be used to distinguish the sign of variety classes unit.
In addition, can adopt the title of all kinds of unit to add the fixing prefix or the mode of suffix, each structure of being created is named.For example: when creating, can be DYN BOARD or BOARD DYN to the name of this structure with the pairing structure of veneer.
Step 102 is provided with the static function of creating MO in the structure of being created, and the static function pointer is kept in the structure.
Static function in each structure is used for creating the corresponding MO in all kinds of unit and exists, and the static function pointer that calls in the structure to be preserved can be realized calling static function.
Step 103, according to the globally unique identifier of the administrative unit of importing, the corresponding structure of globally unique identifier of searching Yu being imported, and according to the static function pointer in the structure of being searched, call static function and create and the corresponding MO of administrative unit.
For example: administrative unit is a veneer A, and the globally unique identifier of input veneer A is a, then finds the structure that storaging mark is a, and utilizes the static function pointer in the structure, calls static function and creates and the corresponding MO of veneer A.Created with the corresponding MO of veneer A after, from the database of network element management device, read the pairing property parameters of veneer A according to a of globally unique identifier, property parameters is stored among the MO of establishment.Network element management device can be according to the property parameters of being stored among the MO, realizes management to veneer A by the operation to MO; And the result that will manage veneer A offers database, upgrades with the state that carries out corresponding veneer A in the database.
On the Operation and Maintenance agency, when increasing an administrative unit newly, the globally unique identifier of dynamic input manager unit, this globally unique identifier can manually be imported by webmaster, also can adopt the form of configuration file to import automatically.Network element management device is according to the globally unique identifier of the administrative unit of input, search in all structures and the corresponding structure of the globally unique identifier that is imported, and according to the static function pointer in the finding structure, the static function of calling in the structure is created and the corresponding MO of administrative unit.
Among the present invention, above-mentioned each structure of creating can be configured to the form of single-track link table, thus convenient searching to structure.Below in conjunction with the embodiment of structure single-track link table, the MO creation method of the invention described above is further elaborated.The flow chart of the MO creation method of the embodiment of the invention as shown in Figure 2, mainly may further comprise the steps:
Step 201 is created structure.
On network element management device,, create and the corresponding structure in all kinds of unit according to the globally unique identifier of all kinds of unit in the network element device.Preserved the globally unique identifier of a certain class unit in each structure.
The creation procedure of structure is as follows:
struct?CDynMO
{
int?MOType;
T*(*m_pfnCreateDynMO)();
T*CreateDynMO();
static?CDynMO<T>*GetDynMO(int?type);
static?CDynMO<T>*pFirstMO;
CDynMO<T>*m_pNextMO;
};
Wherein, T represents certain class unit; MOType represents the globally unique identifier of corresponding certain class unit, and MOType can comprise at least a among class name character string and the type i D; M_pfnCreateDynMO represents to create the static function of MO; CreateDynMO represents the external call interface of static function; GetDynMO represents to obtain the external call interface of static function; PFirstMO represents the head pointer of single-track link table; M_pNextMO represents to point to the pointer of the next chained list node of this structure place node.
Step 202 is provided with the static function of creating MO in the structure of being created, and the static function pointer is kept in the structure.
Step 203, the single-track link table of establishment structure.
All structures are linked into a single-track link table, the structure of single-track link table as shown in Figure 3, chained list among the figure comprises n node, the corresponding structure of each node in the single-track link table, and each node all is made up of information field and pointer field, information field is used for the storage organization body, and pointer field is used to refer to next node.Head represents the head pointer of single-track link table, and the pointer field of the caudal knot point of single-track link table is empty.
Step 204 according to the globally unique identifier of dynamic input, begins to travel through the single-track link table of total body from linked list head.
When increasing the unit of a management newly, network element management device is according to the globally unique identifier of dynamically input and the linked list head pointer of preservation, and the single-track link table head from structure travels through whole single-track link table.
Step 205 judges whether match the node identical with the globally unique identifier that imports in single-track link table, if then forward step 206 to; Otherwise, finish this flow process.
If before the traversing operation of single-track link table is finished, it is identical with the globally unique identifier of input to match the globally unique identifier that is stored in certain node, then shows to find and the pairing structure of administrative unit; If before the traversing operation to single-track link table finishes, fail to match the node identical with the globally unique identifier that imports, then show not exist in the single-track link table and the pairing structure of administrative unit, thereby also just can't realize administrative unit is carried out the establishment of MO, finish this flow process.
Step 206 is called the static function of the establishment MO in the node that is found, administrative unit is carried out the establishment of MO.
The static function pointer that utilizes in the node to be preserved calls the static function of creating MO, realizes the establishment of MO.
For realizing the MO creation method of the invention described above, the present invention also provides a kind of MO creation apparatus, and in network element management device, as shown in Figure 4, this device comprises: structure creation module 10, static function are provided with module 20 and MO creation module 30.Wherein, structure creation module 10 is used for the globally unique identifier according to all kinds of unit, creates and the corresponding structure in all kinds of unit.Static function is provided with module 20, and syndeton body creation module 10 is used at the structure that structure creation module 10 is created the static function of creating MO being set, and the static function pointer is kept in the structure of being created.MO creation module 30, syndeton body creation module 10, be used for globally unique identifier according to the administrative unit of input, the corresponding structure of the globally unique identifier of searching and being imported, and, call static function and create and the corresponding MO of administrative unit according to the static function pointer in the structure of being searched.
Wherein, structure creation module 10 comprises: structure is created submodule 11 and chained list constructor module 12.Structure is created submodule 11, connects static function module 20 is set, and is used for the globally unique identifier according to all kinds of unit, creates and the corresponding structure in all kinds of unit.Chained list constructor module 12, the syndeton body is created submodule 11, and the structure that is used for being created is linked into single-track link table, and the head pointer of storage single-track link table.
Wherein, MO creation module 30 comprises: chained list traversal submodule 31 and MO create submodule 32.Chained list traversal submodule 31 connects chained list constructor module 12, is used for each structure according to the head pointer traversal single-track link table of single-track link table, the corresponding structure of globally unique identifier of searching Yu being imported.MO creates submodule 32, connects chained list traversal submodule 31, is used for the static function pointer according to the structure of being searched, and calls static function and creates and the corresponding MO of administrative unit.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.