CN104615458B - A kind of method and system based on json data format module loadings - Google Patents

A kind of method and system based on json data format module loadings Download PDF

Info

Publication number
CN104615458B
CN104615458B CN201410851468.1A CN201410851468A CN104615458B CN 104615458 B CN104615458 B CN 104615458B CN 201410851468 A CN201410851468 A CN 201410851468A CN 104615458 B CN104615458 B CN 104615458B
Authority
CN
China
Prior art keywords
module
file
functional module
json data
function
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.)
Active
Application number
CN201410851468.1A
Other languages
Chinese (zh)
Other versions
CN104615458A (en
Inventor
蔡专锡
李上杰
方振华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian TQ Digital Co Ltd
Original Assignee
Fujian TQ Digital Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Fujian TQ Digital Co Ltd filed Critical Fujian TQ Digital Co Ltd
Priority to CN201410851468.1A priority Critical patent/CN104615458B/en
Publication of CN104615458A publication Critical patent/CN104615458A/en
Application granted granted Critical
Publication of CN104615458B publication Critical patent/CN104615458B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The present invention relates to application program process field, more particularly to a kind of method and system based on json data format module loadings.Its method includes:S100, the function file for creating json data formats, the function file include more than one orderly functional module, and the functional module includes the first functional module;S200, main program read the function file, form file stream;File stream obtained by S300, analyzing step S200, reads the first functional module, loads the first functional module;The first functional module that S400, operating procedure S300 are loaded.Pass through read functions file, form file stream, resolution file stream, read functions module, and load and operation function module, module dynamic load is realized, the method and system provided by the present invention, can flexibly loading command and object, the execution sequence of free control command, be also beneficial to the extension of systemic-function.

Description

A kind of method and system based on json data format module loadings
Technical field
The present invention relates to application program process field, more particularly to a kind of method based on json data format module loadings And system.
Background technology
In the prior art, dynamic load is dynamically loading scripts and directly run that such dynamic load mode is not clever enough It is living, it is limited to script in itself.It is that disposably the order in script is carried out to complete because dynamically loading scripts mode, It can not freely rest in a certain order, therefore, perform order underaction.And order is described in script, it is not right The function that custom object is described, it is impossible to which description performs the situation that order and object are combined.
Module loading method calls loading generally by program internal logic, that is to say, that be fixed loading method. Such as:Teacher says class hour, thinks that first allow classmate to be read aloud inscribes again, it is necessary to uses bright read through model and hair topic module, and sets The order put is to first carry out to perform hair topic module after bright read through model, and program will first load bright read through model and then reload hair topic mould Block, but if another teacher of lower class reads aloud after thinking first hair topic, or two problems are first sent out, then read aloud.If with Program internal logic carries out loading and is accomplished by changing program code, and every class is all likely to different, and that is accomplished by A software is developed to every class, this is substantially unpractical, so needing a kind of mode of dlm (dynamic loading module).
The content of the invention
The technical problems to be solved by the invention are:There is provided one kind can flexibly loading command and object, freely control Method and system of the execution sequence of order based on json data format module loadings.
In order to solve the above-mentioned technical problem, the technical solution adopted by the present invention is:
A kind of method based on json data format module loadings, comprises the following steps:
S100, the function file for creating json data formats, the function file include more than one orderly function mould Block, the function file includes the first functional module;
S200, main program read the function file, form file stream;
File stream obtained by S300, analyzing step S200, reads the first functional module, loads the first functional module;
The first functional module that S400, operating procedure S300 are loaded.
Another technical scheme that the present invention is used for:
A kind of system based on json data format module loadings, including:Editing machine, the first reading unit, resolver, Two reading units, loading unit and performer;
The editing machine, the function file for creating json data formats, the function file has including more than one The functional module of sequence, the functional module includes the first functional module;
First reading unit, the function file is read for main program, forms file stream;
The resolver, for parsing the file stream;
Second reading unit, for reading the first functional module;
The loading unit, for loading the first functional module;
The performer, for running the first loaded functional module.
The beneficial effects of the present invention are:By read functions file, file stream, resolution file stream, read functions are formed Module, and load and operation function module, module dynamic load is realized, the method and system provided by the present invention, Neng Gouling Loading command living and object, the execution sequence of free control command, are also beneficial to the extension of systemic-function.
Brief description of the drawings
The step of Fig. 1 is the method based on json data format module loadings of the specific embodiment of the invention is schemed;
Fig. 2 is the structural representation of the system based on json data format module loadings of the specific embodiment of the invention;
Label declaration:
10th, editing machine;20th, the first reading unit;30th, resolver;40th, the second reading unit;50th, loading unit;60th, transport Row device.
Embodiment
To describe technology contents, the objects and the effects of the present invention in detail, below in conjunction with embodiment and coordinate attached Figure is explained.
The design of most critical of the present invention is:By read functions file, file stream is formed, resolution file stream reads work( Energy module, and load and operation function module, realize module dynamic load.
Fig. 1 is refer to, the step of be the method based on json data format module loadings of the specific embodiment of the invention Figure, it is specific as follows:
A kind of method based on json data format module loadings, comprises the following steps:
S100, the function file for creating json data formats, the function file include more than one orderly function mould Block, the function file includes the first functional module;
S200, main program read the function file, form file stream;
File stream obtained by S300, analyzing step S200, reads the first functional module, loads the first functional module;
The first functional module that S400, operating procedure S300 are loaded.
It was found from foregoing description, the beneficial effects of the present invention are:By read functions file, file stream, parsing are formed File stream, read functions module, and load and operation function module, module dynamic load is realized, the side provided by the present invention Method, can flexibly loading command and object, the execution sequence of free control command, be also beneficial to the extension of systemic-function.
Further, the step S100 also includes:A default memory cell, for storing the function file.
Seen from the above description, by presetting a memory cell, the function file of establishment is placed on specified location, is easy to Main program is read.
Further, the functional module is data, event or action.The file stream is the binary system generation of function file Code.
Seen from the above description, the functional module is data, event or action, by dynamic load, the effect presented It is really different, realize dynamic purpose.
Further, the step S400 is specially:A default display interface, the function mould that operating procedure S300 is loaded Block, and be shown on the display interface.
Seen from the above description, by presetting a display interface, available for display operation result.
Further, method is also specially including the step S500:Judge whether that all functional modules have been run, if It is, end step;If it is not, return to step S300.
Further, the functional module loading procedure of the step S300 is:
S301, main program create a module object list, initialization presetting module position;
S302, main program read the json objects of json data file module positions, return to mould under the label of json objects Block title and the corresponding property value of module attribute, the property value of the module title is N, and the property value of the module attribute is A;
S303, main program N the and A creation module objects according to obtained by step S302;
Module object obtained by step S303 is added in list object by S304, main program, and the list object length adds 1;
S305, main program judge whether the length of the module position is more than the length of list object, if the module The length of position is more than the length of list object, then returns to step S302, performs step S302 to step S304;If less than Or equal to the length of list object, then into step S306;
S306, main program load step S305 module position list object.
Fig. 2 is refer to, is the structure of the system based on json data format module loadings of the specific embodiment of the invention Schematic diagram, it is specific as follows:
A kind of system based on json data format module loadings, including:Editing machine 10, the first reading unit 20, parsing Device 30, the second reading unit 40, loading unit 50 and performer 60;
The editing machine 10, the function file for creating json data formats, the function file includes more than one Orderly functional module, the functional module includes the first functional module;
First reading unit 20, the function file is read for main program, forms file stream;
The resolver 30, for parsing the file stream;
Second reading unit 40, for reading the first functional module;
The loading unit 50, for loading the first functional module;
The performer 60, for running the first loaded functional module.
It was found from foregoing description, the beneficial effects of the present invention are:By read functions file, file stream, parsing are formed File stream, read functions module, and load and operation function module, module dynamic load is realized, is by what the present invention was provided System, can flexibly loading command and object, the execution sequence of free control command, be also beneficial to the extension of systemic-function.
Further, system also includes memory cell, for store function file.
Seen from the above description, by presetting a memory cell, the function file of establishment is placed on specified location, is easy to Main program is read.
Further, system also includes display unit, for by postrun functional module, being shown in the display interface On.
Seen from the above description, by presetting a display interface, available for display operation result.
Further, system also includes judging unit, for judging whether that all functional modules have been run.
Embodiment one
Step 1, establishment, the function file of editor's json data formats, and specified location is placed, the function file is included A series of functional modules, and the functional module is ordered into;
Step 2, main program form file stream from specified location read functions file;
Step 3, resolution file stream, a functional module is read according to user-defined format;
Step 4, according to main program the need for, the functional module of dynamic load one, then according to the need for main program dynamically plus Carry functional module;
(1) according to the parsing of one module of mark one module, this is done to save internal memory, because module includes figure Piece, the resource such as sound;
(2) according to user behavior, order or backward loading functional module.
Functional module is defined:With relatively independent (self-contained) function, there is specific page display function, and can not depart from Main program, it is necessary to carry out parsing operation by main program, the functional module includes data, event and action, and itself is without execution Authority is, it is necessary to depend on main program.
Main program is defined:It is the core for handling json data files, includes a resolver and a performer, resolver Json is exactly converted into functional module and it is not by whole file translations, but according to user behavior by one mould of a module The conversion of block, performer effect is perform function module;
Resolver is defined:For parsing json data flows, and it is converted into functional module;
Performer is defined:For loading functional module, and it is shown on interface.
Step 4 (2):Order or backward loading functional module, are comprised the following steps:
Step 401:Main program creates a module object list, initialization presetting module position;
Step 402:Main program reads the json objects of json data file module positions, under the label for returning to json objects Module title and the corresponding property value of module attribute, the property value of the module title is N, and the property value of the module attribute is A;
Step 403:Main program is according to step 402 gained N and A creation module object;
Step 404:Step 403 gained module object is added in list object by main program, the list object length Plus 1;
Step 405:Main program judges whether the length of the module position is more than the length of list object, if the mould The length of block position is more than the length of list object, then returns to step 402, performs step 402 and arrives step 404;If less than Or equal to the length of list object, then into step 406;
Step 406:The list object of the module position of main program load step 405.
Thinking of the invention overall is:
By editing machine, with json data format editting function module list and file is generated, put files into specified Catalogue, main program dynamic obtains file stream from assigned catalogue, passes through resolution file stream, systematic function module list, according to main journey Module is dynamically added main program interface the need for sequence, the part as main program interface.
Effect of the invention overall is:Can more flexible loading command and object, and can free control command Execution sequence, is conducive to the extension of systemic-function, such as when I will change One function, it is only necessary to write a class in main program, Then write corresponding function, can be to use new function by json data files, it is not necessary to change system anyly Side, it is only necessary to add a class;Adequately achieve loose couplings.
Teacher, which teaches, to be needed to allow student to be read aloud and inscribed.A json text for including two modules is first created first Part, and SD card is stored in, main program reads the json files formation file stream in SD card.Main program creates a module pair As list, initialization bit is set to 1, and then main program reads first json object of json files, and object, which is contained, reads aloud mould The title and attribute of block, then read aloud module converter for module object by json objects, are added to module object list, module List object length is changed into 1, because the initialized location 1 of module is equal to the length of module object list, main program will be bright Read through model loading is come in, and when teacher needs to carry out next module, plus 1 by position and is changed into 2, then reads json files Second json object simultaneously switchs to module object addition module object list, and the length of list object is changed into 2, because the position of module 2 length for being equal to module object list are put, so main program will just do topic module loading and come in.
In summary, a kind of method and system based on json data format module loadings that the present invention is provided, by reading Function file is taken, file stream, resolution file stream, read functions module is formed, and loaded and operation function module, realizes that module is moved State is loaded, the method and system provided by the present invention, being capable of flexibly loading command and object, the execution of free control command Sequentially, it is also beneficial to the extension of systemic-function.By presetting a memory cell, the function file of establishment is placed on specific bit Put, be easy to main program to read.The functional module is data, event or action, and by dynamic load, the effect presented differs Sample, realizes dynamic purpose.By presetting a display interface, available for display operation result.
Embodiments of the invention are the foregoing is only, are not intended to limit the scope of the invention, it is every to utilize this hair The equivalents that bright specification and accompanying drawing content are made, or the technical field of correlation is directly or indirectly used in, similarly include In the scope of patent protection of the present invention.

Claims (9)

1. a kind of method based on json data format module loadings, it is characterised in that comprise the following steps:
Step S100, the function file for creating json data formats, the function file include more than one orderly function mould Block, the functional module includes the first functional module;
Step S200, main program read the function file, form file stream;
File stream obtained by step S300, analyzing step S200, reads the first functional module, loads the first functional module;
The first functional module that step S400, operating procedure S300 are loaded;
Wherein,
The functional module loading procedure of the step S300 is:
Step S301, main program create a module object list, initialization presetting module position;
Step S302, main program read the json objects of json data file module positions, return to mould under the label of json objects Block title and the corresponding property value of module attribute, the property value of the module title is N, and the property value of the module attribute is A;
Step S303, main program N the and A creation module objects according to obtained by step S302;
Module object obtained by step S303 is added in list object by step S304, main program, and the list object length adds 1;
Step S305, main program judge whether the length of the module position is more than the length of list object, if the module The length of position is more than the length of list object, then returns to step S302, performs step S302 to step S304;If less than Or equal to the length of list object, then into step S306;
Step S306, main program load step S305 module position list object.
2. the method according to claim 1 based on json data format module loadings, it is characterised in that the step S100 also includes:A default memory cell, for storing the function file.
3. the method according to claim 1 based on json data format module loadings, it is characterised in that the function mould Block is data, event or action;The file stream is the binary code of function file.
4. the method according to claim 1 based on json data format module loadings, it is characterised in that the step S400 is specially:A default display interface, the functional module that operating procedure S300 is loaded, and it is shown in the display interface On.
5. the method according to claim 1 based on json data format module loadings, it is characterised in that method also includes Step S500, be specially:Judge whether that all functional modules have been run, if so, end step;If it is not, return to step S300.
6. a kind of system based on json data format module loadings, it is characterised in that including:Editing machine, the first reading unit, Resolver, the second reading unit, loading unit and performer;
The editing machine, the function file for creating json data formats, it is orderly that the function file includes more than one Functional module, the functional module includes the first functional module;
First reading unit, the function file is read for main program, forms file stream;
The resolver, for parsing the file stream;
Second reading unit, for reading the first functional module;
The loading unit, for loading the first functional module;
The performer, for running the first loaded functional module.
7. the system according to claim 6 based on json data format module loadings, it is characterised in that system also includes Memory cell, for store function file.
8. the system according to claim 6 based on json data format module loadings, it is characterised in that system also includes Display unit, for being shown in postrun functional module on the display unit.
9. the system according to claim 6 based on json data format module loadings, it is characterised in that system also includes Judging unit, for judging whether that all functional modules have been run.
CN201410851468.1A 2014-12-31 2014-12-31 A kind of method and system based on json data format module loadings Active CN104615458B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410851468.1A CN104615458B (en) 2014-12-31 2014-12-31 A kind of method and system based on json data format module loadings

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410851468.1A CN104615458B (en) 2014-12-31 2014-12-31 A kind of method and system based on json data format module loadings

Publications (2)

Publication Number Publication Date
CN104615458A CN104615458A (en) 2015-05-13
CN104615458B true CN104615458B (en) 2017-10-31

Family

ID=53149917

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410851468.1A Active CN104615458B (en) 2014-12-31 2014-12-31 A kind of method and system based on json data format module loadings

Country Status (1)

Country Link
CN (1) CN104615458B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108810045B (en) * 2017-04-28 2021-03-16 武汉斗鱼网络科技有限公司 Flash application updating method and system based on Json file
CN110442406B (en) * 2018-05-02 2022-08-12 北京京东乾石科技有限公司 Paging control data processing method, paging control and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102323887A (en) * 2011-06-30 2012-01-18 中兴通讯股份有限公司 Browser engine-based method for dynamically loading Widget and mobile terminal
CN102955694A (en) * 2011-08-31 2013-03-06 中国电信股份有限公司 Client implementation method based on WebKit browser and client

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8776078B2 (en) * 2008-05-20 2014-07-08 International Business Machines Corporation Method for dynamically freeing computer resources

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102323887A (en) * 2011-06-30 2012-01-18 中兴通讯股份有限公司 Browser engine-based method for dynamically loading Widget and mobile terminal
CN102955694A (en) * 2011-08-31 2013-03-06 中国电信股份有限公司 Client implementation method based on WebKit browser and client

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
电子课本学习地图生成工具设计与实现;齐贵超;《中国优秀硕士学位论文全文数据库社会科学Ⅱ辑》;20131215(第S2期);第37-38页,第41-43页,第46-48页,第52-55页 *

Also Published As

Publication number Publication date
CN104615458A (en) 2015-05-13

Similar Documents

Publication Publication Date Title
CN103064403B (en) A kind of ECU hardware-in-loop simulation automated testing method and system
CN102207887B (en) A kind of embedded OS Rapid transplant method and device thereof
CN101763447B (en) Automatic data conversion method between three-dimensional modeling software and finite element analysis software
CN101160579A (en) Apparatus and method for implementing flexible page layout
CN101894039A (en) Auxiliary generating method and system for embedded device driver
WO2009114999A1 (en) Document processing method, system and device
CN106326194A (en) Directory generation method and apparatus applied to file format conversion scene
CN107463126A (en) Unmanned plane double-core control system and digital independent and wiring method
CN102591787B (en) The data processing method of JAVA card and device
CN105550354A (en) Configuration file management method and system
CN105743736A (en) Automated testing method and system
CN104615458B (en) A kind of method and system based on json data format module loadings
CN103309849B (en) A kind of docx document creation based on OpenXML and amending method
EP1821221A1 (en) Document processing device and document processing method
CN106484412A (en) A kind of two-way binding implementation method of the front end data based on accessor abduction
CN104049947A (en) Dynamic Rename Based Register Reconfiguration Of A Vector Register File
CN110187886A (en) A kind of documentation website generation method and terminal
CN100520736C (en) Apparatus and method for managing stacks in virtual machine
Pohja COMPARISON OF COMMON XML-BASED WEB USER INTERFACE LANGUAGESCOMPARISON OF COMMON XML-BASED WEB USER INTERFACE LANGUAGES
CN103389893B (en) A kind of configuration register reading/writing method and device
CN103325360B (en) A kind of field type LCD display method
CN103530353B (en) Self-identification method of GPS user data format
CN103870439A (en) Uyghur Kazak and Kirghiz display method and application
CN105718434A (en) Natural language formula editing method and system
CN101067785B (en) Inserting platform-based resource management method and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant