CN105808261A - Event driving-based component method - Google Patents
Event driving-based component method Download PDFInfo
- Publication number
- CN105808261A CN105808261A CN201610139411.8A CN201610139411A CN105808261A CN 105808261 A CN105808261 A CN 105808261A CN 201610139411 A CN201610139411 A CN 201610139411A CN 105808261 A CN105808261 A CN 105808261A
- Authority
- CN
- China
- Prior art keywords
- business
- plug
- unit
- core
- event
- 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
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/36—Software reuse
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The invention provides an event driving-based component method. The method comprises the following steps: abstracting a core service logic and core service data in a service model of software; abstracting an event interface corresponding to the core service logic; taking the services except the core service data in the service model as a component, wherein the component consists of a group of service plugins and the plugins represent realization bodies of events of one or more core services; defining incidence relation between the service plugins and the core service logic in a component description file, wherein the incidence relation between the service plugins and the core service logic is collected through a plugin bundle; finding a corresponding service plug by the core service logic according to the incidence relation. The event driving-based component method has the benefits that the unobtrusive loose coupling-type development of original systems can be realized, and the developers can complete the expansion of a core service through knowing the event interface without caring for the details of a core code, so that the development efficiency and reusability are high.
Description
Technical field
The present invention relates to the technical field of computer software exploitation, refer more particularly to a kind of based on event driven assembly method.
Background technology
Traditional intermodule method directly invokes formula exploitation, in software field, if traditional software development approach, in existing module, if increasing New function, then need directly to change the code of corresponding module, cause the destruction that existing capability is direct, cause that original function is unstable.It addition, in traditional software development methodology, if the logic of newly-increased function needs to reuse in other module, then the mode only by copy code or method call is reused, it is desired nonetheless to change original code.
Summary of the invention
The invention aims to overcome the deficiencies in the prior art, it is provided that a kind of based on event driven assembly method.
The present invention is achieved through the following technical solutions:
The invention provides a kind of based on event driven assembly method, should include based on event driven assembly method: in the business module of software, take out core business logic and core business data;
Take out the event interface that described core business logic is corresponding;
Being assembly by the business that removes outside core business data in described business module, described assembly is made up of one group of business plug-in unit, described plug-in unit be the event of one or more core business realize body;
Describe the incidence relation defined in file between different business plug-in unit and core business logic at assembly, associating between described business plug-in unit and described core business logic is collected by plug-in unit stake;
Described core business logic finds the business plug-in unit of correspondence according to the described collected association of plug-in unit stake.
Preferably, the business removed in described business module outside core business data is divided into different business plug-in units according to the condition set, different business plug-in units form one group of business plug-in unit group particularly as follows:
Search all of assembly and describe file, and parse the incidence relation between business plug-in unit and core business logic;
Relation between business plug-in unit and core business logic be recorded in internal memory by component view;
Whether detection business plug-in unit installation situation, have this business plug-in unit in detection data, if not having record in component view, then record in the data, and this business plug-in unit be marked as do not install, not actuated, if data have existed described business plug-in unit, then display have been started up.
Preferably, described core business logic according to the described collected association of plug-in unit stake find correspondence business plug-in unit particularly as follows:
At software in running software, call event interface when core business logic is invoked simultaneously, transmit core business data to interface simultaneously, this process is referred to as event activated, when event swashs, in plug-in unit stake, have collected corresponding business plug-in unit set, so in plug-in unit stake business of calling plug-in unit one by one, transmission core data, such business plug-in unit is performed.
The invention has the beneficial effects as follows: by the method for said modules, can realize original system without intrusive mood, loose coupling formula exploitation, developer is without relation core code details, and only it is to be understood that event interface just can complete the extension to core business, development efficiency is high, reusability is high.
Accompanying drawing explanation
Fig. 1 be the embodiment of the present invention provide based on the graph of a relation between event driven assembly method core business and assembly;
Fig. 2 is the schematic diagram in process of the business plug-in unit man in the present invention;
Fig. 3 be the business plug-in unit in the present invention call schematic diagram;
Fig. 4 be the embodiment of the present invention provide based on event driven assembly method flow chart.
Detailed description of the invention
In order to make the purpose of the present invention, technical scheme and advantage clearly understand, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein is only in order to explain the present invention, is not intended to limit the present invention.
Embodiments provide a kind of based on event driven assembly method, should include based on event driven assembly method: in the business module of software, take out core business logic and core business data;
Take out the event interface that described core business logic is corresponding;
Being assembly by the business that removes outside core business data in described business module, described assembly is made up of one group of business plug-in unit, described plug-in unit be the event of one or more core business realize body;
Describe the incidence relation defined in file between different business plug-in unit and core business logic at assembly, associating between described business plug-in unit and described core business logic is collected by plug-in unit stake;
Described core business logic finds the business plug-in unit of correspondence according to the described collected association of plug-in unit stake.
Therein, the business removed in described business module outside core business data is divided into different business plug-in units according to the condition set, different business plug-in units form one group of business plug-in unit group particularly as follows:
Search all of assembly and describe file, and parse the incidence relation between business plug-in unit and core business logic;
Relation between business plug-in unit and core business logic be recorded in internal memory by component view;
Whether detection business plug-in unit installation situation, have this business plug-in unit in detection data, if not having record in component view, then record in the data, and this business plug-in unit be marked as do not install, not actuated, if data have existed described business plug-in unit, then display have been started up.
Additionally, described core business logic according to the described collected association of plug-in unit stake find correspondence business plug-in unit particularly as follows:
At software in running software, call event interface when core business logic is invoked simultaneously, transmit core business data to interface simultaneously, this process is referred to as event activated, when event swashs, in plug-in unit stake, have collected corresponding business plug-in unit set, so in plug-in unit stake business of calling plug-in unit one by one, transmission core data, such business plug-in unit is performed.
In the above-described embodiments, by the method for said modules, it is possible to achieve to original system without intrusive mood, loose coupling formula exploitation, developer is without relation core code details, only it is to be understood that event interface just can complete the extension to core business, development efficiency is high, reusability is high.
In order to conveniently understand the method that the present embodiment provides, it is described in detail below in conjunction with specific embodiment.
First, related notion is taken out as and defines
The business module of software is taken out as going out core business logic (CoreService) and core business data (CoreDataModel), take out as going out the corresponding event interface of core business logic (EventInterface) simultaneously.
Business outside core business is referred to as assembly (Component), assembly is made up of one group of business plug-in unit (Plugin), these plug-in units be the event of one or more core business realize body, the association of core business and event, being collected by plug-in unit stake (PluginBundle), concrete incidence relation is definition in a Component.xml by name (assembly describes file).Wherein the relation between core business and assembly is as shown in Figure 1.
The exploitation of assembly
When needing to insert new logic in core business logic, needs define corresponding plug-in unit, plug-in unit is made to realize corresponding business event interface, plug-in unit realizes concrete business logic codes, the core business data of its needs can be passed over as parameter by event interface, and such plug-in unit just can without the operation core business data of invasive.
The loading of assembly and startup
First assembly has following state: installment state and starting state, has respectively installed and has not installed, has had been turned on not actuated.
Upon power-up of the system, the assembly load-on module all of Component.xml of lookup, and parse the incidence relation of plug-in unit and core business, and this relation is recorded in internal memory by component view (ComponentView).
In loading procedure, whether detection data have the record of this assembly, without then record in the data, now the state of assembly be marked as do not install, not actuated.If data base exists, detect its state, if having been turned on state, then this assembly is started, and be labeled as the state of having been turned on.Its loading procedure as in figure 2 it is shown,
The list of component exhibiting in the control station of system, and operation button is provided, it is possible to perform following operation: installation/unloading, activation/deactivation.
In sum, assembly is activated possibly through two kinds of approach: during system loads or manually boot in the console.After assembly is activated, according to the relation of record in component view, plug-in unit and plug-in unit stake being carried out relation binding, by plug-in unit dynamic insertion to plug-in unit stake, namely finishing service logic is dynamically, be inserted in core business logic without intrusive mood.
Plug-in unit calling logic illustrates, whole calls plug-in unit process as shown in Figure 3.
In running software, calling event interface when core business logic is invoked simultaneously, transmit core business data to interface simultaneously, this process is referred to as event activated.
When event swashs, in plug-in unit stake, have collected corresponding plug-in unit set (the realizing body of event), so in plug-in unit stake one by one call plug-in unit, transmit core data, such plug-in unit is performed.
By the technical scheme of said modules, it is possible to achieve to original system without intrusive mood, loose coupling formula exploitation, developer is without relation core code details, and only it is to be understood that event interface just can complete the extension to core business, development efficiency is high, reusability is high.
Effect is illustrated: for e-commerce system, an electric business business creates the service logic that order is core, after order creation success, it is likely to need to send a SMS to client, based on this kind of packaging scheme, developer needs to develop a short message sending assembly based on certain telecommunications gateway.Developer need not understand the specific code of order creation, only need to be concerned about how to dock with telecommunications gateway, the core datas such as sequence information, client's cell-phone number can be passed to plug-in unit by the establishment event of order by component mechanism, above-mentioned data taken by plug-in unit, according to the concrete telecommunications gateway parameter accessed, core data (sequence information, client's cell-phone number) is organized word, passes to telecommunications gateway and just complete the function being sent order note by this Short Message Service Gateway.
Once business changes, such as to change other Short Message Service Gateway and send note, now develop another note assembly further according to concrete gateway parameter, the note assembly before then disabling, install new assembly, whole flow process is as shown in Figure 4.
Can be seen that, from functional development, change to the later stage is safeguarded, the core business code of order creation is never exposed to Components Development personnel, and they, also without going to change core code, maintain the stability of original system, reduce the difficulty of New function exploitation, and the system based on same rule can install this note assembly, directly uses, greatly reduces development cost.
Embodiment one: order Service Component and order note assembly
Below with the core logic in e-commerce system: " order creation ", for " order note assembly ", concrete technology implementation is described.
This patent formula is never confined in ecommerce or order logic, this patent scheme is suitable in various software systems and each business scope, such as all can adopting this art solutions in CMS system, OA system, ERP system, the technical program is without the limitation of industry field.
The present embodiment illustrates scheme for Java development language, but never only limits this development language to realize, and other development language all can realize this technical scheme, and such as C#/.Net, Php, Ruby, C++ etc., the technical program is without development language limitation.
1. order core business (OrderService)
Being responsible for the establishment of order, this belongs to the core of electricity business business, creates order by createOrder () method.
2. order plug-in unit stake (OrderPluginBundle)
Its pluginList attribute stores the plug-in unit of all response order business event.
3. order creation event interface (OrderCreateEvent)
Order after order creation success, can excite this event, and actual what call is the plug-in unit in above-mentioned pluginList.
The composition of assembly
Order note assembly is by herein below:
Order note assembly (OrderSmsComponent)
Order component, can call its install method when assembly is mounted, completes some and installs necessary operation.
Order note plug-in unit
This type of achieves order creation event, has responded order and has completed event (onOrderCreate) method, when order creation completes, can call the method.
The description file Component.xml of assembly
This describes document definition order plug-in unit (OrderSmsPlugin) and to be injected in order plug-in unit stake, namely define plug-in unit will corresponding to core business
Event activated and plug-in unit call
Concrete technology implementation details is as follows:
Here circulate all of order creation event and call it (activating event interface), these events are really that be injected into into, concrete plug-in unit and realize body, such as order note plug-in unit, now order note plug-in unit is by dynamic call, completes to send the logic of note in this plug-in unit.
Embodiment two: red wine commodity chateau attribute component
Save as example with commodity data in E-business Software field below, introduce the chateau attribute component of red alcoholic commercial articles so that concrete technology implementation to be described.
This patent formula is never confined in ecommerce or order logic, this patent scheme is suitable in various software systems and each business scope, such as all can adopting this art solutions in CMS system, OA system, ERP system, the technical program is without the limitation of industry field.
The present embodiment illustrates scheme for Java development language, but never only limits this development language to realize, and other development language all can realize this technical scheme, and such as C#/.Net, Php, Ruby, C++ etc., the technical program is without development language limitation.
In general electric business business, commodity are mainly made up of detailed description and photograph album, the essential information such as the title of detailed description definitions commodity, price, the pictorial information of photograph album definition commodity.
The present embodiment mode by assembly, it is achieved that the maintenance of its chateau information of certain red wine, it is not necessary to core business code will be changed.
Wherein, commodity preserve core business
1. order core business (GoodsService)
Being responsible for the preservation of commodity, this belongs to the core of electricity business business, adds commodity by addGoods () method.
2. order plug-in unit stake (GoodsPluginBundle)
Its pluginList attribute stores the plug-in unit of all response commodity business event.
3. commodity add event interface (GoodsAddEvent)
Order after order creation success, can excite this event, and actual what call is the plug-in unit in above-mentioned pluginList.
Chateau commodity components
Chateau assembly is by herein below:
Chateau assembly (ChateauComponent)
Chateau assembly class, can call its install method when assembly is mounted, completes some and installs necessary operation.
Chateau plug-in unit
This type of achieves commodity and adds event, has responded commodity and has created event (onAddGoods) method, when commodity add, can call the method.
The description file Component.xml of assembly
This describes document definition chateau plug-in unit (ChateauPlugin) and to be injected in commodity plug-in unit stake, namely define plug-in unit will corresponding to core business
Event activated and plug-in unit call
Concrete technology implementation details is as follows:
Here circulate all of commodity interpolation event and call it (activating event interface), these events are really that be injected into into, concrete plug-in unit and realize body, namely above-mentioned chateau plug-in unit, now chateau plug-in unit is by dynamic call, completes chateau information and the logic of wine product relation preservation in this plug-in unit.
Be can be seen that by above-mentioned specific embodiment, by the method for said modules, can realize original system without intrusive mood, loose coupling formula exploitation, developer is without relation core code details, only it is to be understood that event interface just can complete the extension to core business, development efficiency is high, reusability is high.
These are only presently preferred embodiments of the present invention, not in order to limit the present invention, all any amendment, equivalent replacement and improvement etc. made within the spirit and principles in the present invention, should be included within protection scope of the present invention.
Claims (3)
1. one kind based on event driven assembly method, it is characterised in that take out core business logic and core business data in the business module of software;
Take out the event interface that described core business logic is corresponding;
Being assembly by the business that removes outside core business data in described business module, described assembly is made up of one group of business plug-in unit, described plug-in unit be the event of one or more core business realize body;
Describe the incidence relation defined in file between different business plug-in unit and core business logic at assembly, associating between described business plug-in unit and described core business logic is collected by plug-in unit stake;
Described core business logic finds the business plug-in unit of correspondence according to the described collected association of plug-in unit stake.
2. according to claim 1 based on event driven assembly method, it is characterized in that, the business removed in described business module outside core business data is divided into different business plug-in units according to the condition set, different business plug-in units form one group of business plug-in unit group particularly as follows:
Search all of assembly and describe file, and parse the incidence relation between business plug-in unit and core business logic;
Relation between business plug-in unit and core business logic be recorded in internal memory by component view;
Whether detection business plug-in unit installation situation, have this business plug-in unit in detection data, if not having record in component view, then record in the data, and this business plug-in unit be marked as do not install, not actuated, if data have existed described business plug-in unit, then display have been started up.
3. according to claim 2 based on event driven assembly method, it is characterised in that described core business logic according to the described collected association of plug-in unit stake find correspondence business plug-in unit particularly as follows:
At software in running software, call event interface when core business logic is invoked simultaneously, transmit core business data to interface simultaneously, this process is referred to as event activated, when event swashs, in plug-in unit stake, have collected corresponding business plug-in unit set, so in plug-in unit stake business of calling plug-in unit one by one, transmission core data, such business plug-in unit is performed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610139411.8A CN105808261B (en) | 2016-03-11 | 2016-03-11 | One kind being based on event driven assembly method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610139411.8A CN105808261B (en) | 2016-03-11 | 2016-03-11 | One kind being based on event driven assembly method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105808261A true CN105808261A (en) | 2016-07-27 |
CN105808261B CN105808261B (en) | 2019-01-25 |
Family
ID=56468240
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610139411.8A Expired - Fee Related CN105808261B (en) | 2016-03-11 | 2016-03-11 | One kind being based on event driven assembly method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105808261B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109471626A (en) * | 2018-10-11 | 2019-03-15 | 深圳市金证科技股份有限公司 | Page logic structure, page generation method, page data processing method and device |
CN112527251A (en) * | 2020-11-30 | 2021-03-19 | 北京百度网讯科技有限公司 | Service processing method and device, electronic equipment and storage medium |
CN114518907A (en) * | 2022-01-27 | 2022-05-20 | 佰聆数据股份有限公司 | Extensible self-service data analysis method and system |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101848134A (en) * | 2009-03-27 | 2010-09-29 | 中兴通讯股份有限公司 | Multi-service access node and data message forwarding method thereof |
CN103645919A (en) * | 2013-12-18 | 2014-03-19 | 用友软件股份有限公司 | Method for extending functions of management information system through plugins |
CN103645901A (en) * | 2013-12-16 | 2014-03-19 | 上海证券交易所 | Event chain based user interface plugin interaction method |
-
2016
- 2016-03-11 CN CN201610139411.8A patent/CN105808261B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101848134A (en) * | 2009-03-27 | 2010-09-29 | 中兴通讯股份有限公司 | Multi-service access node and data message forwarding method thereof |
CN103645901A (en) * | 2013-12-16 | 2014-03-19 | 上海证券交易所 | Event chain based user interface plugin interaction method |
CN103645919A (en) * | 2013-12-18 | 2014-03-19 | 用友软件股份有限公司 | Method for extending functions of management information system through plugins |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109471626A (en) * | 2018-10-11 | 2019-03-15 | 深圳市金证科技股份有限公司 | Page logic structure, page generation method, page data processing method and device |
CN109471626B (en) * | 2018-10-11 | 2022-12-02 | 深圳市金证科技股份有限公司 | Page logic structure, page generation method, page data processing method and device |
CN112527251A (en) * | 2020-11-30 | 2021-03-19 | 北京百度网讯科技有限公司 | Service processing method and device, electronic equipment and storage medium |
CN114518907A (en) * | 2022-01-27 | 2022-05-20 | 佰聆数据股份有限公司 | Extensible self-service data analysis method and system |
CN114518907B (en) * | 2022-01-27 | 2023-11-03 | 佰聆数据股份有限公司 | Extensible self-service data analysis method and system |
Also Published As
Publication number | Publication date |
---|---|
CN105808261B (en) | 2019-01-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104049986A (en) | Plugin loading method and device | |
CN103177210B (en) | A kind of method implanting dynamic stain analysis module in Android | |
CN101719077B (en) | Method and device for injecting codes in .Net program | |
CN107608706A (en) | A kind of application program automatic heating update method based on functional module | |
US10176327B2 (en) | Method and device for preventing application in an operating system from being uninstalled | |
CN102236764B (en) | Method and monitoring system for Android system to defend against desktop information attack | |
CN103577757A (en) | Virus defending method and device | |
CN105808261A (en) | Event driving-based component method | |
CN103761114A (en) | Method and device for loading extensions and/or plugins on browser side | |
CN102902576B (en) | Method, server and system for rendering webpages | |
CN103093148A (en) | Detection method, system and device of malicious advertisements | |
CN104156225A (en) | Downloading method, system and server for installation package | |
CN110278264B (en) | Block chain-based cross-link communication method and device and transaction system | |
CN103543991A (en) | Method for extending functions of browser and browser system | |
CN105988846A (en) | Page loading method and page loading device | |
CN106022100A (en) | Method and device for intercepting installation of malicious program and electronic equipment | |
CN101000552A (en) | Java kind loading method and loader | |
WO2016080735A1 (en) | Method and apparatus for preventing injection-type attack in web-based operating system | |
CN116301759B (en) | Mobile component sharing method, system, equipment and storage medium | |
CN102200918B (en) | The method of server disposition application program and device | |
CN109388770B (en) | Web page generation method and device | |
CN110673827A (en) | Resource calling method and device based on android system and electronic equipment | |
CN102184105A (en) | Data processing method based on modularity and data center system | |
CN107277108B (en) | Method, device and system for processing messages at nodes of block chain | |
CN106598680A (en) | Method and device for program repair and content promotion and electronic equipment |
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 | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20190125 Termination date: 20200311 |
|
CF01 | Termination of patent right due to non-payment of annual fee |