CN113590187B - Method and device for acquiring codes and electronic equipment - Google Patents
Method and device for acquiring codes and electronic equipment Download PDFInfo
- Publication number
- CN113590187B CN113590187B CN202110790642.6A CN202110790642A CN113590187B CN 113590187 B CN113590187 B CN 113590187B CN 202110790642 A CN202110790642 A CN 202110790642A CN 113590187 B CN113590187 B CN 113590187B
- Authority
- CN
- China
- Prior art keywords
- code
- script
- class
- calling
- name
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 238000013515 script Methods 0.000 claims abstract description 124
- 238000013507 mapping Methods 0.000 claims abstract description 25
- 238000005516 engineering process Methods 0.000 abstract description 3
- 238000010586 diagram Methods 0.000 description 9
- 238000004891 communication Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 6
- 238000004590 computer program Methods 0.000 description 5
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012552 review Methods 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/72—Code refactoring
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Information Transfer Between Computers (AREA)
Abstract
本申请涉及计算机技术领域,公开一种用于获取代码的方法,包括:获取待加载代码及待加载代码对应的脚本名,在预设的数据库中获取与脚本名对应的调用脚本;数据库中存储有接收到的调用脚本以及调用脚本和脚本名的映射关系;获取与调用脚本对应的目标类;将目标类加载到待加载代码中,获得待运行代码。采用本申请提供的用于获取代码的方法,在新的服务提供者接入服务调用平台的情况下,能够通过接收与新的服务提供者对应的调用脚本,从而将与新的服务提供者对应的目标类加载到待加载代码中,而不需要修改服务调用平台中的调用代码,因此提高了服务调用平台的稳定性。
This application relates to the field of computer technology and discloses a method for obtaining code, which includes: obtaining the code to be loaded and the script name corresponding to the code to be loaded, obtaining the calling script corresponding to the script name in a preset database; storing in the database There is the received calling script and the mapping relationship between the calling script and the script name; the target class corresponding to the calling script is obtained; the target class is loaded into the code to be loaded, and the code to be run is obtained. Using the method for obtaining codes provided by this application, when a new service provider accesses the service invocation platform, the invocation script corresponding to the new service provider can be received, thereby making the code corresponding to the new service provider The target class is loaded into the code to be loaded without modifying the calling code in the service calling platform, thus improving the stability of the service calling platform.
Description
技术领域Technical field
本申请涉及计算机技术领域,具体涉及一种用于获取代码的方法及装置、电子设备。This application relates to the field of computer technology, and specifically to a method and device for obtaining codes, and electronic equipment.
背景技术Background technique
现有技术中,待加载代码通过服务调用平台调用服务提供者的前提是,已修改服务调用平台中的调用代码使得服务调用平台与服务提供者适配。In the prior art, the prerequisite for the code to be loaded to call the service provider through the service calling platform is that the calling code in the service calling platform has been modified to adapt the service calling platform to the service provider.
在实现本公开实施例的过程中,发现相关技术中至少存在如下问题:In the process of implementing the embodiments of the present disclosure, it is found that there are at least the following problems in related technologies:
当有新的服务提供者接入服务调用平台时,需要修改服务调用平台中的调用代码,使得服务调用平台与服务提供者适配;在服务提供者持续更新的情况下,新的服务提供者将不断接入服务调用平台,因此需要不断修改服务调用平台中的调用代码。这样使得服务调用平台一直处于开发状态,从而使得服务调用平台的稳定性较低。When a new service provider accesses the service invocation platform, the calling code in the service invocation platform needs to be modified to adapt the service invocation platform to the service provider; when the service provider is continuously updated, the new service provider It will be continuously connected to the service calling platform, so the calling code in the service calling platform needs to be constantly modified. This keeps the service invocation platform in a state of development, making the service invocation platform less stable.
发明内容Contents of the invention
为了对披露的实施例的一些方面有基本的理解,下面给出了简单的概括。所述概括不是泛泛评述,也不是要确定关键/重要组成元素或描绘这些实施例的保护范围,而是作为后面的详细说明的序言。In order to provide a basic understanding of some aspects of the disclosed embodiments, a simplified summary is provided below. This summary is not intended to be a general review, nor is it intended to identify key/important elements or delineate the scope of the embodiments, but is intended to serve as a prelude to the detailed description that follows.
本公开实施例提供了一种用于获取代码的方法及装置、电子设备,以提高服务调用平台的稳定性。Embodiments of the present disclosure provide a method, device, and electronic device for obtaining codes to improve the stability of the service invocation platform.
在一些实施例中,上述用于获取代码的方法包括:获取待加载代码及所述待加载代码对应的脚本名;在预设的数据库中获取与所述脚本名对应的调用脚本;所述数据库中存储有接收到的调用脚本以及所述调用脚本和脚本名的映射关系;获取与所述调用脚本对应的目标类;将所述目标类加载到所述待加载代码中,获得待运行代码。In some embodiments, the above method for obtaining code includes: obtaining the code to be loaded and the script name corresponding to the code to be loaded; obtaining the calling script corresponding to the script name in a preset database; the database The received calling script and the mapping relationship between the calling script and the script name are stored in; the target class corresponding to the calling script is obtained; the target class is loaded into the code to be loaded to obtain the code to be run.
在一些实施例中,上述用于获取代码的装置包括:第一获取模块,被配置为获取待加载代码及所述待加载代码对应的脚本名;第二获取模块,被配置为在预设的数据库中获取与所述脚本名对应的调用脚本;所述数据库中存储有接收到的调用脚本以及所述调用脚本和脚本名的映射关系;第三获取模块,被配置为获取与所述调用脚本对应的目标类;加载模块,被配置为将所述目标类加载到所述待加载代码中,获得待运行代码。In some embodiments, the above-mentioned device for obtaining code includes: a first obtaining module configured to obtain the code to be loaded and the script name corresponding to the code to be loaded; and a second obtaining module configured to obtain the code at a preset time. The calling script corresponding to the script name is obtained from the database; the received calling script and the mapping relationship between the calling script and the script name are stored in the database; the third acquisition module is configured to obtain the calling script corresponding to the calling script. The corresponding target class; the loading module is configured to load the target class into the code to be loaded and obtain the code to be run.
在一些实施例中,所述用于获取代码的装置,包括处理器和存储有程序指令的存储器,所述处理器被配置为在运行所述程序指令时,执行上述的用于获取代码的方法。In some embodiments, the device for obtaining code includes a processor and a memory storing program instructions, and the processor is configured to execute the above method for obtaining code when running the program instructions. .
在一些实施例中,所述电子设备包括:包括上述的用于获取代码的装置。In some embodiments, the electronic device includes: the above-mentioned device for obtaining the code.
本公开实施例提供的用于获取代码的方法及装置、电子设备,可以实现以下技术效果:通过获取待加载代码及与待加载代码对应的脚本名,并根据接收到的调用脚本以及调用脚本与脚本名的映射关系,获取与调用脚本对应的目标类,并将目标类加载到待加载代码中,获得待运行代码。这样在新的服务提供者接入服务调用平台的情况下,能够通过接收与新的服务提供者对应的调用脚本,从而将与新的服务提供者对应的目标类加载到待加载代码中,而不需要修改服务调用平台中的调用代码,因此提高了服务调用平台的稳定性。The method, device and electronic equipment for obtaining codes provided by the embodiments of the present disclosure can achieve the following technical effects: by obtaining the code to be loaded and the script name corresponding to the code to be loaded, and based on the received calling script and the calling script and Mapping relationship of script names, obtaining the target class corresponding to the calling script, and loading the target class into the code to be loaded to obtain the code to be run. In this way, when a new service provider accesses the service calling platform, the target class corresponding to the new service provider can be loaded into the code to be loaded by receiving the calling script corresponding to the new service provider. There is no need to modify the calling code in the service calling platform, thus improving the stability of the service calling platform.
以上的总体描述和下文中的描述仅是示例性和解释性的,不用于限制本申请。The above general description and the following description are exemplary and explanatory only and are not intended to limit the application.
附图说明Description of the drawings
一个或多个实施例通过与之对应的附图进行示例性说明,这些示例性说明和附图并不构成对实施例的限定,附图中具有相同参考数字标号的元件示为类似的元件,附图不构成比例限制,并且其中:One or more embodiments are exemplified by corresponding drawings. These exemplary descriptions and drawings do not constitute limitations to the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements. The drawings are not limited to scale and in which:
图1是本公开实施例提供的一个用于获取代码的方法的示意图;Figure 1 is a schematic diagram of a method for obtaining codes provided by an embodiment of the present disclosure;
图2是本公开实施例提供的另一个用于获取代码的方法的示意图;Figure 2 is a schematic diagram of another method for obtaining codes provided by an embodiment of the present disclosure;
图3是本公开实施例提供的一个用于获取代码的装置的示意图;Figure 3 is a schematic diagram of a device for obtaining codes provided by an embodiment of the present disclosure;
图4是本公开实施例提供的另一个用于获取代码的装置的示意图。Figure 4 is a schematic diagram of another device for obtaining codes provided by an embodiment of the present disclosure.
具体实施方式Detailed ways
为了能够更加详尽地了解本公开实施例的特点与技术内容,下面结合附图对本公开实施例的实现进行详细阐述,所附附图仅供参考说明之用,并非用来限定本公开实施例。在以下的技术描述中,为方便解释起见,通过多个细节以提供对所披露实施例的充分理解。然而,在没有这些细节的情况下,一个或多个实施例仍然可以实施。在其它情况下,为简化附图,熟知的结构和装置可以简化展示。In order to understand the characteristics and technical content of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. The attached drawings are for reference only and are not intended to limit the embodiments of the present disclosure. In the following technical description, for convenience of explanation, multiple details are provided to provide a thorough understanding of the disclosed embodiments. However, one or more embodiments may be practiced without these details. In other instances, well-known structures and devices may be shown simplified to simplify the drawings.
本公开实施例的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本公开实施例的实施例。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含。The terms "first", "second", etc. in the description and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that data so used are interchangeable under appropriate circumstances for the purposes of the embodiments of the disclosure described herein. Furthermore, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion.
除非另有说明,术语“多个”表示两个或两个以上。Unless otherwise stated, the term "plurality" means two or more.
本公开实施例中,字符“/”表示前后对象是一种“或”的关系。例如,A/B表示:A或B。In the embodiment of the present disclosure, the character "/" indicates that the preceding and following objects are in an "or" relationship. For example, A/B means: A or B.
术语“和/或”是一种描述对象的关联关系,表示可以存在三种关系。例如,A和/或B,表示:A或B,或,A和B这三种关系。The term "and/or" is an association relationship describing objects, indicating that three relationships can exist. For example, A and/or B means: A or B, or A and B.
结合图1所示,本公开实施例提供一种用于获取代码的方法,包括:As shown in FIG. 1 , an embodiment of the present disclosure provides a method for obtaining code, including:
步骤S101、获取待加载代码及待加载代码对应的脚本名;Step S101: Obtain the code to be loaded and the script name corresponding to the code to be loaded;
步骤S102、在预设的数据库中获取与脚本名对应的调用脚本;数据库中存储有接收到的调用脚本以及调用脚本和脚本名的映射关系;Step S102: Obtain the calling script corresponding to the script name in a preset database; the database stores the received calling script and the mapping relationship between the calling script and the script name;
步骤S103、获取与调用脚本对应的目标类;Step S103: Obtain the target class corresponding to the calling script;
步骤S104、将目标类加载到待加载代码中,获得待运行代码。Step S104: Load the target class into the code to be loaded and obtain the code to be run.
本公开实施例提供的用于获取代码的方法,通过获取待加载代码及与待加载代码对应的脚本名,并根据接收到的调用脚本以及调用脚本与脚本名的映射关系,获取与调用脚本对应的目标类,并将目标类加载到待加载代码中,获得待运行代码。因此在新的服务提供者接入服务调用平台的情况下,能够通过接收与新的服务提供者对应的调用脚本,从而将与新的服务提供者对应的目标类加载到待加载代码中,实现待加载代码通过服务调用平台调用新的服务提供者,而不需要修改服务调用平台中的调用代码。因此提高了服务调用平台的稳定性。The method for obtaining the code provided by the embodiment of the present disclosure obtains the code to be loaded and the script name corresponding to the code to be loaded, and obtains the corresponding call script according to the received calling script and the mapping relationship between the calling script and the script name. target class, and load the target class into the code to be loaded to obtain the code to be run. Therefore, when a new service provider accesses the service calling platform, the target class corresponding to the new service provider can be loaded into the code to be loaded by receiving the calling script corresponding to the new service provider. The code to be loaded calls the new service provider through the service calling platform without modifying the calling code in the service calling platform. Therefore, the stability of the service calling platform is improved.
可选地,通过API(Application Program Interface,应用程序接口)接口获取待运行代码。Optionally, obtain the code to be run through an API (Application Program Interface) interface.
可选地,通过API接口接收调用脚本以及调用脚本和脚本名的映射关系,并将接收到的调用脚本以及调用脚本和脚本名的映射关系存储到数据库中。Optionally, the calling script and the mapping relationship between the calling script and the script name are received through the API interface, and the received calling script and the mapping relationship between the calling script and the script name are stored in the database.
可选地,调用脚本为groovy脚本。Optionally, the calling script is a groovy script.
可选地,调用脚本中包括类的全路径限定名,获取与调用脚本对应的目标类,包括:在调用脚本中获取类的全路径限定名;获取与类的全路径限定名对应的目标类。Optionally, the calling script includes the full path qualified name of the class, and obtains the target class corresponding to the calling script, including: obtaining the full path qualified name of the class in the calling script; obtaining the target class corresponding to the full path qualified name of the class .
可选地,获取与类的全路径限定名对应的目标类,包括:在预设的网络磁盘上获取与类的全路径限定名对应的目标字节码;在网络磁盘中存储有类的全路径限定名与目标字节码的映射关系;通过类加载器加载目标字节码,获得目标类。Optionally, obtaining the target class corresponding to the full path qualified name of the class includes: obtaining the target bytecode corresponding to the full path qualified name of the class on a preset network disk; storing the full path qualified name of the class in the network disk. The mapping relationship between the path qualified name and the target bytecode; load the target bytecode through the class loader to obtain the target class.
可选地,通过API接口接收JAR包(Java ARchive,Java归档),并将接收到的JAR包存储到网络磁盘上。Optionally, receive the JAR package (Java ARchive, Java archive) through the API interface, and store the received JAR package on the network disk.
可选地,JAR包中包括目标字节码以及目标字节码与类的全路径限定名的映射关系。Optionally, the JAR package includes the target bytecode and the mapping relationship between the target bytecode and the full path qualified name of the class.
可选地,JAR包中包括对源代码进行编译后获得的目标字节码。Optionally, the JAR package includes the target bytecode obtained after compiling the source code.
在一些实施例中,服务调用平台提供上传JAR包和groovy脚本的API接口;服务调用平台接收服务提供者通过API接口上传的JAR包,并将接收到的JAR包存储到网络磁盘中;服务调用平台接收服务调用者通过API接口上传的groovy脚本以及groovy脚本和脚本名的映射关系,并将接收到的groovy脚本以及groovy脚本和脚本名的映射关系存储到数据库中。In some embodiments, the service invocation platform provides an API interface for uploading JAR packages and groovy scripts; the service invocation platform receives JAR packages uploaded by service providers through the API interface, and stores the received JAR packages in a network disk; service invocation The platform receives the groovy script uploaded by the service caller through the API interface and the mapping relationship between the groovy script and the script name, and stores the received groovy script and the mapping relationship between the groovy script and the script name in the database.
可选地,通过类加载器在网络磁盘上获取与类的全路径限定名对应的目标字节码。Optionally, obtain the target bytecode corresponding to the full path qualified name of the class on the network disk through the class loader.
可选地,通过类加载器将目标类加载到JVM内存中。Optionally, load the target class into JVM memory via a class loader.
可选地,将JVM内存中的目标类加载到待运行代码中,获得待运行代码。Optionally, load the target class in the JVM memory into the code to be run to obtain the code to be run.
可选地,获得待运行代码后,还包括:运行待运行代码。Optionally, after obtaining the code to be run, the method further includes: running the code to be run.
结合图2所示,本公开实施例提供一种用于获取代码的方法,包括:As shown in FIG. 2 , an embodiment of the present disclosure provides a method for obtaining code, including:
步骤S201、获取待加载代码及待加载代码对应的脚本名。Step S201: Obtain the code to be loaded and the script name corresponding to the code to be loaded.
步骤S202、在预设的数据库中获取与脚本名对应的调用脚本;数据库中存储有接收到的调用脚本以及调用脚本和脚本名的映射关系。Step S202: Obtain the calling script corresponding to the script name in a preset database; the database stores the received calling script and the mapping relationship between the calling script and the script name.
步骤S203、获取与调用脚本对应的目标类。Step S203: Obtain the target class corresponding to the calling script.
步骤S204、将目标类加载到待加载代码中,获得待运行代码。Step S204: Load the target class into the code to be loaded and obtain the code to be run.
步骤S205、运行待运行代码。Step S205: Run the code to be run.
本公开实施例提供的用于获取代码的方法,通过获取待加载代码及与待加载代码对应的脚本名,并根据接收到的调用脚本以及调用脚本与脚本名的映射关系,获取与调用脚本对应的目标类,并将目标类加载到待加载代码中,获得并运行待运行代码。因此在新的服务提供者接入服务调用平台的情况下,能够根据接收服务提供者上传的JAR包,和服务调用者上传的groovy脚本以及groovy脚本和脚本名的映射关系,将目标类加载到待加载代码中,获得待运行代码。实现了待加载代码通过服务调用平台调用新的服务提供者,不需要修改服务调用平台中的调用代码,从而提高了服务调用平台的稳定性,使得服务调用平台从研发态迅速进入运维态。同时由于不再需要服务调用平台修改调用代码,因而提高了服务提供者接入服务调用平台的接入效率。The method for obtaining the code provided by the embodiment of the present disclosure obtains the code to be loaded and the script name corresponding to the code to be loaded, and obtains the corresponding call script according to the received calling script and the mapping relationship between the calling script and the script name. The target class, and load the target class into the code to be loaded, obtain and run the code to be run. Therefore, when a new service provider accesses the service calling platform, it can load the target class into In the code to be loaded, the code to be run is obtained. It realizes that the code to be loaded can call a new service provider through the service calling platform without modifying the calling code in the service calling platform, thereby improving the stability of the service calling platform and allowing the service calling platform to quickly enter the operation and maintenance state from the R&D state. At the same time, since the service calling platform no longer needs to modify the calling code, the access efficiency of the service provider to the service calling platform is improved.
结合图3所示,本公开实施例提供一种用于获取代码的装置,包括:第一获取模块301、第二获取模块302、第三获取模块303和加载模块304;第一获取模块301,被配置为获取待加载代码及待加载代码对应的脚本名;第二获取模块302,被配置为在预设的数据库中获取与脚本名对应的调用脚本;数据库中存储有接收到的调用脚本以及调用脚本和脚本名的映射关系;第三获取模块303,被配置为获取与调用脚本对应的目标类;加载模块304,被配置为将目标类加载到待加载代码中,获得待运行代码。As shown in FIG. 3 , an embodiment of the present disclosure provides a device for obtaining codes, including: a first acquisition module 301, a second acquisition module 302, a third acquisition module 303, and a loading module 304; the first acquisition module 301, is configured to obtain the code to be loaded and the script name corresponding to the code to be loaded; the second acquisition module 302 is configured to obtain the calling script corresponding to the script name in a preset database; the database stores the received calling script and The mapping relationship between the calling script and the script name; the third obtaining module 303 is configured to obtain the target class corresponding to the calling script; the loading module 304 is configured to load the target class into the code to be loaded and obtain the code to be run.
本公开实施例提供的用于获取代码的装置,通过第一获取模块获取待加载代码及与待加载代码对应的脚本名,根据第二获取模块从数据库中获取调用脚本与脚本名的映射关系,使得第三获取模块能够获取与调用脚本对应的目标类,并通过加载模块将目标类加载到待加载代码中,获得待运行代码。这样在新的服务提供者接入服务调用平台的情况下,能够通过接收与新的服务提供者对应的调用脚本,从而将与新的服务提供者对应的目标类加载到待加载代码中,而不需要修改服务调用平台中的调用代码,因此提高了服务调用平台的稳定性。The device for obtaining code provided by the embodiment of the present disclosure obtains the code to be loaded and the script name corresponding to the code to be loaded through the first obtaining module, and obtains the mapping relationship between the calling script and the script name from the database according to the second obtaining module, The third acquisition module is enabled to obtain the target class corresponding to the calling script, and load the target class into the code to be loaded through the loading module to obtain the code to be run. In this way, when a new service provider accesses the service calling platform, the target class corresponding to the new service provider can be loaded into the code to be loaded by receiving the calling script corresponding to the new service provider. There is no need to modify the calling code in the service calling platform, thus improving the stability of the service calling platform.
可选地,调用脚本中包括类的全路径限定名,第三获取模块303,被配置为在调用脚本中获取类的全路径限定名;获取与类的全路径限定名对应的目标类。Optionally, the calling script includes the full path qualified name of the class, and the third acquisition module 303 is configured to obtain the full path qualified name of the class in the calling script; and obtain the target class corresponding to the full path qualified name of the class.
可选地,第三获取模块303,被配置为在调用脚本中获取类的全路径限定名,在预设的网络磁盘上获取与类的全路径限定名对应的目标字节码,网络磁盘中存储有类的全路径限定名和目标字节码的对应关系;通过类加载器加载目标字节码,获得目标类。Optionally, the third acquisition module 303 is configured to obtain the full path qualified name of the class in the calling script, and obtain the target bytecode corresponding to the full path qualified name of the class on the preset network disk. The corresponding relationship between the full path qualified name of the class and the target bytecode is stored; the target bytecode is loaded through the class loader to obtain the target class.
可选地,用于获取代码的装置,还包括:运行模块,被配置为运行待运行代码。Optionally, the device for obtaining the code further includes: a running module configured to run the code to be run.
结合图4所示,本公开实施例提供一种用于获取代码的装置,包括处理器(processor)400和存储器(memory)401。可选地,该装置还可以包括通信接口(Communication Interface)402和总线403。其中,处理器400、通信接口402、存储器401可以通过总线403完成相互间的通信。通信接口402可以用于信息传输。处理器400可以调用存储器401中的逻辑指令,以执行上述实施例的用于获取代码的方法。As shown in FIG. 4 , an embodiment of the present disclosure provides a device for obtaining code, including a processor (processor) 400 and a memory (memory) 401. Optionally, the device may also include a communication interface (Communication Interface) 402 and a bus 403. Among them, the processor 400, the communication interface 402, and the memory 401 can communicate with each other through the bus 403. Communication interface 402 may be used for information transmission. The processor 400 can call logical instructions in the memory 401 to execute the method for obtaining code in the above embodiment.
本公开实施例提供的用于获取代码的装置,通过获取待加载代码及与待加载代码对应的脚本名,并根据接收到的调用脚本以及调用脚本与脚本名的映射关系,获取与调用脚本对应的目标类,并将目标类加载到待加载代码中,获得待运行代码。这样在新的服务提供者接入服务调用平台的情况下,能够通过接收与新的服务提供者对应的调用脚本,从而将与新的服务提供者对应的目标类加载到待加载代码中,而不需要修改服务调用平台中的调用代码,因此提高了服务调用平台的稳定性。The device for obtaining code provided by the embodiment of the present disclosure obtains the code to be loaded and the script name corresponding to the code to be loaded, and obtains the corresponding call script according to the received calling script and the mapping relationship between the calling script and the script name. target class, and load the target class into the code to be loaded to obtain the code to be run. In this way, when a new service provider accesses the service calling platform, the target class corresponding to the new service provider can be loaded into the code to be loaded by receiving the calling script corresponding to the new service provider. There is no need to modify the calling code in the service calling platform, thus improving the stability of the service calling platform.
此外,上述的存储器401中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。In addition, the above-mentioned logical instructions in the memory 401 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
存储器401作为一种计算机可读存储介质,可用于存储软件程序、计算机可执行程序,如本公开实施例中的方法对应的程序指令/模块。处理器400通过运行存储在存储器401中的程序指令/模块,从而执行功能应用以及数据处理,即实现上述实施例中用于获取代码的方法。As a computer-readable storage medium, the memory 401 can be used to store software programs, computer-executable programs, such as program instructions/modules corresponding to the methods in the embodiments of the present disclosure. The processor 400 executes program instructions/modules stored in the memory 401 to execute functional applications and data processing, that is, to implement the method for obtaining code in the above embodiment.
存储器401可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据终端设备的使用所创建的数据等。此外,存储器401可以包括高速随机存取存储器,还可以包括非易失性存储器。The memory 401 may include a stored program area and a stored data area, where the stored program area may store an operating system and an application program required for at least one function; the stored data area may store data created according to the use of the terminal device, etc. In addition, the memory 401 may include high-speed random access memory and may also include non-volatile memory.
本公开实施例提供了一种电子设备,包含上述的用于获取代码的装置。An embodiment of the present disclosure provides an electronic device, including the above-mentioned device for obtaining a code.
本公开实施例提供的电子设备,通过获取待加载代码及与待加载代码对应的脚本名,并根据接收到的调用脚本以及调用脚本与脚本名的映射关系,获取与调用脚本对应的目标类,并将目标类加载到待加载代码中,获得待运行代码。这样在新的服务提供者接入服务调用平台的情况下,能够通过接收与新的服务提供者对应的调用脚本,从而将与新的服务提供者对应的目标类加载到待加载代码中,而不需要修改服务调用平台中的调用代码,因此提高了服务调用平台的稳定性。The electronic device provided by the embodiment of the present disclosure obtains the code to be loaded and the script name corresponding to the code to be loaded, and obtains the target class corresponding to the calling script according to the received calling script and the mapping relationship between the calling script and the script name. And load the target class into the code to be loaded to obtain the code to be run. In this way, when a new service provider accesses the service calling platform, the target class corresponding to the new service provider can be loaded into the code to be loaded by receiving the calling script corresponding to the new service provider. There is no need to modify the calling code in the service calling platform, thus improving the stability of the service calling platform.
可选地,电子设备包括:计算机、智能手机、平板或服务器等。Optionally, the electronic device includes: computer, smart phone, tablet or server, etc.
本公开实施例提供了一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行上述用于获取代码的方法。Embodiments of the present disclosure provide a computer-readable storage medium that stores computer-executable instructions, and the computer-executable instructions are configured to execute the above method for obtaining code.
本公开实施例提供了一种计算机程序产品,所述计算机程序产品包括存储在计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行上述获取代码的方法。Embodiments of the present disclosure provide a computer program product. The computer program product includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the The computer executes the above method of obtaining the code.
上述的计算机可读存储介质可以是暂态计算机可读存储介质,也可以是非暂态计算机可读存储介质。The above-mentioned computer-readable storage medium may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.
本公开实施例的技术方案可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括一个或多个指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开实施例所述方法的全部或部分步骤。而前述的存储介质可以是非暂态存储介质,包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等多种可以存储程序代码的介质,也可以是暂态存储介质。The technical solution of the embodiments of the present disclosure may be embodied in the form of a software product. The computer software product is stored in a storage medium and includes one or more instructions to enable a computer device (which may be a personal computer, a server, or a network equipment, etc.) to perform all or part of the steps of the method described in the embodiments of the present disclosure. The aforementioned storage media can be non-transitory storage media, including: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, etc. A medium that can store program code or a temporary storage medium.
以上描述和附图充分地示出了本公开的实施例,以使本领域的技术人员能够实践它们。其他实施例可以包括结构的、逻辑的、电气的、过程的以及其他的改变。实施例仅代表可能的变化。除非明确要求,否则单独的部件和功能是可选的,并且操作的顺序可以变化。一些实施例的部分和特征可以被包括在或替换其他实施例的部分和特征。而且,本申请中使用的用词仅用于描述实施例并且不用于限制权利要求。如在实施例以及权利要求的描述中使用的,除非上下文清楚地表明,否则单数形式的“一个”(a)、“一个”(an)和“所述”(the)旨在同样包括复数形式。类似地,如在本申请中所使用的术语“和/或”是指包含一个或一个以上相关联的列出的任何以及所有可能的组合。另外,当用于本申请中时,术语“包括”(comprise)及其变型“包括”(comprises)和/或包括(comprising)等指陈述的特征、整体、步骤、操作、元素,和/或组件的存在,但不排除一个或一个以上其它特征、整体、步骤、操作、元素、组件和/或这些的分组的存在或添加。在没有更多限制的情况下,由语句“包括一个…”限定的要素,并不排除在包括所述要素的过程、方法或者设备中还存在另外的相同要素。本文中,每个实施例重点说明的可以是与其他实施例的不同之处,各个实施例之间相同相似部分可以互相参见。对于实施例公开的方法、产品等而言,如果其与实施例公开的方法部分相对应,那么相关之处可以参见方法部分的描述。The foregoing description and drawings illustrate embodiments of the disclosure sufficiently to enable those skilled in the art to practice them. Other embodiments may incorporate structural, logical, electrical, process, and other changes. The examples represent only possible variations. Unless explicitly required, individual components and features are optional and the order of operations may vary. Portions and features of some embodiments may be included in or substituted for those of other embodiments. Furthermore, the words used in this application are used only to describe the embodiments and not to limit the claims. As used in the description of the embodiments and the claims, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise. . Similarly, the term "and/or" as used in this application is meant to encompass any and all possible combinations of one or more of the associated listed items. In addition, when used in this application, the term "comprise" and its variations "comprises" and/or "comprising" etc. refer to stated features, integers, steps, operations, elements, and/or The presence of a component does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and/or groupings of these. Without further limitation, an element defined by the statement "comprises a..." does not exclude the presence of additional identical elements in a process, method or apparatus including the stated element. In this article, each embodiment may focus on its differences from other embodiments, and the same and similar parts among various embodiments may be referred to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiment, then the relevant parts can be referred to the description of the method part.
本领域技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,可以取决于技术方案的特定应用和设计约束条件。所述技术人员可以对每个特定的应用来使用不同方法以实现所描述的功能,但是这种实现不应认为超出本公开实施例的范围。所述技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The skilled person may use different methods to implement the described functionality for each specific application, but such implementations should not be considered to be beyond the scope of the disclosed embodiments. The skilled person can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be described again here.
本文所披露的实施例中,所揭露的方法、产品(包括但不限于装置、设备等),可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,可以仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例。另外,在本公开实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units may only be a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined. Either it can be integrated into another system, or some features can be ignored, or not implemented. In addition, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
附图中的流程图和框图显示了根据本公开实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这可以依所涉及的功能而定。在附图中的流程图和框图所对应的描述中,不同的方框所对应的操作或步骤也可以以不同于描述中所披露的顺序发生,有时不同的操作或步骤之间不存在特定的顺序。例如,两个连续的操作或步骤实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这可以依所涉及的功能而定。框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowcharts and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more components for implementing the specified logical function(s). Executable instructions. In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two consecutive blocks may actually execute substantially in parallel, or they may sometimes execute in the reverse order, depending on the functionality involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, operations or steps corresponding to different blocks may also occur in a sequence different from that disclosed in the description, and sometimes there is no specific distinction between different operations or steps. order. For example, two consecutive operations or steps may actually be performed substantially in parallel, or they may sometimes be performed in reverse order, depending on the functionality involved. Each block in the block diagram and/or flowchart illustration, and combinations of blocks in the block diagram and/or flowchart illustration, may be implemented by special purpose hardware-based systems that perform the specified functions or actions, or may be implemented using special purpose hardware implemented in combination with computer instructions.
Claims (6)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110790642.6A CN113590187B (en) | 2021-07-13 | 2021-07-13 | Method and device for acquiring codes and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110790642.6A CN113590187B (en) | 2021-07-13 | 2021-07-13 | Method and device for acquiring codes and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113590187A CN113590187A (en) | 2021-11-02 |
CN113590187B true CN113590187B (en) | 2023-11-17 |
Family
ID=78247148
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110790642.6A Active CN113590187B (en) | 2021-07-13 | 2021-07-13 | Method and device for acquiring codes and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113590187B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114491374A (en) * | 2022-02-16 | 2022-05-13 | 上海驻云信息科技有限公司 | A method and system for loading and using a Python script from a database |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103294455A (en) * | 2012-02-27 | 2013-09-11 | 杭州勒卡斯广告策划有限公司 | Software service implementation method and system, as well as Java platform |
CN103473034A (en) * | 2012-06-06 | 2013-12-25 | 阿里巴巴集团控股有限公司 | Method and device for dynamically publishing Web service |
CN107977243A (en) * | 2017-11-27 | 2018-05-01 | 海尔优家智能科技(北京)有限公司 | A kind of third party's interface call method and device |
CN110399233A (en) * | 2019-06-28 | 2019-11-01 | 口碑(上海)信息技术有限公司 | The processing method and processing device of remote procedure call |
CN112612530A (en) * | 2019-09-18 | 2021-04-06 | 华为技术有限公司 | Class query method and device |
CN112925666A (en) * | 2021-04-10 | 2021-06-08 | 深圳市今天国际物流技术股份有限公司 | Third-party API integrated management method based on groovy script technology |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8689181B2 (en) * | 2010-11-23 | 2014-04-01 | Axeda Corporation | Scripting web services |
US20190056930A1 (en) * | 2017-08-16 | 2019-02-21 | Singareddy Information Technologies, Inc. | System, method, and program product for implementing and co-locating java server faces servlet and sling server servlet in a single webserver |
-
2021
- 2021-07-13 CN CN202110790642.6A patent/CN113590187B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103294455A (en) * | 2012-02-27 | 2013-09-11 | 杭州勒卡斯广告策划有限公司 | Software service implementation method and system, as well as Java platform |
CN103473034A (en) * | 2012-06-06 | 2013-12-25 | 阿里巴巴集团控股有限公司 | Method and device for dynamically publishing Web service |
CN107977243A (en) * | 2017-11-27 | 2018-05-01 | 海尔优家智能科技(北京)有限公司 | A kind of third party's interface call method and device |
CN110399233A (en) * | 2019-06-28 | 2019-11-01 | 口碑(上海)信息技术有限公司 | The processing method and processing device of remote procedure call |
CN112612530A (en) * | 2019-09-18 | 2021-04-06 | 华为技术有限公司 | Class query method and device |
CN112925666A (en) * | 2021-04-10 | 2021-06-08 | 深圳市今天国际物流技术股份有限公司 | Third-party API integrated management method based on groovy script technology |
Non-Patent Citations (3)
Title |
---|
Jas4pp — A data-analysis framework for physics and detector studies;S.V. Chekanov等;Computer Physics Communications;第262卷;第1-11页 * |
数字化酒店统一管理平台的研究与设计;沙宁;中国优秀硕士学位论文全文数据库 信息科技辑(第2期);I138-470 * |
李莹."美团点评API网关系统网关核心模块的设计与实现".《中国优秀硕士学位论文全文数据库 信息科技辑》.2021,(第4期),I138-251. * |
Also Published As
Publication number | Publication date |
---|---|
CN113590187A (en) | 2021-11-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6912583B2 (en) | Service processing method and equipment | |
CN105335187B (en) | Application processing method and device | |
CN107832100B (en) | APK plug-in loading method and terminal thereof | |
CN110308999B (en) | Method for dynamically sharing dependency package between applications, storage medium and mobile terminal | |
CN108647032B (en) | Application loading method and apparatus, computer apparatus and computer-readable storage medium | |
CN111651219A (en) | Method and equipment for managing multi-module project configuration file | |
CN110929195B (en) | Data caching strategy determining method and device and electronic equipment | |
CN111596920A (en) | File compiling method and device, compiling equipment and storage medium | |
CN114465998A (en) | Multi-device file transmission method and device, terminal device and readable storage medium | |
CN112214250A (en) | Application program assembly loading method and device | |
CN102968321A (en) | Application program installation device and application program installation method | |
CN113590187B (en) | Method and device for acquiring codes and electronic equipment | |
CN113672309A (en) | Business service method, device, electronic equipment and readable storage medium | |
CN104765624A (en) | Update processing method and device for virtual machine application | |
CN103379145B (en) | The method, apparatus and system of information processing | |
CN114880013A (en) | A method and device for processing configuration information of a business process | |
CN108228842B (en) | Docker mirror image library file storage method, terminal, device and storage medium | |
CN104965786A (en) | Debugging method for application program, debugging host and running host | |
CN111142972B (en) | Method, apparatus, system, and medium for extending functions of application program | |
CN114270309B (en) | Resource acquisition method, device and electronic device | |
CN109933407B (en) | Block chain DAPP virtual machine, data processing method and computing equipment | |
CN109739548B (en) | Program packaging method, program packaging device, and computer-readable storage medium | |
CN117742742A (en) | Mirror image processing method and device in cross-architecture scene, electronic equipment and storage medium | |
CN112232027B (en) | A symbol translation method, device, equipment and computer-readable storage medium | |
CN114860204A (en) | Program processing method, program operating device, terminal, smart card 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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |