Interface processing method, interface processing device, electronic device and storage medium
Through the automated interface generation and loading method, the problems of high interface development costs and poor management flexibility are solved, and efficient resource utilization and management costs are achieved.
Patent Information
- Application Number
- CN202111335850.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-11
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2041-11-11
AI Technical Summary
In the prior art, the cost of interface development and poor flexibility in interface management and call results in waste of resources and high management costs.
By responding to the docking request of the client device, obtaining interface description information, writing to the preset interface template to generate an interface configuration file, generating a target interface file based on the file, and sending interface deployment instructions to the server device, so that it uses a class loader to load the target interface file.
It realizes the automatic generation and loading of interfaces, reduces the cost of interface development and management, and avoids waste of resources when loading interfaces on the server.
Smart Images

Figure CN114035864B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of computer technology and finance, and more specifically, to an interface processing method, an interface processing device, an electronic device, a readable storage medium, and a computer program product. Background Art
[0002] With the rapid development of information technology, more and more companies have realized the digital storage and management of business data. As the business functions that need to be realized are becoming more and more complex, the business data stored in a single system often cannot meet the needs of the business, so it is inevitable that multiple systems need to be connected to each other's interfaces.
[0003] In the process of realizing the concept of the present disclosure, the inventors discovered that the related technologies at least have technical problems of high interface development cost and poor flexibility in interface management and calling. Summary of the invention
[0004] In view of this, the present disclosure provides an interface processing method, an interface processing device, an electronic device, a readable storage medium and a computer program product.
[0005] One aspect of the present disclosure provides an interface processing method, including: in response to a docking request from a client device, obtaining interface description information carried in the docking request; writing the interface description information into a preset interface template to obtain an interface configuration file; generating a target interface file based on the interface configuration file; and sending an interface deployment instruction to a server device so that the server device uses a class loader to load the target interface file.
[0006] According to an embodiment of the present disclosure, the above-mentioned generation of a target interface file based on the above-mentioned interface configuration file includes: creating an initial template class; creating interface fields in the above-mentioned initial template class based on the above-mentioned interface configuration file; processing the above-mentioned interface fields using a preset method; and compiling the above-mentioned initial template class containing the processed interface fields into the above-mentioned target interface file.
[0007] According to an embodiment of the present disclosure, the above-mentioned preset method at least includes a method of adding an element in the above-mentioned interface field.
[0008] According to an embodiment of the present disclosure, the above method also includes: storing the above target interface file in a memory database and a relational database respectively; wherein the above sending the interface deployment instruction to the server device so that the above server device uses the class loader to load the above target interface file includes: sending the above interface deployment instruction to the above server device so that the above server device uses the above class loader to load the above target interface file stored in the above memory database; in the case of receiving feedback information sent by the above server device that fails to obtain the above target interface file, retrieving the above target interface file from the above relational database; in the case of successfully retrieving the above target interface file from the above relational database, storing the above target interface file in the memory database; and sending the above interface deployment instruction to the above server device again.
[0009] According to an embodiment of the present disclosure, the method further includes: in the case where the target interface file cannot be successfully retrieved from the relational database, sending feedback information of interface configuration failure to the client device.
[0010] According to an embodiment of the present disclosure, the above-mentioned preset interface template has a preset interface address; the above-mentioned method also includes: sending feedback information containing the above-mentioned preset interface address to the above-mentioned client device, so that the above-mentioned client device can be connected with the above-mentioned server device through the above-mentioned preset interface address.
[0011] According to an embodiment of the present disclosure, the above-mentioned interface description information at least includes interface parameters and types of interface parameters.
[0012] According to an embodiment of the present disclosure, the above-mentioned server device includes multiple electronic devices in a distributed system.
[0013] Another aspect of the present disclosure provides an interface processing device, including: an acquisition module, used to respond to a docking request of a client device and obtain interface description information carried in the docking request; a first processing module, used to write the interface description information into a preset interface template to obtain an interface configuration file; a second processing module, used to generate a target interface file based on the interface configuration file; and a deployment module, used to send an interface deployment instruction to a server device so that the server device uses a class loader to load the target interface file.
[0014] Another aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more instructions, wherein when the one or more instructions are executed by the one or more processors, the one or more processors implement the method as described above.
[0015] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.
[0016] Another aspect of the present disclosure provides a computer program product, which includes computer executable instructions, and when the instructions are executed, are used to implement the method as described above.
[0017] According to the embodiments of the present disclosure, when a docking request from a client device is received, a target interface file can be generated by writing the interface description information in the docking request into a preset interface template, and through information interaction, the server device can autonomously load the target interface file to implement interface deployment. Through the above technical means, the automatic generation and loading of the interface is realized, at least partially overcoming the technical problems of high interface development cost and poor flexibility of interface management and calling in related technologies, effectively reducing the development cost and management cost of the interface, and reducing the waste of resources caused by the server loading the interface. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0019] Figure 1 An exemplary system architecture to which the interface processing method according to an embodiment of the present disclosure can be applied is schematically shown.
[0020] Figure 2 The flowchart of the interface processing method according to the embodiment of the present disclosure is schematically shown.
[0021] Figure 3 The flowchart of the target interface file generation method according to the embodiment of the present disclosure is schematically shown.
[0022] Figure 4 A schematic diagram schematically shows an interface deployment process according to an embodiment of the present disclosure.
[0023] Figure 5 The block diagram schematically shows an interface processing device according to an embodiment of the present disclosure.
[0024] Figure 6 A block diagram of an electronic device suitable for implementing an interface processing method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0025] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0026] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0027] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0028] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0029] In the technical solution disclosed in the present invention, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations, necessary confidentiality measures are taken, and do not violate public order and good morals.
[0030] The interface between software systems is a bridge for realizing information exchange between one system and another system. Software interfaces can usually be divided into webservice interfaces and http interfaces. Among them, the http interface is the data interaction interface between applications of the mainstream b / s architecture. It is based on the http protocol and uses xml or json as the data interaction format to realize data interaction between two or more independent systems. Usually, an http interface corresponds to a processing logic, that is, a piece of code.
[0031] In many application scenarios, the system involves the docking of multiple interfaces. For example, the risk control system can call the credit interface. When the risk control system performs model calculations on individuals or enterprises, a large amount of data is required. This data is returned by calling the credit interface. However, there are many types of credit interfaces and they are frequently modified. Therefore, it is necessary to manage a large number of interfaces and be able to modify the interface information in real time while the system is running.
[0032] In order to solve the problem of needing to manage a large number of interfaces in relevant application scenarios and the frequent modification of interfaces, many solutions have been proposed in related technologies. For example, multiple interfaces are merged into one interface, and type enumeration codes are used to distinguish different requests. For another example, an interface for loading bytecode files is developed to load the specified bytecode file according to the file name; when the interface needs to take effect, the bytecode file is uploaded to the server where the application is located, and then the interface is called to load the newly developed interface code file.
[0033] However, as the business develops and changes, it is usually necessary to optimize and adjust the interface or add a new interface. The solutions in related technologies usually need to adjust the interface through hard coding, which requires high learning and manpower costs.
[0034] On the other hand, when deploying interfaces in a distributed system, it is easy to miss files by loading bytecode files, and each loading requires hard coding. Although publishing bytecode files through message queues can ensure the accuracy of file publishing, the publishing process is relatively cumbersome, and the files need to be uploaded to each distributed server separately, which increases the risk of interface deployment.
[0035] In view of this, the embodiments of the present disclosure provide an interface processing method, an interface processing device, an electronic device, a readable storage medium and a computer program product. The method includes responding to a docking request of a client device, obtaining interface description information carried in the docking request; writing the interface description information into a preset interface template to obtain an interface configuration file; generating a target interface file based on the interface configuration file; and sending an interface deployment instruction to a server device so that the server device uses a class loader to load the target interface file. Figure 1The exemplary system architecture to which the interface processing method according to the embodiment of the present disclosure can be applied is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0036] like Figure 1 As shown, the system architecture 100 according to this embodiment may include a business system 110 and a server 120 .
[0037] The business system 110 may include a client device 101 , server devices 102 , 103 and a network 104 .
[0038] The client device 101 and the server devices 102 and 103 may be any electronic device having a memory and a processor, including but not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, and a server.
[0039] The client device 101 may also have a display device for displaying the business processing results of the business system 110 .
[0040] The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links.
[0041] The network 104 may be specifically characterized as a communication interface between the client device 101 and the server devices 102 and 103 .
[0042] The server 120 may be a server that provides various services, for example, it may be a background management server that configures the communication interface between the client device 101 and the server devices 102 and 103 .
[0043] It should be noted that the interface processing method provided in the embodiment of the present disclosure can generally be executed by the server 120. Accordingly, the interface processing device provided in the embodiment of the present disclosure can generally be set in the server 120. The interface processing method provided in the embodiment of the present disclosure can also be executed by the client device 101 in the business system 110. Accordingly, the interface processing device provided in the embodiment of the present disclosure can also be set in the client device 101 in the business system 110. Alternatively, the interface processing method provided in the embodiment of the present disclosure can also be executed by other servers or server clusters that can establish a communication connection with the business system 110 or the server 120. Accordingly, the interface processing device provided in the embodiment of the present disclosure can also be set in other servers or server clusters that can establish a communication connection with the business system 110 or the server 120.
[0044] For example, when a user initiates a docking request using the client device 101, the client device 101 may locally execute the interface processing method provided in the embodiment of the present disclosure to determine the interface with the server devices 102 and 103. Alternatively, the client device 101 may send the docking request to the server 120 or another server or server group different from the server 120, and the server or server group that receives the docking request may execute the interface processing method provided in the embodiment of the present disclosure.
[0045] It should be understood that Figure 1 The numbers of the business systems, client devices, server devices, networks and servers in the embodiment are merely illustrative. Any number of business systems, client devices, server devices, networks and servers may be provided as required.
[0046] Figure 2 The flowchart of the interface processing method according to the embodiment of the present disclosure is schematically shown.
[0047] like Figure 2 As shown, the method includes operations S201 to S204.
[0048] In operation S201, in response to a connection request from a client device, interface description information carried in the connection request is obtained.
[0049] In operation S202, the interface description information is written into a preset interface template to obtain an interface configuration file.
[0050] In operation S203, a target interface file is generated based on the interface configuration file.
[0051] In operation S204, an interface deployment instruction is sent to the server device, so that the server device uses a class loader to load the target interface file.
[0052] According to an embodiment of the present disclosure, the client device and the server device may be any electronic device having a memory and a processor, including but not limited to a computer, a server, etc.
[0053] According to an embodiment of the present disclosure, the docking request may be issued by a business system on a client device, and the docking request may include input and output information of an interface required when the client device is docked with a target server device.
[0054] According to an embodiment of the present disclosure, the preset interface template may be configured with the input and output fields of the interface, the type of the field and the corresponding field mapping. The field mapping table may be as shown in Table 1. The field mapping table may be used to realize accurate and convenient addition of interfaces.
[0055] Table 1
[0056] enter Output Input Type Output Type Input1 Output1 String String Input2 Output2 String Integer
[0057] According to an embodiment of the present disclosure, a management terminal may also be configured in the preset interface template, and the management terminal may provide an operation page for template editing for developers.
[0058] According to an embodiment of the present disclosure, the target interface file may be a bytecode file.
[0059] According to an embodiment of the present disclosure, in generating a target interface file according to an interface configuration file, the interface information contained in the interface configuration file can be read, the corresponding bytecode file name can be generated according to the name of the template, and the bytecode file of the interface description and the bytecode file of the interface operation can be generated through reflection according to the description information of the interface field.
[0060] According to the embodiments of the present disclosure, the method for generating the target interface file according to the interface configuration file is not limited. For example, Javaassist may be used to generate the interface file.
[0061] According to the embodiments of the present disclosure, by using preset interface templates and interface description information to dynamically generate bytecode files, the required interface functions can be implemented without development and code compilation.
[0062] According to an embodiment of the present disclosure, the interface deployment instruction may include an instruction to instruct the server device to load the target interface file. By sending an instruction to enable the server device to load autonomously, the target interface file does not need to be uploaded to each server device separately, reducing the occurrence of file omissions.
[0063] According to an embodiment of the present disclosure, the class loader may be a classloader. By using the class loader, the server device may load the bytecode file during the system operation to make the newly added interface effective.
[0064] According to the embodiments of the present disclosure, when a docking request from a client device is received, a target interface file can be generated by writing the interface description information in the docking request into a preset interface template, and through information interaction, the server device can autonomously load the target interface file to implement interface deployment. Through the above technical means, the automatic generation and loading of the interface is realized, at least partially overcoming the technical problems of high interface development cost and poor flexibility of interface management and calling in related technologies, effectively reducing the development cost and management cost of the interface, and reducing the waste of resources caused by the server loading the interface.
[0065] Reference below Figure 3-4 , combined with specific embodiments Figure 2 The method shown is further explained.
[0066] According to an embodiment of the present disclosure, Javaassist may be used to implement generation of a target interface file.
[0067] Figure 3 The flowchart of the target interface file generation method according to the embodiment of the present disclosure is schematically shown.
[0068] like Figure 3 As shown, the target interface file generation method includes operations S301 to S304.
[0069] In operation S301, an initial template class is created.
[0070] In operation S302, an interface field is created in an initial template class based on an interface configuration file.
[0071] In operation S303, the interface field is processed using a preset method.
[0072] In operation S304, the initial template class including the processed interface fields is compiled into a target interface file.
[0073] According to an embodiment of the present disclosure, the initial template class may be an empty class.
[0074] According to an embodiment of the present disclosure, interface parameters and types of interface parameters may be configured in the interface configuration file, and the newly created interface fields may correspond one-to-one to the interface parameters included in the interface configuration file.
[0075] According to an embodiment of the present disclosure, an access level may be set for a newly created interface field, and the set access level includes public, private, and the like.
[0076] According to an embodiment of the present disclosure, the preset method may include a method of adding elements to an interface field, such as a getter and a setter, which is not limited here.
[0077] According to an embodiment of the present disclosure, after processing the interface field using a preset method, a constructor may be added to the initial template class. In some embodiments, the constructor may also include a constructor that is set by default when the initial template class is created.
[0078] According to an embodiment of the present disclosure, the target interface file may be a class file.
[0079] Figure 4 A schematic diagram schematically shows an interface deployment process according to an embodiment of the present disclosure.
[0080] like Figure 4 As shown, the interface deployment process includes operations S401 to S411, wherein operations S401 to S402 and operations S408 to S411 are completed by the interface processing system, and operations S403 to S407 are completed by the server device.
[0081] In operation S401, the target interface file is stored in the memory database and the relational database respectively.
[0082] In operation S402, an interface deployment instruction is sent to a server device.
[0083] In operation S403, the target interface file is acquired from the memory database.
[0084] In operation S404, it is determined whether the acquisition is successful. If the target interface file is successfully acquired, operation S405 is performed; if the target interface file is not successfully acquired, operation S407 is performed.
[0085] In operation S405 , the target interface file is loaded using a class loader.
[0086] In operation S406, feedback information indicating successful interface loading is sent to the client device.
[0087] In operation S407, feedback information indicating failure in obtaining the interface file is sent to the interface processing system.
[0088] In operation S408, the target interface file is retrieved from the relational database.
[0089] In operation S409, it is determined whether the retrieval is successful. If the target interface file is successfully retrieved, operation S410 is performed; if the target interface file is not successfully retrieved, operation S411 is performed.
[0090] In operation S410, the target interface file is stored in the memory database. After completing operation S410, the process returns to perform operation S402 again.
[0091] In operation S411, feedback information of interface configuration failure is sent to the client device.
[0092] According to an embodiment of the present disclosure, the interface processing system may be a system that implements the method of operations S201 ˜ S204 and operations S301 ˜ S304 .
[0093] According to the embodiments of the present disclosure, the memory database can be selected according to the specific application scenario. The selectable memory databases may include key-value memory databases such as Redis, Memcached, Aerospike, relational memory databases such as Oracle TimesTen, ASP HANA, MenSQL, SQLite, or graph memory databases such as RedisGraph.
[0094] According to an embodiment of the present disclosure, using a memory database to store target interface files can effectively ensure the loading speed of the interface and support the deployment of the interface in a distributed system.
[0095] According to an embodiment of the present disclosure, the relational database may be any relational database such as Oracle, MySQL, etc.
[0096] According to an embodiment of the present disclosure, the server-side device may include all electronic devices that need to be connected when implementing the service function, for example, may be multiple electronic devices in a distributed system.
[0097] According to an embodiment of the present disclosure, by loading the target interface file from the memory database, the target interface file does not need to be downloaded to the server device, thereby reducing the risk of interface exposure.
[0098] According to an embodiment of the present disclosure, the class loader may be a classloader.
[0099] According to an embodiment of the present disclosure, the file names of all target interface files generated by the preset interface template are the same as the template name of the preset interface template. In this way, the hard coding workload in the process of loading interface files can be reduced.
[0100] In some embodiments, a preset interface address is also set in the preset interface template, and all interfaces generated by the preset interface template have the same preset interface address. The client can achieve docking with the server device through the preset interface address.
[0101] According to an embodiment of the present disclosure, after the target interface file is generated, feedback information including a preset interface address may be sent to the client device so that the client device can connect with the server device through the preset interface address.
[0102] According to the embodiments of the present disclosure, by decoupling the specific implementation of the interface from the address of the interface, the flexibility of the interface is effectively improved, and new interfaces can be incrementally released or the specific implementation of the original interface can be modified without modifying or recompiling the original code.
[0103] According to an embodiment of the present disclosure, after operation S411 is completed, the methods of operations S201 to S203 and the method of operation S401 may also be performed to regenerate and store the target interface file.
[0104] Figure 5 The block diagram schematically shows an interface processing device according to an embodiment of the present disclosure.
[0105] like Figure 5 As shown, the interface processing device 500 includes an acquisition module 510 , a first processing module 520 , a second processing module 530 and a deployment module 540 .
[0106] The acquisition module 510 is used to respond to a connection request from a client device and acquire the interface description information carried in the connection request.
[0107] The first processing module 520 is used to write the interface description information into a preset interface template to obtain an interface configuration file.
[0108] The second processing module 530 is used to generate a target interface file based on the interface configuration file.
[0109] The deployment module 540 is used to send an interface deployment instruction to the server device so that the server device uses a class loader to load a target interface file.
[0110] According to the embodiments of the present disclosure, when a docking request from a client device is received, a target interface file can be generated by writing the interface description information in the docking request into a preset interface template, and through information interaction, the server device can autonomously load the target interface file to implement interface deployment. Through the above technical means, the automatic generation and loading of the interface is realized, at least partially overcoming the technical problems of high interface development cost and poor flexibility of interface management and calling in related technologies, effectively reducing the development cost and management cost of the interface, and reducing the waste of resources caused by the server loading the interface.
[0111] According to an embodiment of the present disclosure, the second processing module 530 includes a first processing unit, a second processing unit, a third processing unit, and a fourth processing unit.
[0112] The first processing unit is used to create an initial template class.
[0113] The second processing unit is used to create an interface field in the initial template class based on the interface configuration file.
[0114] The third processing unit is used to process the interface field using a preset method.
[0115] The fourth processing unit is used to compile the initial template class containing the processed interface fields into a target interface file.
[0116] According to an embodiment of the present disclosure, the preset method at least includes a method of adding an element in an interface field.
[0117] According to an embodiment of the present disclosure, the device 500 further includes a storage module.
[0118] The storage module is used to store the target interface file in the memory database and the relational database respectively.
[0119] According to an embodiment of the present disclosure, the deployment module 540 includes a first deployment unit, a second deployment unit, a third deployment unit, and a fourth deployment unit.
[0120] The first deployment unit is used to send an interface deployment instruction to the server device, so that the server device uses a class loader to load a target interface file stored in the memory database.
[0121] The second deployment unit is configured to retrieve the target interface file from the relational database when receiving feedback information sent by the server device indicating that the acquisition of the target interface file fails.
[0122] The third deployment unit is used to store the target interface file into the memory database when the target interface file is successfully retrieved from the relational database.
[0123] The fourth deployment unit is used to send the interface deployment instruction to the server device again.
[0124] According to an embodiment of the present disclosure, the deployment module 540 further includes a fifth deployment unit.
[0125] The fifth deployment unit is configured to send feedback information of interface configuration failure to the client device when the target interface file cannot be successfully retrieved from the relational database.
[0126] According to an embodiment of the present disclosure, the preset interface template has a preset interface address.
[0127] The apparatus 500 further includes a sending module.
[0128] The sending module is used to send feedback information including a preset interface address to the client device, so that the client device can achieve docking with the server device through the preset interface address.
[0129] According to an embodiment of the present disclosure, the interface description information includes at least interface parameters and types of interface parameters.
[0130] According to an embodiment of the present disclosure, the server device includes multiple electronic devices in a distributed system.
[0131] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.
[0132] For example, any multiple of the acquisition module 510, the first processing module 520, the second processing module 530, and the deployment module 540 can be combined in one module / unit / subunit for implementation, or any one of the modules / units / subunits can be split into multiple modules / units / subunits. Alternatively, at least part of the functions of one or more of these modules / units / subunits can be combined with at least part of the functions of other modules / units / subunits and implemented in one module / unit / subunit. According to an embodiment of the present disclosure, at least one of the acquisition module 510, the first processing module 520, the second processing module 530, and the deployment module 540 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or by any one of the three implementation methods of software, hardware, and firmware, or by a suitable combination of any of them. Alternatively, at least one of the acquisition module 510, the first processing module 520, the second processing module 530 and the deployment module 540 may be at least partially implemented as a computer program module, and when the computer program module is executed, the corresponding function may be performed.
[0133] It should be noted that the interface processing device part in the embodiment of the present disclosure corresponds to the interface processing method part in the embodiment of the present disclosure. The description of the interface processing device part specifically refers to the interface processing method part and will not be repeated here.
[0134] Figure 6 A block diagram of an electronic device suitable for implementing an interface processing method according to an embodiment of the present disclosure is schematically shown. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0135] like Figure 6 As shown, the computer electronic device 600 according to the embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage part 608 to the random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include an onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.
[0136] In RAM 603, various programs and data required for the operation of electronic device 600 are stored. Processor 601, ROM 602 and RAM 603 are connected to each other via bus 604. Processor 601 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 602 and / or RAM 603. It should be noted that the program can also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0137] According to an embodiment of the present disclosure, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to the bus 604. The electronic device 600 may further include one or more of the following components connected to the I / O interface 605: an input portion 606 including a keyboard, a mouse, etc.; an output portion 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 608 including a hard disk, etc.; and a communication portion 609 including a network interface card such as a LAN card, a modem, etc. The communication portion 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage portion 608 as needed.
[0138] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0139] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0140] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0141] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 602 and / or the RAM 603 described above and / or one or more memories other than the ROM 602 and the RAM 603 .
[0142] An embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the interface processing method provided by the embodiment of the present disclosure.
[0143] When the computer program is executed by the processor 601, the above functions defined in the system / device of the embodiment of the present disclosure are executed. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0144] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 609, and / or installed from a removable medium 611. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0145] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0146] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments and / or claims of the present disclosure can be combined and / or combined in a variety of ways, even if such a combination or combination is not explicitly recorded in the present disclosure. In particular, without departing from the spirit and teaching of the present disclosure, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0147] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. An interface processing method, comprising: In response to a connection request from a client device, obtaining interface description information carried in the connection request; Writing the interface description information into a preset interface template to obtain an interface configuration file, wherein the preset interface template is configured with input and output fields of the interface, field types, and corresponding field mappings; Generate a target interface file based on the description information of the interface field included in the interface configuration file; as well as Sending an interface deployment instruction to a server device so that the server device uses a class loader to load the target interface file; The step of generating a target interface file based on the description information of the interface field included in the interface configuration file includes: Create the initial template class; Based on the interface configuration file, create an interface field in the initial template class; Process the interface field using a preset method; and The initial template class including the processed interface fields is compiled into the target interface file.
2. The method according to claim 1, wherein: The preset method at least includes a method for adding an element in the interface field.
3. The method according to claim 1, further comprising: Storing the target interface file in a memory database and a relational database respectively; The sending of the interface deployment instruction to the server device so that the server device uses a class loader to load the target interface file includes: Sending the interface deployment instruction to the server device so that the server device uses the class loader to load the target interface file stored in the memory database; Retrieving the target interface file from the relational database when receiving feedback information sent by the server device indicating failure in obtaining the target interface file; In case the target interface file is successfully retrieved from the relational database, storing the target interface file in a memory database; and The interface deployment instruction is sent to the server device again.
4. The method according to claim 3, further comprising: In the case that the target interface file cannot be successfully retrieved from the relational database, feedback information indicating interface configuration failure is sent to the client device.
5. The method according to claim 1, wherein: The preset interface template has a preset interface address; The method further comprises: Feedback information including the preset interface address is sent to the client device, so that the client device can be connected to the server device through the preset interface address.
6. The method according to any one of claims 1 to 5, wherein The interface description information at least includes interface parameters and types of interface parameters.
7. The method according to any one of claims 1 to 5, wherein The server-side device includes multiple electronic devices in a distributed system.
8. An interface processing device, comprising: An acquisition module, configured to respond to a connection request from a client device and acquire interface description information carried in the connection request; A first processing module is used to write the interface description information into a preset interface template to obtain an interface configuration file, wherein the preset interface template is configured with input and output fields of the interface, field types, and corresponding field mappings; A second processing module, configured to generate a target interface file based on the description information of the interface field included in the interface configuration file; as well as A deployment module, used to send an interface deployment instruction to a server device, so that the server device uses a class loader to load the target interface file; Wherein, the second processing module includes a first processing unit, a second processing unit, a third processing unit and a fourth processing unit; The first processing unit is used to create an initial template class; The second processing unit is used to create an interface field in the initial template class based on the interface configuration file; The third processing unit is configured to process the interface field using a preset method; and The fourth processing unit is used to compile the initial template class containing the processed interface field into the target interface file.
9. An electronic device, comprising: one or more processors; a memory for storing one or more instructions, Wherein, when the one or more instructions are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7. 10 . A computer-readable storage medium having executable instructions stored thereon, wherein when the executable instructions are executed by a processor, the processor is enabled to implement the method according to any one of claims 1 to 7.
11. A computer program product, comprising computer executable instructions, wherein the computer executable instructions are used to implement the method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Interface automatic generation method and terminal
CN108491199A