Plug-in management method and device, equipment and medium
By obtaining and verifying plug-in configuration information, dynamic loading or uninstalling of plug-ins is automatically completed, which solves the limitations of the traditional plug-in management mechanism in terms of dynamic update and expansion capabilities, and improves system stability and management efficiency.
Patent Information
- Application Number
- CN202411644348.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-02-14
AI Technical Summary
The traditional plug-in management mechanism has limitations in dynamic updates and extension capabilities, including version conflicts and compatibility issues caused by static update mechanisms, as well as the risk of system pauses, which affect user experience and system stability.
By obtaining plug-in configuration information and performing illegal version verification, dynamic loading or uninstalling of plug-ins is automatically completed, and the plug-in management interface class, plug-in management interface is used to implement class execution management logic.
It realizes the completion of plug-in management during the system running, improves system stability and plug-in management efficiency, and reduces user operation burden and version conflict risks.
Smart Images

Figure CN119440674A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a plug-in management method, device, equipment and medium. Background Art
[0002] In the current software architecture, the plug-in system usually plays an important role in enhancing software functions and providing modular expansion. However, the traditional plug-in management mechanism has obvious limitations in terms of dynamic update and expansion capabilities. On the one hand, the traditional technology is a static update mechanism. The traditional plug-in system usually relies on a static update mechanism, that is, developers need to release new plug-in versions, and users manually download and replace the old plug-in files. This method is not only inefficient, but also prone to version conflicts and compatibility issues; on the other hand, the traditional technology has the risk of system suspension. When adding or updating plug-ins, the traditional approach often requires suspending the operation of the entire system, which not only affects the user experience, but may also cause data loss or system instability.
[0003] From the above, it can be seen that how to manage plug-ins while the system is running and improve system stability and plug-in management efficiency are problems to be solved in the art. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a plug-in management method, device, equipment and medium, which can complete the management of plug-ins when the system is running, and improve the system stability and plug-in management efficiency. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a plug-in management method, comprising:
[0006] Obtain the plugin configuration information of the current plugin to be managed, and call the plugin management interface class to perform illegal version verification on the plugin configuration information;
[0007] If the illegal version verification result indicates that the plug-in configuration information is legal information, calling the plug-in management interface implementation class to process the plug-in configuration information to obtain a plug-in input parameter data object;
[0008] The plug-in configuration information and the plug-in input parameter data object are assembled to obtain assembled plug-in information, the event type of the current plug-in to be managed is determined based on the assembled plug-in information, and the plug-in management implementation class is called according to the event type to execute the management logic of the current plug-in to be managed.
[0009] Optionally, before calling the plug-in management interface class to perform illegal version verification on the plug-in configuration information, the method further includes:
[0010] Creating a plug-in management interface class for defining a plug-in management interface; wherein the plug-in management interface includes a query interface, a loading interface, an unloading interface, and a modification interface of the plug-in;
[0011] Creating a plug-in management interface implementation class for defining plug-in management implementation logic; wherein the plug-in management implementation logic includes query implementation logic, load implementation logic, unload implementation logic, and modify implementation logic;
[0012] A plug-in management implementation class is created for defining plug-in management implementation operations; wherein the plug-in management implementation operations include plug-in loading operations and plug-in unloading operations.
[0013] Optionally, the plug-in configuration information of the current plug-in to be managed includes the name of the current plug-in to be managed, the code of the current plug-in to be managed, the version of the current plug-in to be managed, the file of the current plug-in to be managed, the proxy class of the current plug-in to be managed, and the pointcut expression of the current plug-in to be managed.
[0014] Optionally, the calling of the plug-in management interface class to perform illegal version verification on the plug-in configuration information includes:
[0015] Call the plug-in management interface class to check whether the plug-in configuration information is empty;
[0016] If the plug-in configuration information is not empty, verifying whether the file format of the current plug-in version to be managed in the plug-in configuration information is correct;
[0017] If the file format of the current plug-in version to be managed is correct, then checking whether the current plug-in version to be managed in the plug-in configuration information already exists;
[0018] If the current plug-in version to be managed does not exist, an illegal version verification result is obtained, indicating that the plug-in configuration information is legal information.
[0019] Optionally, after obtaining the plug-in configuration information of the current plug-in to be managed, the method further includes:
[0020] A target folder is established based on the current plug-in code to be managed and the current plug-in version to be managed, and the current plug-in file to be managed is saved in the target folder.
[0021] Optionally, the event type is a plug-in loading type;
[0022] Correspondingly, calling the plug-in management implementation class according to the event type to execute the management logic of the current plug-in to be managed includes:
[0023] Obtain the plug-in configuration information from the plug-in input parameter data object to call a predefined class loader to load a target folder to obtain a plug-in proxy class object;
[0024] Register the plug-in proxy class object in the target container in the Spring IoC container to generate a proxy AOP class, completing the registration of the current plug-in to be managed.
[0025] Optionally, after completing the registration of the current plug-in to be managed, the method further includes:
[0026] Traverse all bean collections in the Spring IoC container to filter out target beans that match the pointcut expression of the current plug-in to be managed;
[0027] If the target bean is not marked as a notified management object, the target bean is marked as a notified management object using the ProxyFactory class object, and then the plug-in is called to load the notification implementation class to transfer the target bean to the notification management object set, and the corresponding notification is installed for each notified management object in the notification management object set.
[0028] In a second aspect, the present application discloses a plug-in management device, including:
[0029] The plug-in version verification module is used to obtain the plug-in configuration information of the current plug-in to be managed, and call the plug-in management interface class to perform illegal version verification on the plug-in configuration information;
[0030] A data object acquisition module is used to call the plug-in management interface implementation class to process the plug-in configuration information to obtain the plug-in input parameter data object if the illegal version verification result indicates that the plug-in configuration information is legal information;
[0031] A management logic execution module is used to assemble the plug-in configuration information and the plug-in input parameter data object to obtain assembled plug-in information, determine the event type of the current plug-in to be managed based on the assembled plug-in information, and call the plug-in management implementation class according to the event type to execute the management logic of the current plug-in to be managed.
[0032] In a third aspect, the present application discloses an electronic device, comprising:
[0033] Memory, used to store computer programs;
[0034] The processor is used to execute the computer program to implement the steps of the plug-in management method disclosed above.
[0035] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned plug-in management method disclosed above are implemented.
[0036] The beneficial effects of the present application are as follows: the present application obtains the plug-in configuration information of the current plug-in to be managed, and calls the plug-in management interface class to perform an illegal version check on the plug-in configuration information; if the plug-in configuration information passes the illegal version check, the plug-in management interface implementation class is called to process the plug-in configuration information to obtain the plug-in input parameter data object; the plug-in configuration information and the plug-in input parameter data object are assembled to obtain the assembled plug-in information, the event type of the current plug-in to be managed is determined based on the assembled plug-in information, and the plug-in management implementation class is called according to the event type to execute the management logic of the current plug-in to be managed. It can be seen that the present application can call the plug-in management interface class, the plug-in management interface implementation class and the event type to call the plug-in management implementation class to complete the management logic of the current plug-in to be managed, that is, to automatically complete the dynamic loading or unloading of the plug-in without manual intervention by the user. This feature improves the update speed of the system, reduces the user's operating burden, and enables the system to dynamically load new plug-ins or unload plug-ins that are no longer needed at runtime without restarting the entire system; the plug-in configuration information is checked for illegal version, that is, version compatibility is checked to ensure that only compatible plug-ins can be loaded later, which helps to reduce system problems caused by version conflicts. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0038] Figure 1 A flow chart of a plug-in management method disclosed in this application;
[0039] Figure 2 A specific schematic diagram of dynamic management of plug-ins disclosed in this application;
[0040] Figure 3 A schematic diagram of the structure of a plug-in management device disclosed in this application;
[0041] Figure 4 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0043] In the current software architecture, the plug-in system usually plays an important role in enhancing software functions and providing modular expansion. However, the traditional plug-in management mechanism has obvious limitations in terms of dynamic update and expansion capabilities. On the one hand, the traditional technology is a static update mechanism. The traditional plug-in system usually relies on a static update mechanism, that is, developers need to release new plug-in versions, and users manually download and replace the old plug-in files. This method is not only inefficient, but also prone to version conflicts and compatibility issues; on the other hand, the traditional technology has the risk of system suspension. When adding or updating plug-ins, the traditional approach often requires suspending the operation of the entire system, which not only affects the user experience, but may also cause data loss or system instability.
[0044] To this end, the present application provides a plug-in loading solution, which can complete the management of plug-ins while the system is running, and improve system stability and plug-in management efficiency.
[0045] See also Figure 1 As shown, the embodiment of the present application discloses a plug-in management method, including:
[0046] Step S11: Obtain the plug-in configuration information of the current plug-in to be managed, and call the plug-in management interface class to perform an illegal version check on the plug-in configuration information.
[0047] In this embodiment, before calling the plug-in management interface class to perform illegal version verification on the plug-in configuration information, it also includes: creating a plug-in management interface class for defining the plug-in management interface; wherein the plug-in management interface includes the query interface, loading interface, unloading interface, and modification interface of the plug-in; creating a plug-in management interface implementation class for defining the plug-in management implementation logic; wherein the plug-in management implementation logic includes the query implementation logic, loading implementation logic, unloading implementation logic, and modification implementation logic; creating a plug-in management implementation class for defining the plug-in management implementation operation; wherein the plug-in management implementation operation includes the plug-in loading operation and the plug-in unloading operation. For example Figure 2 The following is a specific schematic diagram of dynamic plug-in management. Before dynamic plug-in management is performed, various classes need to be created, as follows:
[0048] 1) Create a plug-in information entity class O to define fields such as plug-in name, plug-in code, plug-in version, plug-in jar file, proxy class, and pointcut expression;
[0049] 2) Create a plug-in management interface class A to define the plug-in management interface. The plug-in management interface includes the plug-in query interface, loading interface, unloading interface, and modification interface, which mainly implements the plug-in related management operation interface;
[0050] 3) Create a plug-in management interface implementation class B to define the plug-in management implementation logic. The plug-in management implementation logic includes query implementation logic, loading implementation logic, unloading implementation logic, and modification implementation logic;
[0051] 4) Create a plug-in management event monitoring class C and define the plug-in event monitoring method, which mainly implements the interception of plug-in events to judge plug-in loading and unloading;
[0052] 5) Create a plug-in management implementation class D to define plug-in management implementation operations, including plug-in loading operations and plug-in unloading operations;
[0053] 6) Create the plug-in loading notification implementation class E, define the query, creation, deletion and other implementation methods of Advice (notification), and mainly implement specific logical operations on Advice.
[0054] In this embodiment, the plug-in configuration information of the current plug-in to be managed includes the name of the current plug-in to be managed, the code of the current plug-in to be managed, the version of the current plug-in to be managed, the file of the current plug-in to be managed, the proxy class of the current plug-in to be managed, and the pointcut expression of the current plug-in to be managed. The plug-in configuration information of the current plug-in to be managed uploaded by the system front end is obtained through the system interface, specifically including the name of the current plug-in to be managed, the code of the current plug-in to be managed, the version of the current plug-in to be managed, the file of the current plug-in to be managed, the proxy class of the current plug-in to be managed, and the pointcut expression of the current plug-in to be managed, and the java archive file of the current plug-in to be managed is also obtained.
[0055] In this embodiment, the calling of the plug-in management interface class to perform illegal version verification on the plug-in configuration information includes: calling the plug-in management interface class to verify whether the plug-in configuration information is empty; if the plug-in configuration information is not empty, then verifying whether the file format of the current plug-in version to be managed in the plug-in configuration information is correct; if the file format of the current plug-in version to be managed is correct, then verifying whether the current plug-in version to be managed in the plug-in configuration information already exists; if the current plug-in version to be managed does not exist, then obtaining an illegal version verification result indicating that the plug-in configuration information is legal information. The loading interface of the plug-in management interface class A is called, and the loading interface first performs an illegality check on the plug-in input parameter data to verify whether the input parameter data is empty, that is, to verify whether the plug-in configuration information is empty. If it is not empty, then verifying whether the plug-in jar file format is correct, that is, to verify whether the file format of the current plug-in version to be managed is correct. If the file format of the current plug-in version to be managed is correct, then verifying whether the current plug-in version to be managed in the plug-in configuration information already exists. If not, then the obtained illegal version verification result indicates that the plug-in configuration information is legal information.
[0056] In this embodiment, after the plug-in configuration information of the current plug-in to be managed is obtained, the method further includes: establishing a target folder based on the current plug-in code and the current plug-in version to be managed, and saving the current plug-in file to the target folder. A target folder is created locally based on the current plug-in code and the current plug-in version to be managed, and then the current plug-in file to be managed is saved to the target folder.
[0057] Step S12: If the illegal version verification result indicates that the plug-in configuration information is legal information, the plug-in management interface implementation class is called to process the plug-in configuration information to obtain a plug-in input parameter data object.
[0058] If the illegal version verification result indicates that the plug-in configuration information is legal information, the plug-in management interface implementation class B is called to process the plug-in configuration information to obtain the plug-in input parameter data object, that is, the plug-in management interface implementation class B is called to load the current plug-in to obtain the plug-in input parameter data object.
[0059] Step S13: Assemble the plug-in configuration information and the plug-in input parameter data object to obtain assembled plug-in information, determine the event type of the current plug-in to be managed based on the assembled plug-in information, and call the plug-in management implementation class according to the event type to execute the management logic of the current plug-in to be managed.
[0060] Assemble the plug-in configuration information and the plug-in input parameter data object, that is, merge the plug-in configuration information and the plug-in input parameter data object to obtain the assembled plug-in information, and store the assembled plug-in information in the database. The purpose of storing in the database is to persist the data; send the plug-in loading event notification message for asynchronous decoupling. The purpose of the notification message is to trigger event type monitoring through messages. Among them, asynchronous decoupling decouples the current step and subsequent steps. The current step will directly return the result to the user when it is executed here. The subsequent monitoring step program will be automatically executed in the background until it ends. The main purpose of asynchronous decoupling is that users do not need to wait for a long time for the program to complete and decompose complex tasks into smaller tasks for execution, so as to perform other tasks.
[0061] Next, the plug-in management event listening class C is called to determine the event type of the current plug-in to be managed based on the assembled plug-in information. That is to say, the plug-in management event listening class C listens to the assembled plug-in information to determine whether the event type of the current plug-in to be managed is a plug-in loading type or a plug-in unloading type. If it is a plug-in loading type, the plug-in loading logic of the plug-in management implementation class D is called; if it is a plug-in unloading type, the plug-in unloading logic of the plug-in management implementation class D is called.
[0062] In this embodiment, the event type is a plug-in loading type; accordingly, the plug-in management implementation class is called according to the event type to execute the management logic of the current plug-in to be managed, including: obtaining the plug-in configuration information from the plug-in input data object to call the predefined class loader to load the target folder to obtain the plug-in proxy class object; registering the plug-in proxy class object in the target container in the Spring IoC container to generate a proxy AOP class to complete the registration of the current plug-in to be managed. When the event type is a plug-in loading type, the plug-in loading logic process is: obtaining the plug-in configuration information from the plug-in input data object, specifically determining the plug-in jar address according to the plug-in configuration information, calling the predefined class loader (ClassLoader) to load the target folder to obtain the plug-in proxy class object, that is, the proxy class field data; registering the plug-in proxy class object in the target container in the Spring IoC container to generate a proxy AOP (AspectOriented Programming) class, the purpose of which is to create an object that can be operated in a program for the current plug-in to be managed, thereby completing the registration of the current plug-in to be managed.
[0063] In this embodiment, after completing the registration of the current plug-in to be managed, it also includes: traversing all Bean collections in the SpringIoC container to filter out the target Bean that matches the pointcut expression of the current plug-in to be managed; if the target Bean is not marked as a notified management object, the target Bean is marked as a notified management object using a ProxyFactory class object, and then the plug-in loading notification implementation class is called to transfer the target Bean to the notification management object collection, and corresponding notifications are installed for each notified management object in the notification management object collection.
[0064] Get the pointcut expression field data to traverse all bean collections in the IoC container, and determine whether each bean matches the pointcut according to the pointcut expression of the current plug-in to be managed provided in the plug-in configuration information of the current plug-in to be managed. If the current bean matches the pointcut, the bean is determined as the target bean. In this way, the target bean that matches the pointcut expression of the current plug-in to be managed is filtered out, where the pointcut is the marking point that triggers execution.
[0065] Furthermore, if the current target Bean is not marked as advised (notified management object), the ProxyFactory class object is used to convert the current target Bean into an advised object, that is, the ProxyFactory class object is used to mark the target Bean as a notified management object, so that the capabilities of the notification and the notifier can be operated and managed. Among them, not being marked as a notified management object means that the current cut point is not managed by the notified management object.
[0066] Next, the plugin loading notification implementation class E is called to transfer the target Bean to the notification management object collection, and the corresponding notification is installed for each notified management object in the notification management object collection, that is, the currently converted advised object is saved as a collection, the specific implementation method of the plugin loading notification implementation class E is called, and the advised object collection is passed in as an input parameter. Installing Advice will enable the matching advised object to trigger additional logical processing when executing a specific method; wherein, Advice is a notification, including pre-notification, post-notification, loop notification, etc., and Advised is a notified management object, which provides the ability to operate and manage notifications.
[0067] It should be noted that when the event type is the plug-in uninstall type and the plug-in management implementation class is called to execute the plug-in uninstall logic of the current plug-in to be managed, the current plug-in to be managed and the Advice (notification) of the current plug-in to be managed need to be uninstalled, that is, not only the current plug-in to be managed but also the additional logic processing of the notified management object of the current plug-in to be managed is uninstalled.
[0068] The beneficial effects of the present application are as follows: the present application obtains the plug-in configuration information of the current plug-in to be managed, and calls the plug-in management interface class to perform an illegal version check on the plug-in configuration information; if the plug-in configuration information passes the illegal version check, the plug-in management interface implementation class is called to process the plug-in configuration information to obtain the plug-in input parameter data object; the plug-in configuration information and the plug-in input parameter data object are assembled to obtain the assembled plug-in information, the event type of the current plug-in to be managed is determined based on the assembled plug-in information, and the plug-in management implementation class is called according to the event type to execute the management logic of the current plug-in to be managed. It can be seen that the present application can call the plug-in management interface class, the plug-in management interface implementation class and the event type to call the plug-in management implementation class to complete the management logic of the current plug-in to be managed, that is, to automatically complete the dynamic loading or unloading of the plug-in without manual intervention by the user. This feature improves the update speed of the system, reduces the user's operating burden, and enables the system to dynamically load new plug-ins or unload plug-ins that are no longer needed at runtime without restarting the entire system; the plug-in configuration information is checked for illegal version, that is, version compatibility is checked to ensure that only compatible plug-ins can be loaded later, which helps to reduce system problems caused by version conflicts.
[0069] See also Figure 3 As shown, the embodiment of the present application discloses a plug-in management device, including:
[0070] The plug-in version verification module 11 is used to obtain the plug-in configuration information of the plug-in to be managed currently, and call the plug-in management interface class to perform illegal version verification on the plug-in configuration information;
[0071] The data object acquisition module 12 is used to call the plug-in management interface implementation class to process the plug-in configuration information to obtain the plug-in input parameter data object if the illegal version verification result indicates that the plug-in configuration information is legal information;
[0072] The management logic execution module 13 is used to assemble the plug-in configuration information and the plug-in input parameter data object to obtain the assembled plug-in information, determine the event type of the current plug-in to be managed based on the assembled plug-in information, and call the plug-in management implementation class according to the event type to execute the management logic of the current plug-in to be managed.
[0073] The beneficial effects of the present application are as follows: the present application obtains the plug-in configuration information of the current plug-in to be managed, and calls the plug-in management interface class to perform an illegal version check on the plug-in configuration information; if the plug-in configuration information passes the illegal version check, the plug-in management interface implementation class is called to process the plug-in configuration information to obtain the plug-in input parameter data object; the plug-in configuration information and the plug-in input parameter data object are assembled to obtain the assembled plug-in information, the event type of the current plug-in to be managed is determined based on the assembled plug-in information, and the plug-in management implementation class is called according to the event type to execute the management logic of the current plug-in to be managed. It can be seen that the present application can call the plug-in management interface class, the plug-in management interface implementation class and the event type to call the plug-in management implementation class to complete the management logic of the current plug-in to be managed, that is, to automatically complete the dynamic loading or unloading of the plug-in without manual intervention by the user. This feature improves the update speed of the system, reduces the user's operating burden, and enables the system to dynamically load new plug-ins or unload plug-ins that are no longer needed at runtime without restarting the entire system; the plug-in configuration information is checked for illegal version, that is, version compatibility is checked to ensure that only compatible plug-ins can be loaded later, which helps to reduce system problems caused by version conflicts.
[0074] Furthermore, an embodiment of the present application also provides an electronic device. Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0075] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the following steps:
[0076] Obtain the plugin configuration information of the current plugin to be managed, and call the plugin management interface class to perform illegal version verification on the plugin configuration information;
[0077] If the illegal version verification result indicates that the plug-in configuration information is legal information, calling the plug-in management interface implementation class to process the plug-in configuration information to obtain a plug-in input parameter data object;
[0078] The plug-in configuration information and the plug-in input parameter data object are assembled to obtain assembled plug-in information, the event type of the current plug-in to be managed is determined based on the assembled plug-in information, and the plug-in management implementation class is called according to the event type to execute the management logic of the current plug-in to be managed.
[0079] In some specific implementations, the processor can implement the following steps by executing the computer program stored in the memory:
[0080] Create a plug-in management interface class A for defining a plug-in management interface; wherein the plug-in management interface includes a query interface, a loading interface, an unloading interface, and a modification interface of the plug-in;
[0081] Create a plug-in management interface implementation class B for defining plug-in management implementation logic; wherein the plug-in management implementation logic includes query implementation logic, loading implementation logic, unloading implementation logic, and modification implementation logic;
[0082] A plug-in management implementation class D is created for defining plug-in management implementation operations; wherein the plug-in management implementation operations include plug-in loading operations and plug-in unloading operations.
[0083] In some specific implementations, the processor can implement the following steps by executing the computer program stored in the memory:
[0084] The plug-in configuration information of the current plug-in to be managed includes the name of the current plug-in to be managed, the code of the current plug-in to be managed, the version of the current plug-in to be managed, the file of the current plug-in to be managed, the proxy class of the current plug-in to be managed, and the pointcut expression of the current plug-in to be managed.
[0085] In some specific implementations, the processor can implement the following steps by executing the computer program stored in the memory:
[0086] The calling of the plug-in management interface class to perform illegal version verification on the plug-in configuration information includes:
[0087] Call the plug-in management interface class to check whether the plug-in configuration information is empty;
[0088] If the plug-in configuration information is not empty, verifying whether the file format of the current plug-in version to be managed in the plug-in configuration information is correct;
[0089] If the file format of the current plug-in version to be managed is correct, then checking whether the current plug-in version to be managed in the plug-in configuration information already exists;
[0090] If the current plug-in version to be managed does not exist, an illegal version verification result is obtained, indicating that the plug-in configuration information is legal information.
[0091] In some specific implementations, the processor can implement the following steps by executing the computer program stored in the memory:
[0092] A target folder is established based on the current plug-in code to be managed and the current plug-in version to be managed, and the current plug-in file to be managed is saved in the target folder.
[0093] In some specific implementations, the processor can implement the following steps by executing the computer program stored in the memory:
[0094] The event type is a plug-in loading type;
[0095] Correspondingly, calling the plug-in management implementation class D according to the event type to execute the management logic of the current plug-in to be managed includes:
[0096] Obtain the plug-in configuration information from the plug-in input parameter data object to call a predefined class loader to load a target folder to obtain a plug-in proxy class object;
[0097] Register the plug-in proxy class object in the target container in the Spring IoC container to generate a proxy AOP class, completing the registration of the current plug-in to be managed.
[0098] In some specific implementations, the processor can implement the following steps by executing the computer program stored in the memory:
[0099] Traverse all bean collections in the Spring IoC container to filter out target beans that match the pointcut expression of the current plug-in to be managed;
[0100] If the target bean is not marked as a notified management object, the target bean is marked as a notified management object using the ProxyFactory class object, and then the plug-in is called to load the notification implementation class E to transfer the target bean to the notification management object set, and the corresponding notification is installed for each notified management object in the notification management object set.
[0101] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0102] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0103] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.
[0104] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, which can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the plug-in management method executed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. In addition to data transmitted from an external device received by the electronic device, the data 223 can also include data collected by its own input and output interface 25, etc.
[0105] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the plug-in management method disclosed above. The specific steps of the method can refer to the corresponding contents disclosed in the above embodiments, and will not be repeated here.
[0106] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0107] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. The steps of the method or algorithm described in conjunction with the embodiments disclosed herein can be implemented directly with hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), memory, read-only memory (ROM), electrically programmable EPROM (Erasable Programmable Read Only Memory), electrically erasable programmable EEPROM (Electrically Erasable Programmable read only memory), register, hard disk, removable disk, CD-ROM (CoMP24013305act Disc Read-Only Memory), or any other form of storage medium known in the technical field.
[0108] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0109] The above is a detailed introduction to a plug-in management method, device, equipment and medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A plug-in management method, characterized in that: include: Obtain the plugin configuration information of the current plugin to be managed, and call the plugin management interface class to perform illegal version verification on the plugin configuration information; If the illegal version verification result indicates that the plug-in configuration information is legal information, calling the plug-in management interface implementation class to process the plug-in configuration information to obtain a plug-in input parameter data object; The plug-in configuration information and the plug-in input parameter data object are assembled to obtain assembled plug-in information, the event type of the current plug-in to be managed is determined based on the assembled plug-in information, and the plug-in management implementation class is called according to the event type to execute the management logic of the current plug-in to be managed.
2. The plug-in management method according to claim 1, characterized in that: Before calling the plug-in management interface class to perform illegal version verification on the plug-in configuration information, the method further includes: Creating a plug-in management interface class for defining a plug-in management interface; wherein the plug-in management interface includes a query interface, a loading interface, an unloading interface, and a modification interface of the plug-in; Creating a plug-in management interface implementation class for defining plug-in management implementation logic; wherein the plug-in management implementation logic includes query implementation logic, load implementation logic, unload implementation logic, and modify implementation logic; A plug-in management implementation class is created for defining plug-in management implementation operations; wherein the plug-in management implementation operations include plug-in loading operations and plug-in unloading operations.
3. The plug-in management method according to claim 1, characterized in that: The plug-in configuration information of the current plug-in to be managed includes the name of the current plug-in to be managed, the code of the current plug-in to be managed, the version of the current plug-in to be managed, the file of the current plug-in to be managed, the proxy class of the current plug-in to be managed, and the pointcut expression of the current plug-in to be managed.
4. The plug-in management method according to claim 3, characterized in that: The calling of the plug-in management interface class to perform illegal version verification on the plug-in configuration information includes: Call the plug-in management interface class to check whether the plug-in configuration information is empty; If the plug-in configuration information is not empty, verifying whether the file format of the current plug-in version to be managed in the plug-in configuration information is correct; If the file format of the current plug-in version to be managed is correct, then checking whether the current plug-in version to be managed in the plug-in configuration information already exists; If the current plug-in version to be managed does not exist, an illegal version verification result is obtained, indicating that the plug-in configuration information is legal information.
5. The plug-in management method according to claim 3, characterized in that: After obtaining the plug-in configuration information of the current plug-in to be managed, the method further includes: A target folder is established based on the current plug-in code to be managed and the current plug-in version to be managed, and the current plug-in file to be managed is saved in the target folder.
6. The plug-in management method according to claim 5, characterized in that: The event type is the plug-in loading type. Correspondingly, calling the plug-in management implementation class according to the event type to execute the management logic of the current plug-in to be managed includes: Obtain the plug-in configuration information from the plug-in input parameter data object to call a predefined class loader to load a target folder to obtain a plug-in proxy class object; Register the plug-in proxy class object in the target container in the Spring IoC container to generate a proxy AOP class, completing the registration of the current plug-in to be managed.
7. The plug-in management method according to claim 6, characterized in that: After completing the registration of the current plug-in to be managed, the method further includes: Traverse all bean collections in the Spring IoC container to filter out target beans that match the pointcut expression of the current plug-in to be managed; If the target bean is not marked as a notified management object, the target bean is marked as a notified management object using the ProxyFactory class object, and then the plug-in is called to load the notification implementation class to transfer the target bean to the notification management object set, and the corresponding notification is installed for each notified management object in the notification management object set.
8. A plug-in management device, characterized in that: include: The plug-in version verification module is used to obtain the plug-in configuration information of the current plug-in to be managed, and call the plug-in management interface class to perform illegal version verification on the plug-in configuration information; A data object acquisition module is used to call the plug-in management interface implementation class to process the plug-in configuration information to obtain the plug-in input parameter data object if the illegal version verification result indicates that the plug-in configuration information is legal information; A management logic execution module is used to assemble the plug-in configuration information and the plug-in input parameter data object to obtain assembled plug-in information, determine the event type of the current plug-in to be managed based on the assembled plug-in information, and call the plug-in management implementation class according to the event type to execute the management logic of the current plug-in to be managed.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the plug-in management method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the plug-in management method according to any one of claims 1 to 7 are implemented.