CN108416035A - A kind of Database Mapping file consolidation management method based on disconf - Google Patents
A kind of Database Mapping file consolidation management method based on disconf Download PDFInfo
- Publication number
- CN108416035A CN108416035A CN201810201474.0A CN201810201474A CN108416035A CN 108416035 A CN108416035 A CN 108416035A CN 201810201474 A CN201810201474 A CN 201810201474A CN 108416035 A CN108416035 A CN 108416035A
- Authority
- CN
- China
- Prior art keywords
- disconf
- sql
- files
- mapped
- file
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Stored Programmes (AREA)
Abstract
The Database Mapping file consolidation management method based on disconf that the invention discloses a kind of, distributed server of the present invention first read Dao category informations, and according to class name, method name, method parameter automatically generates corresponding additions and deletions and changes and looks into SQL statement masterplate;As long as distributed program success of operation, locally it will contain most full configuration file, SQL mapped files need not be downloaded to local, and due to being added in the queue of disconf trust instruments, corresponding SQL files will be read from line when starting per secondary program.Since current disconf only supports the update of .properties files is matched to postpone and can be automatically injected, it can come into force immediately without reset routine, so SQL mapped files will come into force immediately, not if reset routine, it is necessary to add call back function to be automatically injected Java bean.
Description
Technical field
The present invention relates to computer technologies and configuration management technical field more particularly to a kind of data based on disconf
Library mapped file Explore of Unified Management Ideas, more particularly to the realization of a kind of decentralized configuration management service and with zookeeper and
Mybatis database manipulations are the unified solution of basic fundamental.
Background technology
Disconf (decentralized configuration management platform) is that the decentralized configuration based on zookeepper of complete set is unified
Solution.It disposes extremely simple:The same packet of reaching the standard grade does not have to change configuration, can be in multiple environment (RD/QA/
PRODUCTION it is run under).Configuration is stored in cloud system, and the distributionization of configuration item and configuration file can be supported to manage
Reason supports the weak code without code intrusion programming mode and based on note formula based on XML to invade programming mode, supports micro services
Framework.It is mainly used for trustship .properties and .xml configuration file in the project at present.In JavaWeb projects, by data
It storing to database and needs to use mybatis Persistence Layer Frameworks, it supports common SQL query, storing process and advanced mapping,
By XML mapped files, the record POJO of interface and Java being mapped in database.But a Dao class just corresponds to one
A SQL mapped files, a table in operating database, table can carry out additions and deletions and change to look into a variety of operations again, one by one in item code
In write, workload is larger and easy error, modification trouble, it is contemplated that by its trustship on disconf.Emphasis among these
It is, disconf platforms will automatically generate SQL mapped files according to the method name of Dao classes and the data source of project profile
Masterplate, and being preserved, while also to realize that one is modified, without restarting, the function that comes into force immediately.
Invention content
Place in view of the shortcomings of the prior art, the purpose of the present invention is to provide a kind of data based on disconf
Library mapped file Explore of Unified Management Ideas, distributed server first read Dao category informations, according to class name, method name, and method parameter,
It automatically generates corresponding additions and deletions and changes and look into SQL statement masterplate;So interface function can not be realized correctly, need developer right on line
It is preserved after changing slightly, is again started up program, you can correctly realize interface function.As long as running a distributed program
Success will locally contain most full configuration file, and SQL mapped files need not be downloaded to local, due to being added to
In the queue of disconf trust instruments, corresponding SQL files will be read from line when starting per secondary program.Due to current
Disconf only supports the update of .properties files with postponing and can be automatically injected, and can come into force immediately without reset routine, institute
It to be come into force immediately with SQL mapped files, not if reset routine, it is necessary to add call back function to be automatically injected Java bean.
The purpose of the invention is achieved by the following technical solution:
A kind of Database Mapping file consolidation management method based on disconf, includes the following steps:
Step A:Local project configures disconf.properties files, and disconf.properties files are local
The core that project is arranged using disconf correlations;Wherein disconf.properties files are provided with the host of server, version
Sheet, APP, environment and the local number of retries for whether using remote profile, acquisition to configure and dormancy time phase are inside the Pass
Hold;
Step B:Basic disconf is added in the entrance configuration file of local project support, inject and need to configure
Java bean;Path and the filename of the SQL mapped files of trustship are wanted in addition simultaneously, and want the XML file of trustship, and
Inject Dao classes;
Step C:It adds and explains in Dao classes, mark the class that it is Spring trustships first, specify SQL mapped file names,
SQL mapped files name is consistent with the trust instrument name in entrance XML;It adds and explains in each method in Dao classes, make
It obtains method name and the id of every sentence in SQL mapped files is consistent;
Step D:When local project program starts for the first time, distributed server first reads Dao category informations, according to class name, side
Religious name, method parameter automatically generate corresponding additions and deletions and change and look into SQL statement masterplate;If interface function can not be realized correctly, need
Developer preserves after being changed slightly it on line, is again started up program, you can correctly realize interface function;Once generating
SQL mapped files will be automatically saved on disconf-web and hold in the palm;
Step E:As long as distributed program success of operation, will locally contain most full configuration file, SQL mappings
File need not be downloaded to local, will when starting per secondary program due to being added in the queue of disconf trust instruments
Corresponding SQL files are read from line;Since current disconf only supports that the update of .properties files is automatic with meeting is postponed
Injection, can come into force without reset routine, immediately so SQL mapped files will come into force immediately, not if reset routine, it is necessary to
Call back function is added to be automatically injected Java bean.
Preferably, wherein step E further includes following method:
The corresponding SQL mapped files of each Dao class in local project are hosted on disconf, later every time
Startup program, the database additions and deletions that will read SQL mapped files from line automatically change and look into sentence, and then operating database.
Preferably, the method name in the step C in Dao classes must be in accordance with Java coding criterions.
Unified management the present invention is based on disconf to configuration file, on condition that in project specified database connect match
File is set to be hosted in decentralized configuration management platform.
For at present, in JavaWeb projects, the use of MySQL database is still quite extensive.Pass through mybatis
SQL mapped files a series of operation is carried out to database.One Dao class is usually predominantly one in data base-oriented
Table also just needs a corresponding SQL mapped file, and the field in the attribute and database table in common Java object is carried out
Matching.If modified to SQL statement, it is necessary to it recompilates, start, being packaged, deploying projects, it is cumbersome.SQL maps
Though file is not the configuration file of project, be also XML type file, and disconf supported .properties with
And the various configuration files of .xml types, the present invention in by the trustship of SQL mapped files in decentralized configuration management platform disconf
On.In addition to this, it generally is intended to change the progress additions and deletions of multiple tables in the project and looks into different operations, need at present complete one by one
The each table of establishment SQL mapped files, and each SQL statement is write to carry out CRUD to database, if do not existed
If carrying out the name automatic mapping statement of hump formula in mybatis configuration files, class field and table are also added in SQL files
The mutual mapping of attribute, just can guarantee one-to-one correspondence, and correctly progress additions and deletions, which change, looks into.Certain literary name sections are relatively more, develop
Written in code amount in journey is bigger, is easy error.Corresponding SQL will be automatically generated in the present invention using disconf platforms to reflect
Document template is penetrated, as long as developer carries out modification supplement appropriate.
At this stage, disconf realizes two kinds of distributed management modes:(1) the weak code mode of infection based on note formula,
It only supports .properties files, is not necessarily to the Java bean defined in item entry XML file, configuration can note automatically when updating
Enter, is not necessarily to reset routine;(2) mode invaded without code based on XML is supported any type of configuration file, needed in project
Java bean defined in entrance XML file, when configuration update, can not be automatically injected, and needing to write call back function can support.And this
It needs disconf according to specified requirements in invention, will explain and two kinds of configuration modes of XML combine, taken first in distribution
Xml document masterplate is automatically generated in business device dosconf-web, then it is managed collectively again.Crucial step includes:
(1) in the entrance configuration file of project (being applicationContext.xml under spring programmed environments)
It adds basic disconf to support, defines Java bean;Path and the filename of the SQL mapped files of trustship are wanted in addition simultaneously
(Java program norms must be met, Dao class names remove the format of the field+Mapper.xml of DAO, otherwise trust instrument
It is not present);
(2) add and explain in Dao classes, mark the class that it is Spring trustships first, specify SQL mapped files names (with
Trust instrument name name in entrance XML is consistent);In each method in Dao classes add explain so that method name with
The id of every sentence is consistent in SQL mapped files.Method name in Dao classes must be in accordance with Java coding criterions, i.e.,:
SELECT is using get as prefix, and UPDATE is using update as prefix, and INSERT is using save as prefix, before DELETE is with remove
Sew.
(3) when program starts for the first time, distributed server first reads Dao category informations, according to class name, method name, method ginseng
Number automatically generates corresponding additions and deletions and changes and looks into SQL statement masterplate.So interface function can not be realized correctly, need developer online
On it is changed slightly after preserve, be again started up program, you can correctly realize interface function.Unlike .properties is configured
File is the same, as long as distributed program success of operation, will locally contain most full configuration file, SQL mapped files
It need not be downloaded to local, it, will be from line when starting per secondary program due to being added in the queue of disconf trust instruments
It is upper to read corresponding SQL files.Since current disconf only supports the update of .properties files is matched to postpone and can be automatically injected,
It can come into force immediately without reset routine, so SQL mapped files will come into force immediately, not if reset routine, it is necessary to add
Call back function is automatically injected Java bean.
The present invention compared with the prior art, has the following advantages and advantageous effect:
As long as the present invention runs a distributed program success, it will locally contain most full configuration file, SQL mappings
File need not be downloaded to local, will when starting per secondary program due to being added in the queue of disconf trust instruments
Corresponding SQL files are read from line.Since current disconf only supports that the update of .properties files is automatic with meeting is postponed
Injection, can come into force without reset routine, immediately so SQL mapped files will come into force immediately, not if reset routine, it is necessary to
Call back function is added to be automatically injected Java bean.
Description of the drawings
Fig. 1 be the present invention in trustship SQL mapped files to disconf flow diagram;
Fig. 2 is that sql mapped files of the present invention preserve the substantially page presentation design sketch to distributed management platform.
Specific implementation mode
The present invention is described in further detail with reference to embodiment:
Embodiment one
As shown in Figure 1, a kind of Database Mapping file consolidation management method based on disconf, includes the following steps:
Step A:Local project configures disconf.properties files, and disconf.properties files are local
The core that project is arranged using disconf correlations;Wherein disconf.properties files are provided with the host of server, version
Sheet, APP, environment and the local number of retries for whether using remote profile, acquisition to configure and dormancy time phase are inside the Pass
Hold;
Step B:Basic disconf is added in the entrance configuration file of local project support, inject and need to configure
Java bean;Path and the filename of the SQL mapped files of trustship are wanted in addition simultaneously, and want the XML file of trustship, and
Inject Dao classes;
Step C:It adds and explains in Dao classes, mark the class that it is Spring trustships first, specify SQL mapped file names,
SQL mapped files name is consistent with the trust instrument name in entrance XML;It adds and explains in each method in Dao classes, make
It obtains method name and the id of every sentence in SQL mapped files is consistent;
Step D:When local project program starts for the first time, distributed server first reads Dao category informations, according to class name, side
Religious name, method parameter automatically generate corresponding additions and deletions and change and look into SQL statement masterplate;If interface function can not be realized correctly, need
Developer preserves after being changed slightly it on line, is again started up program, you can correctly realize interface function;Once generating
SQL mapped files will be automatically saved on disconf-web and hold in the palm;
Step E:As long as distributed program success of operation, will locally contain most full configuration file, SQL mappings
File need not be downloaded to local, will when starting per secondary program due to being added in the queue of disconf trust instruments
Corresponding SQL files are read from line;Since current disconf only supports that the update of .properties files is automatic with meeting is postponed
Injection, can come into force without reset routine, immediately so SQL mapped files will come into force immediately, not if reset routine, it is necessary to
Call back function is added to be automatically injected Java bean.
Wherein step E further includes following method:
The corresponding SQL mapped files of each Dao class in local project are hosted on disconf, later every time
Startup program, the database additions and deletions that will read SQL mapped files from line automatically change and look into sentence, and then operating database.
Method name in the step C in Dao classes must be in accordance with Java coding criterions.
Embodiment two
As shown in Figure 1 and Figure 2, a kind of Database Mapping file consolidation management method based on disconf, including walk as follows
Suddenly:
Step 1:Disconf.properties files are locallyd create in project.Start because it is distributed server
Entrance.Be configured in this document the host of server, version, APP, environment and it is local whether using remote profile,
Obtain the related contents such as number of retries and the dormancy time of configuration.
Step 2:In item entry XML file, under Spring programmed environments, as
ApplicationContext.xml files.It adds basic disconf to support, scans the packet of oneself local project, addition is wanted
The XML file for carrying out trustship, is exactly the corresponding SQL mapped files of each Dao class here, filename and Dao class names are accurately right
It answers, adds the Java bean needed to configure, that is, be exactly Spring injection Dao classes.
Step 3:The addition of pair Dao classes interacted with database is explained.The class that it is Spring trustships is marked first,
Secondly corresponding SQL mapped files name is specified by the note on class name, can be accurately found when starting so as to program and needs to execute
SQL statement, the note in each method then specifies unique id of every SQL statement in SQL mapped files, convenient for generating just
True SQL statement masterplate.
Step 4:Distributed server generates the SQL mapped file masterplates mutually echoed with Dao classes.First time startup program
When, disconf-web is upper and there is no the files that trustship is wanted in project XML file, so can be closed first according to filename therein
Join each corresponding Dao class, further according to each method name and method parameter in Dao classes, creates SQL mapped files, and
Preliminary SQL statement is generated, is stored on distributed server.Then developer needs further to supplement SQL statement and repair
Change, preserves update.
Step 5:The XML file that disconf-web distributed server trustships upload.Its advantage is, the same line
Upper packet can be deployed in different environment, unlike being required for copy a on each server before.For properties
The file of type is changed on line, program can automatic reload configurations, it is local not have to repack deployment startup program.And for
The file of xml types updates on line, program will not the newest modifications of automatic reload, need to add call back function manually, can just obtain
Get latest configuration file.
Step 6:It is again started up program, from the SQL mapped file reading of content on disconf-web, operating database.
Every various types configuration file that trustship is stated in project XML file, both can reside in local, can also exist on remote
Journey.As long as distributed program success of operation, can be downloaded to local, if subsequently if even if not having before local
It when startup, obtains remote profile and has failed, program is just automatic to read local file, does not interfere with successfully the normal of counteroffensive
Operation.
As shown in Fig. 2, preserving sql mapped files to distributed management platform, you can right under various circumstances
It carries out edit operation, its substantially page presentation effect is so schemed.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention
All any modification, equivalent and improvement etc., should all be included in the protection scope of the present invention made by within refreshing and principle.
Claims (3)
1. a kind of Database Mapping file consolidation management method based on disconf, it is characterised in that:Include the following steps:
Step A:Local project configures disconf.properties files, and disconf.properties files are local projects
The core being arranged using disconf correlations;Wherein disconf.properties files be provided with the host of server, version,
APP, environment and the local number of retries and dormancy time related content for whether using remote profile, obtaining configuration;
Step B:Basic disconf is added in the entrance configuration file of local project to support, injects the Java needed to configure
bean;Path and the filename of the SQL mapped files of trustship are wanted in addition simultaneously, and want the XML file of trustship, and are injected
Dao classes;
Step C:It adds and explains in Dao classes, mark the class that it is Spring trustships first, specify SQL mapped file names, SQL
Mapped file name is consistent with the trust instrument name in entrance XML;It adds and explains in each method in Dao classes so that
Method name and the id of every sentence in SQL mapped files are consistent;
Step D:When local project program starts for the first time, distributed server first reads Dao category informations, according to class name, method name,
Method parameter automatically generates corresponding additions and deletions and changes and looks into SQL statement masterplate;If interface function can not be realized correctly, need to develop
Person preserves after being changed slightly it on line, is again started up program, you can correctly realize interface function;Once generating SQL to reflect
File is penetrated, will be automatically saved on disconf-web and hold in the palm;
Step E:As long as distributed program success of operation, will locally contain most full configuration file, SQL mapped files
It need not be downloaded to local, it, will be from line when starting per secondary program due to being added in the queue of disconf trust instruments
It is upper to read corresponding SQL files;Since current disconf only supports the update of .properties files is matched to postpone and can be automatically injected,
It can come into force immediately without reset routine, so SQL mapped files will come into force immediately, not if reset routine, it is necessary to add
Call back function is automatically injected Java bean.
2. a kind of Database Mapping file consolidation management method based on disconf described in accordance with the claim 1, feature exist
In:Wherein step E further includes following method:
The corresponding SQL mapped files of each Dao class in local project are hosted on disconf, are started every time later
Program, the database additions and deletions that will read SQL mapped files from line automatically change and look into sentence, and then operating database.
3. a kind of Database Mapping file consolidation management method based on disconf described in accordance with the claim 1, feature exist
In:Method name in the step C in Dao classes must be in accordance with Java coding criterions.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810201474.0A CN108416035B (en) | 2018-03-12 | 2018-03-12 | Disconf-based unified management method for database mapping files |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810201474.0A CN108416035B (en) | 2018-03-12 | 2018-03-12 | Disconf-based unified management method for database mapping files |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108416035A true CN108416035A (en) | 2018-08-17 |
CN108416035B CN108416035B (en) | 2021-06-22 |
Family
ID=63131107
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810201474.0A Active CN108416035B (en) | 2018-03-12 | 2018-03-12 | Disconf-based unified management method for database mapping files |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108416035B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109491649A (en) * | 2018-11-20 | 2019-03-19 | 北京千丁互联科技有限公司 | Dao code generating method and terminal |
CN110046170A (en) * | 2019-04-22 | 2019-07-23 | 深圳乐信软件技术有限公司 | Sentence based on multifile management executes method, apparatus, equipment and medium |
CN112199334A (en) * | 2020-10-23 | 2021-01-08 | 东北大学 | Method and device for storing data stream processing check point file based on message queue |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100010748A1 (en) * | 2000-02-15 | 2010-01-14 | Perlin Mark W | Method and system for DNA analysis |
CN106685706A (en) * | 2016-12-14 | 2017-05-17 | 深圳中顺易金融服务有限公司 | Zookeeper based configuration update method and system |
CN106815012A (en) * | 2016-12-14 | 2017-06-09 | 深圳中顺易金融服务有限公司 | Decentralized configuration Explore of Unified Management Ideas and system based on Zookeeper |
-
2018
- 2018-03-12 CN CN201810201474.0A patent/CN108416035B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100010748A1 (en) * | 2000-02-15 | 2010-01-14 | Perlin Mark W | Method and system for DNA analysis |
CN106685706A (en) * | 2016-12-14 | 2017-05-17 | 深圳中顺易金融服务有限公司 | Zookeeper based configuration update method and system |
CN106815012A (en) * | 2016-12-14 | 2017-06-09 | 深圳中顺易金融服务有限公司 | Decentralized configuration Explore of Unified Management Ideas and system based on Zookeeper |
Non-Patent Citations (1)
Title |
---|
ROSARIO CACAO: "Disconf irmation of Expectations of Utility in e-Learning", 《INTERNATIONAL JOURNAL ON E-LEARNING》 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109491649A (en) * | 2018-11-20 | 2019-03-19 | 北京千丁互联科技有限公司 | Dao code generating method and terminal |
CN110046170A (en) * | 2019-04-22 | 2019-07-23 | 深圳乐信软件技术有限公司 | Sentence based on multifile management executes method, apparatus, equipment and medium |
CN110046170B (en) * | 2019-04-22 | 2021-07-27 | 深圳乐信软件技术有限公司 | Statement execution method, device, equipment and medium based on multi-file management |
CN112199334A (en) * | 2020-10-23 | 2021-01-08 | 东北大学 | Method and device for storing data stream processing check point file based on message queue |
CN112199334B (en) * | 2020-10-23 | 2023-12-05 | 东北大学 | Method and device for processing check point file storage by data flow based on message queue |
Also Published As
Publication number | Publication date |
---|---|
CN108416035B (en) | 2021-06-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107015804B (en) | Method and system for rapidly developing project by configuring API | |
CA2456771C (en) | Linking elements of a document to corresponding fields, queries and/or procedures in a database | |
CN104133772B (en) | Automatic test data generation method | |
US9021419B2 (en) | System and method for supporting intelligent design pattern automation | |
CN108762743B (en) | Data table operation code generation method and device | |
RU2714609C1 (en) | Automation of document generation | |
CN111767704B (en) | Excel form template generation method and device | |
CN108416035A (en) | A kind of Database Mapping file consolidation management method based on disconf | |
CN109976803B (en) | File generation method and device | |
Goldschmidt et al. | Classification of concrete textual syntax mapping approaches | |
CN108776702A (en) | A kind of data make a report on page user-defined visual configuration method | |
RU2491607C2 (en) | Data viewer management | |
US20140006432A1 (en) | Operation management support device, operation management support method, and recording medium | |
CN110162299A (en) | Web program and its Quick Development Framework, development approach and relevant device | |
CN110825395B (en) | Multi-plug-in layered deployment system, device and medium | |
US10963227B2 (en) | Technique for transforming a standard messaging component to a customized component | |
US10019519B2 (en) | Methods and systems for utilizing global entities in software applications | |
CN100485687C (en) | Method and device for set-up disconnection data programmed model and its application | |
CN109710532A (en) | Test case management method and device and electronic equipment | |
CN108228161B (en) | System and method for extending structured command line | |
CN113268232B (en) | Page skin generation method and device and computer readable storage medium | |
CN110941422B (en) | Code automatic generation method, code generator and readable storage medium | |
CN111580794A (en) | Method and device for creating business document in business management system | |
CN108932121B (en) | Multi-tenant distributed service component research and development oriented module and method | |
CN113342399B (en) | Method and device for configuring structure of application program and readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |