Movatterモバイル変換


[0]ホーム

URL:


CN107133171A - A kind of light weight AOP frameworks and its application method based on assembly type - Google Patents

A kind of light weight AOP frameworks and its application method based on assembly type
Download PDF

Info

Publication number
CN107133171A
CN107133171ACN201710300808.5ACN201710300808ACN107133171ACN 107133171 ACN107133171 ACN 107133171ACN 201710300808 ACN201710300808 ACN 201710300808ACN 107133171 ACN107133171 ACN 107133171A
Authority
CN
China
Prior art keywords
interception
intercept
aop
intercepted
interface
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.)
Pending
Application number
CN201710300808.5A
Other languages
Chinese (zh)
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.)
Shandong Inspur Genersoft Information Technology Co Ltd
Original Assignee
Shandong Inspur Genersoft Information Technology 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 Shandong Inspur Genersoft Information Technology Co LtdfiledCriticalShandong Inspur Genersoft Information Technology Co Ltd
Priority to CN201710300808.5ApriorityCriticalpatent/CN107133171A/en
Publication of CN107133171ApublicationCriticalpatent/CN107133171A/en
Pendinglegal-statusCriticalCurrent

Links

Classifications

Landscapes

Abstract

The invention discloses a kind of light weight AOP frameworks based on assembly type and its application method, including one AOP frameworks of configuration, it is placed between client and service end, the AOP frameworks include intercepting interface, intercept object handles class and intercepting list object;Client sends interception request to service end;Service end calls interception object handles class, and interception intention is passed to each interception object intercepted in list object successively, intercepts object by matching interception intention to decide whether to perform interception task, when it is determined that performing, then completes interception by interception interface.A kind of the light weight AOP frameworks and its application method based on assembly type of the present invention is compared with prior art, the problem of for together with the doping such as system core logic code and common component code, significantly reduce logical code and the common code degree of coupling, improve the durability of this part common component, it is practical, it is applied widely, with good application value.

Description

A kind of light weight AOP frameworks and its application method based on assembly type
Technical field
The present invention relates to field of computer technology, specifically a kind of light weight AOP frameworks based on assembly type and its makeUse method.
Background technology
In recent years, business event becomes increasingly complex, and with continuing to develop for IT application in enterprises, each service application is integrated more nextIt is closer, the code of software systems internal core service code and non-traffic(Such as lock processing, audit processing, abnormal log, thingsProcessing etc.)Often adulterate together, so not only bring many troubles to maintenance work, nor beneficial to these non-trafficCommon component reuse, a kind of new mechanism of invention is needed badly to tackle.
In the prior art, OOP can solve subproblem, but it is relation from top to bottom that OOP, which defines, but simultaneously uncomfortableClose the relation of definition from left to right.Such as journal function, will code is often flatly dispersed in all object hierarchies, and and itThe Core Feature of the object spread to has no bearing on.For other kinds of code, such as security, abnormality processing be also asThis.The unrelated code of this distribution throughout is referred to as crosscutting(cross-cutting)Code, in OOP designs, it causesThe repetitions of a large amount of codes, and it is unfavorable for the reuse of modules.
Based on this, dynamic proxy light weight AOP framework implementation of this patent based on assembly type, AOP is exactly that these are non-The public aspect of core business is extracted, and the task that completes is cut into code when needing.So as to reduce business coreThe degree of coupling of heart code and non-traffic core code, effectively solves the low shortcoming of robustness.
The content of the invention
The technical assignment of the present invention be for above weak point there is provided a kind of light weight AOP frameworks based on assembly type andIts application method.
A kind of light weight AOP frameworks based on assembly type, are placed between client and service end, and the AOP frameworks include interceptingInterface, interception object handles class and interception list object, wherein,
Intercepting interface is used to receive request and completes interception action;
Intercepting object handles class is used to transmit interception intention and returns to accordingly result;
Intercept list object and then preserve some interception objects.
The interception interface is used to receive client request, and triggering generation intercepts object handles class;
Object handles class is intercepted to pass to interception object for intention will will to be intercepted, call all interceptions intercepted in object queueObject, call service end service;
Intercept list object then by parsing to intercept to be intended to, judge whether to handle interception object therein.
When client sends interception request to service end, service end calls interception object handles class, will intercept anticipate successivelyFigure passes to each interception object intercepted in list object, intercepts object by matching interception intention to decide whether that execution is blockedThe task of cutting, when it is determined that performing, then is completed to intercept by interception interface.
When the interception interface is called realization and intercepted, the unified call by way of reflection, unified call interface isBy obtaining analysis service and interception parameter, whether the interception to judge framework is acted triggers.
A kind of light weight AOP framework application methods based on assembly type, its implementation process is,
An AOP frameworks are configured, are placed between client and service end, the AOP frameworks include intercepting interface, intercept object handles classWith intercept list object, wherein, intercepting interface is used to receive client request, and triggering generation intercepts object handles class;Interception pairAs processing class be used for will will intercept be intended to pass to intercept object, call intercept object queue in all interception objects, callService end is serviced;Intercepting list object then includes some interception objects;
Client sends interception request to service end;
Service end calls interception object handles class, will intercept each interception pair for being intended to pass to and intercepting in list object successivelyAs, object is intercepted by matching interception intention to decide whether to perform interception task, it is when it is determined that performing, then complete by interception interfaceInto interception.
The interception object configures realizations by server end defines a configuration file, and the configuration file is that script is literaryPart, configuration file is operationally registered all interception objects.
The server end is provided with the configuration file based on component, when being intercepted interception object in configuration fileConfigured, interception object when after framework operation in identification configuration file, and object registration will be intercepted in system, the systemRefer to the system that client, service end and AOP unified frames are used;When client call service end, service end is being passed toParameter in dish out one and intercept intention, intercepting object automatic identification and will intercept when order is called and is intended to be intercepted, fromAnd complete interception task.
The configuration file includes intercepting the position that procedure set assembly, class class and needs of object are intercepted,The position is intercepted or rear interception before referring to.
When the interception interface is called realization and intercepted, the unified call by way of reflection, unified call interface isBy obtaining analysis service and interception parameter, whether the interception to judge framework is acted triggers.
The object that intercepts provides the configurable modes of XML to set.
The present invention a kind of light weight AOP frameworks and its application method based on assembly type compared to the prior art, withLower beneficial effect:
A kind of the light weight AOP frameworks and its application method based on assembly type of the present invention, by operationally to the method calledOne dynamic agency is provided, the purpose that interference method is performed is reached for capturing the action of this method needs interception, so thatBusiness core code and non-traffic common code are peeled off, the degree of coupling is reduced, increases durability;And noted during supporting frame operationVolume intercepts the mode of object, and intercepting object can be configured in server end by XML file, when interception object changes,Only need to change configuration file, have no effect on business core code, it is practical, it is applied widely, with good popularizationApplication value.
Brief description of the drawings
Accompanying drawing 1 realizes schematic diagram for the present invention's.
Accompanying drawing 2 triggers exemplary plot for the interception of the present invention.
Accompanying drawing 3 calls intercept process class exemplary plot for the present invention's.
Embodiment
Below in conjunction with the accompanying drawings and specific embodiment the invention will be further described.
As shown in Figure 1, a kind of light weight AOP frameworks based on assembly type, including following content:
Intercept interface:The interface that tangent plane is intercepted is realized, the interception task of different demands can be according to circumstances realized;When user needs, it is necessary to realize the interception interface that framework is provided during progress tangent plane interception.
Based on component configurable type:Framework defines a configuration file to configure the object to be intercepted in server end, canFlexibly change.All interception objects can operationally be registered, when client call service end method, it is only necessary toDished out in the parameter for passing to service end one and intercept intention, meaning will be intercepted by intercepting object meeting automatic identification when order is calledFigure is intercepted.
Need interception object to be configured in configuration file when being intercepted, configuration file is recognized when after framework operationIn interception object, and object registration will be intercepted in system.During method call, if object needs to intercept, client existsCall during service end by intercept intent information follow parameter to be delivered to service end together.The dynamic proxy of service end calls interception to graspClass is dealt with, each interception object for being intended to pass to and intercepting in queue will be intercepted successively, intercepts object and intercept meaning by matchingFigure come decide whether perform interception task.
This framework is placed between client and service end, and the AOP frameworks include intercepting interface, intercept object handles class and blockList object is cut, wherein,
Intercepting interface is used to receive request and completes interception action;
Intercepting object handles class is used to transmit interception intention and returns to accordingly result;
Intercept list object and then preserve some interception objects.
The interception interface is used to receive client request, and triggering generation intercepts object handles class;
Object handles class is intercepted to pass to interception object for intention will will to be intercepted, call all interceptions intercepted in object queueObject, call service end service;
Intercept list object then by parsing to intercept to be intended to, judge whether to handle interception object therein.
When client sends interception request to service end, service end calls interception object handles class, will intercept anticipate successivelyFigure passes to each interception object intercepted in list object, intercepts object by matching interception intention to decide whether that execution is blockedThe task of cutting, when it is determined that performing, then is completed to intercept by interception interface.
When the interception interface is called realization and intercepted, the unified call by way of reflection, unified call interface isBy obtaining analysis service and interception parameter, whether the interception to judge framework is acted triggers.
A kind of light weight AOP framework application methods based on assembly type, for system core logic code and common component code etc.The problem of adulterating together significantly reduces logical code and public generation there is provided a kind of developing mechanism based on towards tangent planeThe code degree of coupling, improves the durability of this part common component.
Its implementation process is,
An AOP frameworks are configured, are placed between client and service end, the AOP frameworks include intercepting interface, intercept object handles classWith intercept list object, wherein, intercepting interface is used to receive client request, and triggering generation intercepts object handles class;Interception pairAs processing class be used for will will intercept be intended to pass to intercept object, call intercept object queue in all interception objects, callService end is serviced;Intercepting list object then includes some interception objects;
Client sends interception request to service end;
Service end calls interception object handles class, will intercept each interception pair for being intended to pass to and intercepting in list object successivelyAs, object is intercepted by matching interception intention to decide whether to perform interception task, it is when it is determined that performing, then complete by interception interfaceInto interception.
The interception object configures realizations by server end defines a configuration file, and the configuration file is that script is literaryPart, configuration file is operationally registered all interception objects.
The server end is provided with the configuration file based on component, when being intercepted interception object in configuration fileConfigured, interception object when after framework operation in identification configuration file, and object registration will be intercepted in system, the systemRefer to the system that client, service end and AOP unified frames are used;When client call service end, service end is being passed toParameter in dish out one and intercept intention, intercepting object automatic identification and will intercept when order is called and is intended to be intercepted, fromAnd complete interception task.
The configuration file includes intercepting the position that procedure set assembly, class class and needs of object are intercepted,The position is intercepted or rear interception before referring to.
When the interception interface is called realization and intercepted, the unified call by way of reflection, unified call interface isBy obtaining analysis service and interception parameter, whether the interception to judge framework is acted triggers.
The object that intercepts provides the configurable modes of XML to set.
The present invention includes following characteristics:
Public uncore logic code is extracted as interception object.
The interface that uniform service end is called by way of reflection.
The configurable modes of XML are provided flexibly interception object is set.
By the form of interception parameter tell framework which need intercept.
Based on proxy mode.
Public uncore logic code is extracted as object is intercepted, configuration file, which mainly includes, intercepts objectAssembly, class and the position for needing interception(It is front or rear).
The interface that uniform service end is called by way of reflection, unified call interface is for Standard Service and interception pairAs the parameter of intention, unified interface obtains analysis service and interception parameter, and then judges whether the interception action of framework triggers.
There is provided XML configurable modes that interception object is flexibly set, intercept object can change at any time according to demand andCore logic code is not influenceed.
By the form of interception parameter tell framework those need intercept, intercept intent parameter can accurately tell frameworkThose action need intercept, and do not influence core code, it is necessary to when add the parameter, it is not necessary to when without the parameter.
The registration XML configuration examples for intercepting object are as follows:
<xml version="1.0" encoding="utf-8">
<configuration>
<AOPExtend>
<--AOPLocation="Before/After/All"-->
<AOPAttribute AOPAssembly="Genersoft.ZJGL.AOPProxy" AOPClass="Genersoft.ZJGL.AOPProxy.Proxy.Extends.AOPCompDataLockProxy" AOPLocation="All"/>
<AOPAttribute AOPAssembly="Genersoft.ZJGL.Web.ZJGX.SPI" AOPClass="Genersoft.ZJGL.Web.ZJGX.SPI.AOPExtend.AOPFundCenterAuthority" AOPLocation="Before"/>
<AOPAttribute AOPAssembly="Genersoft.ZJGL.Web.ZJGX.SPI" AOPClass="Genersoft.ZJGL.Web.ZJGX.SPI.AOPExtend.AOPBillLading" AOPLocation="Before"/>
</AOPExtend>
</configuration>
Triggering is intercepted, example is as shown in Figure 2.
As shown in figure 3, the unified entrance of service end can lead to automatically when having parsed parameter call InvokeMethod hereCross dynamic proxy to go to call intercept process class, intercept process class goes back to process by demand the interception object of configuration.
By embodiment above, the those skilled in the art can readily realize the present invention.But shouldWork as understanding, the present invention is not limited to above-mentioned embodiment.On the basis of disclosed embodiment, the technical fieldTechnical staff can be combined different technical characteristics, so as to realize different technical schemes.
It is the known technology of those skilled in the art in addition to the technical characteristic described in specification.

Claims (10)

CN201710300808.5A2017-05-022017-05-02A kind of light weight AOP frameworks and its application method based on assembly typePendingCN107133171A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201710300808.5ACN107133171A (en)2017-05-022017-05-02A kind of light weight AOP frameworks and its application method based on assembly type

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201710300808.5ACN107133171A (en)2017-05-022017-05-02A kind of light weight AOP frameworks and its application method based on assembly type

Publications (1)

Publication NumberPublication Date
CN107133171Atrue CN107133171A (en)2017-09-05

Family

ID=59715166

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201710300808.5APendingCN107133171A (en)2017-05-022017-05-02A kind of light weight AOP frameworks and its application method based on assembly type

Country Status (1)

CountryLink
CN (1)CN107133171A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108154026A (en)*2017-12-282018-06-12成都卫士通信息产业股份有限公司Safety communicating method and system of the Root without intrusion are exempted from based on android system
CN110865848A (en)*2018-08-212020-03-06深圳市优必选科技有限公司 Component interception method and terminal device
WO2020186773A1 (en)*2019-03-162020-09-24平安科技(深圳)有限公司Call request monitoring method, device, apparatus, and storage medium
CN112799699A (en)*2021-01-252021-05-14广州心娱网络科技有限公司Server updating method and device

Cited By (7)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN108154026A (en)*2017-12-282018-06-12成都卫士通信息产业股份有限公司Safety communicating method and system of the Root without intrusion are exempted from based on android system
CN108154026B (en)*2017-12-282022-01-11成都卫士通信息产业股份有限公司Root-free and non-invasive secure communication method and system based on Android system
CN110865848A (en)*2018-08-212020-03-06深圳市优必选科技有限公司 Component interception method and terminal device
CN110865848B (en)*2018-08-212024-03-29深圳市优必选科技有限公司Component interception method and terminal equipment
WO2020186773A1 (en)*2019-03-162020-09-24平安科技(深圳)有限公司Call request monitoring method, device, apparatus, and storage medium
CN112799699A (en)*2021-01-252021-05-14广州心娱网络科技有限公司Server updating method and device
CN112799699B (en)*2021-01-252024-05-03广州心娱网络科技有限公司Method and device for updating server

Similar Documents

PublicationPublication DateTitle
CN110347560B (en)Method, device, system, equipment and medium for prompting abnormity of big data product
US10795992B2 (en)Self-adaptive application programming interface level security monitoring
CN107133171A (en)A kind of light weight AOP frameworks and its application method based on assembly type
US8631124B2 (en)Network analysis system and method utilizing collected metadata
CN103546343B (en)The network traffics methods of exhibiting of network traffic analysis system and system
CN109062982B (en)Financial data interaction method and device, computer equipment and storage medium
EP2562646A1 (en)Modifying application behaviour
CN110069388A (en)Alarm information processing method, device, equipment and computer readable storage medium
US9832198B2 (en)Service-based message access layer frame and implementation method thereof
CN103475746B (en)A kind of terminal service method and device
US8819155B2 (en)System and method for performing centralized common tasks for a set of functions
US20130198265A1 (en)Connection management in a computer networking environment
WO2020006895A1 (en)Account checking method and apparatus, computer device and storage medium
US20140201762A1 (en)Event handling system and method
US12335287B2 (en)Automated detection of cross site scripting attacks
CN103269384A (en)Rich client abnormality processing method, processing device and processing system
WO2020006902A1 (en)Batch payment method and apparatus, computer device, and storage medium
CN107347078A (en)A kind of operating system weak passwurd safety detection method based on cloud service
KR20160013733A (en)System and method for realtime detection of abnormal financial transaction
CN109191271B (en)Funds collection method, apparatus, computer device and storage medium
CN114666407A (en)RPA cross-terminal communication method and equipment
CN105959385A (en)Information communication method, device and system
CN109635027A (en)A kind of implementation method of database access result collection detection
CN104468708A (en)Data collaborating method and data collaborating device
CN113886366A (en)Database operation and maintenance method and device, electronic equipment and readable storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
RJ01Rejection of invention patent application after publication
RJ01Rejection of invention patent application after publication

Application publication date:20170905


[8]ページ先頭

©2009-2025 Movatter.jp