CN1322418C - System for realizing object continuous service and method thereof - Google Patents
System for realizing object continuous service and method thereof Download PDFInfo
- Publication number
- CN1322418C CN1322418C CNB2004100553152A CN200410055315A CN1322418C CN 1322418 C CN1322418 C CN 1322418C CN B2004100553152 A CNB2004100553152 A CN B2004100553152A CN 200410055315 A CN200410055315 A CN 200410055315A CN 1322418 C CN1322418 C CN 1322418C
- Authority
- CN
- China
- Prior art keywords
- module
- sustainableization
- database
- service
- objects services
- 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.)
- Expired - Fee Related
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Stored Programmes (AREA)
Abstract
本发明涉及对象持续化服务,公开了一种实现对象持续化服务的系统及其方法,使得对象持续化服务的实现更为简单,大大减少开发工作量。这种实现对象持续化服务的系统及其方法使用泛型算法归纳出数据库操作例程的共同框架并定义在数据库操作模块中;在服务模块中定义具体属性并登记在基础模块中;根据数据库操作模块的调用,在基础模块中实现具体的数据库查询语言组织、服务模块中属性与数据库表的数据交换。
The invention relates to object persistent service, and discloses a system and method for realizing object persistent service, which makes the realization of object persistent service simpler and greatly reduces the development workload. The system and method for realizing object continuous service use generic algorithms to summarize the common framework of database operation routines and define them in the database operation module; define specific attributes in the service module and register them in the basic module; according to the database operation The call of the module realizes the specific database query language organization in the basic module, and the data exchange between the attribute and the database table in the service module.
Description
技术领域technical field
本发明涉及对象持续化服务,特别涉及对象持续化服务的实现。The invention relates to object persistence service, in particular to the realization of object persistence service.
背景技术Background technique
随着信息化时代的到来,网络的应用已经深入到人们的生活中的方方面面。网络上数据量的急剧增加对网络数据的管理提出越来越高的要求。With the advent of the information age, the application of the network has penetrated into every aspect of people's lives. The sharp increase in the amount of data on the network puts forward higher and higher requirements for the management of network data.
当前,开发网络管理软件大多采用客户机/服务器模式的三层体系结构,包括客户端、服务器端以及关系数据库(Relational DataBase,简称RDB)。一方面,服务器端通过通讯平台与客户端相连;另一方面,通过数据库中间件操纵RDB。服务器端面临的任务模型是面向对象模型,它接受标准C++对象作为任务的输入,完成任务处理后返回相应的标准C++对象作为结果。不过服务器端在执行任务的过程中需要操纵的数据模型为关系模型,其操纵方式为面向过程式的。At present, the development of network management software mostly adopts the three-tier architecture of client/server mode, including client, server and relational database (Relational DataBase, RDB for short). On the one hand, the server is connected to the client through the communication platform; on the other hand, the RDB is manipulated through the database middleware. The task model faced by the server is an object-oriented model, which accepts standard C++ objects as the input of the task, and returns the corresponding standard C++ object as the result after completing the task processing. However, the data model that the server needs to manipulate during the execution of tasks is a relational model, and its manipulation method is process-oriented.
由于任务的面向对象模型与数据库的关系模型之间的差异,应用中在编写任务的代码中必须完成对数据转换。在数据库接口(DataBase Interface,简称DBI)函数中,使用方式是面向过程式的,代码中出现了许多非常相似的函数。数据模型转换及例行的对实际的数据库操作的调用与我们的任务所要完成的事务并没有直接关系,但却大量反复出现,其造成的结果就是:Due to the difference between the object-oriented model of the task and the relational model of the database, the data conversion must be completed in the code of the task in the application. In the database interface (DataBase Interface, referred to as DBI) function, the usage is process-oriented, and many very similar functions appear in the code. Data model conversion and routine calls to actual database operations are not directly related to the transactions to be completed by our tasks, but they occur repeatedly in large numbers, and the results are:
第一,代码冗余度大大增高,相当比例的代码用于数据模型转换,大大增加了开发的工作量。First, the code redundancy is greatly increased, and a considerable proportion of the code is used for data model conversion, which greatly increases the workload of development.
第二,开发人员在开发一个任务时,除了要洞悉该任务的事务逻辑外,既要掌握它的任务模型,又要掌握关系数据库的存储模型,还要掌握它们之间的模型转换,大大增加了开发难度。Second, when developing a task, in addition to understanding the transaction logic of the task, the developer must not only master its task model, but also master the storage model of the relational database, as well as the model conversion between them, which greatly increases development difficulty.
第三,在现行开发模式下,数据模型转换,数据库的操纵完全是显式进行,在DBI函数中大量充斥着对关系数据库操纵的硬编码,关系数据库的关系模式(包括表名、列名)与代码逻辑紧密耦合在一起,使得系统后期维护极其困难。而对于高端网管程序而言,由于用户需求的变化往往比较频繁,系统可维护性尤为重要。Third, in the current development mode, data model conversion and database manipulation are completely explicit. DBI functions are full of hard-coded relational database manipulation. The relational schema of relational databases (including table names and column names) It is tightly coupled with the code logic, making the later maintenance of the system extremely difficult. For high-end network management programs, system maintainability is particularly important due to frequent changes in user requirements.
总而言之,在大多数网络管理系统中,往往以面向过程式的方式操纵关系模型,而任务模型却是面向对象(Object-Oriented,简称OO)模型;这两种模型之间的不同使得在面向过程的编码中只能显式地进行模型转换,显示地操纵关系数据库,这是造成上述种种问题的根本所在。对于这个问题,目前一般有两种解决方法:All in all, in most network management systems, the relational model is often manipulated in a process-oriented manner, while the task model is an Object-Oriented (OO) model; the difference between the two models makes the process-oriented In the coding of the system, only explicit model conversion can be performed, and the relational database can be manipulated explicitly, which is the root cause of the above-mentioned problems. For this problem, there are generally two solutions:
一种方法如图1所示,将语义表示与例行算法适当分离。该解决方案包含两个层次,持续化对象面向对象建模和对象模型到关系数据库的映射。用户首先根据业务逻辑建立适当的持续化对象模型,每一个具体的持续化对象显式建立一个一一对应的“知识库”对象,持续化对象完成必要的语义定义,相应的“知识库”对象则显式地通过数据库工具(Database Tools,简称DBTools)完成实际的对下层RDB的操纵(如插入、更新、删除、选择等操作)。One approach, shown in Figure 1, appropriately separates semantic representation from routine algorithms. The solution consists of two levels, object-oriented modeling of persistent objects and mapping of object models to relational databases. The user first establishes an appropriate persistent object model according to the business logic, and explicitly establishes a one-to-one corresponding "knowledge base" object for each specific persistent object. The persistent object completes the necessary semantic definition, and the corresponding "knowledge base" object The actual manipulation of the underlying RDB (such as insert, update, delete, select, etc.) is done explicitly through the database tools (DBTools for short).
另一种方法如图2所示,目前已经有多个第三方产品采用了该解决方案。该方案的出发点是一切从对象建模开始,用户采用对象定义语言(ObjectDefine Language,简称ODL)建立面向对象的数据库(Object-OrientedDataBase,简称OODB)的数据模型,然后调用相应的编译器编译,产生C++持久化对象的桩代码,并建立数据库脚本。这里所谓的桩代码是指,ODL编译器把我们用ODL编写的文件翻译成C++代码,将我们用ODL编写的类翻译成C++类,这个类的申明、实现代码为相应的C++桩代码。以该桩代码作为框架,加上适当的业务逻辑,成为系统中的可持续化对象,从而操纵关系数据库;而对关系数据库的管理则由专门的对象管理器负责。系统在运行时调用持续化对象,对象存储由持续化对象自己完成,这样在系统开发时开发人员向下仅仅可以见到可持续化对象这一层,完全实现关系模式的面向对象封装。Another method is shown in Figure 2, and many third-party products have already adopted this solution. The starting point of this scheme is that everything starts from object modeling. Users use Object Definition Language (ObjectDefine Language, ODL for short) to build the data model of Object-OrientedDataBase (OODB for short), and then call the corresponding compiler to compile and generate The stub code of the C++ persistent object and the establishment of the database script. The so-called stub code here means that the ODL compiler translates the files we write in ODL into C++ code, and translates the classes we write in ODL into C++ classes. The declaration and implementation code of this class are corresponding C++ stub codes. Using the stub code as a framework, coupled with appropriate business logic, it becomes a sustainable object in the system, thereby manipulating the relational database; and the management of the relational database is in charge of a special object manager. The system calls the persistent object at runtime, and the object storage is completed by the persistent object itself. In this way, during system development, developers can only see the layer of sustainable objects, and fully realize the object-oriented encapsulation of the relational model.
在实际应用中,上述方案存在以下问题:对于现有技术方案一,实际的代码编写量并没有降低,代码冗余现象依旧存在,系统难于维护、难于扩展的状况并没有得到改善。In actual application, the above-mentioned solution has the following problems: for the prior art solution 1, the actual amount of code writing has not been reduced, the phenomenon of code redundancy still exists, and the situation that the system is difficult to maintain and expand has not been improved.
对于现有技术方案二,用ODL重新OODB的工作量过于庞大,且开发难度大,对于大多数中小型软件企业来说,要想自己开发实现不太现实。For the second prior art solution, the workload of re-using OODB with ODL is too large, and the development is difficult. For most small and medium-sized software companies, it is unrealistic to develop and realize by themselves.
造成这种情况的主要原因在于,造成现有技术方案一在实际应用中存在问题的原因在于,对实际的数据库操作的调用采用的是显式建模和显式映射,这必然无法简化代码。系统的可维护性、可扩展性的实现也受到约束。The main reason for this situation is that the problem in the actual application of the prior art solution 1 is that the call to the actual database operation adopts explicit modeling and explicit mapping, which inevitably cannot simplify the code. The maintainability and scalability of the system are also constrained.
造成现有技术方案二在实际应用中存在问题的原因在于,该方案要求建立ODL,并实现ODL编译器,用于将界面定义语言(Interface DefinationLanguage,简称“IDL”)翻译成对应的C++代码和关系数据库脚本,建立在关系数据库之上的对象管理器。这些代码的编写从工作量上来说是很庞大的,无法让大多数中小型软件企业接受。The reason for the problems in the actual application of the prior art solution two is that the solution requires the establishment of ODL and the implementation of an ODL compiler for translating the Interface Definition Language (Interface Definition Language, referred to as "IDL") into corresponding C++ codes and Relational Database Script, an object manager built on top of relational databases. The writing of these codes is very huge in terms of workload, and cannot be accepted by most small and medium-sized software companies.
发明内容Contents of the invention
有鉴于此,本发明的主要目的在于提供一种实现对象持续化服务的系统及其方法,使得对象持续化服务的实现更为简单,大大减少开发工作量。In view of this, the main purpose of the present invention is to provide a system and method for realizing object persistent service, which makes the realization of object persistent service simpler and greatly reduces the development workload.
为实现上述目的,本发明提供了一种实现对象持续化服务的系统,包含数据库操作模块、可持续化对象基础模块和多个可持续化对象服务模块,其中,In order to achieve the above purpose, the present invention provides a system for realizing object persistence service, which includes a database operation module, a sustainable object basic module and a plurality of sustainable object service modules, wherein,
所述数据库操作模块用于通过泛型算法实现统一的数据库操作例程;The database operation module is used to realize a unified database operation routine through a generic algorithm;
所述可持续化对象基础模块用于接收并登记所述可持续化对象服务模块上报的语义,根据所述数据库操作模块的调用完成具体数据库操作语句组织,完成所述可持续化对象服务模块的属性和与其关联的所述数据库表字段之间的数据交换;The sustainable object basic module is used to receive and register the semantics reported by the sustainable object service module, complete the organization of specific database operation statements according to the call of the database operation module, and complete the data exchange between attributes and said database table fields associated therewith;
所述可持续化对象服务模块用于根据所述可持续化对象基础模块定义自身属性以及该属性与数据库表字段关联方法,供所述数据库操作模块读取。The sustainable object service module is used to define its own attributes and the method of associating the attributes with database table fields according to the sustainable object basic module, for the database operation module to read.
其中,所述数据库操作例程包含对所述数据库的查询、增加、更改、删除、块读和块写中的一种或其任意组合。Wherein, the database operation routine includes one or any combination of query, addition, modification, deletion, block read and block write to the database.
所述可持续化对象基础模块还包含代理子模块和字段交换子模块,其中,The sustainable object basic module also includes a proxy submodule and a field exchange submodule, wherein,
所述代理子模块用于接收并登记所述可持续化对象服务模块上报的语义;The agent sub-module is used to receive and register the semantics reported by the sustainable object service module;
所述字段交换子模块用于完成具体数据库查询语句组织,完成所述可持续化对象服务模块的属性和与其关联的所述数据库表字段之间的数据交换。The field exchange sub-module is used to complete the organization of specific database query statements, and complete the data exchange between the attributes of the sustainable object service module and the associated database table fields.
所述系统可应用于通信系统的网络管理。The system is applicable to network management of communication systems.
本发明还提供了一种实现对象持续化服务的方法,包含以下步骤:The present invention also provides a method for realizing object continuous service, comprising the following steps:
在可持续化对象服务模块中定义自身属性以及该属性与数据库表字段关联方法,并上报到可持续化对象基础模块;Define its own attributes in the sustainable object service module and how to associate the attributes with database table fields, and report to the sustainable object basic module;
所述可持续化对象基础模块接收并登记所述可持续化对象服务模块上报的语义;The sustainable object basic module receives and registers the semantics reported by the sustainable object service module;
当进行数据库操作时,数据库操作模块调用通过泛型算法实现的相应数据库操作例程,并使用所述可持续化对象基础模块中登记的语义完成具体数据库操作语句;When performing database operations, the database operation module invokes corresponding database operation routines implemented by generic algorithms, and uses the semantics registered in the sustainable object basic module to complete specific database operation statements;
执行所述具体数据库操作语句,完成在所述可持续化对象服务模块的属性和与其关联的所述数据库表字段之间的数据交换。Execute the specific database operation statement to complete the data exchange between the attributes of the sustainable object service module and the associated database table fields.
其中,所述数据库操作例程包含对所述数据库的查询、增加、更改、删除、块读和块写中的一种或其任意组合。Wherein, the database operation routine includes one or any combination of query, addition, modification, deletion, block read and block write to the database.
所述方法可应用于通信系统的网络管理。The method is applicable to network management of communication systems.
所述方法还包含以下步骤:The method also includes the steps of:
构造与可持续化对象服务模块相对应的数据库表结构。Construct the database table structure corresponding to the sustainable object service module.
这种技术方案具有较为明显的有益效果,即本发明的技术方案引入了持久化层的概念,从而能够统一处理数据库例行操纵过程,方便了代码的开发与维护;并且解决了任务模式、过程模式不匹配的问题,利用POS模块对面向过程式的数据库操作进行了面向对象封装,让程序员能够方便地根据任务模型,建立相应的可持续化对象模型。This technical solution has obvious beneficial effects, that is, the technical solution of the present invention introduces the concept of persistence layer, so that the routine operation process of the database can be handled uniformly, which facilitates the development and maintenance of the code; and solves the problem of task mode, process For the problem of schema mismatch, the POS module is used to carry out object-oriented encapsulation of process-oriented database operations, so that programmers can easily establish corresponding sustainable object models according to the task model.
这样实现的一整套POS系统,使得将普通对象加上几行语义注册代码就变为可持续化对象,完全不必要实现极其复杂的ODL编译器,使得程序员仅仅需要对这些对象操作即可,不需要直接面对关系数据库从而大大降低了代码冗余度,减小了开发的工作量和强度。The whole set of POS system realized in this way makes ordinary objects become sustainable objects by adding a few lines of semantic registration codes. It is completely unnecessary to implement an extremely complicated ODL compiler, so that programmers only need to operate on these objects. There is no need to directly face the relational database, which greatly reduces code redundancy and reduces the workload and intensity of development.
在实际运用中,本发明的技术方案为中小型软件企业在开发在网管系统时,面临的以面向过程式的方式操纵关系模型而以面向对象模型而任务模型为任务模型的矛盾提供了易于实现的解决方案,有利于中小型企业在网络管理方面的业务拓展。In practical application, the technical solution of the present invention provides an easy implementation for small and medium-sized software enterprises when they develop network management systems, and they are faced with the contradiction of manipulating the relational model in a process-oriented manner and using the object-oriented model and the task model as the task model. The solution is conducive to the business expansion of small and medium-sized enterprises in network management.
附图说明Description of drawings
图1是现有技术方案一的结构示意图;Fig. 1 is a structural schematic diagram of the prior art solution one;
图2是现有技术方案二的结构示意图;Fig. 2 is the structural representation of prior art scheme two;
图3是根据本发明的一个实施例的实现对象持续化服务的系统的设计流程示意图;FIG. 3 is a schematic diagram of the design flow of a system for implementing persistent object services according to an embodiment of the present invention;
图4是根据本发明的一个实施例的持久化对象服务的体系结构示意图;FIG. 4 is a schematic structural diagram of a persistent object service according to an embodiment of the present invention;
图5是根据本发明的一个实施例的POS实现简要示意图。Fig. 5 is a schematic diagram of POS implementation according to an embodiment of the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings.
本发明所采用的基本思路是将诸如插入、更新、删除、选择、读取等数据库例行操纵过程归纳为一个个通用的算法,这些算法对被操纵的持续化对象提出一定的语义要求。这样只需要定义持续化对象的语义,进行结构化建模,就能够构成OODB。尽力定义好的算法,使得手工建立OODB模型足够便利,是本方案的一个关键。The basic idea adopted by the present invention is to summarize routine database manipulation processes such as insertion, update, deletion, selection, and reading into common algorithms, and these algorithms put forward certain semantic requirements for the manipulated persistent objects. In this way, it is only necessary to define the semantics of persistent objects and carry out structural modeling to form OODB. Trying to define a good algorithm to make it convenient to manually build the OODB model is a key to this solution.
因此本发明的技术方案提供了一个单独的POS层,这种方法的出发点与业界已经有的商业产品,如Power Tier,versant等有着本质的区别。这些已有的商品是依靠ODL编译器将程序员用ODL建立的对象模型翻译成C++代码,最终目标代码与手工硬编码并没有本质差别,只不过是编译器自动生成的。而本发明的方法是设计一整套实现POS的系统,使得将普通对象只需加上几行语义注册代码就可以变为可持续化对象,完全不必要实现极其复杂的ODL编译器。Therefore, the technical solution of the present invention provides a separate POS layer. The starting point of this method is substantially different from existing commercial products in the industry, such as Power Tier, versant, etc. These existing products rely on the ODL compiler to translate the object model created by the programmer with ODL into C++ code. The final object code has no essential difference from manual hard coding, but is automatically generated by the compiler. The method of the present invention is to design a whole set of systems for realizing POS, so that ordinary objects can be changed into sustainable objects only by adding a few lines of semantic registration codes, and it is completely unnecessary to implement an extremely complicated ODL compiler.
引入POS层后,系统分为四个层次:业务层、OODB(其表象为可持续化的对象树,树中每一个节点为持续化对象)、POS层、对象存储层(这里为RDB)。由于要实现OODB必须实现以下几个技术问题。一、可持续化对象结构建模,最普通的方式是建立一个以没有具体事务含义的根对象为根节点的对象树,这里的建模当是显式建模。二、调整数据库设计,使得关系表的组织从结构上与可持续化对象模型相融合。三、建立OODB,对外访问接口,接口方式当仿效设计模式中的类工厂,每一个类都是其子类的类工厂。四、建立POS,用以实现OODB到关系数据库的映射。然而前三条都是以第四条的实现为基础的,因此可见,本发明的技术方案的关键不在于建立OODB,而是在于建立一套相对完善的用于建立OODB的设施,这个设施的核心就是POS。After introducing the POS layer, the system is divided into four layers: business layer, OODB (which is represented as a sustainable object tree, and each node in the tree is a persistent object), POS layer, and object storage layer (here RDB). Due to the realization of OODB, the following technical problems must be realized. 1. The most common way to model sustainable object structures is to build an object tree with a root object that has no specific transaction meaning as the root node. The modeling here should be explicit modeling. 2. Adjust the database design so that the organization of relational tables is structurally integrated with the sustainable object model. 3. Establish OODB, external access interface, the interface method should imitate the class factory in the design pattern, and each class is a class factory of its subclass. 4. Establish POS to realize the mapping from OODB to relational database. However, the first three items are all based on the realization of the fourth item. Therefore, it can be seen that the key of the technical solution of the present invention is not to establish OODB, but to establish a set of relatively complete facilities for establishing OODB. The core of this facility It is POS.
下面结合图3,对本发明方案的一个实施例的设计流程作进一步的描述。使用在该流程之前,首先要针对原有的网管软件开发一个持续化对象模型和通用的持续化服务层,并调整结构化查询语言(Structured Query Language,简称SQL),使得数据库工具支持持续化服务的操纵。The design process of an embodiment of the solution of the present invention will be further described below with reference to FIG. 3 . Before using this process, it is first necessary to develop a persistent object model and a common persistent service layer for the original network management software, and adjust the structured query language (Structured Query Language, referred to as SQL), so that the database tool supports continuous services manipulation.
首先执行步骤100,根据业务逻辑的要求和持续化对象模型建立持续化对象,接着进入步骤110。需要说明的是,对象持续化是一项程序设计技术,又称为对象持续化,它实现对象的持续化特征,即把该对象保存到文件、数据库等永久场所,不会因为进程退出而丢失。First execute step 100 , establish a persistent object according to the requirements of business logic and the persistent object model, and then enter step 110 . It should be noted that object persistence is a programming technology, also known as object persistence, which realizes the persistence characteristics of objects, that is, saves the objects in permanent places such as files and databases, and will not be lost when the process exits .
然后执行步骤110,利用新建立的持续化对象操纵POS,然后进入步骤120。需要说明的是,POS的服务由先前开发完成的通用持续化服务层提供。Then execute step 110, use the newly established persistent object to manipulate POS, and then enter step 120. It should be noted that POS services are provided by the previously developed general persistent service layer.
接着执行步骤120,通过持续化对象服务来操纵原有的数据库工具,接下来执行步骤130,利用数据库工具完成对关系数据库的操作。这些数据库工具是受POS操纵的,在对关系数据库的操作上和一般的数据库工具并无区别。Next, step 120 is executed to manipulate the original database tool through the persistent object service, and then step 130 is executed to complete the operation on the relational database by using the database tool. These database tools are controlled by POS, and there is no difference in the operation of relational databases from general database tools.
需要指出的是,本发明的技术方案的核心思想就是设计了一整套POS系统,该系统的体系结构如图4所示,对持续化对象提出适当的、隐含的语义要求,统一定义一个父类(CPersistentObject),该父类中包含一些诸如对象序号(Object Identity,简称OID)等通用语义,而各个具体类(CConcretPerObject)中再二次定义自己的具体语义,诸如查询条件,嵌套查询的子SQL等等。由一个“包裹者”(CPerObjWraper)对语义进行统一解释,这样父类、子类可以确定一定灵活度的SQL框架;同时类CPerObjWraper的三个子类CSelectPerObjWraper、CUpdatePerObjWraper和CDeletePerObjWraper分别进一步对其作了扩展,对功能作了细化。持续化对象另外提供接口,以便在运行时刻填充SQL的参数。通过以上三个层次,确保了灵活性与易用性的统一,从而达到简化模型定义的复杂度。It should be pointed out that the core idea of the technical solution of the present invention is to design a whole set of POS system. Class (CPersistentObject), the parent class contains some general semantics such as Object Identity (OID for short), and each specific class (CConcretPerObject) defines its own specific semantics again, such as query conditions, nested queries Sub SQL and more. A "wrapper" (CPerObjWraper) interprets the semantics uniformly, so that the parent class and subclasses can determine a certain degree of flexibility in the SQL framework; at the same time, the three subclasses CSelectPerObjWraper, CUpdatePerObjWraper and CDeletePerObjWraper of the class CPerObjWraper further expand it respectively, The function has been refined. The persistent object also provides an interface to fill in SQL parameters at runtime. Through the above three levels, the unity of flexibility and ease of use is ensured, so as to simplify the complexity of model definition.
可持续化对象的持续化工作由三个对象协同完成,CAlgorithms提供关系数据库的例行操纵过程,持续化对象CConcretPerObject包含自身必须的语义,该语意是按面向对象方式提供的。CPerObjWraper在持续化对象CConcretPerObject外面包上一层,它解读持续化对象语义并向CAlgorithms汇报面向数据库操作的语义。The persistence work of the sustainable object is completed by three objects. CAAlgorithms provides the routine operation process of the relational database, and the persistent object CConcretPerObject contains its own necessary semantics, which are provided in an object-oriented manner. CPerObjWraper wraps a layer outside the persistent object CConcretPerObject, which interprets the semantics of persistent objects and reports the semantics for database operations to CAAlgorithms.
在引入了POS层后,系统分为四个层次:业务层、OODB(其表象为可持续化的对象树,树中每一个节点为持续化对象)、POS层、对象存储层(这里为RDB)。由于要实现OODB必须实现以下几个技术问题。一、可持续化对象结构建模,最普通的方式是建立一个以没有具体事务含义的根对象为根节点的对象树,这里的建模当是显式建模。二、调整数据库设计,使得关系表的组织从结构上与可持续化对象模型相融合。三、建立OODB,对外访问接口,接口方式当仿效设计模式中的类工厂,每一个类都是其子类的类工厂。四、建立POS,用以实现OODB到关系数据库的映射。然而前三条都是以第四条的实现为基础的,因此,本发明的技术方案的关键不在于建立OODB,而是在于建立一套相对完善的用于建立OODB的设施,这个设施的核心就是POS。After introducing the POS layer, the system is divided into four levels: business layer, OODB (its appearance is a sustainable object tree, and each node in the tree is a persistent object), POS layer, and object storage layer (here RDB ). Due to the realization of OODB, the following technical problems must be realized. 1. The most common way to model sustainable object structures is to build an object tree with a root object that has no specific transaction meaning as the root node. The modeling here should be explicit modeling. 2. Adjust the database design so that the organization of relational tables is structurally integrated with the sustainable object model. 3. Establish OODB, external access interface, the interface method should imitate the class factory in the design pattern, and each class is a class factory of its subclass. 4. Establish POS to realize the mapping from OODB to relational database. However, the first three items are all based on the realization of the fourth item. Therefore, the key of the technical solution of the present invention is not to establish OODB, but to establish a set of relatively complete facilities for establishing OODB. The core of this facility is POS.
如图5所示,POS系统内部结构主要由三个部分组成:数据库操作模块、可持续化对象基础模块和多个可持续化对象服务模块。在本发明的一个实施中,数据库操作模块主要由泛型算法实现,可持续化对象基础模块是由一个称为CperBase的基类生成的对象,可持续化对象服务模块是具体的POS对象,生成这些POS对象的具体POS类是从CPerBase继承而来的。泛型算法操纵具体的POS类,而具体POS类从CPerBase继承而来,CPerBase解读存储具体的POS类的语义并向泛型算法汇报这些语义。As shown in Figure 5, the internal structure of the POS system is mainly composed of three parts: database operation module, sustainable object basic module and multiple sustainable object service modules. In an implementation of the present invention, the database operation module is mainly realized by a generic algorithm, the sustainable object base module is an object generated by a base class called CperBase, and the sustainable object service module is a specific POS object, which generates The concrete POS class of these POS objects is inherited from CPerBase. The generic algorithm manipulates the specific POS class, and the specific POS class inherits from CPerBase. CPerBase interprets and stores the semantics of the specific POS class and reports these semantics to the generic algorithm.
泛型算法抽离于特定类型和特定数据结构之外,使得其适应与尽可能的一般化类型,算法本身只是为了实现算法其需要表达的逻辑本质而不去被为各种数据结构的实现细节所干扰。这意味着一个泛型算法实际具有两部分:用来描叙算法本质逻辑的实际指令以及正确指定其参数类型必须满足的性质的一组需求条件。其核心就是抽象条件成为程序设计过程中的核心,从而取代了类型在OO里面的核心地位,正是因为类型不在考虑的重点,类型成为了抽象条件的外衣,所以称这样的程序思想为泛型思想,即把类型泛化。在本系统中由几个模板函数实现通用的查询、增加、更改、删除以及BulkRead/BulkWrite操作。各个泛型算法操纵具体的对象,运行时获取GetSelecter、GetInserter、GetUpdater、GetDeleter、Read语义,实现通用的数据库操作。Generic algorithms are separated from specific types and specific data structures, so that they can adapt to and generalize types as much as possible. The algorithm itself is only to realize the logical essence that the algorithm needs to express and not to be used as the implementation details of various data structures. interfered with. This means that a generic algorithm actually has two parts: the actual instructions that describe the algorithm's essential logic, and a set of requirements that correctly specify the properties that its parameter types must satisfy. The core is that abstract conditions become the core of the programming process, thus replacing the core position of types in OO. It is precisely because types are not the focus of consideration that types have become the coat of abstract conditions, so this kind of program thinking is called generic. The idea is to generalize the type. In this system, general query, increase, change, delete and BulkRead/BulkWrite operations are realized by several template functions. Each generic algorithm manipulates specific objects and obtains the semantics of GetSelecter, GetInserter, GetUpdater, GetDeleter, and Read at runtime to achieve general database operations.
这些对象被映射到对应的表的记录,属性映射为记录的字段,将对象序列映射为表。泛型算法的操作分为表一级操作和记录一级操作。表一级操作包括select(查询)、bulkread(块读)、bulkwrite(块写)等操作;记录一级操作:包括insert(插入)、update(更新),delete(删除)操作,是针对具体某一个对象的操作。持续化对象实现策略有一个原则,它通过表一级操作实例化后,其自身是一个“Smart object”,可以自身的状态变迁,自我毁灭,自己完成持续化操作。These objects are mapped to corresponding table records, attributes are mapped to record fields, and sequences of objects are mapped to tables. The operations of the generic algorithm are divided into table-level operations and record-level operations. Table-level operations include select (query), bulkread (block read), bulkwrite (block write) and other operations; record-level operations: including insert (insert), update (update), delete (delete) operations, are for a specific An operation on an object. There is a principle in the persistent object implementation strategy. After it is instantiated through table-level operations, it is a "Smart object" that can change its own state, self-destruct, and complete persistent operations by itself.
通过分析泛型算法,可以找到持续化对象必须提供的语义最小集。需要特别指出的是在认定语义时,我们应当使用设计模式中的行为模式中的模板方法,在持续化对象的父类中定义一个完整的用于拼装SQL的虚方法,如:GetColumnName、GetTableName、GetWhereCondition、GetOrderByCondition等等。具体的持续化对象在建模时在做适当的有选择的重载,由此做到灵活性与易用性的统一。By analyzing the generic algorithm, it is possible to find the minimum set of semantics that a persistent object must provide. It should be pointed out that when determining the semantics, we should use the template method in the behavior mode in the design mode, and define a complete virtual method for assembling SQL in the parent class of the persistent object, such as: GetColumnName, GetTableName, GetWhereCondition, GetOrderByCondition, and so on. Specific persistent objects are appropriately and selectively overloaded when modeling, so as to achieve the unity of flexibility and ease of use.
具体的POS类定义了自身的属性以及该属性与数据库表字段关联的方法,供泛型算法解读。The specific POS class defines its own attributes and the method of associating the attributes with database table fields for interpretation by generic algorithms.
CPerBase类是POS的核心,各个具体的POS类的父类,统一定存储具体POS对象的语义并提供接口,供泛型算法调用。其内部保存一个CProxy类和CFieldExchange类,CProxy类负责解读存储各个具体的POS类的语义,CFieldExchange类则负责将从数据库中读出的信息倒到POS类的属性中或将POS类的属性倒到数据库中。CPerBase的作用实际上相当于一本注册簿,具体的POS类在构造其对象时向它注册,泛型算法在操纵POS对象时从该注册簿中查找,若没有找到则进行相关的注册。在具体实现时,本发明的技术方案解决了两个具体技术:如何打破对象访问控制壁垒以及如何让集合类vector识别异种数据类型。对于第一个技术,由于在CPerBase类中不知道ClassObject,因此不可以用ClassObject.m_Attrib方法。而对于第二个技术,本发明方案提供一个缺省状况,即一个vector仅能保存一个数据类型的变量。The CPerBase class is the core of POS. The parent class of each specific POS class uniformly stores the semantics of specific POS objects and provides interfaces for generic algorithm calls. It stores a CProxy class and a CFieldExchange class inside. The CProxy class is responsible for interpreting and storing the semantics of each specific POS class. The CFieldExchange class is responsible for pouring the information read from the database into the attributes of the POS class or pouring the attributes of the POS class into in the database. The role of CPerBase is actually equivalent to a register. The specific POS class registers with it when constructing its object. The generic algorithm searches from the register when manipulating the POS object. If it is not found, the relevant registration is performed. In actual implementation, the technical solution of the present invention solves two specific technologies: how to break the object access control barrier and how to make the collection class vector identify heterogeneous data types. For the first technique, since the ClassObject is not known in the CPerBase class, the ClassObject.m_Attrib method cannot be used. As for the second technique, the solution of the present invention provides a default situation, that is, a vector can only store variables of one data type.
上述实现对象持续化服务的系统的工作流程如下:The workflow of the above-mentioned system for implementing persistent object services is as follows:
在可持续化对象服务模块中定义自身属性以及该属性与数据库表字段关联方法,并上报到可持续化对象基础模块。Define its own attributes in the sustainable object service module and the method of associating the attributes with database table fields, and report to the sustainable object basic module.
可持续化对象基础模块接收并登记可持续化对象服务模块上报的语义。登记包含了解读和存储两方面的含义。The sustainable object basic module receives and registers the semantics reported by the sustainable object service module. Registration includes both interpretation and storage.
当进行数据库操作时,数据库操作模块调用通过泛型算法实现的相应数据库操作例程,并使用可持续化对象基础模块中登记的语义完成具体数据库查询语句。例如,需要进行delete操作时,数据库操作模块中只有泛型算法实现的框架,无法完成具体的Sq1语句,需要调用可持续化对象基础模块,该模块中登记了完成具体Sq1语句需要的细节,根据这些细节可以完成具体Sq1语句的组建。When performing database operations, the database operation module invokes the corresponding database operation routines implemented by generic algorithms, and uses the semantics registered in the sustainable object basic module to complete specific database query statements. For example, when a delete operation is required, the database operation module only has the framework implemented by the generic algorithm, and cannot complete the specific Sq1 statement. It is necessary to call the sustainable object basic module, which registers the details required to complete the specific Sq1 statement, according to These details can complete the formation of the specific Sq1 statement.
执行具体数据库查询语句,完成在可持续化对象服务模块的属性和与其关联的数据库表字段之间的数据交换。数据交换的具体方式定义在CperBase中。Execute specific database query statements to complete the data exchange between the attributes of the sustainable object service module and the associated database table fields. The specific way of data exchange is defined in CperBase.
虽然通过参照本发明的某些优选实施例,已经对本发明进行了图示和描述,但本领域的普通技术人员应该明白,可以在形式上和细节上对其作各种各样的改变,而不偏离所附权利要求书所限定的本发明的精神和范围。Although the present invention has been illustrated and described with reference to certain preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein, and without departing from the spirit and scope of the invention as defined by the appended claims.
Claims (8)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB2004100553152A CN1322418C (en) | 2004-08-18 | 2004-08-18 | System for realizing object continuous service and method thereof |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB2004100553152A CN1322418C (en) | 2004-08-18 | 2004-08-18 | System for realizing object continuous service and method thereof |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN1737751A CN1737751A (en) | 2006-02-22 |
| CN1322418C true CN1322418C (en) | 2007-06-20 |
Family
ID=36080555
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CNB2004100553152A Expired - Fee Related CN1322418C (en) | 2004-08-18 | 2004-08-18 | System for realizing object continuous service and method thereof |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN1322418C (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103714129A (en) * | 2013-12-12 | 2014-04-09 | 用友软件股份有限公司 | Device and method for buildingg dynamic data structures and relationships based on condition rules |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105760409A (en) * | 2015-03-04 | 2016-07-13 | 机械工业第六设计研究院有限公司 | Method for mapping distributed object to relational database |
| CN108984236A (en) * | 2018-08-08 | 2018-12-11 | 郑州云海信息技术有限公司 | A kind of implementation method and equipment of virtual management platform |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6006232A (en) * | 1997-10-21 | 1999-12-21 | At&T Corp. | System and method for multirecord compression in a relational database |
| US6145121A (en) * | 1997-04-17 | 2000-11-07 | University Of Washington | Trace based method for the analysis, benchmarking and tuning of object oriented databases and applications |
| EP1054332A1 (en) * | 1999-05-19 | 2000-11-22 | Bull S.A. | System and method for managing attributes in an object-oriented environment |
| WO2001055915A1 (en) * | 2000-01-27 | 2001-08-02 | Joon Seok Chang | Object destination representation method and system |
| CN1315020A (en) * | 1997-04-22 | 2001-09-26 | 格雷格·赫瑟林顿 | Method and apparatus for free-form data processing |
| US6654029B1 (en) * | 1996-05-31 | 2003-11-25 | Silicon Graphics, Inc. | Data-base independent, scalable, object-oriented architecture and API for managing digital multimedia assets |
-
2004
- 2004-08-18 CN CNB2004100553152A patent/CN1322418C/en not_active Expired - Fee Related
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6654029B1 (en) * | 1996-05-31 | 2003-11-25 | Silicon Graphics, Inc. | Data-base independent, scalable, object-oriented architecture and API for managing digital multimedia assets |
| US6145121A (en) * | 1997-04-17 | 2000-11-07 | University Of Washington | Trace based method for the analysis, benchmarking and tuning of object oriented databases and applications |
| CN1315020A (en) * | 1997-04-22 | 2001-09-26 | 格雷格·赫瑟林顿 | Method and apparatus for free-form data processing |
| US6006232A (en) * | 1997-10-21 | 1999-12-21 | At&T Corp. | System and method for multirecord compression in a relational database |
| EP1054332A1 (en) * | 1999-05-19 | 2000-11-22 | Bull S.A. | System and method for managing attributes in an object-oriented environment |
| WO2001055915A1 (en) * | 2000-01-27 | 2001-08-02 | Joon Seok Chang | Object destination representation method and system |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103714129A (en) * | 2013-12-12 | 2014-04-09 | 用友软件股份有限公司 | Device and method for buildingg dynamic data structures and relationships based on condition rules |
| CN103714129B (en) * | 2013-12-12 | 2016-09-14 | 用友网络科技股份有限公司 | Dynamic data structure based on conditional plan and the construction device of relation and construction method |
Also Published As
| Publication number | Publication date |
|---|---|
| CN1737751A (en) | 2006-02-22 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111125440B (en) | Monad-based persistent layer composite condition query method and storage medium | |
| CN108052321B (en) | Method for automatically generating intelligent contract of block chain based on configuration information | |
| CN100456237C (en) | Database access method and device | |
| US5937409A (en) | Integrating relational databases in an object oriented environment | |
| US6499036B1 (en) | Method and apparatus for data item movement between disparate sources and hierarchical, object-oriented representation | |
| CN100578509C (en) | A method for implementing data persistence | |
| CN101617292B (en) | Producer graph oriented programming and execution | |
| CN103049251B (en) | A kind of data base persistence layer device and database operation method | |
| US8805870B2 (en) | Multi-input, multi-output-per-input user-defined-function-based database operations | |
| CN101256650A (en) | A business entity-based enterprise data extraction method and system | |
| CN105808853B (en) | A kind of ontological construction management of Engineering Oriented application and ontology data automatic obtaining method | |
| CN105956087A (en) | Data and code version management system and method | |
| CN109960709B (en) | Database driver processing method, device, equipment and storage medium | |
| CN107977446A (en) | A kind of memory grid data load method based on data partition | |
| US10509632B2 (en) | Model augmentation in a model-driven application development environment | |
| AU9010198A (en) | Relational database coexistence in object oriented environments | |
| CN108845793B (en) | ORM design method and device | |
| CN1322418C (en) | System for realizing object continuous service and method thereof | |
| CN103809944A (en) | Web database development component processing method based on JDBC | |
| CN117931807A (en) | Graph query method and system based on vectorization relational database | |
| CN117539433A (en) | Microservice design method based on model driven architecture | |
| Blaha et al. | Requirements for repository software | |
| CN116955313A (en) | Implementation method of model-driven database application | |
| Alia et al. | A middleware framework for the persistence and querying of java objects | |
| Hohenstein | Bridging the gap between C++ and relational databases |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| ASS | Succession or assignment of patent right |
Owner name: HUAWEI TECH CO., LTD., SHANGHAI Free format text: FORMER OWNER: HUAWEI TECHNOLOGY CO., LTD. Effective date: 20081017 |
|
| C41 | Transfer of patent application or patent right or utility model | ||
| TR01 | Transfer of patent right |
Effective date of registration: 20081017 Address after: No. 615 Nanjing Road, Shanghai, Pudong New Area Patentee after: Shanghai Huawei Technologies Co., Ltd. Address before: Bantian HUAWEI headquarters office building, Longgang District, Shenzhen, Guangdong Patentee before: Huawei Technologies Co., Ltd. |
|
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20070620 Termination date: 20150818 |
|
| EXPY | Termination of patent right or utility model |