Background
Currently, almost all information handling systems are directed to a particular type of data source. In an information processing system, the access technology to a specific type of data source mainly includes: a relational database access technique by JDBC (Java database programming standard), or an XML file access technique by Xpath (XML path language).
With the extension of enterprise business, enterprise information systems are continuously expanded, or new functions are developed on the original systems, or original independent subsystems are integrated to realize enterprise information sharing. This means that enterprise information systems are constantly challenged to handle heterogeneous data sources. The heterogeneous data sources refer to different data sources with significant differences in data organization structures and data reading and writing modes. For example, the relational database and the XML document database are obviously different in data organization structure and data reading and writing modes. The heterogeneous data sources include: relational databases, object databases, XML (extensible modeling language) files, WebService (Web service), and external information systems capable of providing data information, and the like.
Therefore, a group of data programming interfaces which are irrelevant to the type of the data source are defined to realize decoupling between the information processing system and the data source (namely, the dependency relationship between the information processing system and the data source is removed, so that when one party is replaced easily, the other party can still work normally), which is the requirement of enterprise information system development. SDO (Service Data Objects) is a set of application programming interfaces that are currently standardized, and the set of interface specifications provides a standard and consistent Data access method for Data consumers, and shields Data access differences between heterogeneous Data sources. Through the interface specifications, easy decoupling is realized between a data provider and a data user; the information handling system will access the data through a standard SDO API (standard programming interface that services data objects) through which the data provider will also provide the data externally.
In order to enable a data consumer to disconnect from a data provider during the use of data and to contact the data provider only when reading is started and data is written last, a connectionless data programming model needs to be established. The existing SDO Modeling technology is only EMF (Eclipse Modeling Framework) developed by Eclipse (an open source code organization) organization. The EMF modeling technical scheme mainly comprises the following key processes:
1. build a set of class diagrams (class diagrams can also be represented in XML) with a Rational Rose (a software modeling tool) and generate an mdl file:
as shown in FIG. 1, the set of class diagrams contains three classes: library (Library), author (Writer), Book (Book). Wherein each class comprises: class name, attribute (name), method. The connecting lines between the various classes represent the calling relationship between them: may be containment relationships such as between a library and an author, between a library and a book; or an association relationship, such as between an author and a book.
2. Mdl was introduced into EMF, which automatically generated an SDO model, in the format:
platform:/resource/EMFModel/model/library.ecore
library
Book
tilte:EString
pages:EInt
category:BookCategory
author:Writer
Library
name:EString
writes:Writer
books:Book
Writer
name:EString
books:Book
BookCategory
Mystery=0
ScienceFiction=1
Biography=2
the EMF does not layer the SDO model during modeling, but kneads the models of different layers together without separating different object models, thereby increasing the difficulty of developing and maintaining the SDO data object and having large development workload. Because the models of different layers cannot be subdivided and corresponding metadata is defined for the model of each layer, the SDO model has poor expansibility and maintainability and is difficult to integrate into a platform with strong universality and a self-provincial function.
Disclosure of Invention
The invention provides a method and a device for establishing a connectionless data programming model on one hand, so as to reduce the workload of service development and improve the development efficiency.
The invention provides a data access service method and a data access service system, so as to realize decoupling of a business system and a physical table model and improve the expandability of the system.
Therefore, the technical scheme provided by the invention is as follows:
the embodiment of the invention provides a method for establishing a connectionless data programming model, which comprises the following steps:
layering the service data objects;
and respectively establishing data programming models of all layers according to the layered service data objects.
The embodiment of the invention provides a device for establishing a connectionless data programming model, which comprises the following components:
the layering unit is used for layering the service data objects;
and the model establishing unit is used for respectively establishing data programming models of all layers according to the layered service data objects.
The data access service method provided by the embodiment of the invention comprises the following steps:
establishing a group of data programming models containing different levels;
deploying the data programming model to a service/business layer of a system;
when a user accesses data, the data from the heterogeneous data sources is presented to the user through the data programming model.
An embodiment of the present invention provides a data access service system, including: the system comprises a service/business layer subsystem for providing services for users, an application integration layer subsystem and an enterprise information layer subsystem, wherein the enterprise information layer subsystem comprises one or more heterogeneous data sources, a data programming model device is deployed in the service/business layer subsystem, a data intermediary service device is deployed in the application integration layer subsystem, the data programming model device is used for providing a set of connectionless data programming models containing different layers, when users access data, the data intermediary service device acquires data from the heterogeneous data sources and assembles the data into data objects meeting the data programming model specification, and the data programming model device calls the assembled data objects and displays the data objects to the users.
It can be seen from the above technical solutions provided by the embodiments of the present invention that the method of the present invention partitions different levels of models by abstracting and analyzing the models, and defines a completely structured hierarchical model which is independent of implementation technologies, separated from each other, so that developers can establish SDO data objects and perform service development without learning specific SDO implementation technologies, thereby reducing the workload of service development and improving the development efficiency.
In addition, the invention separates the domain model and the physical table model, and establishes a layer of data object model on the domain model, so that system designers can design the system on the domain model, and service developers can define the data object on the domain model, thereby realizing decoupling of the service system and the physical table model, and improving the expandability of the system.
Detailed Description
In order that those skilled in the art will better understand the technical solution of the present invention, the following detailed description of the present invention is provided in conjunction with the accompanying drawings and embodiments.
The invention carries out structural layering on SDO, and respectively establishes service data object models of different layers: domain object model, data object model, physical table model, data object-physical table mapping model, and separating these different levels of models from each other. Therefore, when the business is developed, the data object can be generated by the basic domain object according to the business requirement, thereby reducing the workload of business development and improving the development efficiency.
Referring to FIG. 2, there is shown a flow chart of a preferred embodiment of a method of the present invention for establishing a connectionless data programming model, which includes the steps of:
step 201: the service data object is layered, and can be divided into a domain object and a data object. And defines the data object according to the domain object.
When defining a data object, all or part of one or more domain objects can be combined to form a data object according to the business application requirements.
For example, in the domain object view shown in fig. 3, there are four domain objects, which are domain object 1, domain object 2, domain object 3, and domain object 4. The domain object 2 is associated with three other domain objects, respectively. The domain object 1 and the domain object 2 are combined as one data object according to business needs.
Of course, other hierarchical modes can be adopted, and as long as the metadata can be fully utilized, the development workload can be reduced, and the development efficiency can be improved.
Step 202: and establishing a domain object model, and generating a corresponding physical table model by the domain object model.
The domain objects and their interrelationships required by the service are determined. Among the four domain objects shown in fig. 3, the domain object 2 includes domain object 1, domain object 3, and domain object 4, respectively, without any association among the domain objects 1, 3, and 4.
IDE (Integrated development Environment) modeling tools can be used to build a domain object model that satisfies relationships between objects. For example, the domain object model is built using a Rational Rose or PowerDesigner (a software modeling tool).
Step 203: and establishing a corresponding relation between the data object and the physical table.
Because the object model of Rose mainly supports three programming languages of Java, VC and VB, Naming-SQL (named SQL) can be introduced into SDO, and the corresponding relation between the data object and the physical table is established through the Naming-SQL. The Naming-SQL means that SQL sentences originally embedded in program codes are extracted and put into another file specially storing the SQL sentences, and the original SQL sentences are replaced by a unique identifier. Therefore, a database administrator can carry out centralized management on all SQL sentences stored in one file, and can conveniently modify tables, query sequences or query conditions queried in the SQL sentences on the premise of not changing the query result of the SQL sentences so as to achieve the aim of optimal performance.
Of course, other programming languages may be used to establish the correspondence between the data objects and the physical tables.
Step 204: and generating a data object-physical table mapping model according to the corresponding relation between the data object and the physical table.
For example, the relationship between different hierarchical models established in the embodiment of the present invention is shown in fig. 4:
the data object includes a part of the domain object 1, the domain object 2, and the domain object 3, the physical table model 1 corresponds to the data object model 1, the physical table model 2 corresponds to the data object model 2, and the physical table model 3 corresponds to the data object model 3. And establishing a corresponding relation between the data object and the physical table by naming SQL (structured query language), and generating a data object-physical table mapping model. As can be seen from fig. 4, the data object model, the domain object model, the data object-physical table mapping model, the physical table model are separated from each other.
Therefore, the method for establishing the connectionless data programming model divides the models of different levels through the abstraction and analysis of the models, defines the completely structured hierarchical model which is independent of the implementation technology, separated from each other and enables developers to establish the SDO data object and develop the service without learning the specific SDO implementation technology. By the structured subdivision of the domain model, the data object model, the physical table model and the data object-physical table mapping model and the definition of corresponding metadata for each model, the clear layering of the whole SDO modeling technology and the interface definition based on model processing are realized. Due to the fact that complete metadata is provided, models of all layers can be integrated into different platforms and frameworks in a self-saving mode.
Based on the idea of layering service data objects, the invention also provides a device for establishing a connectionless data programming model.
Referring to fig. 5, fig. 5 shows a schematic block diagram of a first embodiment of the apparatus for establishing a connectionless data programming model of the present invention:
in this embodiment, the method includes: a layering unit 51 and a model building unit 52. The layering unit 51 is configured to layer the service data object, divide the service data object into a domain object and a data object, and define the data object according to the domain object; the model building unit 52 is configured to build data programming models of each layer according to the layered service data objects.
The model building unit 52 includes: a domain object model establishing subunit 521, a physical table model generating subunit 522, and a data object-physical table mapping model generating subunit 523. Wherein,
the domain object model creating subunit 521 is configured to create a domain object model according to the domain objects and the logical relationships thereof determined by the hierarchical unit, and may create a domain object model satisfying the relationships between the objects by using an IDE (integrated development environment) modeling tool. For example, the domain object model is built using a Rational Rose or PowerDesigner (a software modeling tool). The physical table model generating subunit 522 is configured to generate a corresponding physical table model according to the domain object model, that is, convert the domain object model into the physical table model. The data object-physical table mapping model generating subunit 523 is configured to generate a data object-physical table mapping model according to the correspondence between the data object and the physical table.
Referring to fig. 6, fig. 6 is a schematic block diagram of a second embodiment of the apparatus for establishing a connectionless data programming model according to the present invention:
unlike the embodiment shown in fig. 5, in this embodiment, a correspondence relationship establishing subunit 524 is added to the model establishing unit, and is used to establish, by naming SQL, a correspondence relationship between the data object and the physical table required for generating the data object-physical table mapping model. Naming-SQL (named SQL) is introduced into the SDO, and the corresponding relation between the data object and the physical table is established through the Naming-SQL.
The process of establishing the corresponding relation between the data object and the physical table through the Naming-SQL comprises the following steps:
1. writing a query SQL statement (giving the statement a unique identifier, called "named SQL"): it finds out all fields corresponding to the attribute of the data object from the database table;
2. a one-to-one correspondence between the attributes of the data object and the fields queried by the query SQL is specified, rather than a direct correspondence between the attributes of the data object and the fields of the physical table.
That is, the indirect correspondence of the data object to the physical table is established by configuring a one-to-one correspondence between the attributes of the data object and the fields queried by the named SQL.
In this way, the data object-physical table mapping model generating subunit 523 can generate the data object-physical table mapping model directly from the correspondence relationship without determining the correspondence relationship between the data object and the physical table by itself. Of course, a plurality of establishing subunits supporting the corresponding relationship of different languages can be provided, and the establishing subunits can be selected for use according to the application environment during system development.
The method and the device for establishing the connectionless data programming model can be applied to a J2EE (Java2 enterprise edition) architecture, so that system designers can design a system on a domain model, service developers can define data objects on the domain model, decoupling of a service system and a physical table model is realized, and the expandability of the system is improved.
Referring to fig. 7, a flow of a preferred embodiment of the data access service method of the present invention is shown, which comprises the following steps:
step 701: a set of data programming models is established that contain different levels.
The data programming model of different levels includes: domain object model, data object model, physical table model, object-to-physical table mapping model. The process of establishing these data programming models at different levels has been described in detail above, and will not be described herein.
Step 702: the data programming model is deployed to the service/business layer of the system.
Step 703: when a user accesses data, the data from the heterogeneous data sources is exposed to the user through the data programming model.
Step 704: and after the user modifies the data, updating the data modified by the user into the heterogeneous data source through the data programming model.
Referring to the J2EE hierarchical structure and the location of the SDO shown in FIG. 8:
among them, 81 is an enterprise information layer, which is used to provide various information sources, such as information sources with different formats, such as DB (relational database), LEGACY (history file), ERP (enterprise resource planning table), Message (Message), etc.; 82 is an application integration layer, and provides uniform access/exit for Data of different information sources through a Data Mediator Service (DMS); 83 is a Service/Service layer, configured to perform Service processing on data, for example, using technologies such as EJB (Enterprise JavaBean, a model provided for developing server-side Enterprise application components), Bean, and Service; 85 is a server presentation layer, which is used to arrange the processed data into a specific format, for example, by using JSP (Java server Pages, a dynamic web page technology), Servlet (Java Servlet), UI Management (user interface Management), and other technologies; 86 is a client presentation layer for presenting data in a particular format to a client via a page or other visual window, for example, provided to the client via a Browser, PDA (personal digital assistant), Webservice, etc.
As can be seen from the figure, the implementation of the technical solution of the present invention belongs to a DMS (Data Mediator Service) hierarchy, where the DMS receives Data from heterogeneous Data sources (e.g., a relational database DB, an XML file, a Message, etc.), for example, the Data is obtained from different Data sources through JDBC (Java database programming standard), JCA (J2EE connector architecture), JAR-RPC (Java API for XML-based RPC) and JMS (Java Message Service) protocols, respectively, and then the Data is assembled into Data objects meeting the specification of a Data programming model and is handed to the Data programming model in the Service/Service layer of the system; and the data programming model calls the assembled data object and displays the data object to a user. For example, the attributes of the data object and the hierarchical relationship between the attributes can be displayed through a form on a web page.
Referring to fig. 9, fig. 9 is a functional block diagram of a preferred embodiment of the data access service system of the present invention:
in this embodiment, the method includes: a service/business layer subsystem 91, an application integration layer subsystem 92, and an enterprise information layer subsystem 93. Wherein, the service/business layer subsystem 91 is used for providing services for users; the application integration layer subsystem 92 is used for providing a uniform outlet/inlet for data of different information sources; the enterprise information layer subsystem 93 is used to provide information data for the system, including one or more heterogeneous data sources, such as a relational database DB, XML files, Message, etc.
A data programming model means 901 is deployed in the service/business layer subsystem 91 and a data mediation service means 902 is deployed in the application integration layer subsystem 92. The data programming model device 901 is used for providing a set of connectionless data programming models containing different levels, namely modeling business data required by a business layer, including the organization structure and source of the business data. When a user accesses data, the data mediation service device 902 acquires data from heterogeneous data sources and assembles the data into data objects conforming to the data programming model specification, and the data programming model device 901 calls the assembled data objects and displays the data objects to the user. When the user modifies the data, the data programming model device 901 updates the data modified by the user to the heterogeneous data source.
While the present invention has been described with respect to the embodiments, those skilled in the art will appreciate that there are numerous variations and permutations of the present invention without departing from the spirit of the invention, and it is intended that the appended claims cover such variations and modifications as fall within the true spirit of the invention.