CN114661376A - System function expanding method, device, equipment and medium - Google Patents

System function expanding method, device, equipment and medium Download PDF

Info

Publication number
CN114661376A
CN114661376A CN202210319545.3A CN202210319545A CN114661376A CN 114661376 A CN114661376 A CN 114661376A CN 202210319545 A CN202210319545 A CN 202210319545A CN 114661376 A CN114661376 A CN 114661376A
Authority
CN
China
Prior art keywords
plug
target
preset
configuration information
class loader
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210319545.3A
Other languages
Chinese (zh)
Inventor
金志旺
吴超群
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
DBAPPSecurity Co Ltd
Original Assignee
DBAPPSecurity Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by DBAPPSecurity Co Ltd filed Critical DBAPPSecurity Co Ltd
Priority to CN202210319545.3A priority Critical patent/CN114661376A/en
Publication of CN114661376A publication Critical patent/CN114661376A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a method, a device, equipment and a medium for expanding system functions, which are applied to a WEB service system, and the method comprises the following steps: scanning a target plug-in a preset plug-in folder to obtain plug-in configuration information and a Java archive file corresponding to the target plug-in, wherein the target plug-in is developed for realizing the current function upgrading and downgrading requirements of the WEB service system, then determining a custom class loader corresponding to the target plug-in by using the plug-in configuration information, switching the class loader of the current thread into the custom class loader, and finally loading classes in the Java archive file into a memory by using the custom class loader through the current thread. Therefore, partial functions of the system are plugged in by using a Java class loading mechanism, new functions can be expanded by uploading the plug-in, the original system functions can be unloaded by unloading the plug-in, and finally plug-and-play and smooth upgrading and upgrading of the system functions are realized, and decoupling of system codes is realized.

Description

System function expanding method, device, equipment and medium
Technical Field
The invention relates to the field of computers, in particular to a system function expanding method, a system function expanding device, system function expanding equipment and a system function expanding medium.
Background
At present, a large amount of enterprise service software needs to be deployed in an enterprise intranet, and on one hand, the complexity of software system upgrading and downgrading is caused by the closeness of the enterprise intranet. Many times, the software system only needs to be upgraded with a small function, and enterprises often need to upgrade the system in a mode of updating a full package, so that waste of time and labor is caused.
Therefore, how to avoid the situation of wasting manpower and time due to the upgrade of the whole system package in the function upgrading and downgrading process of the software system is a problem to be solved in the field.
Disclosure of Invention
In view of this, an object of the present invention is to provide a method, an apparatus, a device, and a medium for expanding system functions, which can implement the expansion of system functions by plugging some functions in the system, which may need to be updated frequently, into a system and upgrading and downgrading the system in a hot plug manner on a page. Meanwhile, the scheme can solve the problem of dependency conflict under the condition that the system must use the dependencies of different versions at the same time. The specific scheme is as follows:
in a first aspect, the present application discloses a method for expanding system functions, which is applied to a WEB service system, and includes:
scanning a target plug-in a preset plug-in folder to obtain plug-in configuration information and a Java archive file corresponding to the target plug-in; the target plug-in is developed for realizing the current function upgrading and downgrading requirement of the WEB service system;
determining a custom class loader corresponding to the target plug-in by using the plug-in configuration information, and switching the class loader of the current thread into the custom class loader;
and loading the classes in the Java archive file into a memory by using the custom class loader through the current thread.
Optionally, before scanning the target plug-in the preset plug-in folder to obtain the plug-in configuration information and the Java archive file corresponding to the target plug-in, the method further includes:
acquiring a plug-in interface code for creating a plug-in interface, and creating the plug-in interface based on the plug-in interface code;
placing the plug-in interface in a preset universal sub-module so as to call a target plug-in through the plug-in interface in the preset universal sub-module; the plug-in interface is connected with the target plug-in and the WEB service system and comprises a method for realizing the function of the target plug-in.
Optionally, before scanning the target plug-in the preset plug-in folder to obtain the plug-in configuration information and the Java archive file corresponding to the target plug-in, the method further includes:
acquiring a parameter configuration file and a Java archive file of the plugin through a preset plugin acquisition interface; the plug-in comprises a class for realizing a plug-in interface in the preset universal sub-module;
and uploading the parameter configuration file and the Java archive file to a preset folder in a file uploading mode.
Optionally, the scanning a target plugin in a preset plugin folder to obtain plugin configuration information corresponding to the target plugin includes:
determining a target plug-in, and scanning all plug-ins in a preset plug-in folder to obtain a parameter configuration file corresponding to the target plug-in; the parameter configuration file comprises parameter configuration information which corresponds to the target plug-in and is stored in a preset format;
reading the parameter configuration file into a memory, and analyzing the parameter configuration information into plug-in configuration information; the parameter configuration information and the plug-in configuration information both include a complete class path and a plug-in name of a class in the target plug-in, and the complete class path includes a package name and a class name corresponding to the target plug-in.
Optionally, the method for expanding system function further includes:
creating a plug-in manager, and managing the plug-in configuration information by using the plug-in manager;
correspondingly, the loading the class in the Java archive file into the memory by using the custom class loader includes:
determining the plug-in name of the target plug-in, and determining a complete class path corresponding to the plug-in name through the plug-in manager;
and loading the classes in the Java archive file into a memory through the custom loader by utilizing the complete class path.
Optionally, the determining, by using the plug-in configuration information, a custom class loader corresponding to the target plug-in and switching a class loader of a current thread to the custom class loader includes:
determining the plug-in name of the target plug-in by utilizing a preset first manager for managing a custom class loader and based on the plug-in configuration information;
determining a custom class loader corresponding to the target plug-in by using the first manager and according to the plug-in name;
and switching the class loader of the current thread to the custom class loader by using a second manager for switching the class loader.
Optionally, the method for expanding system function further includes:
acquiring plugin deleting information through a preset plugin deleting interface, and determining a plugin to be deleted based on the plugin deleting information;
deleting the parameter configuration file and the Java archive file corresponding to the to-be-deleted plug-in the preset plug-in folder, and calling a preset refreshing method in the plug-in manager to refresh the preset plug-in folder.
In a second aspect, the present application discloses a system function expanding apparatus, which is applied to a WEB service system, and includes:
the system comprises a plug-in scanning module, a target plug-in scanning module and a Java archive file module, wherein the plug-in scanning module is used for scanning a target plug-in a preset plug-in folder to obtain plug-in configuration information and a Java archive file corresponding to the target plug-in; the target plug-in is developed for realizing the current function upgrading and downgrading requirement of the WEB service system;
the loader switching module is used for determining a custom class loader corresponding to the target plug-in by using the plug-in configuration information and switching the class loader of the current thread into the custom class loader;
and the class loading module is used for loading the classes in the Java archive file into the memory by using the custom class loader through the current thread.
In a third aspect, the present application discloses an electronic device, comprising:
a memory for storing a computer program;
and the processor is used for executing the computer program to realize the system function expanding method.
In a fourth aspect, the present application discloses a computer storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the steps of the system function expanding method disclosed above.
The method comprises the steps of scanning a target plugin in a preset plugin folder by using a WEB service system to obtain plugin configuration information and a Java archive file corresponding to the target plugin, wherein the target plugin is developed for realizing the current function upgrading and downgrading requirements of the WEB service system, then determining a custom class loader corresponding to the target plugin by using the plugin configuration information, switching a class loader of a current thread into the custom class loader, and finally loading classes in the Java archive file into a memory by using the custom class loader through the current thread. Therefore, the method utilizes a Java class loading mechanism to plug in the functions which may need to be frequently updated in the system, can expand the new functions in a plug-in uploading mode, and can also unload the original system functions in a plug-in unloading mode, thereby finally realizing the plug-and-play and smooth upgrading and downgrading of the system functions and realizing the decoupling of the system codes. Meanwhile, the scheme can solve the problem of dependency conflict under the condition that the system must use the dependencies of different versions at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flow chart of a system function expanding method provided by the present application;
fig. 2 is a flowchart of a specific system function expanding method provided in the present application;
FIG. 3 is a schematic view of an architecture provided herein;
fig. 4 is a schematic structural diagram of a system function expanding device provided in the present application;
fig. 5 is a block diagram of an electronic device provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the prior art, a software system only needs to be upgraded with a small function, and an enterprise often needs to upgrade the system in a mode of updating a full package, so that waste of time and labor is caused. In the application, some functions which may need to be frequently updated in the system can be plugged in, and the functions of the system can be upgraded and downgraded in a hot plug mode on a page, so that the expansion of the functions of the system is realized. Meanwhile, the scheme can solve the problem of dependency conflict under the condition that the system must use the dependencies of different versions at the same time.
The embodiment of the invention discloses a system function expanding method, which is applied to a WEB service system and is described with reference to figure 1, and the method comprises the following steps:
step S11: scanning a target plug-in a preset plug-in folder to obtain plug-in configuration information and a Java archive file corresponding to the target plug-in; the target plug-in is developed for realizing the current function upgrading and downgrading requirement of the WEB service system.
It can be understood that, in this embodiment, the target plug-in is placed in the preset plug-in folder, and the plug-in configuration information and the Java file corresponding to the plug-in are stored in the target plug-in.
It should be noted that, in this solution, the WEB service system is under the preset server, and the preset plug-in folder is a public folder located inside the server and outside the WEB service system, and in some specific embodiments, the preset plug-in folder may be a plugins folder, the plug-in configuration information may be a plugin config, and the Java archive file may be a Jar package.
In this embodiment, before scanning the target plug-in the preset plug-in folder to obtain the plug-in configuration information and the Java archive file corresponding to the target plug-in, the method may further include: acquiring a plug-in interface code for creating a plug-in interface, and creating the plug-in interface based on the plug-in interface code; placing the plug-in interface in a preset universal sub-module so as to call a target plug-in through the plug-in interface in the preset universal sub-module; the plug-in interface connects the target plug-in and the WEB service system and comprises a method for realizing the function of the target plug-in.
In this embodiment, a plug-in interface is created for the WEB service system, where the interface includes a method for implementing a plug-in. In one embodiment, the interface may be placed in a common sub-module of the system, and both plug-ins and WEB services may depend on the common sub-module.
In this embodiment, before scanning the target plug-in the preset plug-in folder to obtain the plug-in configuration information and the Java archive file corresponding to the target plug-in, the method may further include: acquiring a parameter configuration file and a Java archive file of the plugin through a preset plugin acquisition interface; the plug-in comprises a class for realizing a plug-in interface in the preset universal sub-module; and uploading the parameter configuration file and the Java archive file to a preset folder in a file uploading mode.
It can be understood that after the plug-in is developed according to the current function upgrading and downgrading requirements of the system, a compression package is generated by the parameter configuration file and the Java archive file corresponding to the plug-in a preset format, and the compression package is uploaded to a preset folder through a WEB service system in a file uploading manner. In a specific implementation manner, the parameter configuration information of the plug-in may be stored in a plugin.json file in a json format, and the parameter configuration information is used as the parameter configuration file, and then the plugin.json file and a Jar package of the plug-in are packaged and stored in a preset plug-in folder in a compressed package form. Json file in this embodiment is a complete class path and a plug-in name (i.e., plugin name) of a plug-in interface implementation class in a common module. In one embodiment, the full class path may be represented by className.
It can be understood that, since the WEB service system uses the plug-in interface to use the plug-in, the plug-in includes a class for implementing the plug-in interface in the preset general submodule.
In this embodiment, the method for expanding system functions may further include: creating a plug-in manager, and managing the plug-in configuration information by using the plug-in manager; correspondingly, the loading the class in the Java archive file into the memory by using the custom class loader includes: determining the plug-in name of the target plug-in, and determining a complete class path corresponding to the plug-in name through the plug-in manager; and loading the classes in the Java archive file into a memory through the custom loader by utilizing the complete class path. The plug-in manager may be a PluginManager.
The plug-in manager in this embodiment has the following functions:
1) json configuration information of all plug-ins in the plug-in directory can be initialized, and the json format configuration information is read into the memory for storage management;
2) ensuring the uniqueness of each plug-in (plug-in name);
3) plug-in configuration information (namely plugConfig) can be obtained through the plug-in name;
4) a refresh method is included for reloading and refreshing all the plug-in information in the plug-in manager.
In this embodiment, the method for expanding system functions may further include: acquiring plugin deleting information through a preset plugin deleting interface, and determining a plugin to be deleted based on the plugin deleting information; deleting the parameter configuration file and the Java archive file corresponding to the to-be-deleted plug-in the preset plug-in folder, and calling a preset refreshing method in the plug-in manager to refresh the preset plug-in folder. It can be understood that, after the development of the plug-in is completed and the plug-in is uploaded to the preset plug-in folder, the preset refreshing method in the plug-in manager is also called to refresh the preset plug-in folder.
In this embodiment, the system may not only expand new functions by uploading plug-ins, but also uninstall the original system functions by uninstalling plug-ins. The unloading of the plug-ins can be completed only by deleting the parameter configuration files and the Java archive files corresponding to the plug-ins to be deleted in the preset plug-in file folder and calling a preset refreshing method in the plug-in manager to refresh the preset plug-in file folder.
Step S12: and determining a custom class loader corresponding to the target plug-in by using the plug-in configuration information, and switching the class loader of the current thread into the custom class loader.
It should be noted that the WEB service system described in this embodiment has a custom class loader (i.e., a JarLoader) inside, provides a Jar isolated loading mechanism, adds an incoming path, a sub-path thereof, and Jar files in the path to a class path, and theoretically, a plug-in needs to correspond to a JarLoader. And the WEB service system is internally provided with LoadUtil for managing the JarLoader, the unique JarLoader corresponding to the plug-in can be obtained through the plug-in name, and simultaneously, the usable plug-in object after instantiation can be generated.
In the step, the central line determines the JarLoader corresponding to the target plug-in by using the plug-in configuration information of the target plug-in, and switches the classLoader of the current thread into the JarLoader, so that the purpose is to leave the current classLoader to load the jar packet corresponding to the target plug-in, and after the execution is completed, the central line returns to the original classLoader to continue executing the original code.
Step S13: and loading the classes in the Java archive file into a memory by using the custom class loader through the current thread.
In this step, the class in the Java file is loaded into the memory by using the JarLoader, and in a specific embodiment, since the LoadUtil is used for managing the JarLoader, the class in the Java file can also be loaded into the memory by using the JarLoader through the LoadUtil.
In this embodiment, after the user-defined class loader is used to load the class in the Java archive file into the memory, the method may further include: instantiating the target plug-in. In a specific embodiment, since the LoadUtil is used for managing the JarLoader, the target plug-in may also be instantiated by the JarLoader through the LoadUtil.
The embodiment provides a system function expanding method, which is applied to a WEB service system, and the method comprises the following steps: scanning a target plug-in a preset plug-in folder to obtain plug-in configuration information and a Java archive file corresponding to the target plug-in, wherein the target plug-in is developed for realizing the current function upgrading and downgrading requirements of the WEB service system, then determining a custom class loader corresponding to the target plug-in by using the plug-in configuration information, switching the class loader of the current thread into the custom class loader, and finally loading classes in the Java archive file into a memory by using the custom class loader through the current thread. Therefore, the method utilizes a Java class loading mechanism to plug in the functions which may need to be frequently updated in the system, can expand the new functions in a plug-in uploading mode, and can also unload the original system functions in a plug-in unloading mode, thereby finally realizing the plug-and-play and smooth upgrading and downgrading of the system functions and realizing the decoupling of the system codes. Meanwhile, the scheme can solve the problem of dependency conflict under the condition that the system must use the dependencies of different versions at the same time.
Fig. 2 is a flowchart of a specific system function expanding method provided in an embodiment of the present application. Referring to fig. 2, the method includes:
step S21: determining a target plug-in, and scanning all plug-ins in a preset plug-in folder to obtain a parameter configuration file corresponding to the target plug-in; the parameter configuration file comprises parameter configuration information which corresponds to the target plug-in and is stored in a preset format.
It can be understood that the parameter configuration information is stored in a preset format, and the parameter configuration information is stored in the parameter configuration file. In the step, a target plug-in is determined, all plug-ins in a preset plug-in folder are scanned, and then a parameter configuration file corresponding to the target plug-in is obtained.
Step S22: reading the parameter configuration file into a memory, and analyzing the parameter configuration information into plug-in configuration information; the parameter configuration information and the plug-in configuration information both comprise a complete class path and a plug-in name of a class in the target plug-in, and the complete class path comprises a package name and a class name corresponding to the target plug-in.
In this step, the parameter configuration information obtained in step S21 is analyzed to obtain plugin configuration information, and both the parameter configuration information and the plugin configuration information include a complete class path and a plugin name (i.e., plugin name) of the plugin interface implementation class in the common module. In one embodiment, the full class path may be represented by className.
Step S23: and determining the plug-in name of the target plug-in by utilizing a preset first manager for managing the custom class loader and based on the plug-in configuration information.
It should be noted that the first manager for managing the custom class loader in this step may be the loadutility described above.
Step S24: and determining a custom class loader corresponding to the target plug-in by using the first manager and according to the plug-in name.
Step S25: and switching the class loader of the current thread to the custom class loader by using a second manager for switching the class loader.
It should be noted that the second manager for switching class loaders in this step may be a classloadersswapper, and a user may switch the class loader of the current thread through the classloadersswapper. In order to avoid jar collision, for example, hbase may have multiple versions of read-write dependent jar packets, it is necessary to leave the current classLoader to load the jar packets, and after the execution is completed, the current classLoader is returned to the original classLoader to continue executing the original code. The classloadersswapper tool class needs to implement the following two functions:
1) saving the current classLoader, and setting the classLoader of the current thread as the specified JarLoader;
2) and restoring the class loader of the current thread to the originally stored class loader.
Step S26: and loading the classes in the Java archive file into a memory by using the custom class loader through the current thread.
It should be noted that after the class loader is used to perform class loading on the target plug-in, the JarLoader is also used to instantiate an object in the target plug-in.
The embodiment describes the acquisition process of the plug-in configuration information in detail, and expands the switching process of the class loader in detail. Therefore, the method in the scheme can be used for plugging in the functions which possibly need to be frequently updated in the system, so that the new functions can be expanded in a plug-in uploading mode, the original system functions can be unloaded in a plug-in unloading mode, the plug-and-play and smooth upgrading and downgrading of the system functions are finally realized, and the decoupling of system codes is realized. Meanwhile, the scheme can solve the problem of dependency conflict under the condition that the system must use the dependencies of different versions at the same time.
Fig. 3 is a schematic structural diagram provided by the present application, where it is shown that the WEB service system applies plug-ins by using JarLoader, LoadUtil, classloadersswapper defined in the system, and the plug-ins of all plug-ins are managed by the plug manager, the system can arbitrarily install and uninstall plug-ins, and the host can implement application of plug-ins by accessing the WEB service system.
Referring to fig. 4, an embodiment of the present application discloses a system function expanding device, which is applied to a WEB service system, and specifically may include:
the plugin scanning module 11 is configured to scan a target plugin in a preset plugin folder to obtain plugin configuration information and a Java archive file corresponding to the target plugin; the target plug-in is developed for realizing the current function upgrading and downgrading requirement of the WEB service system;
a loader switching module 12, configured to determine a custom class loader corresponding to the target plug-in by using the plug-in configuration information, and switch the class loader of the current thread to the custom class loader;
and the class loading module 13 is configured to load a class in the Java archive file into the memory through the current thread by using the custom class loader.
The method comprises the steps of scanning a target plugin in a preset plugin folder by using a WEB service system to obtain plugin configuration information and a Java archive file corresponding to the target plugin, wherein the target plugin is developed for realizing the current function upgrading and downgrading requirements of the WEB service system, then determining a custom class loader corresponding to the target plugin by using the plugin configuration information, switching a class loader of a current thread into the custom class loader, and finally loading classes in the Java archive file into a memory by using the custom class loader through the current thread. Therefore, the method utilizes a Java class loading mechanism to plug in the functions which may need to be frequently updated in the system, can expand the new functions in a plug-in uploading mode, and can also unload the original system functions in a plug-in unloading mode, thereby finally realizing the plug-and-play and smooth upgrading and downgrading of the system functions and realizing the decoupling of the system codes. Meanwhile, the scheme can solve the problem of dependency conflict under the condition that the system must use the dependencies of different versions at the same time.
In some specific embodiments, the method for expanding system functionality further includes:
the interface creating unit is used for acquiring a plug-in interface code for creating a plug-in interface and creating the plug-in interface based on the plug-in interface code;
the interface placing unit is used for placing the plug-in interface in a preset universal sub-module so as to call a target plug-in through the plug-in interface in the preset universal sub-module; the plug-in interface connects the target plug-in and the WEB service system and comprises a method for realizing the function of the target plug-in.
In some specific embodiments, the system function expanding method further includes:
the file acquisition unit is used for acquiring a parameter configuration file and a Java archive file of the plug-in through a preset plug-in acquisition interface; the plug-in comprises a class for realizing a plug-in interface in the preset universal sub-module;
and the file uploading unit is used for uploading the parameter configuration file and the Java archive file to a preset folder in a file uploading mode.
In some embodiments, the card scanner module 11 includes:
the plug-in determining unit is used for determining a target plug-in and scanning all plug-ins in a preset plug-in folder to acquire a parameter configuration file corresponding to the target plug-in; the parameter configuration file comprises parameter configuration information which corresponds to the target plug-in and is stored in a preset format;
the information analysis unit is used for reading the parameter configuration file into a memory and analyzing the parameter configuration information into plug-in configuration information; the parameter configuration information and the plug-in configuration information both include a complete class path and a plug-in name of a class in the target plug-in, and the complete class path includes a package name and a class name corresponding to the target plug-in.
In some specific embodiments, the system function expanding method further includes:
the manager creating unit is used for creating a plug-in manager and managing the plug-in configuration information by using the plug-in manager;
correspondingly, the loading the class in the Java archive file into the memory by using the custom class loader includes:
the complete type path determining unit is used for determining the plug-in name of the target plug-in and determining a complete type path corresponding to the plug-in name through the plug-in manager;
and the first class loading unit is used for loading the classes in the Java archive file into the memory through the custom loader by utilizing the complete class path.
In some embodiments, the loader switching module 12 includes:
the plug-in name determining unit is used for determining the plug-in name of the target plug-in by utilizing a preset first manager for managing a custom class loader and based on the plug-in configuration information;
a loader determining unit, configured to determine, by using the first manager and according to the plug-in name, a custom class loader corresponding to the target plug-in;
and the loader switching unit is used for switching the class loader of the current thread to the custom class loader by using a second manager for switching the class loader.
In some specific embodiments, the system function expanding method further includes:
the plug-in to be deleted determining unit is used for acquiring plug-in deletion information through a preset plug-in deletion interface and determining the plug-in to be deleted based on the plug-in deletion information;
and the file deleting unit is used for deleting the parameter configuration file and the Java archive file which correspond to the plug-in to be deleted in the preset plug-in folder, and calling a preset refreshing method in the plug-in manager to refresh the preset plug-in folder.
Further, an electronic device is also disclosed in the embodiments of the present application, and fig. 5 is a block diagram of the electronic device 20 shown in the exemplary embodiments, and the contents in the diagram cannot be considered as any limitation to the scope of the application.
Fig. 5 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present disclosure. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a display 24, an input-output interface 25, a communication interface 26, and a communication bus 27. The memory 22 is configured to store a computer program, and the computer program is loaded and executed by the processor 21 to implement relevant steps in the system function expanding method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 26 can create a data transmission channel between the electronic device 20 and an external device, and a communication protocol followed by the communication interface is any communication protocol applicable to the technical solution of the present application, and is not specifically limited herein; the input/output interface 25 is configured to obtain external input data or output data to the outside, and a specific interface type thereof may be selected according to specific application requirements, which is not specifically limited herein.
In addition, the storage 22 is used as a carrier for resource storage, and may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage manner may be a transient storage or a permanent storage.
The operating system 221 is used for managing and controlling each hardware device on the electronic device 20 and the computer program 222, and may be Windows Server, Netware, Unix, Linux, or the like. The computer programs 222 may further include computer programs that can be used to perform other specific tasks in addition to the computer programs that can be used to perform the system function expanding method performed by the electronic device 20 disclosed in any of the foregoing embodiments.
Further, the present application discloses a computer-readable storage medium, wherein the computer-readable storage medium includes a Random Access Memory (RAM), a Memory, a Read-Only Memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a magnetic disk, or an optical disk or any other form of storage medium known in the art. Wherein the computer program, when executed by a processor, implements the system function expanding method disclosed above. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, which are not described herein again.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The system function expanding method, device, equipment and storage medium provided by the invention are described in detail, a specific example is applied in the text to explain the principle and the implementation of the invention, and the description of the embodiment is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A system function expanding method is characterized in that the method is applied to a WEB service system and comprises the following steps:
scanning a target plug-in a preset plug-in folder to obtain plug-in configuration information and a Java archive file corresponding to the target plug-in; the target plug-in is developed for realizing the current function upgrading and downgrading requirement of the WEB service system;
determining a custom class loader corresponding to the target plug-in by using the plug-in configuration information, and switching the class loader of the current thread into the custom class loader;
and loading the class in the Java archive file into a memory by using the custom class loader through the current thread.
2. The method for expanding system functions according to claim 1, wherein before scanning a target plug-in a preset plug-in folder to obtain plug-in configuration information and a Java archive file corresponding to the target plug-in, the method further comprises:
acquiring a plug-in interface code for creating a plug-in interface, and creating the plug-in interface based on the plug-in interface code;
placing the plug-in interface in a preset universal sub-module so as to call a target plug-in through the plug-in interface in the preset universal sub-module; the plug-in interface connects the target plug-in and the WEB service system and comprises a method for realizing the function of the target plug-in.
3. The method for expanding system functions according to claim 2, wherein before scanning the target plug-in the preset plug-in folder to obtain the plug-in configuration information and the Java archive file corresponding to the target plug-in, the method further comprises:
acquiring a parameter configuration file and a Java archive file of the plugin through a preset plugin acquisition interface; the plug-in comprises a class for realizing a plug-in interface in the preset universal sub-module;
and uploading the parameter configuration file and the Java archive file to a preset folder in a file uploading mode.
4. The method for expanding system functions according to claim 3, wherein the scanning a target plug-in a preset plug-in folder to obtain plug-in configuration information corresponding to the target plug-in includes:
determining a target plug-in, and scanning all plug-ins in a preset plug-in folder to obtain a parameter configuration file corresponding to the target plug-in; the parameter configuration file comprises parameter configuration information which corresponds to the target plug-in and is stored in a preset format;
reading the parameter configuration file into a memory, and analyzing the parameter configuration information into plug-in configuration information; the parameter configuration information and the plug-in configuration information both include a complete class path and a plug-in name of a class in the target plug-in, and the complete class path includes a package name and a class name corresponding to the target plug-in.
5. The system function expanding method according to claim 4, further comprising:
creating a plug-in manager, and managing the plug-in configuration information by using the plug-in manager;
correspondingly, the loading the class in the Java archive file into the memory by using the custom class loader includes:
determining the plug-in name of the target plug-in, and determining a complete class path corresponding to the plug-in name through the plug-in manager;
and loading the classes in the Java archive file into a memory through the custom loader by utilizing the complete class path.
6. The method for extending system functions according to claim 1, wherein the determining, by using the plug-in configuration information, a custom class loader corresponding to the target plug-in and switching a class loader of a current thread to the custom class loader includes:
determining the plug-in name of the target plug-in by utilizing a preset first manager for managing a custom class loader and based on the plug-in configuration information;
determining a custom class loader corresponding to the target plug-in by using the first manager and according to the plug-in name;
and switching the class loader of the current thread to the custom class loader by using a second manager for switching the class loader.
7. A system function expansion method according to any one of claims 1 to 6, further comprising:
acquiring plugin deleting information through a preset plugin deleting interface, and determining a plugin to be deleted based on the plugin deleting information;
deleting the parameter configuration file and the Java archive file corresponding to the to-be-deleted plug-in the preset plug-in folder, and calling a preset refreshing method in the plug-in manager to refresh the preset plug-in folder.
8. The utility model provides a system function extends device which characterized in that, is applied to the WEB service system, includes:
the system comprises a plug-in scanning module, a target plug-in scanning module and a Java archive file module, wherein the plug-in scanning module is used for scanning a target plug-in a preset plug-in folder to obtain plug-in configuration information and a Java archive file corresponding to the target plug-in; the target plug-in is developed for realizing the current function upgrading and downgrading requirement of the WEB service system;
the loader switching module is used for determining a custom class loader corresponding to the target plug-in by using the plug-in configuration information and switching the class loader of the current thread into the custom class loader;
and the class loading module is used for loading the class in the Java archive file into the memory by using the custom class loader through the current thread.
9. An electronic device comprising a processor and a memory; wherein the processor, when executing the computer program stored in the memory, implements the system function expanding method according to any one of claims 1 to 7.
10. A computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements a system functionality expansion method as claimed in any one of claims 1 to 7.
CN202210319545.3A 2022-03-29 2022-03-29 System function expanding method, device, equipment and medium Pending CN114661376A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210319545.3A CN114661376A (en) 2022-03-29 2022-03-29 System function expanding method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210319545.3A CN114661376A (en) 2022-03-29 2022-03-29 System function expanding method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN114661376A true CN114661376A (en) 2022-06-24

Family

ID=82032809

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210319545.3A Pending CN114661376A (en) 2022-03-29 2022-03-29 System function expanding method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN114661376A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102411506A (en) * 2011-07-07 2012-04-11 杭州典能科技有限公司 Java-system business-unit plug-in type managing system and dynamic business-function changing method
CN105373396A (en) * 2015-08-14 2016-03-02 腾讯科技(深圳)有限公司 Method and device for updating plug-in in plug-in platform
CN108595246A (en) * 2018-03-15 2018-09-28 阿里巴巴集团控股有限公司 A kind of method, apparatus and equipment of operation application
CN111475227A (en) * 2020-04-02 2020-07-31 深圳创维-Rgb电子有限公司 Business plug-in loading implementation method and device and terminal equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102411506A (en) * 2011-07-07 2012-04-11 杭州典能科技有限公司 Java-system business-unit plug-in type managing system and dynamic business-function changing method
CN105373396A (en) * 2015-08-14 2016-03-02 腾讯科技(深圳)有限公司 Method and device for updating plug-in in plug-in platform
CN108595246A (en) * 2018-03-15 2018-09-28 阿里巴巴集团控股有限公司 A kind of method, apparatus and equipment of operation application
CN111475227A (en) * 2020-04-02 2020-07-31 深圳创维-Rgb电子有限公司 Business plug-in loading implementation method and device and terminal equipment

Similar Documents

Publication Publication Date Title
KR100903999B1 (en) System and method for operating domain profile using database in a core framework for SDR mobile terminals
CN111427596B (en) Software upgrading method and device and terminal equipment
CN106406919A (en) Terminal device pre-loaded application management method and terminal device
CN104731622A (en) Application program loading method and device and mobile terminal
CN105938436A (en) Startup control method of operation system and terminal
CN114647422A (en) Vehicle electronic control unit flashing method, device, equipment and medium
CN114546588A (en) Task deployment method and device, storage medium and electronic device
CN110083366B (en) Application running environment generation method and device, computing equipment and storage medium
CN113626095A (en) Switching method and switching system of configuration center, electronic equipment and storage medium
CN108595192A (en) A kind of installation method and terminal device of application program
CN112685102B (en) Gateway plug-in hot loading method, device, equipment and medium
CN114661376A (en) System function expanding method, device, equipment and medium
CN116755788A (en) On-line rule modification method, device, equipment and storage medium
CN115098118A (en) Mirror image filling method, device, equipment and storage medium
CN114443065A (en) Platform deployment method, platform deployment device, electronic equipment and storage medium
CN113641641A (en) Switching method, switching system, equipment and storage medium of file storage service
CN111885194B (en) Communication method and device for communication application and electronic equipment
CN115080276B (en) Application program function dynamic switching method and device, storage medium and electronic equipment
CN112558975B (en) Method and device for switching codes of components, electronic equipment and readable storage medium
CN111432401B (en) Method and apparatus for turning on/off roaming data network for mobile terminal
CN114637553B (en) Method, system, equipment and storage medium for configuring comprehensive treatment platform of cell
US20230229402A1 (en) Intelligent and efficient pipeline management
CN118349263A (en) Flash partition upgrading method, device, equipment and storage medium
CN112486539A (en) Application updating method, device, equipment and storage medium
CN113961206A (en) Patch package installation method and device, electronic equipment and storage 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