Movatterモバイル変換


[0]ホーム

URL:


CN113986206A - Construction method of plug-in loading system, plug-in loading system and computing device - Google Patents

Construction method of plug-in loading system, plug-in loading system and computing device
Download PDF

Info

Publication number
CN113986206A
CN113986206ACN202111341605.3ACN202111341605ACN113986206ACN 113986206 ACN113986206 ACN 113986206ACN 202111341605 ACN202111341605 ACN 202111341605ACN 113986206 ACN113986206 ACN 113986206A
Authority
CN
China
Prior art keywords
plug
service
layer
modules
module
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
CN202111341605.3A
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.)
Chengdu Tongxin Software Technology Co ltd
Original Assignee
Chengdu Tongxin Software 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 Chengdu Tongxin Software Technology Co ltdfiledCriticalChengdu Tongxin Software Technology Co ltd
Priority to CN202111341605.3ApriorityCriticalpatent/CN113986206A/en
Publication of CN113986206ApublicationCriticalpatent/CN113986206A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Classifications

Landscapes

Abstract

Translated fromChinese

本发明公开了一种插件加载系统的构建方法、插件加载系统及计算设备,其中方法包括:构建一个或多个插件服务,基于一个或多个插件服务构建插件服务层;在所述插件服务层的下层构建一个或多个插件模块,基于一个或多个插件模块形成插件层,其中,插件层的每个插件模块动态链接于所述插件服务层,且所述一个或多个插件模块之间相互隔离;以及在所述插件层的下层构建执行程序,所述执行程序适于加载一个或多个插件模块,以便调用与所述插件模块动态链接的插件服务层的插件服务。根据本发明的技术方案,实现了各个插件模块之间的物理隔离特性,能够从根源上解决插件隔离丢失的问题,并且可以灵活扩展插件服务。

Figure 202111341605

The invention discloses a construction method of a plug-in loading system, a plug-in loading system and a computing device, wherein the method comprises: constructing one or more plug-in services, and constructing a plug-in service layer based on the one or more plug-in services; The lower layer builds one or more plug-in modules, and forms a plug-in layer based on one or more plug-in modules, wherein each plug-in module of the plug-in layer is dynamically linked to the plug-in service layer, and the one or more plug-in modules are between and constructing an executive program at a lower layer of the plug-in layer, the executive program being adapted to load one or more plug-in modules so as to invoke the plug-in services of the plug-in service layer dynamically linked with the plug-in modules. According to the technical scheme of the present invention, the physical isolation characteristic between each plug-in module is realized, the problem of plug-in isolation loss can be solved from the root, and the plug-in service can be flexibly expanded.

Figure 202111341605

Description

Plug-in loading system construction method, plug-in loading system and computing equipment
Technical Field
The invention relates to the technical field of computers, in particular to a plug-in loading system construction method, a plug-in loading system and computing equipment.
Background
At present, a single application program under traditional development often expands codes along with new service development and numerous iterations of versions, so that maintenance difficulty of developers is exponentially increased, and then a new function is developed, all old functions before the developers need to be maintained, and the developers develop the single application program under the environment with high development cost, so that all codes are reconstructed at a later stage. However, the existing single-body implementation is to adopt an Open Service Gateway Initiative (OSGi) technology to perform plug-in dynamic combination. And the problems of service association logic confusion, physical isolation characteristic loss and the like are caused when the software is combined due to the problems of plug-in hierarchy division and module division based on the traditional OSGi plug-in development mode. The patent provides an optimization method for plug-in shelf division and module division, and finally solves the problems of software association logic confusion, loss of physical isolation characteristics and the like.
The C + + plug-in framework layered architecture in the prior art generally adopts the traditional OSGi idea, the plug-in framework based on the OSGi hierarchical structure includes CTKs, CppMicroServices, and the like, and its internal guiding idea is to encapsulate services (plug-in services) inside bundles (plug-ins). A schematic diagram of a plug-in loading principle based on such a plug-in framework is shown in fig. 1. Each Bundle closure plug-in layer in the OSGi has the capability of issuing Service plug-in services, and the Bundle not only has a Service logic code closure, but also has the capability of providing an interface to the outside. When loading Bundle C, Bundle A and B need to be loaded in advance. While Bundle C uses the interfaces in Bundle a, B, Bundle C will depend directly on Bundle a, B.
Taking the existing plug-ins CTK or CppMicroServices as an example, the existing plug-in technology has the following disadvantages: the loss of physical isolation causes a high module coupling degree, and particularly, since Bundle depends on Service, there is a strong logical association, and Service is defined as a type consistent with Bundle, which causes continuous superposition of the internal coupling degree in subsequent development. In a common method, Service is generally uniformly packaged into a single dynamic library, and after an internal logic source code is changed, only the dynamic library can be reconstructed, and with the increase of Service functions of the dynamic library, the source code will expand continuously, so that the time for recompiling when a line of code is changed is long, and the compiling efficiency is low. Because the Bundle and the Service are closed to be a plug-in, the expansion of the Service will change the Bundle, resulting in an inflexible expansion mode of the Service.
Therefore, a method for constructing a plug-in loading system is needed to solve the problems in the prior art.
Disclosure of Invention
To this end, the present invention provides a method for constructing a plug-in loading system, a plug-in loading system and a computing device, so as to solve or at least alleviate the above problems.
According to one aspect of the invention, a method for constructing a plug-in loading system is provided, one or more plug-in services are constructed, and a plug-in service layer is constructed based on the one or more plug-in services; constructing one or more plug-in modules at the lower layer of the plug-in service layer, and forming the plug-in layer based on the one or more plug-in modules, wherein each plug-in module of the plug-in layer is dynamically linked to the plug-in service layer, and the one or more plug-in modules are isolated from each other; and constructing an executive program below the plug-in layer, wherein the executive program is suitable for loading one or more plug-in modules so as to call the plug-in services of the plug-in service layer dynamically linked with the plug-in modules.
Optionally, in the method for constructing a plug-in loading system according to the present invention, the plug-in service is adapted to publish a service interface and communicate with one or more plug-in modules through the service interface, so that the one or more plug-in modules access the service module through the service interface.
Optionally, in the method for constructing a plug-in loading system according to the present invention, the plug-in service includes a file reading service.
Optionally, in the method for building a plug-in loading system according to the present invention, the step of building a plug-in layer based on one or more plug-in modules includes: constructing a core plug-in module, and setting the core plug-in module to refer to the file reading service; constructing a sender plug-in module, and setting the sender plug-in module to refer to the file reading service; constructing a processor plug-in module, and setting the processor plug-in module to refer to the file reading service; a plug-in layer is formed based on the core plug-in module, sender plug-in module, and processor plug-in module.
Optionally, in the method for constructing a plug-in loading system according to the present invention, the method further includes the steps of: calling an import interface to import a new plug-in service into the plug-in service layer; and calling an export interface to delete the plug-in service of the plug-in service layer.
Optionally, in the method for constructing a plug-in loading system according to the present invention, the plug-in services of the plug-in service layer are managed based on the global service table; the global service table comprises one or more plug-in service functions, and each plug-in service function corresponds to one plug-in service of the plug-in service layer.
Optionally, in the method for constructing a plug-in loading system according to the present invention, invoking an import interface to import a new plug-in service into the plug-in service layer includes: and calling an addindicator function in the import interface so as to import a new plug-in service function into the global service table.
Optionally, in the method for constructing a plug-in loading system according to the present invention, invoking an export interface to delete a plug-in service of the plug-in service layer includes: and calling a delaporter function in the export interface so as to delete the plug-in service function in the global service table.
According to an aspect of the present invention, there is provided a plug-in loading system including: a plug-in service layer comprising one or more plug-in services; a plug-in layer arranged below the plug-in service layer, wherein the plug-in layer comprises one or more plug-in modules, each plug-in module is dynamically linked to the plug-in service layer, and the one or more plug-in modules are isolated from each other; and the executive program is arranged below the plug-in layer and is suitable for loading one or more plug-in modules so as to call the plug-in services of the plug-in service layer dynamically linked with the plug-in modules.
According to an aspect of the invention, there is provided a computing device comprising: at least one processor; a memory storing program instructions configured to be suitable for execution by the at least one processor, the program instructions including instructions for performing the method of building a plug-in loading system as described above.
According to an aspect of the present invention, there is provided a readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to execute the method of building a plug-in loading system as described above.
According to the technical scheme of the invention, the plug-in service and the plug-in module adopt a separated structure and are positioned at different levels, each plug-in module of the plug-in layer depends on a uniform plug-in service layer, and the plug-in service layer does not depend on the plug-in layer. Based on the hierarchical relationship of the unidirectional association, each plug-in module of the plug-in layer can use the plug-in service of the plug-in service layer, and the association relationship of dynamic link does not exist among the plug-in modules, so that the physical isolation characteristic among the plug-in modules is realized, and the problem of plug-in isolation loss can be fundamentally solved.
In addition, after the plug-in service is separated according to the technical scheme of the invention, the separated plug-in service is an independent dynamic library, when the plug-in service needs to be expanded, a plug-in module does not need to be compiled again, and only the plug-in service needs to be constructed, so that the plug-in service can be expanded flexibly, the construction time is saved, and the construction efficiency is improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
FIG. 1 illustrates a schematic diagram of plug-in loading in the prior art;
FIG. 2 shows a schematic diagram of a computing device 200, according to one embodiment of the invention;
FIG. 3 illustrates a flow diagram of amethod 300 for building a plug-in loading system according to one embodiment of the invention;
FIG. 4 shows a schematic diagram of a plug-in loading system 400 according to one embodiment of the invention;
FIG. 5 shows a schematic diagram of a prior art plug-in after separation to form a plug-in service layer and a plug-in layer; and
FIG. 6 shows a schematic diagram of a configuration in which a plug-in module is separated from a plug-in service according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
FIG. 2 shows a schematic diagram of a computing device 200, according to one embodiment of the invention.
As shown in FIG. 2, in a basic configuration 202, a computing device 200 typically includes a system memory 206 and one or more processors 204. A memory bus 208 may be used for communication between the processor 204 and the system memory 206.
Depending on the desired configuration, the processor 204 may be any type of processing, including but not limited to: a microprocessor (UP), a microcontroller (UC), a digital information processor (DSP), or any combination thereof. The processor 204 may include one or more levels of cache, such as a level onecache 210 and a level twocache 212, aprocessor core 214, and registers 216.Example processor cores 214 may include Arithmetic Logic Units (ALUs), Floating Point Units (FPUs), digital signal processing cores (DSP cores), or any combination thereof. Theexample memory controller 218 may be used with the processor 204, or in some implementations thememory controller 218 may be an internal part of the processor 204.
Depending on the desired configuration, system memory 206 may be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 206 may include an operating system 220, one or more applications 222, andprogram data 224. The application 222 is actually a plurality of program instructions that direct the processor 204 to perform corresponding operations. In some embodiments, application 222 may be arranged to cause processor 204 to operate withprogram data 224 on an operating system.
Computing device 200 also includes storage device 232, storage device 232 including removable storage 236 and non-removable storage 238.
Computing device 200 may also include a storage interface bus 234. The storage interface bus 234 enables communication from the storage devices 232 (e.g., removable storage 236 and non-removable storage 238) to the basic configuration 202 via the bus/interface controller 230. At least a portion of the operating system 220, applications 222, anddata 224 may be stored on removable storage 236 and/or non-removable storage 238, and loaded into system memory 206 via storage interface bus 234 and executed by the one or more processors 204 when the computing device 200 is powered on or the applications 222 are to be executed.
Computing device 200 may also include an interface bus 240 that facilitates communication from various interface devices (e.g., output devices 242, peripheral interfaces 244, and communication devices 246) to the basic configuration 202 via the bus/interface controller 230. The example output device 242 includes a graphics processing unit 248 and an audio processing unit 250. They may be configured to facilitate communication with various external devices, such as a display or speakers, via one or more a/V ports 252. Example peripheral interfaces 244 can include a serial interface controller 254 and aparallel interface controller 256, which can be configured to facilitate communications with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 258. An example communication device 246 may include anetwork controller 260, which may be arranged to facilitate communications with one or moreother computing devices 262 over a network communication link via one ormore communication ports 264.
A network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes made in a manner that encodes information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
In an embodiment in accordance with the invention, the computing device 200 is configured to perform abuild method 300 of a plug-in loading system in accordance with the invention. The application of the computing device 200 includes a plurality of program instructions for executing the plug-in loadingsystem construction method 300 of the present invention, and the program instructions may instruct the processor to execute the plug-in loadingsystem construction method 300 of the present invention, so that the computing device 200 constructs the plug-in loading system by executing the plug-in loadingsystem construction method 300.
FIG. 3 illustrates a flow diagram of amethod 300 for building a plug-in loading system, according to one embodiment of the invention. Themethod 300 is suitable for execution in a computing device, such as the computing device 200 described above.
As shown in fig. 3, themethod 300 begins at step S310.
In step S310, one or more plug-in services are built, and a plug-in service layer is built based on the one or more plug-in services. Here, each plug-in service is a service module that exists independently of the plug-in, and each plug-in service is a separate dynamic library.
It should be noted that the plug-in service layer is also a dynamic library of plug-in services, and the plug-in service layer can be used as a unified dependent library of a plurality of plug-in modules.
As described above, the plug-in the prior art is a closure structure with a high coupling degree, and the plug-in service is encapsulated inside the plug-in, that is, the plug-in module and the plug-in service are closed into one closure plug-in.
According to the technical scheme of the invention, the closure plug-ins are separated, the plug-in service in each closure plug-in is separated to become independent plug-in service, and each plug-in service does not depend on the plug-ins. Furthermore, a plug-in service layer is constructed and formed based on a plurality of independent plug-in services, and the plug-in service layer is used as a dynamic dependency library unified by a plurality of plug-in modules.
In step S320, one or more plug-in modules are built below the plug-in service layer, and a plug-in layer is formed based on the one or more plug-in modules. Here, each plug-in module of the plug-in layer is dynamically linked to the plug-in service layer. That is, the manner in which each plug-in module of the plug-in layer is dynamically linked depends on the plug-in services layer. And one or more plug-in modules of the plug-in layer are isolated from each other, and no dependency exists.
In one implementation, each plug-in module is built based on the specifications of the OSGI dynamic modular system. Each plug-in module adopts a module physically isolated by a dynamic library, so that physical isolation is realized among one or more plug-in modules obtained by construction.
In step S330, one or more executives are built below the plug-in layer, and the executives can dynamically load one or more plug-in modules so as to call the plug-in services of the plug-in service layer dynamically linked with the plug-in modules.
Thus, a plug-in loading system is formed based on the plug-in service layer constructed in the above steps, the plug-in layer depending on the plug-in service layer, and the one or more execution programs.
It should be noted that, according to the plug-in loading system 400 constructed by themethod 300 of the present invention, the plug-in layer depends on the plug-in service layer, and the plug-in service layer does not depend on the plug-in layer. Based on the hierarchical relationship of the one-way association, each plug-in module of the plug-in layer can use one or more plug-in services of the plug-in service layer. In addition, the incidence relation of dynamic link does not exist among all the plug-in modules, the physical isolation characteristic among all the plug-in modules is realized, and the function realization of the original plug-in is kept.
It should be noted that the separated plug-in service is an individual dynamic library, and the dynamic library of the plug-in service can be constructed in a naming mode associated with the plug-in service.
In one embodiment, the one or more add-in services built in step S310 include, for example, a file reading service. After building the dynamic library of the file reading service, building one or more plug-in modules, building a plug-in layer based on the one or more plug-in modules comprises the steps of:
and constructing a core plug-in module, and setting the core plug-in module to quote the file reading service. And constructing a sender plug-in module, and setting the sender plug-in module to refer to the file reading service. And constructing a processor plug-in module, and setting a file reading service quoted by the processor plug-in module. A plug-in layer is formed based on the core plug-in module, the sender plug-in module, and the processor plug-in module. In this way, the built plug-in modules can be isolated from each other, and each plug-in module is dynamically linked to the built file reading service.
The specific code may be implemented as:
add _ library (file-service file i.h file i.cpp)// construct a dynamic library of file read services;
add _ library (corePlugin. h corePlugin. cpp)// build core plug-in;
target _ link _ libraries (sendplug SHARED file-service)// core plug-in references read service, this line is not needed here if the core plug-in does not have a function call for file.
add _ library (sendplug coreplug. h sendplug. cpp)// build sender plug-in;
target _ link _ libraries (sendplug SHARED file-service)// sender plug-in references read service;
add _ library (handlerpugin. h handlerpugin. cpp)// construct a handler plug-in;
target _ link _ libraries (handlerpugin SHARED file-service)// handler plug-in references read service;
add _ execute (application)/construct execution program.
It should be further noted that, based on the above construction method, the plug-in service is an independent dynamic library, and when a new plug-in service needs to be extended, the extension of the plug-in service can be realized by constructing the dynamic library of the new plug-in service and associating one or more plug-in modules with the new plug-in service. Without requiring changes to the plug-in modules.
FIG. 4 shows a schematic diagram of a plug-in loading system 400 according to one embodiment of the invention. The plug-in loading system 400 resides in a computing device, such as the computing device 200 described above. As shown in fig. 4, the plug-in loading system 400 includes a plug-in service layer 410, a plug-in layer 420, and one or more executive programs 430, wherein the plug-in service layer 410 includes one or more plug-in services, and the plug-in layer 420 includes one or more plug-in modules. The plug-in layer 420 is disposed below the plug-in service layer 410 and is dynamically linked to the plug-in service layer 410. Each plug-in module of plug-in layer 410 is dynamically linked to plug-in services layer 420, and one or more plug-in modules are isolated from each other. One or more executives 430 are disposed below the plug-in layer 420, and the executives 430 can load one or more plug-in modules of the plug-in layer 420 so as to call, through the plug-in modules, the plug-in services of the plug-in services layer 410 that are dynamically linked to the plug-in modules.
In one implementation, as shown in FIG. 4, the plug-in services layer 410 includes plug-in services such as ServiceB, ServiceC, ServiceD, and ServiceE, for example. Plug-in layer 420 includes, for example, plug-in modules such as BundleA, BundleB, BundleC, BundleD, BundleE, and BundleF. Each plug-in module of the plug-in layer 410 may dynamically depend on the plug-in services layer 420 in a dynamic link-based manner.
It can be understood that in the plug-in loading system 400, there is no association relationship of dynamic links between plug-in modules, so as to solve the problem of chain dynamic library association and ring node between plug-ins in the prior art.
In one implementation, as shown in fig. 5, the existing plug-in loading scheme shown in fig. 1 may be modified according to the method for constructing the plug-in loading system of the present invention, so as to form a plug-in service layer 410 and a plug-in layer 420 shown in fig. 5. Specifically, the plug-in layer 420 is formed by separating the plug-in Service in each plug-in package, constructing the plug-in Service layer 410 based on the separated Service, and forming the plug-in layer based on the plug-in modules after the plug-in Service is separated. As shown in fig. 5, the plug-in service layer includes ServiceA and ServiceB, and the plug-in layer includes independent Bundle a, Bundle b and Bundle C, where Bundle a, Bundle b and Bundle C are physically isolated from each other, and there is no dynamic link dependency relationship. Based on the hierarchical relationship, the original dynamic dependency relationship (Bundle C depends on Bundle A and Bundle B) is changed into the dependency relationship that Bundle C depends on serviceA and serviceB.
According to embodiments of the present invention, each plug-in service of the plug-in service layer may publish a service interface through which one or more plug-in modules may communicate, such that the one or more plug-in modules may access the plug-in service through the service interface.
It should be noted that, according to the plug-in loading system constructed by the plug-in loadingsystem construction method 300 of the present invention, the plug-in module and the plug-in service are of a separate structure. Each plug-in module constructed by the invention only comprises a platform characteristic module (framework characteristic module), and the platform characteristic module is used for releasing plug-in interfaces. And the service interface is issued by the plug-in service of the plug-in service layer, and the service interface does not depend on the platform characteristic module of the plug-in.
FIG. 6 shows a schematic diagram of a configuration in which a plug-in module is separated from a plug-in service according to an embodiment of the present invention. As shown in fig. 6, after the plug-in service ServiceA is separated from a plug-in package Bundle, the service interface that can be accessed by the Bundle B that depends on the Bundle a is issued by the ServiceA, and it does not depend on the platform feature Module issued by the Bundle a, and there is no problem of accessing the plug-in interface Module B, thereby achieving physical isolation.
The closure plug-in the prior art comprises a plug-in service and a platform characteristic module, wherein the plug-in exposes a service interface and a plug-in interface outwards, and the plug-in interface is called as the service interface depending on the main access of the service interface. When the platform characteristic module of the plug-in a is externally released along with the interface, it means that the other plug-ins B also have the same access right to the plug-in interface of the plug-in a, and even the private scope destruction can be performed through the source code # define private public, so that the plug-in a cannot achieve the effect of isolating the plug-in service from the platform characteristic module.
According to the embodiment of the invention, the plug-in service of the plug-in service layer is extended by monitoring the service import and the service export. In particular, the plug-in service layer is provided with an import interface and an export interface, and one or more new plug-in services can be imported into the plug-in service layer by calling the import interface. In addition, one or more currently existing plug-in services in the plug-in service layer can be deleted by calling the export interface.
In one implementation, the plug-in services of the plug-in services layer are managed based on a global services table. The global service table comprises one or more plug-in service functions, and each plug-in service function corresponds to one plug-in service of the plug-in service layer.
When the plug-in service is imported or exported, a plug-in service function can be imported into the global service table to realize the import of the plug-in service; accordingly, export of the plug-in services is achieved by deleting the plug-in service functions in the global service table.
In one implementation, the import interface includes an addindicator function and the export interface includes a delImporter function. When the import interface is called, specifically, a new plug-in service function is imported into the global service table by calling an addindicator function in the import interface, so that the new plug-in service is imported into the plug-in service layer by calling the import interface.
When the export function is called, specifically, the delImporter function in the export interface is called to delete the plug-in service function in the global service table, so that the current existing plug-in service in the plug-in service layer is deleted by calling the export interface.
In one implementation, the import and export of the plug-in service may be implemented in a macro-defined manner, where the key codes are, for example:
Figure BDA0003352309410000111
the code is realized as a service abstract interface class and a service identification interface macro, wherein the abstract service class is the service abstract class, and the plug _ service (x) identifies that the abstract service is added into a global service table when being constructed. The abstract interface class and the service identification interface macro have the following use modes:
class InteractiveService:public AbstractService
{Q_OBJECT
PLUGIN_SERVICE(InteractiveService)
}
in one implementation, the listening to import/export plug-in services may be implemented by:
#define IMPORT_SERVICE(x)\
nullptr==Extensions::PluginServiceGlobal::findService<x>(#x)?\
new x(this):Extensions::PluginServiceGlobal::findService<x>(#x);\
Extensions::PluginServiceGlobal::addImporter(#x,this->metaObject()->class Name());
#define EXPORT_SERVICE(x)\
nullptr==Extensions::PluginServiceGlobal::findService<x>(#x)?\
0:Extensions::PluginServiceGlobal::delFreeService<x>(#x);\
Extensions::PluginServiceGlobal::delImporter(#x)。
wherein, in IMPORT _ SERVICE (x) and EXPORT _ SERVICE (x), the x parameter is the implemented plug-in service function.
In the macro function of the IMPORT interface IMPORT _ SERVICE, adding the plug-in SERVICE function x to the global SERVICE table can be realized by using the addindicator function of the global SERVICE table.
In EXPORT interface EXPORT _ SERVICE, deletion of plug-in SERVICE function x from the global SERVICE table may be implemented using the delaporter function that the global SERVICE table has.
In addition, the service object can be obtained by calling an access function in the global service table to realize access to the plug-in service, and the specific codes are as follows:
template<class T=PluginService>
static T*findService(const QString&serviceName)
{
return static_cast<T*>(s_services.value(serviceName));
}。
according to the plug-in loading system constructed by the construction method of the plug-in loading system, the plug-in service and the plug-in modules adopt a separated structure and are positioned at different levels, each plug-in module of the plug-in layer depends on a uniform plug-in service layer, and the plug-in service layer does not depend on the plug-in layer. Based on the hierarchical relationship of the unidirectional association, each plug-in module of the plug-in layer can use the plug-in service of the plug-in service layer, and the association relationship of dynamic link does not exist among the plug-in modules, so that the physical isolation characteristic among the plug-in modules is realized, and the problem of plug-in isolation loss can be fundamentally solved.
In addition, after the plug-in service is separated according to the technical scheme of the invention, the separated plug-in service is an independent dynamic library, when the plug-in service needs to be expanded, a plug-in module does not need to be compiled again, and only the plug-in service needs to be constructed, so that the plug-in service can be expanded flexibly, the construction time is saved, and the construction efficiency is improved.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U.S. disks, floppy disks, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the mobile terminal generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the method of constructing a plug-in loading system of the present invention according to instructions in the program code stored in the memory.
By way of example, and not limitation, readable media may comprise readable storage media and communication media. Readable storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with examples of this invention. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments.
Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The present invention has been disclosed in an illustrative rather than a restrictive sense with respect to the scope of the invention, as defined in the appended claims.

Claims (11)

1. A method for constructing a plug-in loading system comprises the following steps:
building one or more plug-in services, and building a plug-in service layer based on the one or more plug-in services;
constructing one or more plug-in modules at the lower layer of the plug-in service layer, and forming the plug-in layer based on the one or more plug-in modules, wherein each plug-in module of the plug-in layer is dynamically linked to the plug-in service layer, and the one or more plug-in modules are isolated from each other; and
and constructing an executive program below the plug-in layer, wherein the executive program is suitable for loading one or more plug-in modules so as to call the plug-in services of the plug-in service layer dynamically linked with the plug-in modules.
2. The method of claim 1, wherein the plug-in service is adapted to publish a service interface and communicate with one or more plug-in modules through the service interface such that the one or more plug-in modules access the service module through the service interface.
3. The method of claim 1 or 2, wherein the plug-in service comprises a file reading service.
4. The method of claim 3, wherein building a plug-in layer based on one or more plug-in modules comprises:
constructing a core plug-in module, and setting the core plug-in module to refer to the file reading service;
constructing a sender plug-in module, and setting the sender plug-in module to refer to the file reading service;
constructing a processor plug-in module, and setting the processor plug-in module to refer to the file reading service;
a plug-in layer is formed based on the core plug-in module, sender plug-in module, and processor plug-in module.
5. The method according to any one of claims 1-4, further comprising the step of:
calling an import interface to import a new plug-in service into the plug-in service layer;
and calling an export interface to delete the plug-in service of the plug-in service layer.
6. The method of claim 5, wherein the plug-in services of the plug-in services layer are managed based on a global services table;
the global service table comprises one or more plug-in service functions, and each plug-in service function corresponds to one plug-in service of the plug-in service layer.
7. The method of claim 6, wherein invoking an import interface to import a new plug-in service into the plug-in service layer comprises:
and calling an addindicator function in the import interface so as to import a new plug-in service function into the global service table.
8. The method of claim 6, wherein invoking an export interface to delete a plug-in service of the plug-in service layer comprises:
and calling a delaporter function in the export interface so as to delete the plug-in service function in the global service table.
9. A plug-in loading system comprising:
a plug-in service layer comprising one or more plug-in services;
a plug-in layer arranged below the plug-in service layer, wherein the plug-in layer comprises one or more plug-in modules, each plug-in module is dynamically linked to the plug-in service layer, and the one or more plug-in modules are isolated from each other; and
and the executive program is arranged below the plug-in layer and is suitable for loading one or more plug-in modules so as to call the plug-in services of the plug-in service layer dynamically linked with the plug-in modules.
10. A computing device, comprising:
at least one processor; and
a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-8.
11. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1-8.
CN202111341605.3A2021-11-122021-11-12 Construction method of plug-in loading system, plug-in loading system and computing devicePendingCN113986206A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202111341605.3ACN113986206A (en)2021-11-122021-11-12 Construction method of plug-in loading system, plug-in loading system and computing device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202111341605.3ACN113986206A (en)2021-11-122021-11-12 Construction method of plug-in loading system, plug-in loading system and computing device

Publications (1)

Publication NumberPublication Date
CN113986206Atrue CN113986206A (en)2022-01-28

Family

ID=79748294

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202111341605.3APendingCN113986206A (en)2021-11-122021-11-12 Construction method of plug-in loading system, plug-in loading system and computing device

Country Status (1)

CountryLink
CN (1)CN113986206A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114546538A (en)*2022-04-272022-05-27季华实验室OSgi-based virtual simulation platform construction method
CN115080058A (en)*2022-06-282022-09-20重庆长安汽车股份有限公司 An implementation method of compiling plug-in based on Android system
CN116414386A (en)*2023-01-182023-07-11之江实验室 A VUE-based plug-in development system and method

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US6148336A (en)*1998-03-132000-11-14Deterministic Networks, Inc.Ordering of multiple plugin applications using extensible layered service provider with network traffic filtering
US7433935B1 (en)*2005-04-292008-10-07Hewlett-Packard Development Company, L.P.Self-adapting plug-in service
CN102109981A (en)*2009-12-252011-06-29奥林网络科技(宁波)有限公司Real-time communication universal plug-in
CN103064886A (en)*2012-12-072013-04-24百度在线网络技术(北京)有限公司Method for supporting multiple browsers and plug-in
CN111610979A (en)*2020-04-152020-09-01河南大学 An API gateway optimized for persistence and coupling and its method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US6148336A (en)*1998-03-132000-11-14Deterministic Networks, Inc.Ordering of multiple plugin applications using extensible layered service provider with network traffic filtering
US7433935B1 (en)*2005-04-292008-10-07Hewlett-Packard Development Company, L.P.Self-adapting plug-in service
CN102109981A (en)*2009-12-252011-06-29奥林网络科技(宁波)有限公司Real-time communication universal plug-in
CN103064886A (en)*2012-12-072013-04-24百度在线网络技术(北京)有限公司Method for supporting multiple browsers and plug-in
CN111610979A (en)*2020-04-152020-09-01河南大学 An API gateway optimized for persistence and coupling and its method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
沃伟峰, 吴蕾, 顾松山: "插件技术在天气雷达数据处理软件中的应用", 南京气象学院学报, vol. 27, no. 6, 25 December 2004 (2004-12-25), pages 806 - 813*

Cited By (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114546538A (en)*2022-04-272022-05-27季华实验室OSgi-based virtual simulation platform construction method
CN115080058A (en)*2022-06-282022-09-20重庆长安汽车股份有限公司 An implementation method of compiling plug-in based on Android system
CN116414386A (en)*2023-01-182023-07-11之江实验室 A VUE-based plug-in development system and method

Similar Documents

PublicationPublication DateTitle
US11941381B2 (en)Method for compiling from a high-level scripting language to a blockchain native scripting language
CN113986206A (en) Construction method of plug-in loading system, plug-in loading system and computing device
JP5857072B2 (en) Expansion of quantifiers to control the order of entry and / or exit of automata
JP5763783B2 (en) Method and apparatus for compiling regular expressions
CN113986515B (en)Method and device for creating sandbox environment for plug-in operation and computing equipment
US10579381B2 (en)Encoding and decoding variable length instructions
JP2014506693A5 (en)
WO2022148390A1 (en)Methods for deploying, updating and calling smart contract in blockchain
US20210365253A1 (en)Heterogeneity-agnostic and topology-agnostic data plane programming
CN101111834A (en) Dynamically Reconfigurable Processor
JP7669696B2 (en) OPC UA SERVER, SYSTEM PROCESSING USING OPC UA, AND METHOD FOR RUNNING OPC UA SYSTEM
CN102289367B (en)Command-line shell order according to pattern generates
CN114327477A (en)Intelligent contract execution method and device, electronic device and storage medium
CN113194127B (en) A data storage method, data transmission method and computing device
CN109491806A (en)Adaptation method and device between a kind of kernel and third-party application
US7818719B2 (en)Extending expression-based syntax for creating object instances
CN103235745B (en)A kind of address conflict detecting method and device
CN111913814A (en)Object copying method and computing equipment
US8752075B1 (en)Method for data transport
CN116600025A (en) Data protocol conversion method, device and storage medium supporting configuration
CN114491366A (en)Method and device for mounting instances on multiple document object model nodes
CN114546475A (en)Service system management method and device
CN114185556A (en)Intelligent contract deployment method, device, equipment and storage medium
CN116578281B (en) Web page development method, system, electronic device and storage medium based on code package
CN118689456A (en) Fact object flexible expansion method, system, equipment and medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination

[8]ページ先頭

©2009-2025 Movatter.jp