CN116991491A - Program plug-in loading method and device, computer equipment and computer program - Google Patents
Program plug-in loading method and device, computer equipment and computer program Download PDFInfo
- Publication number
- CN116991491A CN116991491A CN202210741427.1A CN202210741427A CN116991491A CN 116991491 A CN116991491 A CN 116991491A CN 202210741427 A CN202210741427 A CN 202210741427A CN 116991491 A CN116991491 A CN 116991491A
- Authority
- CN
- China
- Prior art keywords
- plug
- program
- package
- loading
- module
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000011068 loading method Methods 0.000 title claims abstract description 80
- 238000004590 computer program Methods 0.000 title claims abstract description 14
- 230000001419 dependent effect Effects 0.000 claims description 25
- 238000009434 installation Methods 0.000 claims description 20
- 238000003860 storage Methods 0.000 claims description 15
- 230000006835 compression Effects 0.000 claims description 3
- 238000007906 compression Methods 0.000 claims description 3
- 238000000034 method Methods 0.000 abstract description 3
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
- G06F9/44526—Plug-ins; Add-ons
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Stored Programmes (AREA)
Abstract
The invention provides a program plug-in loading method, a program plug-in loading device, computer equipment and a computer program, wherein the loading method comprises the following steps: s1: defining a plug-in package and a dependency package of an application program; s2: completing deployment of plug-in packages and dependency packages; s3: establishing a dependency link between the plug-in and the corresponding dependency package; s4: establishing a plug-in description file under each plug-in position, wherein the plug-in description file contains plug-in description information; s5: uploading the plug-in description information to a metadata base; s6: when the application program runs, the custom class loader is used for loading the target plug-in on demand. The invention solves the problem that the dependency packet conflict easily occurs in the loading process of the JAVA plug-in the prior art, and can effectively save the disk space.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a program plug-in loading method, a device, a computer device, and a computer program.
Background
The conventional plug-in loading method of the program uses a loading mode based on a parent delegation model, for example, when different plug-in modules or different versions of the program have dependence on a specific version corresponding to a certain program package, and when the same version package of the same plug-in is loaded by using a parent delegation mechanism, the problem of package conflict may occur, and when the plug-ins are loaded by using the parent delegation mechanism, an independent loader is hoped to load the package required by the plug-ins, so that the loading mode breaking the parent delegation mechanism occurs, the package required by the loading mode is loaded by the user, the package required by the user is searched, and the package is not searched upwards, so that the stability of the plug-in and the compatibility of various plug-ins or multi-version plug-ins are ensured.
However, this causes new problems, such as independent dependency relationships between the plugins, and when some plugins have dependent packages that are communicated, repeated dependent packages occupy a lot of space, which is also more and more obvious with the increase of plugins.
The invention aims to provide a method for uniformly compressing and combining management of package dependencies during program installation, realizing a class loading mode based on parent delegation breaking, loading according to requirements during package use, realizing balance between package dependency loading efficiency and memory occupation, and reducing the occupied volume of software installation.
Disclosure of Invention
Aiming at the defects existing in the prior art, according to the embodiment of the invention, a program plug-in loading method, a device, computer equipment and a computer program are provided, which solve the problem that the dependence communicated in the plug-in loading process in the prior art occupies a large amount of memory space.
According to a first aspect of the present invention, there is provided a program plug-in loading method, which is characterized by comprising:
s1: defining a plug-in package and a dependency package of an application program;
the plug-in package comprises a plurality of plug-ins, and each plug-in package comprises a plurality of first program packages;
s2: completing deployment of plug-in packages and dependency packages;
s21: renaming all first program packages in the plug-in package by using own file storage check code information to generate a second program package;
s22: moving the second program package to the directory where the dependent package is located, and replacing when the file with the repeated file name appears;
s3: establishing a dependency link between the plug-in and the corresponding dependency package;
s4: establishing a plug-in description file under each plug-in position, wherein the plug-in description file contains plug-in description information;
s5: uploading the plug-in description information to a metadata base;
s6: when the application program runs, the custom class loader is used for loading the target plug-in on demand.
In one embodiment, the step S3 includes:
s31: establishing a link file pointing to the generated second program package at the original position of the first program package of the plug-in;
s32: the link file is renamed with the original name of the first package.
In one embodiment, the plug-in description information includes a plug-in name, a plug-in icon, a plug-in category, plug-in location information, and/or a plug-in version.
In one embodiment, the step S6 includes:
s61: finding a target plug-in to be loaded through a metadata base;
s62: loading plug-in description information of the target plug-in into a memory of the application program;
s63: obtaining plug-in position information of a target plug-in;
s64: and loading a second program package pointed by the link file in the target plug-in position through a custom class loader.
In one embodiment, the step S6 further includes:
and displaying the plug-in description information of all available plug-ins through a display interface.
In a second aspect, in one embodiment, a program plug-in loading apparatus is provided, including: the device comprises a plug-in installation module, a metadata base and a plug-in loading and running module;
the plug-in installation module is used for analyzing and processing a plug-in package of the target plug-in and a corresponding dependency package when the application program is installed, so that the compression, storage and installation of the target plug-in are realized;
and the plug-in loading and running module is used for loading the target plug-in on demand by using a custom class loader when the application program calls the target plug-in.
In one embodiment, the card installation module includes:
the definition module is used for defining a plug-in package and a dependency package of an application program;
the deployment module is used for completing deployment of the plug-in package and the dependency package;
the deployment module comprises a renaming unit and a mobile unit;
the renaming unit is used for renaming all the first program packages in the plug-in package by file storage check code information to generate a second program package; the mobile unit is used for moving the second program package to the directory where the dependent package is located and replacing the second program package when the file with the repeated file name appears;
the link relation establishing module is used for establishing a dependent link between the plug-in and the corresponding dependent package;
the link relation establishing module comprises a link file establishing module and a link file renaming module;
the link file establishing module is used for establishing a link file pointing to the generated second program package at the original position of the first program package of the plug-in; the link file renaming module is used for renaming the link file by the original name of the first program package;
the plug-in description file establishing module is used for establishing plug-in description files under each plug-in position, wherein the plug-in description files contain plug-in description information;
and the data uploading module is used for uploading the plug-in description information to a metadata base.
In one embodiment, the plug-in loading and running module comprises:
the plug-in searching module is used for searching a target plug-in to be loaded through the metadata base;
the plug-in information loading module is used for loading plug-in description information of the target plug-in into the memory of the application program;
the plug-in position information acquisition module is used for acquiring plug-in position information of the target plug-in;
and the plug-in loading module is used for loading a second program package pointed by the connection file at the target plug-in position through the custom class loader.
In a third aspect, a computer device is presented, comprising: a memory and a processor, the memory having stored therein a computer program for invoking the computer program to perform the operational steps in the program plug-in loading method of any of claims 1-5.
A fourth aspect proposes a computer program for performing the operational steps of the program plug-in loading method according to any one of claims 1-5 when said program is called.
Compared with the prior art, the invention has the following beneficial effects:
1. before loading the plug-in, renaming the program package in the plug-in by using the file storage check code information, transferring the renamed program package to a dependent package area, and replacing when the file with the repeated file name appears, so that the condition of dependent package conflict can be prevented, and the disk space can be effectively saved as the same program package is reserved for only one part finally.
2. Before loading the plug-in, a dependency link between the plug-in and a corresponding dependency package is established, and when the plug-in needs to be loaded, a custom class loader is used for loading the dependency link and the corresponding dependency package in a disk as required, so that the plug-in loading efficiency is improved, and the memory occupation space of the plug-in during installation is reduced.
Drawings
Fig. 1 is a basic flowchart of a program plug-in loading method according to an embodiment of the present invention.
Fig. 2 is a basic flowchart of step S3 in an embodiment of the present invention.
Fig. 3 is a basic flowchart of step S6 in an embodiment of the present invention.
FIG. 4 is a block diagram of a program plug-in loading device according to another embodiment of the present invention.
Detailed Description
The technical scheme of the invention is further described below with reference to the accompanying drawings and examples.
As shown in fig. 1, according to a first aspect of the present invention, a program plug-in loading method is proposed, which is characterized by comprising:
s1: defining a plug-in package and a dependency package of an application program;
the plug-in package comprises a plurality of plug-ins, and each plug-in package comprises a plurality of first program packages;
s2: completing deployment of plug-in packages and dependency packages;
establishing a plug-in installation catalog, wherein the plug-in installation catalog comprises a dependency package storage subdirectory and a plug-in catalog, the plug-in catalog also comprises a dependency catalog, and when an application program receives a plug-in installation instruction request of a user, a target plug-in is decompressed into a temporary catalog;
s21: renaming all first program packages in the plug-in package by using own file storage check code information to generate a second program package;
s22: moving the second program package to the directory where the dependent package is located, and replacing when the file with the repeated file name appears;
specifically, reading the plugins and all the first program packages in the plugin installation directory, obtaining MD5 information of each first program package, renaming each first program package with MD5 information and moving the first program package to a dependent package storage subdirectory in the plugin installation main directory; if the same name file exists in the target directory, replacing the file;
s3: establishing a dependency link between the plug-in and the corresponding dependency package;
s4: establishing a plug-in description file under each plug-in position, wherein the plug-in description file contains plug-in description information;
s5: uploading the plug-in description information to a metadata base;
s6: when the application program runs, the custom class loader is used for loading the target plug-in on demand.
In the above embodiment, before loading the plug-in, the package in the plug-in is renamed by using the file storage check code information, and the renamed package is migrated to the dependent package area and replaced when the file with the duplicate file name appears, so that the situation of the dependent package conflict can be prevented.
In addition, when the plug-in application needs to be uninstalled, whether the dependent file of the current plug-in application is dependent on other plug-ins can be judged through metadata query, and finally the current plug-in application is used as a logic judgment decision for deleting the real dependent file or deleting the plug-in directory only.
In one embodiment, the step S3 includes:
s31: establishing a link file pointing to the generated second program package at the original position of the first program package of the plug-in;
s32: the link file is renamed with the original name of the first package.
Specifically, a new link file is created in a dependent directory corresponding to a new storage position of the plug-in package, the file name is the original name of the first program package, the file suffix is link, and the information in the file is the md5 information value of the dependent package.
In one embodiment, the plug-in description information includes a plug-in name, a plug-in icon, a plug-in category, plug-in location information, and/or a plug-in version.
In one embodiment, the step S6 includes:
s61: finding a target plug-in to be loaded through a metadata base;
s62: loading plug-in description information of the target plug-in into a memory of the application program;
when an application program is started or a plug-in is installed and needs to be loaded, firstly, reading a target plug-in to be loaded from a metadata base, and loading plug-in description information of the plug-in stored during plug-in installation into an application program memory, wherein the plug-in and a dependent package thereof are not actually loaded into the memory.
S63: obtaining plug-in position information of a target plug-in;
s64: and loading a second program package pointed by the link file in the target plug-in position through a custom class loader. The application program sequentially loads the plug-ins and the dependency packages thereof by using a custom class loader, when the plug-ins begin to load the dependency packages, the class loader can firstly judge suffix information, and when the dependency directory and link suffix files are identified, the md5 information in the link files is directly read, and the set dependency storage paths are taken as new paths and are put into the class loader for loading, so that the plug-in application can load successfully.
In the embodiment, before loading the plug-in, the dependency link between the plug-in and the corresponding dependency package is established, and when the plug-in needs to be loaded, the custom class loader is used for loading the dependency link and the dependency package in the disk as required, so that the memory occupation space of the plug-in during installation can be reduced.
In one embodiment, the step S6 further includes:
and displaying the plug-in description information of all available plug-ins through a display interface.
In a second aspect, in one embodiment, a program plug-in loading apparatus is provided, including: the device comprises a plug-in installation module, a metadata base and a plug-in loading and running module;
the plug-in installation module is used for analyzing and processing a plug-in package of the target plug-in and a corresponding dependency package when the application program is installed, so that the compression, storage and installation of the target plug-in are realized;
and the plug-in loading and running module is used for loading the target plug-in on demand by using a custom class loader when the application program calls the target plug-in.
In one embodiment, the card installation module includes:
the definition module is used for defining a plug-in package and a dependency package of an application program;
the deployment module is used for completing deployment of the plug-in package and the dependency package;
the deployment module comprises a renaming unit and a mobile unit;
the renaming unit is used for renaming all the first program packages in the plug-in package by file storage check code information to generate a second program package; the mobile unit is used for moving the second program package to the directory where the dependent package is located and replacing the second program package when the file with the repeated file name appears;
the link relation establishing module is used for establishing a dependent link between the plug-in and the corresponding dependent package;
the link relation establishing module comprises a link file establishing module and a link file renaming module;
the link file establishing module is used for establishing a link file pointing to the generated second program package at the original position of the first program package of the plug-in; the link file renaming module is used for renaming the link file by the original name of the first program package;
the plug-in description file establishing module is used for establishing plug-in description files under each plug-in position, wherein the plug-in description files contain plug-in description information;
and the data uploading module is used for uploading the plug-in description information to a metadata base.
In one embodiment, the plug-in loading and running module comprises:
the plug-in searching module is used for searching a target plug-in to be loaded through the metadata base;
the plug-in information loading module is used for loading plug-in description information of the target plug-in into the memory of the application program;
the plug-in position information acquisition module is used for acquiring plug-in position information of the target plug-in;
and the plug-in loading module is used for loading a second program package pointed by the connection file at the target plug-in position through the custom class loader.
In a third aspect, a computer device is presented, comprising: a memory and a processor, the memory having stored therein a computer program for invoking the computer program to perform the operational steps in the program plug-in loading method of any of claims 1-5.
A fourth aspect proposes a computer program for performing the operational steps of the program plug-in loading method according to any one of claims 1-5 when said program is called.
Finally, it is noted that the above embodiments are only for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made thereto without departing from the spirit and scope of the technical solution of the present invention, which is intended to be covered by the scope of the claims of the present invention.
Claims (10)
1. A program plug-in loading method, characterized in that the loading method comprises:
s1: defining a plug-in package and a dependency package of an application program;
the plug-in package comprises a plurality of plug-ins, and each plug-in package comprises a plurality of first program packages;
s2: completing deployment of plug-in packages and dependency packages;
s21: renaming all first program packages in the plug-in package by using own file storage check code information to generate a second program package;
s22: moving the second program package to the directory where the dependent package is located, and replacing when the file with the repeated file name appears;
s3: establishing a dependency link between the plug-in and the corresponding dependency package;
s4: establishing a plug-in description file under each plug-in position, wherein the plug-in description file contains plug-in description information;
s5: uploading the plug-in description information to a metadata base;
s6: when the application program runs, the custom class loader is used for loading the target plug-in on demand.
2. The program plug-in loading method according to claim 1, wherein the step S3 includes:
s31: establishing a link file pointing to the generated second program package at the original position of the first program package of the plug-in;
s32: the link file is renamed with the original name of the first package.
3. A program plug-in loading method according to claim 1, wherein the plug-in description information includes a plug-in name, a plug-in icon, a plug-in category, plug-in location information and/or a plug-in version.
4. The program plug-in loading method according to claim 1, wherein the step S6 includes:
s61: finding a target plug-in to be loaded through a metadata base;
s62: loading plug-in description information of the target plug-in into a memory of the application program;
s63: obtaining plug-in position information of a target plug-in;
s64: and loading a second program package pointed by the link file in the target plug-in position through a custom class loader.
5. The program plug-in loading method according to claim 1, wherein the step S6 further comprises:
and displaying the plug-in description information of all available plug-ins through a display interface.
6. A program plug-in loading apparatus, comprising: the device comprises a plug-in installation module, a metadata base and a plug-in loading and running module;
the plug-in installation module is used for analyzing and processing a plug-in package of the target plug-in and a corresponding dependency package when the application program is installed, so that the compression, storage and installation of the target plug-in are realized;
and the plug-in loading and running module is used for loading the target plug-in on demand by using a custom class loader when the application program calls the target plug-in.
7. The program plug-in loading device according to claim 6, wherein the plug-in installation module includes:
the definition module is used for defining a plug-in package and a dependency package of an application program;
the deployment module is used for completing deployment of the plug-in package and the dependency package;
the deployment module comprises a renaming unit and a mobile unit;
the renaming unit is used for renaming all the first program packages in the plug-in package by file storage check code information to generate a second program package; the mobile unit is used for moving the second program package to the directory where the dependent package is located and replacing the second program package when the file with the repeated file name appears;
the link relation establishing module is used for establishing a dependent link between the plug-in and the corresponding dependent package;
the link relation establishing module comprises a link file establishing module and a link file renaming module;
the link file establishing module is used for establishing a link file pointing to the generated second program package at the original position of the first program package of the plug-in; the link file renaming module is used for renaming the link file by the original name of the first program package;
the plug-in description file establishing module is used for establishing plug-in description files under each plug-in position, wherein the plug-in description files contain plug-in description information;
and the data uploading module is used for uploading the plug-in description information to a metadata base.
8. The plug-in loading device according to claim 6, wherein the plug-in loading and running module comprises:
the plug-in searching module is used for searching a target plug-in to be loaded through the metadata base;
the plug-in information loading module is used for loading plug-in description information of the target plug-in into the memory of the application program;
the plug-in position information acquisition module is used for acquiring plug-in position information of the target plug-in;
and the plug-in loading module is used for loading a second program package pointed by the connection file at the target plug-in position through the custom class loader.
9. A computer device, comprising: a memory and a processor, the memory having stored therein a computer program for invoking the computer program to perform the operational steps in the program plug-in loading method of any of claims 1-5.
10. A computer program for performing the operational steps in the program plug-in loading method according to any one of claims 1-5 when said program is called.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210741427.1A CN116991491A (en) | 2022-06-28 | 2022-06-28 | Program plug-in loading method and device, computer equipment and computer program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210741427.1A CN116991491A (en) | 2022-06-28 | 2022-06-28 | Program plug-in loading method and device, computer equipment and computer program |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116991491A true CN116991491A (en) | 2023-11-03 |
Family
ID=88523781
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210741427.1A Pending CN116991491A (en) | 2022-06-28 | 2022-06-28 | Program plug-in loading method and device, computer equipment and computer program |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116991491A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117270887A (en) * | 2023-11-22 | 2023-12-22 | 广州嘉为科技有限公司 | Spring micro-service management method, device and storage medium |
-
2022
- 2022-06-28 CN CN202210741427.1A patent/CN116991491A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117270887A (en) * | 2023-11-22 | 2023-12-22 | 广州嘉为科技有限公司 | Spring micro-service management method, device and storage medium |
CN117270887B (en) * | 2023-11-22 | 2024-03-19 | 广州嘉为科技有限公司 | Spring micro-service management method, device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7784043B2 (en) | Method and system for automated code-source indexing in Java Virtual Machine environment | |
US8566372B2 (en) | Method and device for dynamically loading relocatable file | |
CN100426235C (en) | System and method for representing user process to software package in software package management system | |
JP5208350B2 (en) | Self-describing software image update component | |
US20070162538A1 (en) | System and method of providing contents for mobile communication terminal | |
US7913265B2 (en) | Method of loading software with an intermediate object oriented language in a portable device | |
CN1732458A (en) | Method and apparatus for shared libraries on mobile devices | |
CN109032631B (en) | Application program patch package obtaining method and device, computer equipment and storage medium | |
JP2005182784A (en) | Determining maximal set of dependent software update valid for installation | |
CN109558320B (en) | System testing method, device, system, equipment and computer readable storage medium | |
US20220188088A1 (en) | Repository including exclusion list | |
CN111258587A (en) | Method, device, equipment and storage medium for realizing android application plug-in | |
CN110308999B (en) | Method for dynamically sharing dependency package between applications, storage medium and mobile terminal | |
CN110659045B (en) | Software radar real-time dynamic updating system | |
CN101833464A (en) | Method and device for sectionally loading application programs by mobile terminal | |
CN104731622A (en) | Application program loading method and device and mobile terminal | |
CN116991491A (en) | Program plug-in loading method and device, computer equipment and computer program | |
US20050060378A1 (en) | Method and apparatus for providing language modularization | |
CN112631621A (en) | Dependency package management method, device, server and storage medium | |
CN108536444B (en) | Plug-in compiling method and device, computer equipment and storage medium | |
CN112486517B (en) | Application program installation method and system, electronic equipment and storage medium | |
CN113312073B (en) | Installation package file processing method and related device | |
CN114489827B (en) | Dynamic library loading method, core deployment adjusting method and related devices | |
US7571436B2 (en) | Device for increasing the execution speed of a linked program | |
US20050149270A1 (en) | Componentware creating method, apparatus and recording medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |