Embodiment
Generally, the various functions realized according to needed for operation system are realized code and disposed, it is necessary to develop corresponding function
Onto the operation system.For example, for a kind of internet financial platform, its function (or business) of needing to realize may include:Meeting
Member, account, assets etc. are, it is necessary to which exploitation corresponding function realizes code respectively.Currently, sent out with the business of all kinds of operation systems
Exhibition, can produce one or more subservice systems (hereinafter referred to as " subsystem ") that there is homogeneous business demand, so-called " same
Matter " refers to that these subservice systems have some general character in some business or possess approximate implementation process.For example, for
A kind of internet financial platform, such as business development, business can be distributed in multiple domains (such as:Main website, the world, net business etc.),
Wherein each " domain " corresponds to a subsystem.In the related art, for the business of a certain homogeneity in operation system, one
As need each subsystem under respectively operation system dispose it is a set of realize code accordingly, for example:If internet finance is flat
The service distribution of platform is in multiple domains such as main website, the world, net business, then for " member " this business, it is necessary to respectively in main website, state
Border, the multiple domains deployment of net business etc. a set of " member " business for being used to realize each domain realize code.It can be seen that, with subsystem number
The increase of amount, developer needs each subsystem development being directed under same operation system and many set codes of deployment, and this is in certain journey
The rising of code development cost is caused on degree, also, the later stage needs to safeguard many set codes, causes the time-consuming consumption of code maintenance process
Power.To solve the above problems, proposing the following scheme of the embodiment of the present application.
Fig. 1 is a kind of flow chart for code dispositions method that the exemplary embodiment of the application one is provided, shown in ginseng Fig. 1, this
In embodiment, the code dispositions method can apply in the electronic equipment for being deployed to code on subsystems that (this sets
It is standby that corresponding code deployment tool can be installed) on, the code dispositions method comprises the steps 101~104, wherein:
In a step 101, the corresponding environmental labelses of target sub system under operation system are obtained.
Wherein, an environmental labelses are defined respectively for each subsystem under operation system in advance, the environmental labelses exist
It is unique in the operation system, and for identifying each subsystem.For example, for a certain internet financial platform, if bag
Enclosed tool system a, b, the then environmental labelses that can define subsystem a are " XXX ", and the environmental labelses for defining subsystem b are " YYY ".
In the embodiment of the present application, above-mentioned " target sub system " is the subsystem for needing to dispose code.
, it is necessary to develop one according to default code skeleton for operation system before code is deployed into target sub system
Source code file is covered, wherein, the source code file is disposed needed for can including the subsystems under the operation system
Code file.The code skeleton used on source code file, will be introduced in greater detail below.
In the embodiment of the application one, the step 101 can be realized especially by following processes:
When code is packed, the corresponding environmental labelses of target sub system are read from mark incoming command.
For example, developer can by software configuration management (Software Configuration Management,
SCM) instrument is (such as:Maven packing order) is initiated, such as:mvn package.Wherein, can be incoming by identifying in packing
Order, the corresponding environmental labelses app of subsystem of incoming required deployment, identifying incoming command is, for example,:Mvn-Dapp=xxx.
Certainly, in feasible other embodiment, the environmental labelses can also be carried in code packing order.
In a step 102, based on configuration file, it is determined that code module corresponding with the environmental labelses.
In the embodiment of the present application, for subsystems under operation system, the main body of otherness of code
Now:
1st, the file bag that each subsystem is relied on is (such as:Jar bags etc.) have differences.For example:Different sub-systems are not dependent on
With the jar bags of version.
2nd, the interface of required realization and realize that the model employed in interface procedure has differences.For example:Different sub-systems
" member's interface " member ID for returning it is inconsistent, the member ID that " net business subsystem " is returned is:IpRoleId, " international subsystem
System " return member ID be:userId.
Although there is above-mentioned difference in subsystems, due to there is the business demand of homogeneity, respectively in code realization
The overall business realizing flow of individual subsystem is similar or basically identical.
In view of the overall business realizing flow of subsystems is basically identical, in the embodiment of the present application, developer develops
It is a set of can by the public code skeleton of multiple subsystems, developer can be write according to this code skeleton source code text
Part.As shown in Fig. 2 the code skeleton is according to realizing that function can be divided into multiple functional layers, each functional layer can also include
One or more assemblies (component), wherein, each component can represent a code module.For example, functional layer can
Including:Test layers, core layers, service layers etc..Wherein, there may be certain dependence (arrow in figure between each component
Head represents the relation for relying on and being relied on).In the embodiment of the present application, the code skeleton can be java code skeletons etc..
In the embodiment of the application one, the code skeleton may include adapter layers 10 and one or more integration
Layer, each subsystem correspond to one integration layer, with by the code file in the integration layers come reality
The existing business of corresponding subsystem.In the exemplary embodiment, it is assumed that subsystem a, b are included under certain operation system, then subsystem a
Integration layers 21 are may correspond to, subsystem b may correspond to integration layers 22., can be by generation herein for ease of description
Remaining functional layer in code framework in addition to adapter layers and integration layers is defined as " public functional layers ", in addition, will
The code file for being present in integration layers is defined as " integration layer identification codes file ", will be present in adapter layers
Code file be defined as " adapter layer identification codes file ", the code file that will be present in public functional layers is defined as " public work(
Ergosphere code file ".
In the embodiment of the present application, the adapter layer identification codes file is used to define the object that the target sub system is used,
The integration layer identification codes file is used to realize the object according to the service logic of the target sub system.It is described right
As including:What is included in interface interface, and/or model, and/or interface interface enters ginseng and goes out ginseng.Wherein, it is described
Model refer into ginseng and go out ginseng used in object, for example:Interface is:" custview ", its it is corresponding enter ginseng be:
" VcAuthoritySceneRequest.java ", going out ginseng is:" VcAuthorityRuleCheckResult.java ", then should
Model may include used in interface:" VcAuthorityRuleCheckView.java ",
" AuthorityRuleCheckClient.java ", etc..
For example:
In adapter layer identification codes file (such as pom.xml files), it can be subsystem a defining interface interface1, be
Subsystem b defining interface interface2, wherein:The code format of defining interface is, for example,:
[modifier] interface interfaces name [extends father's interface list of file names]
[public] [static] [final] constant;
[public] [abstract] method;
}
After adapter layers define above-mentioned interface, code text can be passed through in the corresponding integration layers 21 of subsystem a
Part realizes above-mentioned interface interface1;It can be realized in the corresponding integration layers 22 of subsystem b by code file
State interface interface2.For example, realizing that interface can use keyword implements in class, its basic format is as follows:
[modifier] class<Class name>[extends parents name] [implements interface lists] {
}
In the embodiment of the present application, the object of the adapter layer identification codes document definition can be general for subsystems
Object (such as interface interface, and/or model, and/or parameter).So as to which general object is supplied into the generation
Other each functional layers in code framework are called.For example, the member ID that " the member's interface " of different sub-systems is returned is inconsistent,
The member ID that " net business subsystem " is returned is:IpRoleId, the member ID that " international subsystem " is returned are:customerId.
Adapter layers, the unified member ID of definable is userId.
At adapter layers, if different sub-systems define the universal model that general-purpose interface and general-purpose interface are used, each
Individual subsystem is corresponding integration layers, can realize logic using subsystem is exclusive and realizes above-mentioned general-purpose interface
Function.So, other code modules in code skeleton only need to perceive or call userId, and this is to a certain extent
Can be with simplified code.
In the embodiment of the present application, the dependence of different sub-systems can be defined beforehand through configuration file (such as pom.xml)
File bag and code module, the dependent file bag is to build the code module.Code content in the configuration file
For example,:
Assuming that subsystem a environmental labelses are " ifcvoucherfront ", system b environmental labelses are
" fcvoucherfront ", then, the configuration file content based on above example can be seen that:
When environmental labelses app is:When " ifcvoucherfront ", can by "<dependency>" and "</
dependency>" between code content determine catalogue, title, version number of dependent file bag that subsystem a is needed to use etc.
Information, can by "<modules>" and "</modules>" between code content determine subsystem a need utilize above-mentioned dependence
The code module that file bag is built, such as:app/common/service/adaptor/pom-ap.xml、app/common/
service/integration/ap.When environmental labelses app is:When " fcvoucherfront ", can by "<dependency
>" and "</dependency>" between code content determine the catalogue of the dependent file bag that subsystem b is needed to use, title,
The information such as version number, can by "<modules>" and "</modules>" between code content determine subsystem b need utilization
The code module that above-mentioned dependent file bag is built, such as:app/common/service/adaptor/pom-bk.xml、app/
common/service/integration/bk。
In step 103, from the corresponding source code file of the operation system, the code mould with determining is extracted
The corresponding object code file of block.
In the embodiment of the application one, the step 103 can be specifically included:
Step 1031:From source code file, extract corresponding with environmental labelses adapter layer identification codes file and
Public functional layers code file.
Above-mentioned example is held, when environmental labelses app is:, it is necessary to the adapter layer generations extracted when " ifcvoucherfront "
Code file be:Adaptor/pom-ap.xml (can subsystem a is used defined in pom-ap.xml each object);Work as environment
Identifying app is:, it is necessary to which the adapter layer identification code files extracted are when " fcvoucherfront ":adaptor/pom-bk.xml
(can subsystem b is used defined in pom-bk.xml each object).
Step 1032:From source code file, integration layer identification codes text corresponding with the environmental labelses is extracted
Part.
Above-mentioned example is held, when environmental labelses app is:, it is necessary to the adapter layer generations extracted when " ifcvoucherfront "
Code file be:It is present in the code file under adapter layers 21;When environmental labelses app is:When " fcvoucherfront ", need
The adapter layer identification code files to be extracted are:It is present in the code file under adapter layers 22.
Step 1033:By the adapter layer identification codes file of extraction, public functional layers code file and integration layers
Code file is packaged into object code file.
At step 104, the object code file is installed to the target sub system.
In the embodiment of the present application, for different subsystems, when disposing code, according to the difference of business realizing,
Some code modules matched with own service are correspondingly extracted from source code file and carry out code deployment.From described
In the corresponding source code file of operation system, extract after object code text corresponding with the code module determined, by institute
State object code file to be installed to before the target sub system, methods described can also include:
Test case corresponding with the environmental labelses is obtained, and using the test case to the object code file
Tested.
Can be respectively that each subsystem writes test case in view of the otherness of each subsystem, and by test case
It is marked by environmental labelses, so that in test process, it is only necessary to which input environment mark just can get corresponding automatically
Test case and complete test, testing efficiency is higher, test case is searched without artificial, while being easy to management of test cases.
Fig. 3 is a kind of scene graph for code dispositions method that the exemplary embodiment of the application one is provided, as shown in figure 3, opening
Originator is write out source code file and uploaded by the business difference of above-mentioned general code skeleton and combination subsystems
Into code library.When needing code being deployed to subsystems under operation system, incoming in packing deployment can be needed
The environmental labelses app of the subsystem of code so that code deployment facility is extracted and environmental labelses app from above-mentioned code library
The object code file matched, and be deployed on the subscriber device (server) specified.
In the embodiment of the present application, include one or more subsystems (such as in operation system:Subsystem a, b) in the case of,
Dispose code during, the embodiment of the present application by obtain code to be disposed target sub system environmental labelses (such as:
Ifcvoucherfront), and based on configuration file pom.xml, the corresponding code module of the environmental labelses is determined;Then, from
In the corresponding source code file of the operation system, object code file corresponding with the code module of determination is extracted;
Finally, the object code file is installed in the target sub system.It can be seen that, the embodiment of the present application is directed to same business
System, develops corresponding with the operation system a set of source code file, in deployment code, according to environmental labelses from above-mentioned original
Beginning code file extracts the object code file of deployment required for each subsystem, to complete deployment.The embodiment of the present application is used
The general code skeleton a set of source code file of exploitation (as shown in Figure 2), you can realization disposes generation respectively in multiple subsystems
The purpose of code, reduces code development cost.Simultaneously in follow-up maintenance code, it is only necessary to safeguard a set of source code file, and
Without safeguarding a set of code file respectively for each subsystem, the follow-up maintenance efficiency of code is greatly promoted.In addition, working as industry
When business system constantly derives new subsystem, it is only necessary in above-mentioned code skeleton, increase corresponding integration layers of generation
Code file, you can realize the code deployment of newly-increased subsystem, enhance the expanded compatibility of operation system.
Fig. 4 is the structural representation for a kind of electronic equipment that the exemplary embodiment of the application one is provided.The electronic equipment can
With code deployment facility (equipment for being such as provided with code management tools), Fig. 4 is refer to, in hardware view, the electronic equipment bag
Processor, internal bus, network interface, internal memory and nonvolatile memory are included, is also possible that certainly needed for other business
The hardware wanted.Processor reads corresponding computer program into internal memory and then run from nonvolatile memory, in logic
Formed in aspect and dispose device for code.Certainly, in addition to software realization mode, the application is not precluded from other realization sides
Mode of formula, such as logical device or software and hardware combining etc., that is to say, that the executive agent of following handling process is not limited
Due to each logic unit or hardware or logical device.
Fig. 5 is refer to, in the embodiment of the application one, a kind of code disposes device, including:
Obtaining unit 201, for obtaining the corresponding environmental labelses of target sub system under operation system;
Determining unit 202, for based on configuration file, it is determined that code module corresponding with the environmental labelses;
Extracting unit 203, for from the corresponding source code file of the operation system, extracting the generation with determining
The corresponding object code file of code module;
Installation unit 204, for the object code file to be installed into the target sub system.
In the embodiment of the application one, the code module includes adapter layer identification codes file and integration layer identification codes
File, the adapter layer identification codes file is used to define the object that the target sub system is used, described integration layers
Code file is used to realize the object according to the service logic of the target sub system.
In the embodiment of the application one, the object of the adapter layer identification codes document definition is general pair of subsystems
As.
In the embodiment of the application one, the object is joined and gone out including entering for being included in interface, and/or model, and/or interface
Ginseng.
In the embodiment of the application one, the determining unit 202 specifically for:
Based on configuration file, it is determined that dependent file bag corresponding with the environmental labelses and code module, the dependence text
Part bag is to build the code module.
In the embodiment of the application one, the extracting unit 203 can be specifically included:
First extracts subelement, for from source code file, extracting adapter layers corresponding with the environmental labelses
Code file and public functional layers code file;The source code file includes the subsystems under the operation system
Code file;
Second extracts subelement, for from source code file, extracting corresponding with the environmental labelses
Integration layer identification code files;
Packaged unit, for by the adapter layer identification codes file of extraction, public functional layers code file and
Integration layer identification code files are packaged into object code file.
In the embodiment of the application one, the obtaining unit 201 can be specifically for:
When code is packed, the corresponding environmental labelses of target sub system are read from mark incoming command.
In the embodiment of the application one, described device can also include:
Test cell, for obtaining test case corresponding with the environmental labelses, and using the test case to institute
Object code file is stated to be tested.
It should be noted that, said apparatus embodiment and above method embodiment, can be each other on the premise of not disagreing
Supplement.
System, device, module or unit that above-described embodiment is illustrated, can specifically be realized by computer chip or entity,
Or realized by the product with certain function.A kind of typically to realize that equipment is computer, the concrete form of computer can
To be personal computer, laptop computer, cell phone, camera phone, smart phone, personal digital assistant, media play
In device, navigation equipment, E-mail receiver/send equipment, game console, tablet PC, wearable device or these equipment
The combination of any several equipment.
For convenience of description, it is divided into various units during description apparatus above with function to describe respectively.Certainly, this is being implemented
The function of each unit can be realized in same or multiple softwares and/or hardware during application.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or computer program
Product.Therefore, the present invention can be using the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware
Apply the form of example.Moreover, the present invention can be used in one or more computers for wherein including computer usable program code
The computer program production that usable storage medium is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.)
The form of product.
The present invention is the flow with reference to method according to embodiments of the present invention, equipment (system) and computer program product
Figure and/or block diagram are described.It should be understood that can be by every first-class in computer program instructions implementation process figure and/or block diagram
Journey and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.These computer programs can be provided
The processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce
A raw machine so that produced by the instruction of computer or the computing device of other programmable data processing devices for real
The device for the function of being specified in present one flow of flow chart or one square frame of multiple flows and/or block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which is produced, to be included referring to
Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or
The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that in meter
Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, thus in computer or
The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one
The step of function of being specified in individual square frame or multiple square frames.
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 permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize 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), moved
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, the information that can be accessed by a computing device available for storage.Define, calculate according to herein
Machine computer-readable recording medium does not include temporary computer readable media (transitory media), such as data-signal and carrier wave of modulation.
It should also be noted that, term " comprising ", "comprising" or its any other variant are intended to nonexcludability
Comprising so that process, method, commodity or equipment including a series of key elements are not only including those key elements, but also wrap
Include other key elements being not expressly set out, or also include for this process, method, commodity or equipment intrinsic want
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.Deposited moreover, the application can use to can use in one or more computers for wherein including computer usable program code
The shape for the computer program product that storage media is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.)
Formula.
The application can be described in the general context of computer executable instructions, such as program
Module.Usually, program module includes performing particular task or realizes routine, program, object, the group of particular abstract data type
Part, data structure etc..The application can also be put into practice in a distributed computing environment, in these DCEs, by
Remote processing devices connected by communication network perform task.In a distributed computing environment, program module can be with
Positioned at including in the local and remote computer-readable storage medium including storage device.
Each embodiment in this specification is described by the way of progressive, identical similar portion between each embodiment
Divide mutually referring to what each embodiment was stressed is the difference with other embodiment.It is real especially for system
Apply for example, because it is substantially similar to embodiment of the method, so description is fairly simple, related part is referring to embodiment of the method
Part explanation.
Embodiments herein is the foregoing is only, the application is not limited to.For those skilled in the art
For, the application can have various modifications and variations.It is all any modifications made within spirit herein and principle, equivalent
Replace, improve etc., it should be included within the scope of claims hereof.