[go: up one dir, main page]

CN115098183B - Method and device for generating module program for service architecture - Google Patents

Method and device for generating module program for service architecture Download PDF

Info

Publication number
CN115098183B
CN115098183B CN202210654023.9A CN202210654023A CN115098183B CN 115098183 B CN115098183 B CN 115098183B CN 202210654023 A CN202210654023 A CN 202210654023A CN 115098183 B CN115098183 B CN 115098183B
Authority
CN
China
Prior art keywords
program
file
module
module program
key
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
Application number
CN202210654023.9A
Other languages
Chinese (zh)
Other versions
CN115098183A (en
Inventor
冯敏
郭光明
朱晨
魏刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
International Network Technology Shanghai Co Ltd
Original Assignee
International Network Technology Shanghai Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by International Network Technology Shanghai Co Ltd filed Critical International Network Technology Shanghai Co Ltd
Priority to CN202210654023.9A priority Critical patent/CN115098183B/en
Publication of CN115098183A publication Critical patent/CN115098183A/en
Application granted granted Critical
Publication of CN115098183B publication Critical patent/CN115098183B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

本发明提供一种面向服务架构的模块程序生成方法及装置,涉及计算机技术领域,该方法包括:解析预先配置的与模块程序对应的第一声明文件,获取所述第一声明文件中声明的关键字的关键变量,所述关键变量表示不同模块程序的共有程序段中的独有字段;将所述关键变量插入预先设计的程序模板中相应的预留位置,以生成模块程序。该方法大大减少了模块程序开发代码量,缩短了开发周期。

The present invention provides a method and device for generating a module program for a service architecture, and relates to the field of computer technology. The method comprises: parsing a pre-configured first declaration file corresponding to the module program, obtaining key variables of keywords declared in the first declaration file, wherein the key variables represent unique fields in common program segments of different module programs; and inserting the key variables into corresponding reserved positions in a pre-designed program template to generate the module program. The method greatly reduces the amount of module program development code and shortens the development cycle.

Description

Service architecture-oriented module program generation method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for generating a module program for a service-oriented architecture.
Background
The service-oriented architecture (SOA) is a software architecture, and the SOA architecture is also a very suitable architecture for an autopilot system, and two most direct factors are:
1. In an automatic driving system, the functions of sensing and fusing of various sensors, planning decision of complex and changeable scenes, control execution with high real-time requirements and the like relate to a large number of calculations with very different types, and the functions need to be decomposed into different service subsystems and independently evolved;
2. The communication mode of 'publish-subscribe' can effectively reduce the communication coupling between the services.
The two factors described above correspond exactly to the two architectural constraints of the "client-server" style and the "event/message based publish-subscribe" style in the SOA architecture style. The core problem solved by these two architectural styles is how to break up the complex system into multiple software components and integrate in a low-coupling manner. From this perspective, the entire autopilot system integrates data distribution service (Data Distribution Service, DDS) middleware based on the SOA architecture style, and different services are respectively disassembled into corresponding module programs, that is, one service corresponds to one module program, and only manages receiving messages, processing messages and sending results. However, the development of the module program requires a large amount of repeated handwritten codes, resulting in a long development period.
Disclosure of Invention
The invention provides a service-oriented architecture module program generation method and device, which are used for solving the problems that a large amount of repeated handwriting codes are required for SOA architecture module program development and the development period is long in the prior art.
The invention provides a module program generating method facing to a service architecture, which comprises the following steps:
Analyzing a first preset declaration file corresponding to a module program, and acquiring key variables of keywords declared in the first declaration file, wherein the key variables represent unique fields in common program segments of different module programs;
and inserting the key variables into corresponding reserved positions in a pre-designed program template to generate a module program.
According to the method for generating the module program of the service-oriented architecture provided by the invention, the key variables are inserted into corresponding reserved positions in a pre-designed program template to generate the module program, and the method comprises the following steps:
searching placeholders corresponding to the key variables in the program template according to the key words, wherein each reserved position is provided with the placeholder;
replacing the placeholders with the key variables until all placeholders are replaced;
and receiving an instruction for renaming the program template, and generating the module program after renaming.
According to the method for generating the module program of the service-oriented architecture, before analyzing the first preset declaration file corresponding to the module program and acquiring the key variable of the key word declared in the first declaration file, the method further comprises the following steps:
analyzing a pre-configured second plaintext, and acquiring starting configuration information and connection relations corresponding to each module program declared in the second plaintext;
Generating a starting configuration file of a corresponding module program according to the starting configuration information;
Generating a theme file of a corresponding module program according to the connection relation, wherein the theme file comprises a theme key and a theme value of the connection relation, the key variables in the first statement file comprise the theme key and the theme key type,
The starting configuration file is used for being called by a system process to start a module program in the starting configuration file, a reading function used for reading a corresponding theme file when the module program is started is arranged in the program template, and the reading function is used for reading a theme value corresponding to the theme key in the theme file so that the module program can create an instance of a connection relation according to the theme value and the type of the theme key.
According to the method for generating the module program of the service-oriented architecture, the keywords in the first statement file further comprise selectable items of whether the theme value in the connection relation is selectable, a judging function is arranged in the program template, and the judging function is used for judging whether the module program is normally started or not under the condition that the theme value is not read when the module program is started according to the actual value of the key variable of the selectable items, if the actual value of the key variable is true, the program module is normally started, and if the actual value of the key variable is false, the program module cannot be started.
According to the method for generating the module program facing the service architecture, the judging function is further used for starting the error reporting and prompting the theme key corresponding to the default theme value when judging that the module program cannot be started normally because the theme value is not read.
According to the module program generating method of the service-oriented architecture, key variables in the first declaration file further comprise transmission data types of connection relations.
The invention also provides a module program generating device facing to the service architecture, which comprises:
The first declaration file analysis unit is used for analyzing a first declaration file which is pre-configured and corresponds to the module program, and acquiring key variables of keywords declared in the first declaration file, wherein the key variables represent unique fields in common program segments of different module programs;
and the module program generating unit is used for inserting the key variables into corresponding reserved positions in a pre-designed program template so as to generate a module program.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the module program generating method of the service-oriented architecture when executing the program.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a module program generating method of a service oriented architecture as described in any of the above.
The invention also provides a computer program product comprising a computer program which when executed by a processor implements a module program generation method of a service oriented architecture as described in any of the above.
The method and the device for generating the module program facing the service architecture acquire the keywords declared in the first declaration file by analyzing the preconfigured first declaration file corresponding to the module program, the keywords represent the unique fields in the common program segments of different module programs, and the keywords are inserted into the corresponding reserved positions in the predesigned program template to generate the module program. Therefore, a developer only needs to configure the first declaration file when developing the module program, then automatically generates the module program, and only needs to develop a core algorithm part in the module program subsequently, thereby greatly reducing the code quantity of the module program development and shortening the development period.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for generating a module program of a service-oriented architecture according to the present invention;
FIG. 2 is a schematic diagram of a module program generating device of a service-oriented architecture according to the present invention;
fig. 3 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The method for generating the module program of the service-oriented architecture provided by the embodiment of the invention, as shown in fig. 1, comprises the following steps:
Step S110, a first declaration file corresponding to the module program is analyzed, and key variables of keywords declared in the first declaration file are obtained, wherein the key variables represent unique fields in a common program section of different module programs, namely different fields in the common program section. In this embodiment, the first declaration file is designed by adopting a YAML (Yet Another Markup Language) declaration programming manner, specifically, in practical application, the first declaration file is named as base yaml file, the base yaml file provides specific configurable keywords for a developer, the developer configures specific values corresponding to the keywords, namely key variables, and the keywords can be detected from grammar so as to be capable of resolving the key variables from base yaml files. The configurable keywords in the base yaml document include unique fields in the common program segment of the SOA architecture module program, for example, the autopilot system, and the keywords include keywords of timing tasks, diagnostics, metrics, and connection relationship (i.e., io) data segments, etc.
And step S120, inserting the key variables into corresponding reserved positions in a pre-designed program template to generate a module program. The program template is a template of a module program, and common program segments of all module programs in a system (such as an automatic driving system) are arranged in the program template. Taking a C++ program as an example, the program templates comprise 2 C++ program templates, namely a header file program template and a source file program template. And if the key variables corresponding to the key words in the different first declaration files are different, and the different key variables are inserted into the program template, different module programs are generated. It should be noted that the module program generated here is not a module program with complete functions, but only a common program segment in the module program is generated by adopting a mode of YAML declarative configuration programming, so that the code amount of a developer is reduced, and the developer continues to develop on the basis of the generated module program, for example, inherits the module program and realizes the service-related algorithm of the most core of the developer.
According to the module program generating method of the service-oriented architecture, a first declaration file corresponding to a module program is analyzed, a value corresponding to a keyword declared in the first declaration file is obtained, the key variable represents a unique field in a common program section of different module programs, and the value corresponding to the key variable is inserted into a corresponding reserved position in a pre-designed program template to generate the module program. Therefore, a developer only needs to configure the first declaration file when developing the module program, then automatically generates the module program, and only needs to develop a core algorithm part in the module program subsequently, thereby greatly reducing the code quantity of the module program development and shortening the development period.
In this embodiment, step S120 includes:
And searching placeholders corresponding to the key variables in the program template according to the keywords, wherein each reserved position is provided with the placeholders, and specifically, the placeholders can be in the following form of "# # # keywords" # # ", as long as the symbols in the placeholders are not symbols with special meanings in the program language. By setting the placeholder at the reserved position, the position to be replaced by the keyword can be conveniently and rapidly searched according to the keyword.
And replacing the placeholders by the key variables, and replacing the "#" keyword "# #" by the key variables until all the placeholders are replaced.
And receiving an instruction for renaming the program template, renaming to generate the module program, changing the suffix name of the program template of the header file into.h for the C++ program, and changing the suffix name of the program template of the source file into.cc for the program template of the source file.
In this embodiment, before step S110, the method further includes:
Analyzing a second preset plaintext, and acquiring starting configuration information and connection relations corresponding to each module program stated in the second plaintext. Similar to the first declaration file, the second declaration file is designed in a YAML declaration programming manner, specifically, in practical application, the second declaration file may be named as a startup YAML file, and the startup YAML file may be used for a developer to configure startup configuration information when each module program is started, and a connection relationship, where the connection relationship is a publish-subscribe relationship and a client-server relationship in an SOA architecture. The startup yaml file is configured with startup configuration information of all module programs in the whole system and corresponding connection relations, and the startup configuration information comprises basic information such as module program names (or IDs).
And generating a starting configuration file of the corresponding module program according to the starting configuration information, wherein the starting configuration file also comprises the name (or ID) of the module program and basic information required during starting.
Generating a theme file of a corresponding module program according to the connection relation, wherein each module program corresponds to one theme file respectively, the theme file comprises a theme key and a theme value of the connection relation, the key variables comprise the theme key and the theme key type, namely, the key variable of the key word of the connection relation in the first statement file is consistent with the theme key, and the theme key type indicates which connection relation of the module program belongs to a publisher, a subscriber, a client or a server respectively.
The starting configuration file is used for being called by a system process (such as a management process of an automatic driving system) to start a module program in the starting configuration file, specifically, the system process acquires a module program name and a basic information pair required in starting from the starting configuration file, and starts the module program according to the basic information pair. The program template is provided with a reading function for reading the corresponding theme file when the module program is started, and the module program generated after the step S120 also comprises the reading function because the reading function is arranged in the program template, and the reading function is used for reading the theme value corresponding to the theme key in the theme file so that the module program creates an instance of the connection relation according to the theme value and the type of the theme key. Examples of connection relationships include a publish-subscribe relationship instance and a client-server relationship instance.
Because the starting sequence of each module program in one system (such as an automatic driving system) has a certain logic association, the starting configuration information of all the module programs is configured in a starting yaml file, so that the unified configuration of a developer is facilitated. In addition, in one system, the overall topological relation of the publish-subscribe (many-to-many relation) relation is complex, the connection relation is uniformly configured in the second plaintext, and if the publish-subscribe relation or the client-server relation is changed, the code is not required to be manually changed, and only the second plaintext is required to be uniformly modified. For example, to add a subscription relationship, a corresponding topic key value pair (i.e., topic key and topic value) may be added to the start yaml file, and a name relationship data segment may be added to the module base yaml file, and after re-executing steps S110 and S120, the module program may be regenerated.
In this embodiment, the keywords in the first declaration file further include an optional item of whether the theme value in the connection relationship is optional, and the program template is provided with a judging function, where the judging function is configured to judge whether the module program is normally started or not when the module program is started according to the actual value of the key variable of the optional item, if the actual value of the key variable is true, the program module is normally started, and if the actual value of the key variable is false, the program module cannot be started. Specifically, if the actual value of the key variable of the selectable item is True, the key value of the connection relation in the second plaintext is allowed to be opposite to the default theme value, the module program may not create an instance of the connection relation corresponding to the default theme value after being started, and the starting of the module program is not affected, if the actual value of the key variable of the selectable item is False, the default theme value is not allowed, and if the default theme value exists in the theme file, the module program cannot be started. Because the selectable option of whether the theme value in the connection relation is selectable is configured, when one connection relation is wanted to be removed, the theme key value pair can be removed from the starting yaml file, if the actual value of the key variable of the corresponding selectable option in the module base yaml file is True, at this time, the starting yaml file is only needed to be parsed again, that is, the S110 is executed, the module program is not needed to be regenerated, and the maintenance of the module program is facilitated.
Further, the judging function is further used for starting to report errors and prompting the topic key corresponding to the default topic value when judging that the module program cannot be started normally because the module program does not read the topic value, so that when the starting fails, a developer can quickly locate an error point and timely configure the default topic value in the second plaintext.
In this embodiment, the key variables in the first declaration file further include a transmission data type of a connection relationship, and when changing the transmission data type of a publish-subscribe or client-server relationship, only the key variables corresponding to the transmission data type key of the connection relationship in the base yaml file of the module program need to be changed, and the module program is regenerated without changing the code if step S120 is executed again.
In a specific application, the method for generating the module program of the service-oriented architecture can be implemented by adopting a SDK (Software Development Kit) framework. The following two tables present partial contents of a second declaration file (startup yaml file) and a first declaration file (base yaml file), where the first declaration file only shows keywords of a connection (i.e., io) data segment.
Table 1 Start yaml File
Table 2 base yaml File
In table 1, start configuration information and connection relation of a module program mobileye are shown, wherein content above connection is start configuration information, and is used for generating a start configuration file corresponding to the module, processor represents starting the module program in main processor 1, args represents related parameters of main processor 1, and param is basic information at the time of starting the module program, and the basic information is from mobileye _config.yaml file.
The following contents of connection are connection relations and are used for generating a theme file corresponding to the module program, and the module program comprises four pairs of connection relations:
localization_result:localization_result1;
perception_result:perception_result1;
relative_motion_result:relative_motion_result1;
smart_camera_front_result:smart_camera_front_result1。
each set of connection relations consists of key-value pairs (keys: topic key, value: topic value), localisation_result represents topic key, localisation_result 1 represents topic value.
The mobileye module program has four pairs of connection relationships, who are publish-subscribe relationships and who are client-server relationships, which cannot be distinguished at present, and base yaml files (io: type field distinction) to a specific module program are required to be distinguished.
Table 2 lists some of the keys of the io data segment in the base yaml file.
The key name is a key for starting the connection relation topic key in yaml files, and the corresponding key variable is a topic key, for example, topic key localization_result. And mobileye, the module program can acquire the topic value corresponding to the topic key from the topic file according to the key variable localization_result of the name key.
Keyword type, which is a keyword representing the type of connection relation configured in the startup yaml file, and corresponding key variables include publicher (publishing instance type), subscore (subscribing instance type), client (client instance type) and service (server instance type).
Keyword schema-keywords of transmission data types between publish-subscribe and client-server relationship, corresponding key variables are transmission data types.
Keyword optional, namely starting key words of selectable options of whether the topic values of the connection relations in the yaml files are selectable, wherein the corresponding key variables are Ture or False.
The service architecture-oriented module program generating device provided by the invention is described below, and the service architecture-oriented module program generating device described below and the service architecture-oriented module program generating method described above can be referred to correspondingly.
As shown in fig. 2, the module program generating device for a service oriented architecture provided by the present invention includes:
the first declaration file parsing unit 210 is configured to parse a first declaration file configured in advance and corresponding to a module program, and obtain key variables of keywords declared in the first declaration file, where the key variables represent unique fields in common program segments of different module programs.
And a module program generating unit 220, configured to insert the key variable into a corresponding reserved position in a pre-designed program template, so as to generate a module program.
According to the module program generating device of the service-oriented architecture, the value corresponding to the keyword declared in the first declaration file is obtained through analyzing the preconfigured first declaration file corresponding to the module program, the key variable represents the unique field in the common program section of different module programs, and the value corresponding to the key variable is inserted into the corresponding reserved position in the predesigned program template to generate the module program. Thus, a developer only needs to configure the first declaration file when developing the module program, then automatically generates the module program, and only needs to develop a core algorithm part in the module program subsequently, thereby greatly reducing the code quantity of the module program development and shortening the development period
Alternatively, the module program generating unit 220 includes:
And the placeholder searching unit is used for searching placeholders corresponding to the key variables in the program template according to the key words, and each reserved position is provided with the placeholder.
And the placeholder replacing unit is used for replacing the placeholders by the key variables until all the placeholders are replaced.
And the rename instruction receiving unit is used for receiving the instruction renaming the program template and generating the module program after renaming.
Optionally, the module program generating device of the service oriented architecture further includes:
the second plaintext file analyzing unit is used for analyzing the preconfigured second plaintext file and acquiring starting configuration information and connection relations corresponding to each module program stated in the second plaintext file.
And the starting configuration file generating unit is used for generating a starting configuration file of the corresponding module program according to the starting configuration information.
The theme file generation unit is used for generating a theme file of the corresponding module program according to the connection relation, wherein the theme file comprises a theme key and a theme value of the connection relation, and the key variables in the first statement file comprise the theme key and the theme key type.
The starting configuration file is used for being called by a system process to start a module program in the starting configuration file, a reading function used for reading a corresponding theme file when the module program is started is arranged in the program template, and the reading function is used for reading a theme value corresponding to the theme key in the theme file so that the module program can create an instance of a connection relation according to the theme value and the type of the theme key.
Optionally, the keywords in the first declaration file further include an optional item of whether the theme value in the connection relation is optional, a judging function is set in the program template, and the judging function is used for judging whether the module program is normally started or not under the condition that the theme value is not read when the module program is started according to the actual value of the key variable of the optional item, if the actual value of the key variable is true, the program module is normally started, and if the actual value of the key variable is false, the program module cannot be started.
Optionally, the judging function is further used for starting to report errors and prompting a theme key corresponding to the default theme value when judging that the module program fails to read the theme value and cannot be started normally.
Optionally, the key variable in the first declaration file further includes a transmission data type of the connection relationship.
Fig. 3 illustrates a physical schematic diagram of an electronic device, which may include a processor 310, a communication interface (Communications Interface), a memory 330, and a communication bus 340, as shown in fig. 3, where the processor 310, the communication interface 320, and the memory 330 communicate with each other via the communication bus 340. Processor 310 may invoke logic instructions in memory 330 to perform a service-oriented architecture module program generation method comprising:
Analyzing a first preset declaration file corresponding to a module program, and acquiring key variables of keywords declared in the first declaration file, wherein the key variables represent unique fields in common program segments of different module programs.
And inserting the key variables into corresponding reserved positions in a pre-designed program template to generate a module program.
The module program generating device of the service-oriented architecture provided by the invention acquires the keywords declared in the first declaration file through analyzing the preconfigured first declaration file corresponding to the module program, wherein the keywords represent the unique fields in the common program segments of different module programs, and inserts the keywords into the corresponding reserved positions in the predesigned program template to generate the module program. Therefore, a developer only needs to configure the first declaration file when developing the module program, then automatically generates the module program, and only needs to develop a core algorithm part in the module program subsequently, thereby greatly reducing the code quantity of the module program development and shortening the development period.
Further, the logic instructions in the memory 330 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. The storage medium includes a U disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, where the computer program product includes a computer program, where the computer program can be stored on a non-transitory computer readable storage medium, and when the computer program is executed by a processor, the computer can execute a method for generating a module program of a service oriented architecture provided by the above methods, and the method includes:
Analyzing a first preset declaration file corresponding to a module program, and acquiring key variables of keywords declared in the first declaration file, wherein the key variables represent unique fields in common program segments of different module programs.
And inserting the key variables into corresponding reserved positions in a pre-designed program template to generate a module program.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform a method of generating a module program for a service oriented architecture provided by the above methods, the method comprising:
Analyzing a first preset declaration file corresponding to a module program, and acquiring key variables of keywords declared in the first declaration file, wherein the key variables represent unique fields in common program segments of different module programs.
And inserting the key variables into corresponding reserved positions in a pre-designed program template to generate a module program.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
It should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention, and not for limiting the same, and although the present invention has been described in detail with reference to the above-mentioned embodiments, it should be understood by those skilled in the art that the technical solution described in the above-mentioned embodiments may be modified or some technical features may be equivalently replaced, and these modifications or substitutions do not make the essence of the corresponding technical solution deviate from the spirit and scope of the technical solution of the embodiments of the present invention.

Claims (9)

1.一种面向服务架构的模块程序生成方法,其特征在于,包括:1. A module program generation method for a service-oriented architecture, characterized by comprising: 解析预先配置的与模块程序对应的第一声明文件,获取所述第一声明文件中声明的关键字的关键变量,所述关键变量表示不同模块程序的共有程序段中的独有字段;Parsing a pre-configured first declaration file corresponding to the module program, obtaining key variables of keywords declared in the first declaration file, wherein the key variables represent unique fields in a common program segment of different module programs; 将所述关键变量插入预先设计的程序模板中相应的预留位置,以生成模块程序;Inserting the key variables into corresponding reserved positions in a pre-designed program template to generate a module program; 其中,在解析预先配置的与模块程序对应的第一声明文件,获取所述第一声明文件中声明的关键字的关键变量之前,还包括:Wherein, before parsing the pre-configured first declaration file corresponding to the module program and obtaining the key variables of the keywords declared in the first declaration file, the method further includes: 解析预先配置的第二声明文件,获取所述第二声明文件中声明的各模块程序对应的启动配置信息和连接关系;Parsing a pre-configured second declaration file, and obtaining startup configuration information and connection relationships corresponding to each module program declared in the second declaration file; 根据所述启动配置信息生成对应模块程序的启动配置文件;Generate a startup configuration file for the corresponding module program according to the startup configuration information; 根据所述连接关系生成对应模块程序的主题文件,所述主题文件中包括:连接关系的主题键和主题值,所述第一声明文件中的关键变量包括:所述主题键及主题键类型,Generate a theme file of the corresponding module program according to the connection relationship, wherein the theme file includes: a theme key and a theme value of the connection relationship, and the key variables in the first declaration file include: the theme key and the theme key type, 其中,所述启动配置文件用于被系统进程调用以启动所述启动配置文件中的模块程序,所述程序模板中设有用于在模块程序启动时读取对应的主题文件的读取函数,所述读取函数用于读取所述主题文件中与所述主题键对应的主题值,以便模块程序根据所述主题值和主题键类型创建连接关系的实例。Among them, the startup configuration file is used to be called by the system process to start the module program in the startup configuration file. The program template is provided with a reading function for reading the corresponding theme file when the module program starts. The reading function is used to read the theme value corresponding to the theme key in the theme file, so that the module program creates an instance of the connection relationship according to the theme value and the theme key type. 2.根据权利要求1所述的面向服务架构的模块程序生成方法,其特征在于,将所述关键变量插入预先设计的程序模板中相应的预留位置,以生成模块程序,包括:2. The method for generating a module program for a service-oriented architecture according to claim 1, wherein the key variables are inserted into corresponding reserved positions in a pre-designed program template to generate a module program, comprising: 根据所述关键字在所述程序模板中查找与所述关键变量相应的占位符,每个所述预留位置均设有所述占位符;Searching for a placeholder corresponding to the key variable in the program template according to the keyword, each of the reserved positions is provided with the placeholder; 采用所述关键变量替换所述占位符,直到替换完所有占位符;The key variable is used to replace the placeholder until all the placeholders are replaced; 接收对所述程序模板重命名的指令,重命名后生成所述模块程序。An instruction to rename the program template is received, and the module program is generated after the renaming. 3.根据权利要求1所述的面向服务架构的模块程序生成方法,其特征在于,所述第一声明文件中的关键字还包括:所述连接关系中主题值是否可选的可选项,所述程序模板中设有判断函数,所述判断函数用于根据可选项的关键变量的实际值判断模块程序启动时未读取到所述主题值的情况下,模块程序是否正常启动,若关键变量的实际值为真,则程序模块正常启动,若关键变量的实际值为假,则程序模块无法启动。3. The method for generating a module program for a service-oriented architecture according to claim 1 is characterized in that the keywords in the first declaration file also include: an optional item indicating whether the subject value in the connection relationship is optional, a judgment function is provided in the program template, and the judgment function is used to judge whether the module program starts normally when the subject value is not read when the module program starts according to the actual value of the key variable of the optional item, if the actual value of the key variable is true, the program module starts normally, and if the actual value of the key variable is false, the program module cannot be started. 4.根据权利要求3所述的面向服务架构的模块程序生成方法,其特征在于,所述判断函数还用于在判断出模块程序未读取到主题值而无法正常启动时,启动报错,并提示缺省主题值对应的主题键。4. According to the service-oriented architecture module program generation method described in claim 3, it is characterized in that the judgment function is also used to start an error report when it is determined that the module program has not read the theme value and cannot be started normally, and prompt the theme key corresponding to the default theme value. 5.根据权利要求1所述的面向服务架构的模块程序生成方法,其特征在于,所述第一声明文件中的关键变量还包括:连接关系的传输数据类型。5. The method for generating a module program for a service-oriented architecture according to claim 1, wherein the key variables in the first declaration file further include: a transmission data type of a connection relationship. 6.一种面向服务架构的模块程序生成装置,其特征在于,包括:6. A module program generation device for a service-oriented architecture, characterized by comprising: 第一声明文件解析单元,用于解析预先配置的与模块程序对应的第一声明文件,获取所述第一声明文件中声明的关键字的关键变量,所述关键变量表示不同模块程序的共有程序段中的独有字段;A first declaration file parsing unit, configured to parse a pre-configured first declaration file corresponding to a module program, and obtain key variables of keywords declared in the first declaration file, wherein the key variables represent unique fields in a common program segment of different module programs; 模块程序生成单元,用于将所述关键变量插入预先设计的程序模板中相应的预留位置,以生成模块程序;A module program generating unit, used for inserting the key variables into corresponding reserved positions in a pre-designed program template to generate a module program; 其中,所述装置还包括:Wherein, the device further comprises: 第二声明文件解析单元,用于解析预先配置的第二声明文件,获取所述第二声明文件中声明的各模块程序对应的启动配置信息和连接关系;A second declaration file parsing unit, configured to parse a pre-configured second declaration file, and obtain startup configuration information and connection relationships corresponding to each module program declared in the second declaration file; 启动配置文件生成单元,用于根据所述启动配置信息生成对应模块程序的启动配置文件;A startup configuration file generating unit, used to generate a startup configuration file of a corresponding module program according to the startup configuration information; 主题文件生成单元,用于根据所述连接关系生成对应模块程序的主题文件,所述主题文件中包括:连接关系的主题键和主题值,所述第一声明文件中的关键变量包括:所述主题键及主题键类型;A subject file generating unit, used for generating a subject file of a corresponding module program according to the connection relationship, wherein the subject file includes: a subject key and a subject value of the connection relationship, and the key variables in the first declaration file include: the subject key and the subject key type; 其中,所述启动配置文件用于被系统进程调用以启动所述启动配置文件中的模块程序,所述程序模板中设有用于在模块程序启动时读取对应的主题文件的读取函数,所述读取函数用于读取所述主题文件中与所述主题键对应的主题值,以便模块程序根据所述主题值和主题键类型创建连接关系的实例。Among them, the startup configuration file is used to be called by the system process to start the module program in the startup configuration file. The program template is provided with a reading function for reading the corresponding theme file when the module program starts. The reading function is used to read the theme value corresponding to the theme key in the theme file, so that the module program creates an instance of the connection relationship according to the theme value and the theme key type. 7.一种电子设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现如权利要求1至5任一项所述面向服务架构的模块程序生成方法。7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for generating a module program for a service-oriented architecture as described in any one of claims 1 to 5 is implemented. 8.一种非暂态计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至5任一项所述面向服务架构的模块程序生成方法。8. A non-transitory computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method for generating a module program for a service-oriented architecture as claimed in any one of claims 1 to 5 is implemented. 9.一种计算机程序产品,包括计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至5任一项所述面向服务架构的模块程序生成方法。9. A computer program product, comprising a computer program, characterized in that when the computer program is executed by a processor, the method for generating a module program for a service-oriented architecture as claimed in any one of claims 1 to 5 is implemented.
CN202210654023.9A 2022-06-09 2022-06-09 Method and device for generating module program for service architecture Active CN115098183B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210654023.9A CN115098183B (en) 2022-06-09 2022-06-09 Method and device for generating module program for service architecture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210654023.9A CN115098183B (en) 2022-06-09 2022-06-09 Method and device for generating module program for service architecture

Publications (2)

Publication Number Publication Date
CN115098183A CN115098183A (en) 2022-09-23
CN115098183B true CN115098183B (en) 2025-02-18

Family

ID=83291111

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210654023.9A Active CN115098183B (en) 2022-06-09 2022-06-09 Method and device for generating module program for service architecture

Country Status (1)

Country Link
CN (1) CN115098183B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7320007B1 (en) * 2003-12-12 2008-01-15 Peter Hon-You Chang Dynamic generation of target files from template files and tracking of the processing of target files

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7350192B2 (en) * 2003-12-08 2008-03-25 Ebay Inc. Method and system to automatically generate software code
JP2012094127A (en) * 2010-10-01 2012-05-17 Fujifilm Corp Diagnostic result explanation report creation device, diagnostic result explanation report creation method and diagnostic result explanation report creation program

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7320007B1 (en) * 2003-12-12 2008-01-15 Peter Hon-You Chang Dynamic generation of target files from template files and tracking of the processing of target files

Also Published As

Publication number Publication date
CN115098183A (en) 2022-09-23

Similar Documents

Publication Publication Date Title
CN115017182B (en) Visual data analysis method and device
CN105511873B (en) User interface control display method and device
CA2912852C (en) Method and apparatus for code virtualization and remote process call generation
CN110308930A (en) Interface document generation method, device, computer equipment and storage medium
CN112130993B (en) Power edge IoT proxy edge computing method and system based on graphical modeling
CN113656471B (en) Solution processing method, device, computer equipment and storage medium
US10963227B2 (en) Technique for transforming a standard messaging component to a customized component
CN111026568A (en) Data and task relation construction method and device, computer equipment and storage medium
EP4184330A1 (en) Code analysis method and system, and computing device
CN113495723B (en) Method, device and storage medium for calling functional component
CN114064142A (en) Batch-flow integrated data processing system and processing method
CN109359139A (en) Data synchronization method, system, electronic device and computer readable storage medium
CN117407082A (en) Engine configuration method, device, electronic equipment and computer storage medium
CN116980705A (en) Methods, devices, equipment and storage media for special effects production
CN115098183B (en) Method and device for generating module program for service architecture
CN116955765A (en) Message pushing method, device, computer equipment, storage medium and product
CN118503142B (en) Test case modification method, device, storage medium and program product
CN114756511A (en) Method and device for exporting data in database into text file
CN113268232B (en) Page skin generation method and device and computer readable storage medium
CN119536720A (en) A code generation method, device, equipment and storage medium
US20250390296A1 (en) Application management method, application subscription method, and related device
CN112130849A (en) Automatic code generation method and device
CN119724175B (en) A method and apparatus for constructing interconnected scenes
CN114461524A (en) Interface access testing method and device, electronic equipment and storage medium
CN112363700A (en) Cooperative creation method and device of intelligent contract, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant