Specific embodiment
Typically, a business can be based on different flows, different interfaces, different service parameters etc. come real
It is existing;And when the development task of the business is carried out, can appreciate that within following a period of time, the change that the business may occur
Change.Various may the change of the business can be concluded, the metadata for describing each alterable element be extracted, by developing
Personnel write out the exploitation output template for implementing for covering all spans of metadata.The business each is specifically opened
For hair project, the alterable element of business is determined, and in other words metadata has the value for determining in exploration project, by unit
The fixed Configuration Values of data are applied to the exploitation output template of the business, you can obtain exploration project exploitation output (including
Code or document), without manually generating exploitation output respectively for each exploration project of the business by developer.
Based on above-mentioned thinking, embodiments herein proposes the generation method of a kind of new exploitation code or document, can be with
New code or document is generated by changing the Configuration Values of metadata when business changes, it is manual without developer
Modification original code or document, reduce the workload of developer, and will not be because to different types of code or document
Modification omit or mismatch cause mistake to occur, so as to solve the problems, such as prior art.
It should be noted that in the prior art, metadata is also using in program code, by the difference to metadata
Assignment, carrys out the running or operation result of reprogramming.And in embodiments herein, program code is during exploitation is exported
One kind, to the exploitation output including program code, when the assignment of metadata is different in the embodiment of the present application, will generate different journeys
Sequence code.That is, being in the prior art constant program code, the metadata in program code is for determining operation
Metadata;And be that program code is determined by the value of metadata in itself in the embodiment of the present application, the value of different metadata is corresponding
In different program codes, such metadata is to determine the metadata of program code.Certainly, in the embodiment of the present application, as
The exploitation output for automatically generating, can also not limited in program code using being used for determining the metadata how program is run
It is fixed.
Embodiments herein may operate in any physically or logically equipment with calculating and store function, example
Such as, can be mobile device, panel computer, PC (Personal Computer, PC), notebook, server, virtual
Machine, computer cluster etc..
In embodiments herein, business can be a rounded system for providing the user certain aspect service, such as prop up
Pay platform, shopping platform etc.;Can also be a relatively independent part in certain integral framework, for completing the body
Part of functions or a kind of special services etc. in the system are provided in system, do not limited.These function or services etc., can
To be realized using different mechanism (such as different flow, different interfaces, different service parameters), every kind of realization will be produced
A kind of different exploitation output of life.These factors for causing exploitation output different reflect the alterable element of business.The application
Described exploration project in embodiment, refers to a kind of implementation of determination of business, that is to say, that when exploration project is started,
The alterable element of the affiliated business of the exploration project is determined.
Developer may be referred to the conditions such as the limitation of practical application scene, available technological means to enumerate one
Different factors in the various possible realization of individual business.According to development language, developing instrument, the needs of realizing that the business is used
Type of exploitation output of offer etc., it is the metadata with respective span that these different factors are refined, each first number
According to for describing a kind of alterable element of business, the combination of all metadata and its span can cover above-mentioned various
May realize.
For example, an a certain Branch Tasks for business can be realized using different flows, then can be using a job
Flow metadata to describe the variable flow, each value of the workflow metadata corresponds to a kind of alternative flow,
The span of the workflow metadata is all flows for realizing the Branch Tasks of the business support.In this example,
If certain formula can be used in realizing the flow of the Branch Tasks, and can be met not using different formula in the business
Same business demand, then can be expressed the formula with metadata, and its span is each the specific formula that possible use;
Similar, certain parameter in the formula is variable, and the parameter can be equally expressed with metadata.
By taking certain payment transaction of payment system as an example, can be including in following all kinds of metadata in the metadata of the business
One to multiple:
1), the metadata of API is described:For the payment transaction of calling interface is provided to other external systems, its exploitation
Generally include API and its correlation output in code or document, such as API in itself, API examples (Sample), API documents
(Documentation), for testing the API Mock etc. of API.The metadata for describing API is used for representing above-mentioned code or document
In alterable factor.For example, can be defined using metadata in the message header and message body of API request and response message
It is required that the data form for using;
2), the metadata of network configuration is described:Payment transaction generally needs to be completed by network service, network service
Ways of carrying out is related to the network configuration of application scenarios, therefore usually includes description network configuration in the metadata of payment transaction
Metadata;
3), the metadata of data storage is described:The transient data produced in payment transaction will generally be converted to persistant data,
To be stored in database for a long time.The metadata for describing data storage can be used to the data persistence for implementing difference
Store code is summarized as template, the templating of such as Hibernate (a kind of Object Relation Mapping framework of open source code) code;
4), the metadata of description data mapping:Be related to it is related to the function such as data log analyzing and processing, data mining
In payment transaction, it will usually need to carry out the conversion of data model, now can by describe data map metadata by
The Code Template of data model translation, such as templating ETL (Extract-Transform-Load extracts-conversion-and loads) generation
Code;
5), the metadata of UI is described:Payment transaction would generally be related to the information exchange with user, if the payment transaction
Realization includes the function related to user interface, UI controls, UI can be laid out, UI render etc. it is related to user interface can
Changing factor is described with metadata, so as to templating UI codes.It is for instance possible to use metadata will in the payment page to define
Ask user input field quantity and each field particular content (such as:Bank account, payment and password this 3 words
Section, or 2 fields of payment and password);
6), the metadata of workflow is described:If payment transaction includes that certain needs carries out a series of interaction with user
Handling process, and this series of interaction can be completed using different page flows, then can be abstract by every kind of page flow
It is a kind of specific workflow, and workflow is described using metadata such that it is able to the realization of templating page stream code.
7), the metadata of description rule:For describing the business rule in payment transaction, templating is related to business rule
Code or document realization.
It is determined that after all metadata of business, developer writes the exploitation output of the business using metadata
Template.Exploitation output template includes exploitation output realization (including code and text of the business in all spans of metadata
Shelves are realized), therefore after the value of metadata determines, exploitation of the exploitation output template generation corresponding to these values can be based on
Output.For example, span for workflow metadata is 3 values, each value corresponds to a kind of workflow, it is assumed that code or
Document includes the UI page stream codes determined by the workflow metadata, then develop in output template will be comprising can give birth to respectively
Into the realization of this corresponding page stream code of 3 kinds of workflows;For another example, a metadata is joined for describing one in judgment rule
Number, the span of the metadata is certain continuum, it is assumed that used the rule in certain API as exploitation output,
Then will be comprising such realization in exploitation output template:It is this yuan of number that the realization can use parameter value in the code of the API
According to the rule of value, and the API code can all run to any one value in metadata span.
That develops output template writes mode with the object phase described by the development language, developing instrument and metadata for using
Close.Specifically, what developer write in the prior art is code or document, and developer writes in the embodiment of the present application
Exploitation output template be code for producing code or document;Developer can generate code or text using any
The programming language or instrument of shelves, exploitation output template is write according to metadata, and embodiments herein is not limited.
In output template is developed, the basis that metadata is exported as the exploitation of generation business difference implementation, application
In the place being associated with business alterable factor.For example, metadata can apply the public affairs in exploitation output template as parameter
In formula or rule, can apply in Workflow decision points, can apply in Pageflow drivings, can also be in UI templates
In, the UI templates can be used to render UI controls and UI layouts;In other words, exploitation output template can include:It is with metadata
The formula of parameter, the rule with metadata as parameter, the Workflow workflows decision point based on metadata, based on metadata
Pageflow page flows drive, and/or the UI templates for rendering UI controls and UI layouts based on metadata.
In addition, code or document in the embodiment of the present application can include various in the prior art being write by developer
Code or document, do not limit.For example, it may be API, API Mock, API example, API documents, network configuration, data model
Transcode, data persistence store code, UI codes, and/or page stream code etc..
In actual development work, different types of exploitation output template, one species develop the different portions of output template
Dividing may all be write by different developers, and these developers often use identical unit in output template is developed
Data.All metadata of business can be defined in the form of service metadata model, mould is exported in different exploitations
Unified each metadata using in model in plate, consequently facilitating developer completes and clearly understands metadata definition, and
Accurately metadata is used in output template is developed such that it is able to one or more exploitations are generated using metadata defeated
Go out.Can be according to situations such as actual service feature, the selection of metadata in the way of service metadata model metadata, ginseng
Realized according to prior art, repeated no more.
After metadata definition, exploitation output template in finishing service are write, you can using exploitation output template come automatic
Generation exploitation output.
In embodiments herein, the flow of the generation method of exploitation code or document is as shown in Figure 1.
Step 110, obtains Configuration Values of the metadata in exploration project.Metadata is used for describing the affiliated industry of the exploration project
The alterable element of business.
As it was previously stated, one kind that the alterable element that exploration project is its affiliated business is determined is implemented.Also
It is to say, the metadata of the affiliated business of exploration project all has the Configuration Values for determining.
The concrete mode for obtaining the Configuration Values of metadata in exploration project is not limited, for example, developer can pass through
Specify the mode of metadata configurations value to create a new exploration project, the Configuration Values of the exploration project can be developed with receiving
The mode of personnel's input is obtained;Each yuan of number can also be read by certain predetermined network location (such as reservations database table)
Obtained according to the mode of Configuration Values.
Step 120, the Configuration Values of metadata are applied to the exploitation output template of the business, obtain the exploration project
Code or document.
The implementation of application metadata configurations value is relevant with the form of exploitation output template on exploitation output template, this
The embodiment of application is not limited.For example, to by multiple can the exploitation output template that constitutes of call subroutine, each subprogram can
With the code or document of the Configuration Values generating portion according to metadata, then Configuration Values that can successively with metadata are as parameter call
Corresponding subprogram, and the output of subprogram is combined as complete code or document.
In some exploration projects, the same different types of code of exploration project or document, one species code or document
Different piece may all be generated by different application programs, all these codes or document should correspond to identical unit number
According to Configuration Values.If the source that different application programs obtains metadata configurations value is different, may be because of the configuration of separate sources
Value is unable to Complete Synchronization and causes code or document to produce mistake.In order to avoid such case, can be by exploration project metadata
Configuration Values stored with single True Data (Single Truth) form centralization so that all of application program is all from single
Data source obtains metadata and similarly configures value, so as to avoid the inconsistent of various types of or each several part code or document.Especially
Be, by all metadata definitions of business for service metadata model application scenarios in, to metadata schema in first number
The centralization storage in the form of single True Data is postponed according to match somebody with somebody, an exploitation can be generated by disposable configuration
The code or document of project various species (or obtain institute after an exploration project is changed by disposable modification Configuration Values
Have the code or document of species), greatly simplify the work of developer.
When the implementation of business changes, if the implementation after change is in the business development output template
In the range of realization, then new code or document can be generated by changing metadata configurations value;Can otherwise be opened by modification
Hair output template come generate be matched with change after implementation code or document.Therefore, when business exploitation output template or
When the Configuration Values of metadata change in exploration project, step 110 and 120 can be re-executed, i.e.,:The unit that will be reacquired
Data configuration value is applied to the exploitation output template of the business, the code or document of the exploration project after being updated.Can be
Step 110 and 120 are re-executed after the change for detecting exploitation output template or metadata configurations value automatically, it is also possible to heavy manually
It is new to perform, do not limit.
It can be seen that, in embodiments herein, the various alterable elements of business are described using metadata, and it is defeated developing
Going out template includes that the code of all spans of metadata or document are realized, to the exploration project of the business, obtains metadata
Configuration Values and be applied to exploitation output template, you can automatically generate the code or document of the exploration project, without by
Developer writes the code or document of each exploration project of the business manually, significantly reduces the workload of developer, and
And avoid and manually omit and change inconsistent, reduce wrong generation.
Embodiments herein is highly suitable for changing the exploitation of rapid business, code and is reached the standard grade if desired for quickly generating
Marketing activity of operation etc..
In an application example of the application, the exploitation code or document of a kind of payment transaction include API, API
Mock, API example, API documents, data model translation code, data persistence store code, UI codes and page stream code 8
Individual species.Developer summarizes the various possible different implementations of the payment transaction, returns from these different implementations
The metadata of the payment transaction received out describes the various alterable factors of the payment transaction.Using first number of the payment transaction
According to developer has write the exploitation output template corresponding to every kind of code or document, and each exploitation output template includes this
The realization of all correspondence codes or document species of the payment transaction in metadata span.
Based on the code or document to be generated, developer has write 6 different types of codes or document generator, point
It is not API/API Mock makers, API examples/document generator, data model translation maker, data persistence storage life
Grow up to be a useful person, UI makers and page flow maker, each maker with the Configuration Values of the payment transaction metadata be input, by unit
The Configuration Values of data are applied to one or two exploitation output templates of correspondence species, one or two generations of output correspondence species
Code or document.
When an exploration project of the payment transaction is created, developer specifies matching somebody with somebody for each metadata of payment transaction
Value is put, and predetermined network site is centrally stored in the form of single True Data.Above-mentioned 6 makers are predetermined from this respectively
Network site read the metadata configurations value of the exploration project, the code or document of output correspondence species, as shown in Figure 2.
Corresponding with the realization of above-mentioned flow, embodiments herein additionally provides the generation dress of a kind of exploitation code or document
Put.The device can be realized by software, it is also possible to be realized by way of hardware or software and hardware combining.It is implemented in software to be
Example, is by the CPU (Central Process Unit, central processing unit) of place equipment as the device on logical meaning
Run what is formed during corresponding computer program instructions are read into internal memory.From for hardware view, except the CPU shown in Fig. 3,
Outside internal memory and nonvolatile memory, equipment where the generating means of exploitation code or document generally also include being used for into
The chip etc. of row wireless signal transmitting-receiving other hardware, and/or for realizing the board etc. of network communicating function other hardware.
Fig. 4 show a kind of exploitation code of the embodiment of the present application offer or the generating means of document, including Configuration Values are obtained
Unit and code document generation unit are taken, wherein:Configuration Values acquiring unit is used to obtain configuration of the metadata in exploration project
Value;The metadata is used for describing the alterable element of the affiliated business of the exploration project;Code document generation unit is used for will
The Configuration Values of metadata are applied to the exploitation output template of the business, obtain the code or document of the exploration project;It is described
Exploitation output template includes that the business is realized in the code or document of all spans of metadata.
Optionally, the metadata include it is following at least one:Describe the metadata of application programming interface API, retouch
State the metadata of network configuration, the metadata of description data mapping, the metadata of description data storage, description user interface UI
Metadata, the metadata of description rule of metadata, description workflow.
Optionally, the exploitation output template of the business include it is following at least one:Formula with metadata as parameter,
Rule with metadata as parameter, the Workflow workflows decision point based on metadata, Pageflow pages based on metadata
Surface current drives, the UI templates for rendering UI controls and UI layouts based on metadata.
Optionally, the Configuration Values of metadata are stored with single True Data form centralization in the exploration project.
Optionally, the metadata is with the formal definition of service metadata model, the unit in the service metadata model
Data are used to generate one or more codes or document.
Optionally, the code or document include following at least one:API, API Mock simulations, API examples, API text
Shelves, network configuration, data model translation code, data persistence store code, UI codes, page stream code.
Optionally, described device also includes:Code document updating block, for the exploitation output template when the business or
When the Configuration Values of metadata change in the exploration project, the Configuration Values of the metadata of reacquisition are applied to the industry
The exploitation output template of business, the code or document of the exploration project after being updated.
The preferred embodiment of the application is the foregoing is only, is not used to limit the application, all essences in the application
Within god and principle, any modification, equivalent substitution and improvements done etc. should be included within the scope of the application protection.
In a typical configuration, computing device includes one or more processors (CPU), input/output interface, net
Network interface and internal memory.
Internal memory potentially includes the volatile memory in computer-readable medium, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash RAM).Internal memory is computer-readable medium
Example.
Computer-readable medium includes that permanent and non-permanent, removable and non-removable media can be by any method
Or technology realizes information Store.Information can be computer-readable instruction, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only storage (ROM), electric erasable
Programmable read only memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM),
Digital versatile disc (DVD) or other optical storages, magnetic cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus
Or any other non-transmission medium, can be used to store the information that can be accessed by a computing device.Defined according to herein, calculated
Machine computer-readable recording medium does not include temporary computer readable media (transitory media), such as data-signal and carrier wave of modulation.
Also, it should be noted that term " including ", "comprising" or its any other variant be intended to nonexcludability
Comprising so that process, method, commodity or equipment including a series of key elements not only include those key elements, but also wrapping
Include other key elements being not expressly set out, or also include for this process, method, commodity or equipment is intrinsic wants
Element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that wanted including described
Also there is other identical element in process, method, commodity or the equipment of element.
It will be understood by those skilled in the art that embodiments herein can be provided as method, system or computer program product.
Therefore, the application can be using the embodiment in terms of complete hardware embodiment, complete software embodiment or combination software and hardware
Form.And, the application can be used to be can use in one or more computers for wherein including computer usable program code and deposited
The shape of the computer program product implemented on storage media (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)
Formula.