CN115237631A - Easily-extensible data sharing system and method based on data sharing plug-in - Google Patents

Easily-extensible data sharing system and method based on data sharing plug-in Download PDF

Info

Publication number
CN115237631A
CN115237631A CN202210906110.9A CN202210906110A CN115237631A CN 115237631 A CN115237631 A CN 115237631A CN 202210906110 A CN202210906110 A CN 202210906110A CN 115237631 A CN115237631 A CN 115237631A
Authority
CN
China
Prior art keywords
plug
data sharing
data
requirement
cache
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
CN202210906110.9A
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.)
Sichuan Keyway Software Co ltd
Original Assignee
Sichuan Keyway Software 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 Sichuan Keyway Software Co ltd filed Critical Sichuan Keyway Software Co ltd
Priority to CN202210906110.9A priority Critical patent/CN115237631A/en
Publication of CN115237631A publication Critical patent/CN115237631A/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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • 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
    • 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/44594Unloading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses an easily-extensible data sharing system and method based on a data sharing plug-in, wherein the system comprises a data sharing system and a plug-in basic service module; the plug-in basic service module is realized by a plug-in as a single module and is depended on by a data sharing system; the plug-in basic service module is used for forming a rule for the data sharing requirement in a plug-in mode by the plug-in basic service module through self-defining plug-in annotation and a plug-in interface on the basis of not influencing the normal operation of the original data sharing system according to a newly added data sharing requirement, and loading the plug-in for the data sharing requirement into the data sharing system; the data sharing system is used for realizing management, application configuration and operation of the data sharing demand plug-in according to the loaded data sharing demand plug-in; and the data result obtained after operation is used for sharing data externally in an interface mode. The invention solves the problems of flexible expansion, quick response and resource loading of a data sharing system; the maintenance cost is low and the efficiency is high.

Description

Easily-extensible data sharing system and method based on data sharing plug-in
Technical Field
The invention relates to the technical field of data sharing, in particular to an easily extensible data sharing system and method based on a data sharing plug-in.
Background
With the rapid development of computer technology and information technology, government units and enterprises have higher and higher requirements for data, and the requirements are constantly changing. Moreover, the enterprises and public institutions often have the requirement of mutual cooperation, which needs to share data. And sharing the data of the company A to the department B for use. As the use frequency becomes higher and the update frequency becomes faster, the original data sharing technology is less developed in the era.
In the prior art data sharing system, data processing (such as data encryption, data desensitization and the like) before outputting a result is directly processed by codes in the system. Namely, the data sharing in the prior art needs customized development, and the problem of the method is that: the method is over-customized and cannot well adapt to the diversity of the requirements (the encryption rule is diversified, the desensitization scheme is diversified, and the like). When the same data is shared by different organizations and units, the adopted data processing methods are often greatly different, and the difference may not be completely determined during system development, so that if a new data processing rule exists, developers are required to develop and adapt in the original system, then the original system is packaged and deployed, and the availability of the system is also influenced (re-service is required) in the deployment process. Secondly, the basic jar packages depended on by different data processing rules cannot conflict, and dependence management is relatively complex.
Therefore, the data sharing technology in the prior art needs customized development, is inconvenient to expand, has high maintenance cost and low efficiency; and changing the data processing rules can affect the service operation of the data sharing system.
Disclosure of Invention
The invention aims to solve the technical problems that the data sharing technology in the prior art needs customized development, is inconvenient to expand, has high maintenance cost and low efficiency; often, changing the data processing rule affects the service operation of the data sharing system, and all resources are loaded at one time during sharing, and all resources are loaded regardless of use, which causes waste of system resources. The invention aims to provide an easily-extensible data sharing system and method based on a data sharing plug-in, which solve the problems of flexible expansion, quick response and resource loading of a data sharing system; meanwhile, the maintenance cost is low and the efficiency is high.
The invention is realized by the following technical scheme:
in a first aspect, the invention provides an easily extensible data sharing system based on a data sharing plug-in, which comprises a data sharing system and a plug-in basic service module;
the plug-in basic service module is independent of the data sharing system, and the plug-in basic service module is realized by a plug-in as a single module and is depended by the data sharing system; the plug-in basic service module is used for forming a rule of the data sharing requirement in a plug-in mode by a user-defined plug-in annotation and a plug-in interface according to a newly added data sharing requirement on the basis of not influencing the normal operation of the original data sharing system and depending on the plug-in basic service module, and loading the plug-in with the data sharing requirement into the data sharing system;
the data sharing system is used for specifically realizing management of the data sharing demand plug-in, application configuration of the data sharing demand plug-in and operation of the data sharing demand plug-in according to the data sharing demand plug-in loaded from the plug-in basic service module; and the data result obtained after operation is used for sharing data externally in an interface mode.
The working principle is as follows: based on the existing data sharing system, when a data sharing requirement is newly added, the plug-in is generated by performing customized development and packaging in the original data sharing system, and the data sharing can be performed only by restarting the service of the data sharing system, so that the customized development is inconvenient to expand, the maintenance cost is high, and the efficiency is low; and changing the data processing rules can affect the service operation of the data sharing system, and the plug-ins have the problems of dependence conflict and the like.
Therefore, the invention designs an easily-extensible data sharing system based on a data sharing plug-in, which is characterized in that a plug-in basic service module is independently arranged outside an original data sharing system, and the plug-in basic service module is realized by the plug-in as an independent module and is depended on by the data sharing system; when a data sharing requirement is newly added, on the basis of not influencing the normal operation of the original data sharing system, the data sharing requirement is formed into a rule in a plug-in mode by a plug-in basic service module through a self-defined plug-in annotation and a plug-in interface, and the plug-in with the data sharing requirement is loaded into the data sharing system.
The invention develops a new data processing rule without being carried out in the original data sharing system, only a plug-in basic service module (basic jar package) is needed to be relied on, and then a plug-in service class is realized; the new data processing rule is quickly online and dynamically managed (hot plug), and the data sharing system does not need to be stopped and restarted; the plug-in is loaded according to the requirement, so that the system resource is saved; the problems of flexible expansion, quick response and resource loading of a data sharing system are solved; meanwhile, the maintenance cost is low and the efficiency is high.
Furthermore, the plug-in basic service module comprises a plug-in annotation unit, a plug-in information parameter unit and a plug-in interface unit;
the plug-in annotation unit is used for defining plug-in annotation according to the acquired data sharing requirement;
the plug-in information parameter unit is used for adding and describing plug-in basic information in the plug-in annotation according to the plug-in annotation; the basic information of the plug-in comprises a plug-in name, a plug-in version, a plug-in type, a plug-in description, a plug-in parameter description, a plug-in function and a detailed description of use; the plug-in type is data used to describe what format can be processed; the detailed description of the functions and the use of the plug-in is used for introducing how a user uses the plug-in, and the plug-in can do detailed description of what and the like;
and the plug-in interface unit is used for realizing the functions of plug-in initialization and data processing by defining a plug-in interface or an abstract class.
Further, the data sharing system comprises a plug-in loading module, a plug-in management module and a plug-in execution module; the plug-in management module depends on the plug-in loading module, and the plug-in execution module depends on the plug-in loading module.
The plug-in loading module realizes the loading of the data sharing plug-in through a custom class loader, wherein the custom class loader is a plug-in class loader which destroys a parent delegation mechanism, and can realize the loading as required and solve the problem of dependence conflict.
Further, the plug-in management module comprises a registration unit of the data sharing requirement plug-in and an unloading unit of the data sharing requirement plug-in;
the execution process of the registration unit of the data sharing demand plug-in comprises the following steps:
acquiring jar files of a data sharing requirement plug-in, which are uploaded by a user, and storing the jar files into a plug-in folder fixed by a data sharing system;
loading the jar file by adopting a custom class loader, and storing a jar full path of the data sharing demand plugin and the current class loader into a plugin class loader cache after successful loading;
scanning resource files in the jar file according to the jar file successfully loaded, and searching a plug-in interface or an abstract class defined in the plug-in basic service module;
checking the plug-in parameters one by adopting a plug-in basic information calibration rule judgment method; if all verification passes, the data sharing requirement plug-in is loaded successfully, a registration result is returned, and the full class name of the plug-in implementation class, the basic information of the plug-in and the full path of the data sharing requirement plug-in jar are stored to be cached in the basic information of the plug-in; if the verification is not passed, the data sharing demand plug-in loading fails, the corresponding plug-in class loader cache is deleted, and a registration result is returned;
the judging method of the plug-in basic information calibration rule comprises the following steps:
judging whether the resource files in the jar files are class files, if so, continuously judging whether the plug-in service class is realized or the plug-in abstract class is inherited; if not, judging whether the scanning is finished or not;
judging whether the service class of the plug-in or the abstract class of the inherited plug-in is realized, if so, continuously judging whether the plug-in is annotated; if not, judging whether the scanning is finished or not;
judging whether plug-in annotation exists, if so, continuously judging whether the annotation meets the preset rule; if not, judging whether the scanning is finished or not;
judging whether the annotation meets a preset rule, if so, continuously judging whether instantiation is needed, and simultaneously writing the plug-in basic information into a plug-in basic information cache; if not, judging whether the scanning is finished or not;
judging whether instantiation is needed, if so, instantiating the plug-in implementation class, executing plug-in initialization, and writing the plug-in object after the plug-in is instantiated into a plug-in object cache; if not, judging whether the scanning is finished or not.
Further, the execution process of the uninstalling unit of the data sharing requirement plug-in is as follows:
judging whether the plug-in to be unloaded exists in a plug-in object cache according to the selected plug-in to be unloaded, and if so, deleting the object in the plug-in object cache; if the plug-in to be unloaded does not exist, the plug-in to be unloaded is completely unloaded;
acquiring a jar full path of the plug-in to be unloaded from a plug-in basic information cache and deleting the plug-in basic information cache of the plug-in to be unloaded, wherein if the plug-in basic information cache of the plug-in to be unloaded does not exist, the plug-in to be unloaded is completely unloaded;
judging whether a plug-in object of the jar full path of the plug-in to be unloaded exists in the plug-in basic information cache; if the plug-in to be unloaded exists, the unloading of the plug-in to be unloaded is completed; and if not, deleting the cache corresponding to the jar full path of the plug-in to be unloaded from the plug-in class loader cache, and closing the corresponding class loader.
Further, the plug-in execution module comprises a plug-in application configuration unit and a plug-in operation unit;
the execution process of the plug-in application configuration unit is as follows:
a front-end user (such as a page) acquires an available plug-in list, and a back-end system inquires a plug-in basic information cache and returns a result to the front-end user;
the front-end user selects the plug-in to be used, fills in plug-in parameters according to the requirements of the plug-in and stores configuration information;
the execution process of the plug-in operation unit comprises the following steps:
the data sharing system prepares data to be output;
acquiring plug-in configuration information of shared data of a data sharing requirement;
acquiring a plug-in object from a plug-in object cache for each plug-in the plug-in configuration information, and if the plug-in object exists, directly calling the plug-in object to execute a data processing method for data processing; if the plug-in object does not exist, acquiring a jar full path of the plug-in with the data sharing requirement from the plug-in basic information cache according to the plug-in configuration information of the shared data, acquiring a plug-in class loader through the plug-in class loader cache, instantiating the plug-in by using the class loader, executing a plug-in initialization method, and calling the plug-in object to execute a data processing method for data processing;
acquiring a data processing result, judging whether all the plug-ins are executed completely, and if not, continuing to execute the process; if not, the data sharing system outputs a data processing result as shared data outside the data sharing requirement.
In a second aspect, the present invention further provides an easily extensible data sharing method based on a data sharing plug-in, which is applied to an easily extensible data sharing system based on a data sharing plug-in according to any one of claims 1 to 6; the method comprises the following steps:
acquiring a data sharing requirement, forming a rule of the data sharing requirement in a plug-in mode by a plug-in basic service module through a self-defined plug-in note and a plug-in interface according to the data sharing requirement on the basis of not influencing the normal operation of an original data sharing system by the plug-in basic service module, and loading a data sharing requirement plug-in into the data sharing system;
according to the data sharing demand plug-in loaded from the plug-in basic service module, management of the data sharing demand plug-in, application configuration of the data sharing demand plug-in and operation of the data sharing demand plug-in are concretely achieved; and the data result obtained after operation is used for sharing data externally in an interface mode.
Further, the plug-in base service module is independent of the data sharing system, the plug-in base service module being implemented as a separate module by a plug-in and being relied upon by the data sharing system.
Further, the management of the data sharing demand plug-in is realized, and specifically includes:
acquiring a jar file of a data sharing requirement plug-in uploaded by a user, and storing the jar file into a plug-in folder fixed by a data sharing system;
loading the jar file by adopting a custom class loader, and storing a jar full path of the data sharing demand plug-in and a current class loader into a plug-in class loader cache after successful loading;
scanning resource files in the jar file according to the jar file successfully loaded, and searching a plug-in interface or an abstract class defined in the plug-in basic service module;
checking the plug-in parameters one by adopting a plug-in basic information calibration rule judgment method; if all verification passes, the data sharing requirement plug-in is loaded successfully, a registration result is returned, and the full class name of the plug-in implementation class, the basic information of the plug-in and the full path of the data sharing requirement plug-in jar are stored to be cached in the basic information of the plug-in; and if the verification fails, the data sharing demand plug-in loading fails, the corresponding plug-in class loader cache is deleted, and the registration result is returned.
Further, the application configuration for implementing the data sharing requirement plug-in specifically includes:
a front-end user (such as a page) acquires an available plug-in list, a back-end system inquires a plug-in basic information cache and returns a result to the front-end user;
the front-end user selects the plug-in to be used, fills in plug-in parameters according to the plug-in requirement and stores configuration information;
the method for realizing the operation of the data sharing demand plug-in specifically comprises the following steps:
the data sharing system prepares data to be output;
acquiring plug-in configuration information of shared data of a data sharing requirement;
acquiring a plug-in object from a plug-in object cache for each plug-in the plug-in configuration information, and if the plug-in object exists, directly calling the plug-in object to execute a data processing method for data processing; if the plug-in object does not exist, acquiring a jar full path of the plug-in with the data sharing requirement from the plug-in basic information cache according to the plug-in configuration information of the shared data, acquiring a plug-in class loader through the plug-in class loader cache, instantiating the plug-in by using the class loader, executing a plug-in initialization method, and calling the plug-in object to execute a data processing method for data processing;
acquiring a data processing result, judging whether all the plug-ins are executed completely, and if not, continuing to execute the process; if not, the data sharing system outputs a data processing result as shared data outside the data sharing requirement.
Compared with the prior art, the invention has the following advantages and beneficial effects:
1. the invention relates to an easily-extensible data sharing system and method based on a data sharing plug-in, wherein a new data processing rule is developed without being carried out in an original data sharing system, only a plug-in basic service module (a basic jar packet) is needed to be relied on, and then a plug-in service class is realized; the new data processing rule is quickly online and dynamically managed (hot plug), and the data sharing system does not need to be stopped and restarted; the plug-in is loaded according to the requirement, so that the system resource is saved; the problem of high customization of a data sharing system is solved, and the maintenance cost and the development cost are reduced; the problem of inefficiency is solved, accomplish quick response, the quick line of going up.
2. The invention relates to an easily extensible data sharing system and method based on data sharing plug-ins, which have the advantages that the plug-ins are isolated in a class mode, and the problem of dependence conflict among the plug-ins is not required to be concerned; the plug-in realizes natural integration with the basic information used by the user by using the plug-in (when the code for data processing is realized, the basic information of the plug-in is written in the annotation together), and does not need to be managed separately.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention. In the drawings:
fig. 1 is a schematic structural diagram of an easily extensible data sharing system based on a data sharing plug-in according to the present invention.
FIG. 2 is a flowchart illustrating plug-in registration by the registration unit of the data sharing requirement plug-in according to the present invention.
FIG. 3 is a flowchart illustrating a plug-in offload by the offload unit of the data sharing requirement plug-in according to the present invention.
Fig. 4 is a flowchart of the plug-in application configuration unit performing plug-in application configuration according to the present invention.
FIG. 5 is a flowchart of the operation of the plug-in unit according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to examples and accompanying drawings, and the exemplary embodiments and descriptions thereof are only used for explaining the present invention and are not meant to limit the present invention.
Example 1
As shown in fig. 1 to 5, an easily extensible data sharing system based on a data sharing plug-in of the present invention is shown in fig. 1, and the system includes a data sharing system and a plug-in basic service module;
the plug-in basic service module is independent of the data sharing system, and the plug-in basic service module is realized by a plug-in as a single module and is depended by the data sharing system; the plug-in basic service module is used for forming a rule for the data sharing requirement in a plug-in mode by a user-defined plug-in annotation and a plug-in interface according to a newly added data sharing requirement on the basis of not influencing the normal operation of the original data sharing system and depending on the plug-in basic service module, and loading a data sharing requirement plug-in into the data sharing system;
the data sharing system is used for specifically realizing management of the data sharing demand plug-in, application configuration of the data sharing demand plug-in and operation of the data sharing demand plug-in according to the data sharing demand plug-in loaded from the plug-in basic service module; and the data result obtained after operation is used for sharing data externally in an interface mode.
In this embodiment, the plug-in basic service module includes a plug-in annotation unit, a plug-in information parameter unit, and a plug-in interface unit;
the plug-in annotation unit is used for defining plug-in annotation according to the acquired data sharing requirement, and examples are as follows: @ Plugin;
the plug-in information parameter unit is used for adding description plug-in basic information in the plug-in annotation according to the plug-in annotation; the plug-in basic information comprises a plug-in name, a plug-in version, a plug-in type, a plug-in description, a plug-in parameter description, a plug-in function and a detailed description of use; the plug-in type is data used to describe what format can be processed; the detailed description of the functions and the use of the plug-in is used for introducing how a user uses the plug-in and what the plug-in can do in detail;
the plug-in interface unit is used for realizing the functions of plug-in initialization and data processing by defining a plug-in interface or an abstract class; the plug-in interface or the abstract class at least comprises two methods, wherein one method is responsible for initializing the plug-in and the other method is responsible for executing data processing. Example (c): defining an interface PluginService, wherein the interface comprises two methods: defaultvoinit () { } is used for initializing the plugin, and can be realized by rewriting the method if the plugin implementation class needs to load some configuration of the plugin or perform some preparation work; object exit (Object data, string param), where data is input data (data to be processed), param is a plug-in parameter (for example, a desensitization plug-in supports a user to specify a field that needs desensitization, etc.), and the return result and type are Object.
In this embodiment, the data sharing system includes a plug-in loading module, a plug-in management module, and a plug-in execution module; the plug-in management module depends on the plug-in loading module, and the plug-in execution module depends on the plug-in loading module.
The plug-in loading module is used for loading the plug-in with the data sharing requirement through a custom class loader, wherein the custom class loader is a plug-in class loader which destroys a parental delegation mechanism, and can realize loading as required and solve the problem of dependency conflict.
Specifically, the plug-in loading module defines a custom plug-in class loader plug classloader inherited to the urlclass loader, the custom class loader needs to destroy a parent delegation mechanism, a current class loader is preferentially used for loading a specified class, and if loading fails, a system class loader is used for loading.
In this embodiment, the plug-in management module includes a registration unit of the data sharing demand plug-in and an uninstallation unit of the data sharing demand plug-in; ( The caching and storing mode of the plug-in basic information mentioned in the following plug-in management module preferably uses a persistent (such as redis) cache or a database for storage. Because the data sharing system will load all data processing plug-ins under the plug-in directory after reboot if non-persistent cache (memory) is used. )
As shown in fig. 2, the execution process of the registration unit of the data sharing requirement plug-in includes:
(1) Acquiring a jar file of a data sharing requirement plug-in uploaded by a user, and storing the jar file into a plug-in folder fixed by a data sharing system (example: a plugin folder of a directory where the system is located);
(2) Loading the jar file by adopting a custom class loader, and storing a jar full path of the data sharing demand plugin and the current class loader into a plugin class loader cache (key, value two fields, key is jar full path, and value is current class loader) after successful loading;
(3) Scanning a resource file in the jar file according to the jar file successfully loaded, and searching a plug-in interface or abstract class (such as PluginService) defined in the plug-in basic service module; and this class (class) contains our custom annotations (example @ Plugin).
(4) Verifying plug-in parameters (@ Plugin annotated parameters) one by adopting a plug-in basic information calibration rule judgment method; if all verification passes, storing the full class name (including the package name) of the plug-in implementation class, the plug-in basic information and the full path of the data sharing requirement plug-in jar to a plug-in basic information cache (three fields of key1, key2 and value, wherein key1 is the full path of the jar, key2 is the full class name of the plug-in implementation class, and value is the basic information of the plug-in); if the verification is not passed, the data sharing demand plug-in loading fails, the corresponding plug-in class loader cache is deleted, and a registration result is returned; and then continuing to execute, otherwise, the plug-in loading fails, deleting the plug-in class loader cache, and then executing the step (6).
(5) And (3) determining whether to instantiate the plug-in according to the parameters of the registered plug-in (which can be specified in the plug-in implementation and can also be configured in the data sharing system according to requirements; the type is booten), if not, continuing to execute the step (3) until all files are scanned, if so, calling the instantiation method of the current class through reflection, and executing the initialization method (example: init () method) of the plug-in after instantiation. And (3) storing the currently instantiated object into a plug-in object cache (three fields of key1, key2 and value, wherein key1 is a jar full path, key2 is a plug-in implementation class full name, and value is an implementation class object), and continuing to perform the step (3) until all files are scanned completely.
(6) And returning the plug-in addition result.
Specifically, the judging step of the plug-in basic information calibration rule judging method is as follows:
judging whether the resource files in the jar files are class files, if so, continuously judging whether the plug-in service class is realized or the plug-in abstract class is inherited; if not, judging whether the scanning is finished or not;
judging whether the plug-in service class is realized or the plug-in abstract class is inherited, if so, continuously judging whether plug-in annotation exists; if not, judging whether the scanning is finished or not;
judging whether plug-in annotation exists, if yes, continuously judging whether the annotation meets preset rules; if not, judging whether the scanning is finished or not;
judging whether the annotation meets a preset rule, if so, continuously judging whether instantiation is needed, and simultaneously writing the plug-in basic information into the plug-in basic information cache; if not, judging whether the scanning is finished or not;
judging whether instantiation is needed, if so, instantiating the plug-in implementation class, executing plug-in initialization, and writing the plug-in object after the plug-in is instantiated into a plug-in object cache; if not, judging whether the scanning is finished or not.
In this embodiment, as shown in fig. 3, the execution process of the uninstall unit of the data sharing requirement plug-in is as follows:
judging whether the plug-in to be unloaded exists in a plug-in object cache according to the selected plug-in to be unloaded, and if so, deleting the object in the plug-in object cache; if the plug-in to be unloaded does not exist, indicating that the unloading of the plug-in to be unloaded is completed;
acquiring a jar full path of the plug-in to be unloaded from a plug-in basic information cache, deleting the plug-in basic information cache of the plug-in to be unloaded, and if the plug-in basic information cache of the plug-in to be unloaded does not exist, indicating that the plug-in to be unloaded is unloaded;
judging whether a plug-in object of the jar full path of the plug-in to be unloaded exists in the plug-in basic information cache; if yes, indicating that the plug-in to be unloaded is unloaded completely; and if not, deleting the cache corresponding to the jar full path of the plug-in to be unloaded from the plug-in class loader cache, and closing the corresponding class loader.
In this embodiment, the method further includes a plug-in preparation operation when the data sharing system is started. (1) After the system kernel function is started, the fixed plug-in folder of the system (e.g., the plug-in folder of the directory where the system is located) is scanned. (2) And executing the plug-in registration method on all available plug-ins (the available plug-ins refer to the cached plug-in data if the plug-in basic information cache is stored in a persistent mode, and the available plug-ins are all plug-ins in the system (data sharing system) plug-in directory if the plug-in basic information cache is not stored in the persistent mode). The registration plug-in method is performed for each jar under the folder, if used. (3) The plug-in is ready to be completed.
In this embodiment, the plug-in execution module includes a plug-in application configuration unit and a plug-in operation unit;
as shown in fig. 4, the execution process of the plug-in application configuration unit is as follows:
a front-end user (such as a page) acquires an available plug-in list, and a back-end system inquires a plug-in basic information cache and returns a result to the front-end user;
the front-end user selects the plug-in to be used, fills in plug-in parameters according to the requirements of the plug-in and stores configuration information;
as shown in fig. 5, the execution process of the plug-in operation unit is as follows:
(1) the data sharing system prepares data needing to be output;
(2) and acquiring plug-in configuration information of shared data of the data sharing requirement, and recording the plug-in configuration information as P. And (4) executing the steps (3) to (6) for each plug-in the P.
(3) And (5) obtaining the plug-in object from the plug-in object cache, if the plug-in object exists, executing the step (5), and if the plug-in object does not exist, executing the step (4).
(4) And (3) acquiring a full path of the plug-in jar from the plug-in basic information cache according to the plug-in configuration of the shared data (if the plug-in does not exist or is unloaded, the step (6) is continuously executed), then acquiring a plug-in class loader through the plug-in class loader cache, then instantiating the plug-in by using the class loader, and executing a plug-in initialization (example: init) method.
(5) Calling a plug-in object to execute a data processing method (example: excute), it should be noted that the class loader used when calling a method needs to be the class loader that instantiates the plug-in.
(6) And (5) acquiring a data processing result, judging whether all the plug-ins in the P are executed, and if not, continuing to execute the steps (3) to (6).
(7) The data sharing system outputs a data processing result as shared data outside the data sharing requirement.
The data sharing system based on the plug-in is realized through the steps, the service development can be quickly responded, even if the requirement changes very frequently, the data sharing system can quickly respond without influencing the previous data sharing system, the decoupling from the previous system is realized, and developers can only concentrate on the development of new data sharing rules; and is very quick to use.
Note that: the caches such as the plug-in loader cache, the plug-in basic information cache, the plug-in object cache and the like can be stored by using a persistent cache or a database in a unified manner.
The working principle is as follows: based on the existing data sharing system, when a data sharing requirement is newly added, the plug-in is generated by performing customized development and packaging in the original data sharing system, and the data sharing can be performed only by restarting the service of the data sharing system, so that the customized development is inconvenient to expand, the maintenance cost is high, and the efficiency is low; and changing the data processing rule can affect the service operation of the data sharing system, and the plug-ins have the problems of dependence conflict and the like. Therefore, the invention designs an easily extensible data sharing system based on a data sharing plug-in, which is characterized in that a plug-in basic service module is independently arranged outside the original data sharing system, and the plug-in basic service module is realized by the plug-in as an independent module and is depended by the data sharing system; when a data sharing requirement is newly added, on the basis of not influencing the normal operation of the original data sharing system, the data sharing requirement is formed into a rule in a plug-in mode by a plug-in basic service module through a self-defined plug-in annotation and a plug-in interface, and the plug-in with the data sharing requirement is loaded into the data sharing system.
The invention has the following beneficial effects:
1. the development of a new data processing rule does not need to be carried out in the original data sharing system, and only a plug-in basic service module (a basic jar packet) is needed to be relied on, and then a plug-in service class is realized;
2. the new data processing rule of the invention is on-line and dynamically managed (hot plug), and the data sharing system does not need to be stopped and restarted;
3. the plug-in unit is loaded as required, so that system resources are saved;
4. and class isolation among the plug-ins is realized, and the problem of dependency conflict among the plug-ins is not required to be concerned.
5. The plug-in realizes natural integration with the basic information used by the user through the plug-in (when the code for data processing is realized, the basic information of the plug-in is written into the annotation together), and does not need to be managed separately.
6. The problem of high customization of a data sharing system is solved, and the maintenance cost and the development cost are reduced.
7. The problem of inefficiency is solved, accomplish quick response, the quick line of going up.
Example 2
As shown in fig. 1 to fig. 5, the present embodiment is different from embodiment 1 in that the present embodiment provides an easily extensible data sharing method based on a data sharing plug-in, and the method is applied to an easily extensible data sharing system based on a data sharing plug-in described in embodiment 1; the method comprises the following steps:
acquiring a data sharing requirement, forming a rule of the data sharing requirement in a plug-in mode by a plug-in basic service module through a self-defined plug-in note and a plug-in interface according to the data sharing requirement on the basis of not influencing the normal operation of an original data sharing system by the plug-in basic service module, and loading a data sharing requirement plug-in into the data sharing system;
according to the data sharing demand plug-in loaded from the plug-in basic service module, the management of the data sharing demand plug-in, the application configuration of the data sharing demand plug-in and the operation of the data sharing demand plug-in are concretely realized; and the data result obtained after operation is used for sharing data externally in an interface mode.
As a further implementation, the plug-in base service module is independent of the data sharing system, the plug-in base service module being implemented as a separate module by a plug-in and being relied upon by the data sharing system.
As a further implementation, the implementation of the management of the data sharing requirement plug-in specifically includes:
acquiring a jar file of a data sharing requirement plug-in uploaded by a user, and storing the jar file into a plug-in folder fixed by a data sharing system;
loading the jar file by adopting a custom class loader, and storing a jar full path of the data sharing demand plug-in and a current class loader into a plug-in class loader cache after successful loading;
scanning resource files in the jar file according to the jar file successfully loaded, and searching a plug-in interface or an abstract class defined in the plug-in basic service module;
checking the plug-in parameters one by adopting a plug-in basic information calibration rule judgment method; if all verification passes, the data sharing requirement plug-in is loaded successfully, a registration result is returned, and the full class name of the plug-in implementation class, the basic information of the plug-in and the full path of the data sharing requirement plug-in jar are stored to be cached in the basic information of the plug-in; and if the verification fails, the data sharing demand plug-in loading fails, the corresponding plug-in class loader cache is deleted, and the registration result is returned.
As a further implementation, the application configuration of the plug-in for implementing data sharing requirements specifically includes:
a front-end user (such as a page) acquires an available plug-in list, a back-end system inquires a plug-in basic information cache and returns a result to the front-end user;
the front-end user selects the plug-in to be used, fills in plug-in parameters according to the requirements of the plug-in and stores configuration information;
the method for realizing the operation of the data sharing requirement plug-in specifically comprises the following steps:
the data sharing system prepares data to be output;
acquiring plug-in configuration information of shared data of a data sharing requirement;
acquiring a plug-in object from a plug-in object cache for each plug-in the plug-in configuration information, and if the plug-in object exists, directly calling the plug-in object to execute a data processing method for data processing; if the plug-in object does not exist, acquiring a jar full path of the plug-in with the data sharing requirement from the plug-in basic information cache according to the plug-in configuration information of the shared data, acquiring a plug-in class loader through the plug-in class loader cache, instantiating the plug-in by using the class loader, executing a plug-in initialization method, and calling the plug-in object to execute a data processing method for data processing;
acquiring a data processing result, judging whether all the plug-ins are executed completely, and if not, continuing to execute the process; if not, the data sharing system outputs a data processing result as shared data outside the data sharing requirement.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. An easily extensible data sharing system based on a data sharing plug-in is characterized by comprising a data sharing system and a plug-in basic service module;
the plug-in basic service module is independent of the data sharing system, and the plug-in basic service module is realized by a plug-in as a single module and is depended by the data sharing system; the plug-in basic service module is used for forming a rule for the data sharing requirement in a plug-in mode by a user-defined plug-in annotation and a plug-in interface according to a newly added data sharing requirement on the basis of not influencing the normal operation of the original data sharing system and depending on the plug-in basic service module, and loading a data sharing requirement plug-in into the data sharing system;
the data sharing system is used for specifically realizing management of the data sharing demand plug-in, application configuration of the data sharing demand plug-in and operation of the data sharing demand plug-in according to the data sharing demand plug-in loaded from the plug-in basic service module; and the data result obtained after operation is used for sharing data externally in an interface mode.
2. The extensible data sharing system based on the data sharing plug-in unit of claim 1, wherein the plug-in basic service module comprises a plug-in annotation unit, a plug-in information parameter unit and a plug-in interface unit;
the plug-in annotation unit is used for defining plug-in annotation according to the acquired data sharing requirement;
the plug-in information parameter unit is used for adding description plug-in basic information in the plug-in annotation according to the plug-in annotation; the plug-in basic information comprises a plug-in name, a plug-in version, a plug-in type, a plug-in description, a plug-in parameter description, a plug-in function and a detailed description of use;
and the plug-in interface unit is used for realizing the functions of plug-in initialization and data processing by defining a plug-in interface or an abstract class.
3. The extensible data sharing system based on the data sharing plug-in unit of claim 1, wherein the data sharing system comprises a plug-in unit loading module, a plug-in unit management module and a plug-in unit execution module; the plug-in management module depends on the plug-in loading module, and the plug-in execution module depends on the plug-in loading module;
the plug-in loading module loads the plug-in with the data sharing requirement through a custom class loader, wherein the custom class loader is a plug-in class loader which destroys a parent delegation mechanism.
4. The system of claim 3, wherein the plug-in management module comprises a registration unit of the data sharing requirement plug-in and an uninstallation unit of the data sharing requirement plug-in;
the execution process of the registration unit of the data sharing requirement plug-in comprises the following steps:
acquiring a jar file of a data sharing requirement plug-in uploaded by a user, and storing the jar file into a plug-in folder fixed by a data sharing system;
loading the jar file by adopting a custom class loader, and storing a jar full path of the data sharing demand plug-in and a current class loader into a plug-in class loader cache after successful loading;
scanning resource files in the jar file according to the jar file successfully loaded, and searching a plug-in interface or an abstract class defined in the plug-in basic service module;
checking the plug-in parameters one by adopting a plug-in basic information calibration rule judgment method; if all verification passes, the data sharing requirement plug-in is loaded successfully, a registration result is returned, and the full class name of the plug-in implementation class, the basic information of the plug-in and the full path of the data sharing requirement plug-in jar are stored to be cached in the basic information of the plug-in; and if the verification fails, the data sharing demand plug-in loading fails, the corresponding plug-in class loader cache is deleted, and the registration result is returned.
5. The system of claim 4, wherein the uninstall unit of the data sharing requirement plug-in executes the following procedures:
judging whether the plug-in to be unloaded exists in a plug-in object cache according to the selected plug-in to be unloaded, and if so, deleting the object in the plug-in object cache; if the plug-in to be unloaded does not exist, the plug-in to be unloaded is completely unloaded;
acquiring a jar full path of the plug-in to be unloaded from a plug-in basic information cache and deleting the plug-in basic information cache of the plug-in to be unloaded, wherein if the plug-in basic information cache of the plug-in to be unloaded does not exist, the plug-in to be unloaded is completely unloaded;
judging whether a plug-in object of the jar full path of the plug-in to be unloaded exists in the plug-in basic information cache; if the plug-in to be unloaded exists, the unloading of the plug-in to be unloaded is completed; and if not, deleting the cache corresponding to the jar full path of the plug-in to be unloaded from the plug-in class loader cache, and closing the corresponding class loader.
6. The extensible data sharing system based on the data sharing plug-in unit of claim 3, wherein the plug-in execution module comprises a plug-in application configuration unit and a plug-in operation unit;
the execution process of the plug-in application configuration unit comprises the following steps:
the front-end user acquires an available plug-in list, and the back-end system inquires a plug-in basic information cache and returns a result to the front-end user;
the front-end user selects the plug-in to be used, fills in plug-in parameters according to the requirements of the plug-in and stores configuration information;
the execution process of the plug-in operation unit comprises the following steps:
the data sharing system prepares data to be output;
acquiring plug-in configuration information of shared data of a data sharing requirement;
acquiring a plug-in object from a plug-in object cache for each plug-in the plug-in configuration information, and if the plug-in object exists, directly calling the plug-in object to execute a data processing method for data processing; if the plug-in object does not exist, acquiring a jar full path of the plug-in with the data sharing requirement from the plug-in basic information cache according to the plug-in configuration information of the shared data, acquiring a plug-in class loader through the plug-in class loader cache, instantiating the plug-in by using the class loader, executing a plug-in initialization method, and calling the plug-in object to execute a data processing method for data processing;
acquiring a data processing result, judging whether all the plug-ins are executed completely, and if not, continuing to execute the process; if not, the data sharing system outputs a data processing result as shared data outside the data sharing requirement.
7. An easily extensible data sharing method based on a data sharing plug-in, which is applied to an easily extensible data sharing system based on a data sharing plug-in according to any one of claims 1 to 6; the method comprises the following steps:
acquiring a data sharing requirement, forming a rule of the data sharing requirement in a plug-in mode by a plug-in basic service module through self-defined plug-in annotation and a plug-in interface according to the data sharing requirement on the basis of not influencing the normal operation of an original data sharing system by the plug-in basic service module, and loading a data sharing requirement plug-in into the data sharing system;
according to the data sharing demand plug-in loaded from the plug-in basic service module, the management of the data sharing demand plug-in, the application configuration of the data sharing demand plug-in and the operation of the data sharing demand plug-in are concretely realized; and the data result obtained after operation is used for sharing data externally in an interface mode.
8. The method of claim 7, wherein the plug-in base service module is independent of the data sharing system, and the plug-in base service module is implemented as a separate module by a plug-in and depended on by the data sharing system.
9. The easily extensible data sharing method based on the data sharing plugin according to claim 7, wherein the management of the data sharing requirement plugin is realized by specifically comprising:
acquiring a jar file of a data sharing requirement plug-in uploaded by a user, and storing the jar file into a plug-in folder fixed by a data sharing system;
loading the jar file by adopting a custom class loader, and storing a jar full path of the data sharing demand plug-in and a current class loader into a plug-in class loader cache after successful loading;
scanning resource files in the jar file according to the jar file successfully loaded, and searching a plug-in interface or an abstract class defined in the plug-in basic service module;
checking the plug-in parameters one by adopting a plug-in basic information calibration rule judgment method; if all verification passes, the data sharing requirement plug-in is loaded successfully, a registration result is returned, and the full class name of the plug-in implementation class, the basic information of the plug-in and the full path of the data sharing requirement plug-in jar are stored to be cached in the basic information of the plug-in; and if the verification is not passed, the data sharing demand plug-in loading fails, the corresponding plug-in class loader cache is deleted, and the registration result is returned.
10. The method for easily expanding data sharing based on data sharing plugin according to claim 7, wherein the application configuration for implementing the data sharing requirement plugin specifically includes:
the front-end user acquires an available plug-in list, the back-end system inquires the basic information cache of the plug-ins and returns the result to the front-end user;
the front-end user selects the plug-in to be used, fills in plug-in parameters according to the requirements of the plug-in and stores configuration information;
the method for realizing the operation of the data sharing demand plug-in specifically comprises the following steps:
the data sharing system prepares data needing to be output;
acquiring plug-in configuration information of shared data of a data sharing requirement;
acquiring a plug-in object from a plug-in object cache for each plug-in the plug-in configuration information, and if the plug-in object exists, directly calling the plug-in object to execute a data processing method for data processing; if the plug-in object does not exist, acquiring a jar full path of the data sharing plug-in from the plug-in basic information cache according to the plug-in configuration information of the shared data, acquiring a plug-in class loader through the plug-in class loader cache, instantiating the plug-in by using the class loader, executing a plug-in initialization method, and calling the plug-in object to execute a data processing method for data processing;
acquiring a data processing result, judging whether all the plug-ins are executed completely, and if not, continuing to execute the process; if not, the data sharing system outputs a data processing result as shared data outside the data sharing requirement.
CN202210906110.9A 2022-07-29 2022-07-29 Easily-extensible data sharing system and method based on data sharing plug-in Pending CN115237631A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210906110.9A CN115237631A (en) 2022-07-29 2022-07-29 Easily-extensible data sharing system and method based on data sharing plug-in

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210906110.9A CN115237631A (en) 2022-07-29 2022-07-29 Easily-extensible data sharing system and method based on data sharing plug-in

Publications (1)

Publication Number Publication Date
CN115237631A true CN115237631A (en) 2022-10-25

Family

ID=83677898

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210906110.9A Pending CN115237631A (en) 2022-07-29 2022-07-29 Easily-extensible data sharing system and method based on data sharing plug-in

Country Status (1)

Country Link
CN (1) CN115237631A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116541105A (en) * 2023-07-06 2023-08-04 智慧眼科技股份有限公司 Annotation-based component loading method, system, terminal and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116541105A (en) * 2023-07-06 2023-08-04 智慧眼科技股份有限公司 Annotation-based component loading method, system, terminal and storage medium

Similar Documents

Publication Publication Date Title
CN105657191B (en) Application increment upgrading method and system based on Android system
CN109614167B (en) Method and system for managing plug-ins
CN108279941B (en) Application program compression method and device
US8386608B1 (en) Service scripting framework
WO2021022713A1 (en) Distributed module update method, device, and storage medium
CN108614702B (en) Byte code optimization method and device
JP2004158012A (en) System and method for software application management
US11816458B2 (en) Method and system for packaging infrastructure as code
CN106406919A (en) Terminal device pre-loaded application management method and terminal device
CN111651169B (en) Block chain intelligent contract operation method and system based on web container
US9411618B2 (en) Metadata-based class loading using a content repository
CN115237631A (en) Easily-extensible data sharing system and method based on data sharing plug-in
CN117707543A (en) Application installation package manufacturing and installation method, computing device and storage medium
CN108694048B (en) Method for realizing batch publishing service
US20180341475A1 (en) Just In Time Deployment with Package Managers
CN111045746A (en) Code expansion method and framework
CN115129348A (en) Resource updating method, device and equipment of application program and readable storage medium
US8190587B1 (en) In-place image promotion
CN111273940B (en) Method and device for uploading program file to code warehouse
WO2020029995A1 (en) Application upgrading through sharing dependencies
US20240193032A1 (en) Performing ci/cd error analysis involving software products that are dependent upon each other
CN113127140B (en) Resource management method, device and system
US20240152371A1 (en) Dynamic re-execution of parts of a containerized application pipeline
CN113076109B (en) Cross-platform script language deployment method
US12013774B2 (en) Verification of core file debugging resources

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