Plug-in calling method and device, equipment, storage medium and program product
By introducing a management intermediate layer in plug-in and modular application scenarios, the direct dependence between target project programs and third-party platform plug-ins is decoupled, and the problems of high development and maintenance costs and long iteration cycles in traditional plug-in calling methods are solved, and the problem of high development and maintenance costs and long iteration cycles are achieved. Efficient and flexible plug-in calls.
Patent Information
- Application Number
- CN202411568653.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-18
AI Technical Summary
Traditional plug-in calling methods have limitations in plug-in and modular application scenarios, resulting in increased development and maintenance costs, extended iteration cycles, and unable to respond to market changes quickly.
The management intermediate layer is introduced, and the management intermediate layer is connected to the target project program and third-party platform, responds to plug-in call requests, determines the target interface and target plug-in resources, and schedules bindings to achieve the target project program calling the target plug-in resources through the target interface.
By managing the intermediate layer decoupling of the direct dependence between target project programs and third-party platform plug-ins, the flexibility and efficiency of plug-in calls are improved, and the situation of frequent recompilation and testing is reduced due to plug-in changes is significantly improved, and development and maintenance are significantly improved overall efficiency.
Smart Images

Figure CN119473655A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a plug-in calling method, device, equipment, storage medium and program product. Background Art
[0002] In modern software development, interface calling is a crucial technology. Whether it is the communication between modules within an application or the interaction between different applications, it needs to be implemented through a series of well-defined interfaces.
[0003] However, in the traditional development model, interface calls often have certain limitations, especially in plug-in and modular application scenarios. The traditional method is usually to hard-code the plug-in call logic into the main project. Once the business requirements change, the code of the main project needs to be modified, recompiled and released. This increases the cost of development and maintenance, prolongs the iteration cycle, and reduces the speed of responding to market changes.
[0004] Therefore, a flexible plug-in calling method is urgently needed. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a plug-in calling method. One or more embodiments of the present invention also relate to a plug-in calling device, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.
[0006] According to a first aspect of an embodiment of the present invention, a plug-in calling method is provided, which is applied to a management middle layer, where the management middle layer is connected to a target project program and a third-party platform respectively, and includes: In response to a plug-in call request of a target project program, determining a target interface among external interfaces pre-registered by the target project program, wherein the plug-in call request includes a target plug-in identifier; Based on the target plug-in identifier, determine the target plug-in resource from the plug-in resources preloaded on the third-party platform; The scheduling target interface is bound to the target plug-in resource so that the target project program calls the target plug-in resource through the target interface.
[0007] According to a second aspect of an embodiment of the present invention, a plug-in calling device is provided, comprising: A first determination module is configured to determine a target interface from external interfaces pre-registered by the target project program in response to a plug-in call request of the target project program, wherein the plug-in call request includes a target plug-in identifier; A second determination module is configured to determine a target plug-in resource from plug-in resources preloaded on the third-party platform based on the target plug-in identifier; The scheduling module is configured to schedule the binding of the target interface and the target plug-in resource so that the target project program calls the target plug-in resource through the target interface.
[0008] According to a third aspect of an embodiment of the present invention, there is provided a computing device, including: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above-mentioned plug-in calling method are implemented.
[0009] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the above-mentioned plug-in calling method are implemented.
[0010] According to a fifth aspect of an embodiment of the present invention, a computer program product is provided, including a computer program / instruction, which implements the steps of the above-mentioned plug-in calling method when executed by a processor.
[0011] An embodiment of the present invention realizes that in response to a plug-in call request of a target project program, a target interface is determined in an external interface pre-registered by the target project program, wherein the plug-in call request includes a target plug-in identifier; based on the target plug-in identifier, a target plug-in resource is determined in plug-in resources pre-loaded on a third-party platform; and the target interface is scheduled to be bound to the target plug-in resource so that the target project program calls the target plug-in resource through the target interface. By introducing a management middle layer, the direct dependency between the target project program and the third-party platform plug-in is effectively decoupled. When the target project program issues a plug-in call request, the method can quickly locate the required target interface in the pre-registered external interface, and find a matching target plug-in resource from the loaded plug-in resources, and then establish a connection between the two. The flexibility and efficiency of plug-in calls are improved, and the situation in which the target project program needs to be frequently recompiled and tested due to plug-in changes is reduced, thereby significantly improving the overall efficiency of development and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 This is an interactive schematic diagram of a plug-in calling system provided by an embodiment of the present invention; Figure 2 is a flow chart of a plug-in calling method provided by an embodiment of the present invention; Figure 3 It is a structural diagram of a plug-in calling system applied to a Lua script provided by an embodiment of the present invention; Figure 4It is a structural diagram of a plug-in calling device provided by an embodiment of the present invention; Figure 5 It is a structural block diagram of a computing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0013] Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present invention, so the present invention is not limited to the specific implementation disclosed below.
[0014] The terms used in one or more embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present invention. The singular forms of "a", "said" and "the" used in one or more embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present invention refers to and includes any or all possible combinations of one or more associated listed items.
[0015] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present invention, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present invention, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0016] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0017] First, the terms involved in one or more embodiments of the present invention are explained.
[0018] Lua: Lua is a lightweight, efficient scripting language that is commonly used in embedded applications and game development.
[0019] With the rapid development of information technology, the complexity of software systems is increasing. Especially in large-scale applications and service frameworks, systems often need to integrate multiple functional modules or third-party plug-ins to implement complex business logic. In traditional software architecture design, the main project program usually integrates and calls these plug-ins or modules in a hard-coded way. Although this method can quickly achieve functional integration in the early stage, it exposes a series of problems in the long-term maintenance and development process. With the changes in market demand and the advancement of technology, software projects not only need to be highly flexible, but also be able to quickly adapt to changes in the business environment, which puts higher requirements on software architecture.
[0020] However, in the traditional method, if the main project program needs to use a plug-in, the usual practice is to directly introduce the plug-in through code in the main project and call the interface provided by the plug-in to perform calculations. This method means that the plug-in must be compiled and packaged together with the main project. Once the main project needs to be updated or the plug-in needs to be upgraded, the entire project must be reintegrated and compiled. This approach not only increases the workload of development and maintenance, but also increases the difficulty of version control. Especially when the plug-in logic is embedded in the main project, any changes may cause the main project to be unstable, which in turn affects the quality and reliability of the entire system. In addition, for some special project environments, it may be necessary to customize the development of plug-in projects, which not only consumes additional time and resources, but also increases the complexity of the project because it needs to modify or customize various interfaces, which reduces development efficiency and lacks sufficient flexibility to cope with rapidly changing market demands.
[0021] In response to the above problems, the present invention provides a plug-in calling method. The present invention also relates to a plug-in calling method, a plug-in calling device, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.
[0022] See also Figure 1 , Figure 1 It is an interactive schematic diagram of a plug-in calling system provided by an embodiment of the present invention. The plug-in calling system includes a target project program, a management middle layer and a third-party platform, and the management middle layer is connected to the target project program and the third-party platform respectively. The target project program is used to register an external interface with the management middle layer; the third-party platform is used to load plug-in resources to the management middle layer; the management middle layer is used to respond to the plug-in calling request of the target project program, and determine the target interface in the external interface pre-registered by the target project program, wherein the plug-in calling request includes a target plug-in identifier; based on the target plug-in identifier, determine the target plug-in resource in the plug-in resources pre-loaded on the third-party platform; schedule the target interface to bind with the target plug-in resource, so that the target project program calls the target plug-in resource through the target interface.
[0023] Applied to the plug-in calling system, the direct dependency between the target project program and the third-party platform plug-in is effectively decoupled by introducing a management middle layer. When the target project program issues a plug-in calling request, the management middle layer can respond quickly and determine the target interface in the external interface pre-registered by the target project program. At the same time, according to the target plug-in identifier contained in the request, the matching target plug-in resource is accurately located from the plug-in resources pre-loaded by the third-party platform, and the target interface is bound to the target plug-in resource through the scheduling mechanism, so that the target project program can smoothly call the target plug-in resource through the target interface. This series of processes not only improves the flexibility and efficiency of plug-in calling, but also greatly reduces the need for frequent recompilation and testing of target project programs due to plug-in changes, thereby significantly improving the overall efficiency of development and maintenance.
[0024] See also Figure 2 , Figure 2 It is a flow chart of a plug-in calling method provided by an embodiment of the present invention, which specifically includes the following steps.
[0025] Step 202: In response to a plug-in calling request of a target project program, a target interface is determined from external interfaces pre-registered by the target project program, wherein the plug-in calling request includes a target plug-in identifier.
[0026] Among them, the target interface is used to establish a communication bridge between the target project program and the plug-in, and the target plug-in identifier is an identifier used to uniquely identify a specific plug-in.
[0027] In actual applications, when the target project program needs to call a plug-in function, it will send a plug-in call request containing a target plug-in identifier. After receiving the request, the management middle layer first parses the target plug-in identifier in the request to determine which specific plug-in function is requested. Then, the management middle layer searches for the target interface corresponding to the target plug-in identifier in the request in the list of external interfaces pre-registered by the target project program. The pre-registered external interface list usually contains all functional interfaces that can be called by the plug-in and their related information. For the step of responding to the plug-in call request of the target project program, one implementation method is that the management middle layer listens to the request message queue from the target project program and processes it once a new request is detected; another implementation method is that the management middle layer adopts an event-driven architecture, and triggers the event processor when the target project program issues a request, thereby starting the processing flow. The management middle layer parses the target plug-in identifier in the request, and then matches the corresponding target interface in the registry according to the identifier. The registry can be a data structure, such as a hash table or a dictionary, in which the key is the plug-in identifier and the value is the target interface information corresponding to the plug-in. Once a matching target interface is found, the management middle layer will prepare to call the interface to respond to the request of the target project program.
[0028] In a specific embodiment of the present invention, assuming that the target project program needs to call the function of an image processing plug-in, it will send a request containing the image processing plug-in identifier. After receiving the request, the management middle layer extracts the plug-in identifier from the request, and then searches for the interface corresponding to the identifier in the pre-registered interface list. Assuming that there is an interface named "ImageProcess" in the pre-registered interface list that matches the plug-in identifier in the request, the management middle layer will prepare to call the "ImageProcess" interface. If the request contains more details, such as the specific image processing operations that need to be performed (such as rotation, scaling, etc.), the management middle layer will also parse this information and prepare the corresponding parameters for use when calling the interface.
[0029] Step 204: Based on the target plug-in identifier, determine the target plug-in resource from the plug-in resources preloaded on the third-party platform.
[0030] The target plug-in resource refers to an actual plug-in function or code module that is pre-loaded on a third-party platform and corresponds to a specific plug-in identifier.
[0031] In actual applications, when the management middle layer receives a plug-in call request containing a target plug-in identifier, it searches for a matching target plug-in resource in the plug-in resource list preloaded by the third-party platform based on the target plug-in identifier. The plug-in resource list preloaded by the third-party platform is a collection of all available plug-ins and their corresponding identifiers. The management middle layer needs to traverse this list to find a plug-in resource that matches the target plug-in identifier in the request. For the step based on the target plug-in identifier, one implementation method is that the management middle layer quickly locates the target plug-in resource by querying a pre-established plug-in resource index database; another implementation method is that the management middle layer uses a hash table or other efficient data structure to store plug-in resources and their identifiers, thereby achieving fast search. Once a matching target plug-in resource is found, the management middle layer will prepare to call the resource. If the plug-in resource exists in the form of a dynamic link library (DLL), the management middle layer needs to load the corresponding library file; if it exists in the form of a Lua script, the corresponding script file needs to be loaded in the Lua environment.
[0032] In a specific embodiment of the present invention, it is assumed that the target project program has issued a request containing an image processing plug-in identifier. The management middle layer first parses the plug-in identifier in the request, and then searches for resources that match the identifier in the pre-loaded plug-in resource list. Assume that there is an entry in the pre-loaded plug-in resource list that matches the image processing plug-in identifier in the request, and the entry points to an image processing plug-in module that has been loaded into the memory. The management middle layer marks the found image processing plug-in module as a target plug-in resource and prepares for subsequent calling operations. If the image processing plug-in exists in the form of a DLL, the management middle layer will ensure that the DLL has been correctly loaded into the memory; if it exists in the form of a Lua script, the management middle layer will load and prepare the script in the Lua environment so that the functions therein can be called at any time.
[0033] Furthermore, based on the target plug-in identifier, the target plug-in resource is determined in the plug-in resources pre-loaded on the third-party platform, including: when a project parameter is detected that is passed in by the target project program through the target interface, determining whether the project parameter is a calling parameter through a pre-configured judgment condition; if so, determining the target plug-in resource in the plug-in resources pre-loaded on the third-party platform based on the target plug-in identifier.
[0034] The target plug-in resource refers to the functional module or code segment pre-loaded on the third-party platform corresponding to the specific plug-in identifier. The project parameter is the parameter passed in by the target project program through the target interface, which is used to indicate or configure the call of the plug-in. The call parameter refers to those parameters that explicitly indicate the need to call a specific plug-in function.
[0035] In actual applications, when the management middle layer receives the project parameters passed in by the target project program through the target interface, it first needs to determine whether these parameters are call parameters. This process usually involves checking the content of the project parameters to see whether they meet the pre-configured judgment conditions. If the detected project parameters are indeed call parameters, then further based on the target plug-in identifier, the corresponding target plug-in resources are searched and determined in the plug-in resources pre-loaded by the third-party platform. The pre-configured judgment conditions can be a set of rules or algorithms for distinguishing which parameters are used to call plug-ins and which are not. For example, these conditions can check the format, keywords or specific flags of the parameters. Once it is determined that the project parameters are call parameters, the management middle layer will use the target plug-in identifier to find the target plug-in resource matching it in the pre-loaded plug-in resource list. The plug-in resource list is a data structure containing all available plug-ins and their identifiers. The management middle layer finds the plug-in resource corresponding to the target plug-in identifier by traversing the list. For the step, in the case of detecting the project parameters passed in by the target project program through the target interface, one implementation method is that the management middle layer parses the passed-in parameters and applies pre-set rules to determine whether they are call parameters; another implementation method is that the management middle layer uses regular expressions or other pattern matching technologies to automatically identify call parameters. Once the project parameter is determined to be a call parameter, the management middle layer searches for the target plug-in resource in the pre-loaded plug-in resources based on the target plug-in identifier. This search process can be accelerated by a hash table or other efficient data structures.
[0036] In a specific embodiment of the present invention, it is assumed that the target project program needs to call the function of an image processing plug-in, and a set of project parameters are passed in through the target interface. After receiving these parameters, the management middle layer first checks whether the call parameters are included. Assuming that the pre-configured judgment condition is to check whether the keyword "process" exists, if it is detected that the project parameter contains "process", the project parameter is considered to be a call parameter. Next, the management middle layer extracts the target plug-in identifier from the project parameter and searches for a plug-in resource matching the identifier in the pre-loaded plug-in resource list. Assuming that there is an entry in the pre-loaded plug-in resource list that matches the image processing plug-in identifier in the request, the entry points to an image processing plug-in module that has been loaded into the memory. The management middle layer marks the found image processing plug-in module as a target plug-in resource and prepares for subsequent call operations. If the image processing plug-in exists in the form of a DLL, the management middle layer will ensure that the DLL has been correctly loaded into the memory; if it exists in the form of a Lua script, the management middle layer will load and prepare the script in the Lua environment so that the function therein can be called at any time.
[0037] Based on this, by determining the target plug-in resource in the plug-in resources pre-loaded on the third-party platform based on the target plug-in identifier, and identifying the call parameters through the pre-configured judgment conditions, it can be ensured that the management middle layer accurately finds and prepares the correct plug-in resource for subsequent calls. This method not only improves the efficiency of plug-in calls, but also enhances the flexibility and maintainability of the system, because even if the plug-in resources change, as long as the plug-in identifier and call parameters remain unchanged, there is no need to modify the code in the target project program, thereby significantly improving the overall efficiency of development and maintenance. The system can quickly and accurately find and load the target plug-in resources, thereby ensuring the correct execution of the plug-in function.
[0038] Step 206: Schedule the target interface to bind with the target plug-in resource, so that the target project program calls the target plug-in resource through the target interface.
[0039] The scheduling target interface and target plug-in resource binding refers to associating the target interface that the target project program needs to call with the determined target plug-in resource in the management middle layer, so that the target project program can call the function of the target plug-in resource through the interface.
[0040] In actual applications, after the management middle layer determines the target interface and the target plug-in resource, the next step is to bind the two. This process usually involves creating a connection or mapping relationship, so that each time the target project program initiates a request through the target interface, it actually indirectly calls the function of the target plug-in resource. For the step scheduling target interface and target plug-in resource binding, one implementation method is that the management middle layer creates a proxy object, which acts as an intermediary between the target interface and the target plug-in resource. All requests through the target interface will be captured by the proxy object and forwarded to the target plug-in resource; another implementation method is that the management middle layer maintains a routing table or mapping table internally, records the correspondence between the target interface and the target plug-in resource, and when a request arrives, redirects the request to the corresponding plug-in resource according to the routing table. Once the binding is completed, the management middle layer can ensure that each request initiated by the target project program through the target interface can correctly reach the target plug-in resource and obtain the corresponding response. For example, if the target plug-in resource exists in the form of a dynamic link library (DLL), then the scheduling module needs to ensure that the corresponding function in the DLL can be called through the target interface; if the target plug-in resource is a Lua script, it is necessary to ensure that the corresponding function in the Lua environment can be called through the target interface.
[0041] In a specific embodiment of the present invention, it is assumed that the target project program needs to call the function of an image processing plug-in, and the management middle layer has determined the corresponding target interface and target plug-in resources. At this time, the management middle layer will create a binding so that each time the target project program initiates a request through the target interface, it is actually calling the function of the image processing plug-in. For example, the management middle layer can create a proxy object, and when the target project program calls the target interface, the proxy object intercepts the request and forwards the request to the image processing plug-in. If the image processing plug-in exists in the form of a DLL, the management middle layer needs to ensure that the corresponding function in the DLL can be called through the target interface; if the image processing plug-in exists in the form of a Lua script, the management middle layer needs to ensure that the corresponding function in the Lua environment can be called through the target interface. Once the binding is completed, the target project program can call the function of the image processing plug-in just like calling a local function, without having to worry about the specific implementation details of the plug-in.
[0042] Furthermore, the target interface is scheduled to be bound to the target plug-in resource so that the target project program calls the target plug-in resource through the target interface, including: scheduling the target interface to be bound to the target plug-in resource; obtaining the data information pre-registered by the target project program, and calling the target plug-in resource to execute the plug-in processing logic based on the data information to obtain the processing result; returning the processing result to the target project program through the target interface.
[0043] Among them, scheduling the binding of the target interface and the target plug-in resource refers to associating the target interface that the target project program needs to call with the determined target plug-in resource in the management middle layer, so that the target project program can call the function of the target plug-in resource through the interface. The data information pre-registered by the target project program refers to the data pre-defined and registered in the target project program, which will play a key role in the plug-in processing logic.
[0044] In actual applications, after the management middle layer determines the target interface and the target plug-in resource, the first step is to schedule the binding of the target interface and the target plug-in resource. This process usually involves creating a connection or mapping relationship, so that each time the target project program initiates a request through the target interface, it actually indirectly calls the function of the target plug-in resource. For scheduling the binding of the target interface and the target plug-in resource, the management middle layer will create a proxy object or use a routing table to implement the mapping between the target interface and the target plug-in resource. Once the binding is completed, the management middle layer can ensure that each request initiated by the target project program through the target interface can correctly reach the target plug-in resource and obtain the corresponding response.
[0045] Next, the management middle layer needs to obtain the data information pre-registered by the target project program. This data information may include configuration parameters, initial data required for business logic, etc. The management middle layer extracts the necessary parameters from the pre-registered data information and calls the target plug-in resource to execute the plug-in processing logic based on this data information. For example, if the target plug-in resource is an image processing plug-in, the pre-registered data information may include the image file path, processing parameters (such as rotation angle, scaling, etc.). The management middle layer passes this information to the target plug-in resource, which executes the corresponding processing logic based on this information and generates processing results.
[0046] Finally, the management middle layer returns the processing result to the target project program through the target interface. This process ensures that the processing result can be accurately passed back to the target project program, so that the target project program can continue its subsequent logical processing or present the processing result. For example, if the result of the plug-in processing is a processed image file, the management middle layer will return the file to the target project program through the target interface for further processing or display.
[0047] In a specific embodiment of the present invention, it is assumed that the target project program needs to call the function of an image processing plug-in, and the management middle layer has determined the corresponding target interface and target plug-in resources. At this time, the management middle layer first binds the target interface to the image processing plug-in, so that each time the target project program initiates a request through the target interface, it is actually calling the function of the image processing plug-in. Then, the management middle layer obtains the image file path and processing parameters, such as rotation angle, scaling, etc., from the pre-registered data information. The management middle layer passes these parameters to the image processing plug-in, and the plug-in executes the image processing logic according to these parameters to generate the processing results. Finally, the management middle layer returns the processed image file to the target project program through the target interface, so that the target project program can continue its subsequent processing logic or display the processing results.
[0048] Based on this, by scheduling the target interface to bind with the target plug-in resource, and obtaining the data information pre-registered by the target project program to call the target plug-in resource to execute the plug-in processing logic, and finally returning the processing result to the target project program through the target interface, it can be ensured that the target project program can still efficiently call the plug-in function without directly relying on the internal implementation of the plug-in. This method not only improves the flexibility of plug-in calling, but also enhances the maintainability and scalability of the system, because even if the plug-in resource itself changes, as long as the target interface remains unchanged, the target project program can still work normally. The system can flexibly adjust the plug-in resources without affecting the normal operation of the target project program.
[0049] Furthermore, returning the processing result to the target project program through the target interface includes: determining the project format of the target project program, and changing the format of the processing result based on the project format to obtain a target format result; and returning the target format result to the target project program through the target interface.
[0050] Among them, the project format refers to the data format that the target project program expects to receive, the processing result refers to the data or information generated after the plug-in is processed, and the target format result refers to the result of the data format that meets the expectations of the target project program after the format change.
[0051] In actual applications, when the management middle layer receives the result of processing the target plug-in resource, it first needs to determine the data format expected by the target project program. This step usually involves consulting the data information or configuration file pre-registered by the target project program to obtain the requirements for the data format. After determining the project format, the management middle layer needs to change the format of the processing result to make it meet the format requirements of the target project program. This process may include but is not limited to data type conversion, data structure reorganization, encoding format adjustment, etc. For example, if the target project program expects to receive data in JSON format, and the processing result is in XML format, it is necessary to convert the XML format data into JSON format. For the step of determining the project format of the target project program and changing the format of the processing result based on the project format, one implementation method is that the management middle layer determines the format requirements by querying a pre-configured format mapping table, and uses the corresponding library function or tool class to perform format conversion; another implementation method is that the management middle layer uses a custom conversion logic to dynamically generate conversion code according to the project format requirements.
[0052] Once the processing results are converted to the target format, the management middle layer will return these results to the target project program through the target interface. This process ensures that the processing results can be accurately passed back in the format required by the target project program, so that the target project program can seamlessly receive and process these results. For example, if the target format result is JSON format data, the management middle layer will return this data to the target project program through the target interface, and the latter can immediately parse it and use it for further processing or display.
[0053] In a specific embodiment of the present invention, it is assumed that the target project program needs to call the function of an image processing plug-in, and the management middle layer has determined the corresponding target interface and target plug-in resources. After the plug-in processing is completed, a processing result is generated. It is assumed that the result exists in the form of a binary stream, and the data format expected by the target project program is a Base64-encoded string. At this time, the management middle layer first determines that the project format of the target project program is a Base64-encoded string, and then converts the binary stream into a Base64-encoded string. This conversion process can be implemented using a standard Base64 encoding library. After the conversion is completed, the management middle layer returns the Base64-encoded string to the target project program through the target interface, and the latter can immediately parse the string and perform further processing or display.
[0054] Based on this, by determining the project format of the target project program, changing the format of the processing results based on the project format, and finally returning the target format results to the target project program through the target interface, it can be ensured that the results processed by the plug-in can be passed to the target project program in the correct format. This method not only improves the flexibility of plug-in calls, but also enhances the maintainability and scalability of the system, because even if the format of the results processed by the plug-in changes, as long as the management middle layer can perform the corresponding format conversion, the target project program can still receive and process these results normally. The system can flexibly process data in different formats, thereby ensuring the correct execution of plug-in functions and the effective use of results.
[0055] Furthermore, in response to the plug-in call request of the target project program, before determining the target interface in the external interface pre-registered by the target project program, it also includes: receiving a registration request from the target project program, wherein the registration request includes an interface identifier and a data object; registering the interface information and data object corresponding to the interface identifier as global variables; loading the plug-in resources in the third-party platform; and in response to the configuration operation of the front-end user, completing the configuration operation of the call logic based on the global variables and the plug-in resources.
[0056] Among them, the interface identifier is used to uniquely identify the external interface pre-registered in the target project program, and the data object refers to the data entity or operation that the target project program hopes to open to the outside world. Global variables are variables or functions accessible globally in the Lua environment, used to store interface information and data objects. Plugin resources refer to functional modules or code segments pre-loaded in the third-party platform, which can be called by the target project program.
[0057] In actual applications, the management middle layer first needs to receive the registration request sent by the target project program. The registration request contains the interface identifier and data object, which are used to describe the functional interface and related data that the target project program wants to open to the outside world. After receiving the registration request, the management middle layer registers the interface information and data object corresponding to the interface identifier as global variables. This means that the management middle layer will store these interface information and data objects in a globally accessible variable or function so that they can be referenced and called in the Lua environment. The process of registering as a global variable usually involves creating a mapping table or dictionary, where the key is the interface identifier and the value is the interface information and data object.
[0058] Next, the management middle layer loads the plug-in resources in the third-party platform. This step is to ensure that when the target project program needs to call the plug-in function, the corresponding plug-in resources have been loaded and are ready for calling. The process of loading plug-in resources may include downloading plug-in files from the third-party platform, loading plug-in files into memory, or registering plug-in functions in the Lua environment. By pre-loading plug-in resources, the delay when actually calling the plug-in can be reduced and the system response speed can be improved.
[0059] After the above preparations are completed, the management middle layer can respond to the configuration operations of the front-end user. The front-end user may need to configure different plug-in call logic according to business needs. The management middle layer completes the configuration operation of the call logic based on global variables and plug-in resources, which means that according to the configuration instructions of the front-end user, the management middle layer will dynamically organize and adjust the logic of plug-in calls. For example, the front-end user may configure a specific plug-in call order, or set a specific plug-in call strategy under certain conditions. Based on these configurations, the management middle layer uses the interface information and data objects in the global variables, as well as the loaded plug-in resources, to implement the user-specified call logic.
[0060] In a specific embodiment of the present invention, it is assumed that the target project program needs to open a set of functional interfaces to the outside, including an image processing interface and a data query interface. The target project program sends a registration request to the management middle layer, and the request includes the identifiers of these interfaces and related data objects. After receiving the request, the management middle layer registers these interface identifiers and data objects as global variables so that they can be referenced in the Lua environment. Then, the management middle layer loads the image processing plug-in and data query plug-in in the third-party platform. These plug-in resources are loaded into the memory and registered as callable functions or objects in the Lua environment. Subsequently, the front-end user sets the order and conditions of image processing through the configuration interface. The management middle layer organizes the call logic of image processing based on the user's configuration, using the interface information in the global variables and the loaded plug-in resources. For example, the user may configure to call the image compression plug-in first, and then call the image sharpening plug-in. Based on this configuration, the management middle layer dynamically adjusts the order of plug-in calls to ensure that the image processing process is executed according to the user's needs.
[0061] Based on this, by receiving the registration request of the target project program, registering the interface information and data objects corresponding to the interface identifier as global variables, pre-loading the plug-in resources in the third-party platform, and responding to the configuration operations of the front-end users to complete the configuration operations of the call logic, it can ensure that the management middle layer can flexibly manage and schedule plug-in resources and improve the configurability and response speed of the system. This method not only enhances the flexibility and maintainability of the system, but also enables front-end users to dynamically adjust the plug-in call logic according to actual business needs, thereby significantly improving the overall efficiency of development and maintenance. The system can quickly respond to user configuration changes to ensure the correct execution of plug-in functions and the effective use of results.
[0062] Furthermore, after completing the calling logic configuration operation based on the global variables and the plug-in resources in response to the configuration operation of the front-end user, it also includes: responding to the dynamic adjustment instruction of the front-end user to perform the adjustment operation on the calling logic.
[0063] The dynamic adjustment instructions of the front-end users refer to the instructions put forward by the users at runtime to modify or optimize the existing call logic in real time according to the actual situation or demand changes. The call logic configuration operation refers to the process of adjusting the plug-in call sequence, conditions or other parameter settings according to the user instructions.
[0064] In actual applications, after the management middle layer completes the initial call logic configuration operation based on global variables and plug-in resources, it still needs to be able to respond to dynamic adjustment instructions from front-end users. This is because business requirements may change during operation, and users need to be able to adjust the plug-in call logic in real time to adapt to new situations. When the management middle layer receives dynamic adjustment instructions from front-end users, it will perform adjustment operations on the call logic based on these instructions. This process usually includes but is not limited to reconfiguring the call order of plug-ins, modifying call conditions or parameter settings, etc.
[0065] For the step of responding to the dynamic adjustment instructions of the front-end user, one implementation method is that the management middle layer monitors the input events of the front-end user interface, and when the adjustment instructions issued by the user are detected, the calling logic configuration is updated immediately; another implementation method is that the management middle layer provides an API port, through which the front-end user can send adjustment instructions, and the management middle layer makes corresponding logic adjustments after receiving the instructions. For example, if the user needs to adjust the calling order of plug-in A and plug-in B, the management middle layer will reconfigure the plug-in calling process according to the new order; if the user needs to call plug-in C under specific conditions, the management middle layer will update the conditional judgment logic to ensure that the corresponding plug-in is called when the conditions are met.
[0066] In a specific embodiment of the present invention, it is assumed that the front-end user finds that the order of image processing needs to be adjusted when using the image processing function. The user issues a dynamic adjustment instruction through the front-end interface, requesting to call the image sharpening plug-in first, and then call the image compression plug-in. After receiving this instruction, the management middle layer immediately updates the calling logic configuration and rearranges the calling order of the plug-ins. If the user also wants to call the image compression plug-in under specific conditions, for example, when the image size exceeds a certain threshold, the management middle layer will update the logic configuration according to this condition to ensure that the image compression plug-in is called only when the condition is met. In addition, if the user needs to modify the parameter settings of the plug-in, such as adjusting the image compression ratio, the management middle layer will also update the parameter configuration of the plug-in according to the user's instructions.
[0067] Based on this, by responding to the dynamic adjustment instructions of the front-end user and performing adjustment operations on the call logic, it can ensure that the system can adapt to changes in business needs in real time and improve the flexibility and response speed of the system. This method not only enhances the configurability of the system, but also enables the front-end user to dynamically adjust the plug-in call logic according to actual business needs, thereby significantly improving the overall efficiency of development and maintenance. The system can quickly respond to user configuration changes to ensure the correct execution of plug-in functions and the effective use of results.
[0068] An embodiment of the present invention realizes that in response to a plug-in call request of a target project program, a target interface is determined in an external interface pre-registered by the target project program, wherein the plug-in call request includes a target plug-in identifier; based on the target plug-in identifier, a target plug-in resource is determined in plug-in resources pre-loaded on a third-party platform; and the target interface is scheduled to be bound to the target plug-in resource so that the target project program calls the target plug-in resource through the target interface. By introducing a management middle layer, the direct dependency between the target project program and the third-party platform plug-in is effectively decoupled. When the target project program issues a plug-in call request, the method can quickly locate the required target interface in the pre-registered external interface, and find a matching target plug-in resource from the loaded plug-in resources, and then establish a connection between the two. The flexibility and efficiency of plug-in calls are improved, and the situation in which the target project program needs to be frequently recompiled and tested due to plug-in changes is reduced, thereby significantly improving the overall efficiency of development and maintenance.
[0069] The following combination Figure 3 , taking the application of the plug-in calling method provided by the present invention in a lua script as an example, the plug-in calling method is further described. Figure 3 The present invention provides a schematic diagram of a plug-in calling system for a Lua script, which specifically includes the following components.
[0070] Main project engineering: The part directly facing users needs to call the functions of external plug-ins. In order to more flexibly support changes in business needs, the main project is connected to the LuaInterface module, and the operation interfaces and data objects that need to be authorized and opened to the outside are planned.
[0071] The Lua collective operation management center includes transaction operation entry, event and data objects of registered main projects, plug-in object management center, user business logic extension module, and loading of external plug-in objects.
[0072] Transaction operation entry: implements the interface entry that the main project needs to call in the Lua integrated operating system, allowing the main project to interact with the Lua environment through these interfaces and perform specific operations.
[0073] Register the events and data objects of the main project: Through the functions of the LuaInterface module, the function interfaces and data objects that need to be open to the outside world in the main project are registered in the Lua global variables and managed in a unified manner so that these interfaces and data objects can be accessed and called in the Lua script.
[0074] Plugin Object Management Center: Creates a module for managing external plugin objects, allowing developers to easily call these plugin objects in Lua scripts to perform data processing or logical operations.
[0075] User business logic extension module: It is part of the Lua integrated operating system and allows users to extend their business logic as needed without having to modify the code of the main project or the plug-in itself, thus increasing the flexibility of the system.
[0076] Loading external plug-in objects: Develop a plug-in loading module compatible with various platform types to dynamically load and unload external plug-in objects at runtime to improve the scalability and maintainability of the system.
[0077] External plug-in resources: refers to various plug-ins that already exist on third-party platforms. These plug-ins can be dynamically loaded into the Lua integrated operation management center and managed and called through the plug-in object management center.
[0078] The main project is completely decoupled from the plug-in call, and the plug-in call logic is no longer statically placed in the main project as before. This system places the plug-in call processing in an external Lua module, so there is no need to frequently modify and recompile and package the main project and plug-in project, which reduces the release and testing costs of the main project version. Since Lua is a non-compiled scripting language, it can be tested immediately after adjustment, so the efficiency of maintenance and verification testing will be significantly improved. In addition, the system can register and obtain the operation interface of the main project, so that it can well support the changing business needs of users and provide great flexibility.
[0079] Corresponding to the above method embodiment, the present invention also provides a plug-in calling device embodiment, Figure 4 FIG. 1 is a schematic diagram of a plug-in calling device provided by an embodiment of the present invention. Figure 4 As shown, the device comprises: A first determination module 402 is configured to determine a target interface from external interfaces pre-registered by the target project program in response to a plug-in call request of the target project program, wherein the plug-in call request includes a target plug-in identifier; The second determination module 404 is configured to determine the target plug-in resource from the plug-in resources preloaded on the third-party platform based on the target plug-in identifier; The scheduling module 406 is configured to schedule the binding of the target interface and the target plug-in resource so that the target project program calls the target plug-in resource through the target interface.
[0080] Optionally, the second determination module 404 is further configured to determine whether the project parameters are calling parameters through pre-configured judgment conditions when detecting the project parameters passed into the target project program through the target interface; if so, determine the target plug-in resources in the plug-in resources pre-loaded on the third-party platform based on the target plug-in identifier.
[0081] Optionally, the scheduling module 406 is further configured to schedule the target interface to bind with the target plug-in resource; obtain the data information pre-registered by the target project program, and call the target plug-in resource to execute the plug-in processing logic based on the data information to obtain the processing result; and return the processing result to the target project program through the target interface.
[0082] Optionally, the scheduling module 406 is further configured to determine the project format of the target project program, and change the format of the processing result based on the project format to obtain a target format result; and return the target format result to the target project program through the target interface.
[0083] Optionally, the plug-in calling device also includes a registration module, which is configured to receive a registration request for a target project program, wherein the registration request includes an interface identifier and a data object; register the interface information and data object corresponding to the interface identifier as global variables; load the plug-in resources in the third-party platform; and complete the configuration operation of the calling logic based on the global variables and the plug-in resources in response to the configuration operation of the front-end user.
[0084] Optionally, the registration module is further configured to execute an adjustment operation on the call logic in response to a dynamic adjustment instruction of a front-end user.
[0085] Applied to the plug-in calling device, the direct dependency relationship between the target project program and the third-party platform plug-in is effectively decoupled by introducing a management middle layer. When the target project program issues a plug-in calling request, the first determination module 402 can respond to the request and quickly locate the required target interface in the external interface pre-registered by the target project program. And because the plug-in calling request contains a target plug-in identifier, the second determination module 404 can find a matching target plug-in resource in the plug-in resources pre-loaded on the third-party platform based on the identifier. Then the scheduling module 406 schedules the target interface to bind with the target plug-in resource so that the target project program can call the target plug-in resource through the target interface. This series of processes not only improves the flexibility and efficiency of plug-in calling, but also reduces the frequent recompilation and testing of the target project program due to plug-in changes, thereby significantly improving the overall efficiency of development and maintenance.
[0086] The above is a schematic scheme of a plug-in calling device of this embodiment. It should be noted that the technical scheme of the plug-in calling device and the technical scheme of the plug-in calling method described above are of the same concept, and the details not described in detail in the technical scheme of the plug-in calling device can be referred to the description of the technical scheme of the plug-in calling method described above.
[0087] Figure 5The block diagram of a computing device 500 provided according to an embodiment of the present invention is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.
[0088] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0089] In one embodiment of the present invention, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present invention. Those skilled in the art may add or replace other components as needed.
[0090] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 500 may also be a mobile or stationary server.
[0091] The processor 520 is used to execute the following computer program / instruction, which implements the steps of the above-mentioned plug-in calling method when executed by the processor.
[0092] The various embodiments of the present invention are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computing device embodiment, since it is basically similar to the plug-in calling method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the plug-in calling method embodiment.
[0093] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned plug-in calling method when executed by a processor.
[0094] The various embodiments of the present invention are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computer-readable storage medium embodiment, since it is basically similar to the plug-in calling method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the plug-in calling method embodiment.
[0095] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned plug-in calling method when executed by a processor.
[0096] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the plug-in calling method described above are of the same concept, and the details not described in detail in the technical scheme of the computer program product can be found in the description of the technical scheme of the plug-in calling method described above.
[0097] The above describes specific embodiments of the present invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0098] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0099] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the described action sequence, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of the present invention.
[0100] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0101] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of the present invention. The present invention selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A plug-in calling method, characterized in that: Applied to a management middle layer, the management middle layer is connected to a target project program and a third-party platform respectively, the method comprises: In response to a plug-in calling request of the target project program, determining a target interface among external interfaces pre-registered by the target project program, wherein the plug-in calling request includes a target plug-in identifier; Based on the target plug-in identifier, determining a target plug-in resource from plug-in resources preloaded on the third-party platform; The target interface is scheduled to be bound to the target plug-in resource, so that the target project program calls the target plug-in resource through the target interface.
2. The method according to claim 1, characterized in that Determining a target plug-in resource from plug-in resources preloaded on the third-party platform based on the target plug-in identifier includes: In the case of detecting a project parameter transmitted by the target project program through the target interface, determining whether the project parameter is a call parameter according to a pre-configured judgment condition; If so, based on the target plug-in identifier, a target plug-in resource is determined from the plug-in resources preloaded on the third-party platform.
3. The method according to claim 1, characterized in that The scheduling of binding the target interface with the target plug-in resource so that the target project program calls the target plug-in resource through the target interface includes: Scheduling the target interface to be bound to the target plug-in resource; Acquire the data information pre-registered by the target project program, and call the target plug-in resource to execute the plug-in processing logic based on the data information to obtain a processing result; The processing result is returned to the target project program through the target interface.
4. The method according to claim 3, characterized in that The step of returning the processing result to the target project program through the target interface includes: Determine the project format of the target project program, and change the format of the processing result based on the project format to obtain a target format result; The target format result is returned to the target project program through the target interface.
5. The method according to claim 1, characterized in that: In responding to the plug-in call request of the target project program, before determining the target interface in the external interfaces pre-registered by the target project program, the method further includes: receiving a registration request of the target project program, wherein the registration request includes an interface identifier and a data object; Registering the interface information corresponding to the interface identifier and the data object as global variables; Loading plug-in resources in the third-party platform; In response to the configuration operation of the front-end user, the configuration operation of the calling logic is completed based on the global variable and the plug-in resource.
6. The method according to claim 5, characterized in that After the configuration operation of the front-end user is completed based on the global variable and the plug-in resource, the method further includes: In response to a dynamic adjustment instruction from a front-end user, an adjustment operation on the calling logic is performed.
7. A plug-in calling device, characterized in that: include: A first determination module is configured to determine a target interface from external interfaces pre-registered by the target project program in response to a plug-in call request of the target project program, wherein the plug-in call request includes a target plug-in identifier; A second determination module is configured to determine a target plug-in resource from the plug-in resources preloaded on the third-party platform based on the target plug-in identifier; The scheduling module is configured to schedule the target interface to be bound to the target plug-in resource so that the target project program calls the target plug-in resource through the target interface.
8. A computing device, characterized in that include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the plug-in calling method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which, when executed by a processor, implements the steps of the plug-in calling method described in any one of claims 1 to 6.
10. A computer program product, characterized in that The method comprises a computer program / instruction, which, when executed by a processor, implements the steps of the plug-in calling method according to any one of claims 1 to 6.