The content of the invention
The technical assignment of the present invention is for above weak point, there is provided a kind of practical, based on interface data are led to
Letter method.
A kind of data communications method based on interface, including api function service host layer, access logic control layer, data
Storehouse access layer and some databases, its communication process is:
When user proposes to call the request of database in client, the api function service host layer generates api interface and carries out
Management;
The request of user services host layer and is sent to access logic control layer by above-mentioned api function, and logical access key-course enters
The semantic parsing of row, construction logic rule, while returning result and request are limited;
The unrestricted information of the request is found after logic control layer analysis request is accessed, then request call database access layer, should
Database access layer connects some databases, and database access layer is according to request call database and returns response contents, realizes
User calls database.
Api function service host layer is included with lower module:
Common query module, the API in system externally provides inquiry service, is responsible for the existing API examples of inquiry, including shape
State, function parameter explanation, code sample, Service controll people, called side information;
API instance management modules, realize maintenance, the control of API examples, are responsible for the issue of API examples, enable state, visit
Ask information, access privilege control, status poll;
Api interface and class generation module, the interface and class according to needed for the instruction of API instance management modules generates API issues
Java code;
The timely collectors of Java, according to specified Java files and build path, compiling Java code be Class or
Object;
Api function constructing module, realizes the construction and issuing function of api function, and the api function of construction is sent to into API host
Module;
API hosting modules, there is provided WebService services allow outside to conduct interviews from specified entrance, so as to provide service.
Accessing logic control layer includes following logic rules module:
Logic control management module, is realized by configuring the entrance and each logic rules module of following logic rules hosting modules
The control of logic rules, realizes the reading of state and daily record;
Logic rules generation module, according to the interface and the example of general class create-rule class of application definition, and is added to logic
Regular hosting module;
Logic rules hosting module, there is provided sole inlet point supplies external call, realizes integrated control, and in entrance performing environment
Example rule module and call the control for carrying out implementation rule;
Logic rules monitoring module, this module realizes the reading of state by the readjustment of logic rules hosting module entrance
Take, and log information, to realize recalling for all operations, in log pattern, log pattern is with Log for the log recording
The form record user of daily record or system all operations and browsing process.
The logic control management module adds, deletes, enabling, disabling logic rules module by service logic rule,
The operating state real time information and daily record of logic rules host are obtained by calling logic rule state monitoring module.
Calling for the logic rules generation module response logic control management module, generates logic rules hosting module and refers to
Fixed control rule, and it is added to logic rules hosting module, realize the addition of logic rules.
The pattern that the logic rules hosting module is reflected by factory, what the form of loose coupling called order calls access
The modules of logic control layer, each logic rules module is performed and returned according to application definition interface.
Logic rules monitoring module is defined uniquely without formula call back function is stopped, for logic rules hosting module entrance
Readjustment, by the callback information of function, obtains current state and records and process.
Logical access key-course also includes security audit module, returns request and limits by security audit module realization, should
Security audit module by access source and connect safety audit, make requests on filtration, so as to filter limited accass or
Non-trusted request is accessed, and services the content that host layer returns request restriction to api function.
The security audit module provides web Service interface, connects for custom security or unsecured connections, i.e.,
When the security audit module examination & verification request content passes through, realize accessing the safety between logic control layer and database access layer
Connection, is not otherwise then attached.
The database access layer is included with lower module:
Data cube computation management module, configures the database instance information and switch specified, and calls to realize for link block
The control of connection database, i.e. the carry of this module management database instance and unloading, the addition of database-driven, and call number
The hang-up of database manipulation is realized according to link block;
Data connection module, this module specifies unique entrance for calling to realize the operation of database, i.e., by managing mould
Block configuration information and entry call information drive come the connection type and dynamic importing connection for judging database, by driving mould
Block operating database.
A kind of data communications method based on interface of the present invention, with advantages below:
A kind of data communications method based on interface of the present invention, can effectively solve the problem that kernel business system is loose, data sharing,
Data safety, system combination, database access that is cross-platform and bringing across aspects such as language applications, and data safety are asked
Topic;Control ability of the user to data is more effectively improved, strengthens enterprise work efficiency and capax negotii;Optimization is traditional at present
Project development implementing though, and then consolidation system operating efficiency and reusing degree, it is practical, it is applied widely, it is easy to promote.
Specific embodiment
Below in conjunction with the accompanying drawings the invention will be further described with specific embodiment.
As shown in Figure 1, a kind of data communications method based on interface of the invention, it is therefore an objective to beaten by way of API
Logical database directly links passage.
Including api function service host layer, logic control layer, database access layer and some databases are accessed, it leads to
Letter process is:
When user proposes to call the request of database in client, the api function service host layer generates api interface and carries out
Management;
The request of user services host layer and is sent to access logic control layer by above-mentioned api function, and logical access key-course enters
The semantic parsing of row, construction logic rule, while returning result and request are limited;
The unrestricted information of the request is found after logic control layer analysis request is accessed, then request call database access layer, should
Database access layer connects some databases, and database access layer is according to request call database and returns response contents, realizes
User calls database.
Api function services host layer:
Common query module, mainly the API in system externally provides inquiry service, allows called side to obtain technology
Hold.It is responsible for the letters such as the existing API examples of inquiry, including state, function parameter explanation, code sample, Service controll people, called side
Breath.
API instance management modules, by API instance management modules the maintenance of API examples is realized, control etc., can allow pipe
Reason person controls API examples.The issue of API examples is responsible for, state, access information, access privilege control, status poll is enabled
Deng.
Api interface and class generation module, realize, automatically generating to compile according to the interface definition and general class of program
Java code.The Java code of the required interface of API issues and class can be generated according to the instruction of management module.
The timely collectors of Java, can be according to the Java files and build path specified, and compiling Java code is Class
Or Object.
Specifically, the JavaCompiler for being provided using jdk, using rewriting SimpleJavaFileObject,
The self-defined compiling java codes of mode of ForwardingJavaFileManager, URLClassLoade are Class, are used
DynamicClassLoader realizes dynamic instance object.
Api function constructing module, can realize the construction and issuing function of api function, can send out the api function of construction
It is sent to API hosting modules.The ServerFactoryBean provided using CXF class libraries constructs service unit, and adds in construction process
Plus blocker readjustment and access logic, to realize security function.
API hosting modules, can provide WebService services and allow outside to conduct interviews from specified entrance, so as to carry
For service.By building module construction ServerFactoryBean, Server is produced using Create, configured according to structure mould
The definition configuration Endpoint of block, realizes WebService services to provide outside access.
Accessing logic control layer includes following logic rules module:
Logic control management module, is realized by configuring the entrance and each logic rules module of following logic rules hosting modules
The control of logic rules, realizes the reading of state and daily record;
Logic rules generation module, according to the interface and the example of general class create-rule class of application definition, and is added to logic
Regular hosting module;
Logic rules hosting module, there is provided sole inlet point supplies external call, realizes integrated control, and in entrance performing environment
Example rule module and call the control for carrying out implementation rule;
Logic rules monitoring module, this module realizes the reading of state by the readjustment of logic rules hosting module entrance
Take, and log information, to realize recalling for all operations, in log pattern, log pattern is with Log for the log recording
The form record user of daily record or system all operations and browsing process.
The logic control management module adds, deletes, enabling, disabling logic rules module by service logic rule,
The operating state real time information and daily record of logic rules host are obtained by calling logic rule state monitoring module.
Calling for the logic rules generation module response logic control management module, generates logic rules hosting module and refers to
Fixed control rule, and it is added to logic rules hosting module, realize the addition of logic rules.
The pattern that the logic rules hosting module is reflected by factory, what the form of loose coupling called order calls access
The modules of logic control layer, each logic rules module is performed and returned according to application definition interface.
Logic rules monitoring module is defined uniquely without formula call back function is stopped, for logic rules hosting module entrance
Readjustment, by the callback information of function, obtains current state and records and process.
Logical access key-course also includes security audit module, returns request and limits by security audit module realization, should
Security audit module by access source and connect safety audit, make requests on filtration, so as to filter limited accass or
Non-trusted request is accessed, and services the content that host layer returns request restriction to api function.
The security audit module provides web Service interface, connects for custom security or unsecured connections, i.e.,
When the security audit module examination & verification request content passes through, realize accessing the safety between logic control layer and database access layer
Connection, is not otherwise then attached.
The database access layer is included with lower module:
Data cube computation management module, configures the database instance information and switch specified, and calls to realize for link block
The control of connection database, i.e. the carry of this module management database instance and unloading, the addition of database-driven, and call number
The hang-up of database manipulation is realized according to link block;
Data connection module, this module specifies unique entrance for calling to realize the operation of database, i.e., by managing mould
Block configuration information and entry call information drive come the connection type and dynamic importing connection for judging database, by driving mould
Block operating database.
The method that the present invention is provided has the characteristics that:
Specifying for incoming parameter is realized by the parameter of api function, is returned when implementing result is data set
DataTableResult, is to return SingleResult when monodrome returning result is performed, and is to return when performing without returning result
VoidResult
Incoming state modulator, the necessary atomic data types of incoming parameter of each function, int, string etc..
Big data quantity Properties Control, the maximum number data elements for returning of system single are arranged for 5000 row * 500, to avoid
Program forms resource lock.
Exception control, in systems can be using peripheral exception control, so being not result in program crashing, program can print institute
There is abnormal information in abnormal information record, to be consulted and be debugged.
The stability of a system, need to test the 3-5 haplotype datas request pressure verification that maximum pressure is enterprise practical business datum amount.
Extensibility is arranged, and can not changed in the range of system logic framework, carries out later development, and is opened for the later stage
Send out extensive interface and module reserved.
Connected mode in the present invention between each layer is as follows:
Client calls API to realize the access of database by soap agreements.
Access safety, client is by private spoon(Or certificate)Encryption, IP, MAC, encrypted message to service end, service end is recognized
Service is provided after card, client receives incoming connection to be needed to be verified the IP at client private spoon cryptographic services end, MAC, password
Information, is thus to realize to be transferred into and out safety verification.
By hardware and software platform, client provides various language(.Net, java, VC)Help class libraries, auxiliary client complete
Access, client can be indifferent to completely realizes logic(Certainly client self-defined can also access, because soap agreements are general
's).
Above-mentioned specific embodiment is only the concrete case of the present invention, and the scope of patent protection of the present invention is included but is not limited to
Above-mentioned specific embodiment, it is any to meet a kind of the claims of data communications method based on interface of the invention and appoint
The appropriate change or replacement that the those of ordinary skill of what technical field is done to it, should all fall into the patent protection of the present invention
Scope.