CN111158777B - Component calling method, device and computer readable storage medium - Google Patents

Component calling method, device and computer readable storage medium Download PDF

Info

Publication number
CN111158777B
CN111158777B CN201911277956.5A CN201911277956A CN111158777B CN 111158777 B CN111158777 B CN 111158777B CN 201911277956 A CN201911277956 A CN 201911277956A CN 111158777 B CN111158777 B CN 111158777B
Authority
CN
China
Prior art keywords
component
calling
call
function
remote
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
CN201911277956.5A
Other languages
Chinese (zh)
Other versions
CN111158777A (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.)
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology 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 China Mobile Communications Group Co Ltd, China Mobile Hangzhou Information Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201911277956.5A priority Critical patent/CN111158777B/en
Publication of CN111158777A publication Critical patent/CN111158777A/en
Application granted granted Critical
Publication of CN111158777B publication Critical patent/CN111158777B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Abstract

The embodiment of the application relates to the field of software development componentization, and discloses a component calling method. The method and the device receive and analyze the component call request to obtain the name of the component to be called, judge whether the component call request is a remote call request or a local call request, call and run a local call function from a pre-built component call library if the component call request is the local call request, analyze the URL of the remote call request if the component call request is the remote call request, call a remote call function from the component call library, take the URL as a call parameter of the remote call function, and run the remote call function. The application also provides a component calling device and a computer readable storage medium. The application can solve the problem that the remote call and the local call do not distinguish and occupy the memory when the component call is consumed.

Description

Component calling method, device and computer readable storage medium
Technical Field
The embodiment of the application relates to the field of software development componentization, in particular to a method for calling components.
Background
In the current software development, with the expansion of project business demand and team scale, the defects of a single engineering development mode, such as serious business and code coupling, low development and test efficiency, are exposed, compared with the single engineering development mode, the componentization scheme is gradually paid attention to in large project development, and the componentization scheme is to decouple each business module of a project, each business module is provided with an independent software warehouse, and finally each business module is integrated into a main project to realize the componentization construction of the project, so that the method has the advantages of high code multiplexing, independent test, low coupling degree and the like.
The current method for componentization calling mainly comprises two types, one type is a mushroom street Url/Protocol component registration calling scheme, and the other type is a Target-Action component calling scheme based on a component calling library CTMedator (also called as middleware). However, the inventors have found that while both approaches can address component invocation, the coupling problem is not fully solved and the comparison relies on the URL registry, thus the comparison takes up memory.
Disclosure of Invention
The embodiment of the application aims to provide a component calling method, a device and a computer readable storage medium, which can solve the problems that the coupling degree between a component calling library and a component is high, the remote calling and the local calling are not distinguished, and the memory is occupied when the component calling is consumed.
In order to solve the above technical problems, an embodiment of the present application provides a component calling method, including:
receiving and analyzing a component call request to obtain a component name to be called, and judging whether the component call request is a remote call request or a local call request;
if the component call request is a local call request, calling and running a local call function from a pre-built component call library;
if the component call request is a remote call request, analyzing the URL of the remote call request, calling a remote call function from the component call library, taking the URL as a call parameter of the remote call function, and running the remote call function.
Preferably, the determining whether the component call request is a remote call request or a local call request includes:
analyzing the component call request to obtain a call IP address of the component call request;
judging whether the component call request is a remote call request or a local call request according to the call IP address of the component call request.
Preferably, the determining, according to the call IP address of the component call request, whether the component call request is a remote call request or a local call request includes:
if the calling IP address is different from the preset local IP address, the component calling request is a remote calling request;
and if the calling IP address is the same as the preset local IP address, the component calling request is a local calling request.
Preferably, the step of calling and running the local calling function from the pre-constructed component call library comprises the following steps:
calling a local component path method class from a pre-built component call library, and searching a local call function corresponding to the component name to be called in the local component path method class;
and extracting calling parameters required by the local calling function from a parameter dictionary in the component calling library, transmitting the calling parameters to the local calling function, and running the local calling function.
Preferably, the extracting the calling parameters needed by the local calling function includes:
acquiring the function name of the local calling function;
and searching the parameter dictionary key with the same function name from the parameter dictionary by comparing and searching methods, and extracting calling parameters corresponding to the parameter dictionary key.
Preferably, the running the native call function includes:
compiling the local calling function through a preset integrated development environment;
if the local calling function fails to be compiled in the integrated development environment, the component call fails;
and if the local calling function is successfully compiled in the integrated development environment, the local calling function is operated.
Preferably, the solution calls a remote call function from the component call library, uses the URL as a call parameter of the remote call function, and includes:
calling a remote component path method class from the component call library, and searching a remote call function corresponding to the component name to be called in the remote component path method class;
extracting calling parameters needed by the remote calling function from a parameter dictionary in the component calling library, merging the URL and the calling parameters needed by the remote calling function, then transmitting the merged URL and the calling parameters needed by the remote calling function to the remote calling function, and operating the remote calling function.
In order to solve the above problems, the present application also provides a component calling apparatus, the apparatus comprising:
the component call request judging module is used for receiving and analyzing a component call request to obtain a component name to be called and judging whether the component call request is a remote call request or a local call request;
and the local calling function operation module is used for calling and operating the local calling function from the pre-constructed component calling library if the component calling request is a local calling request.
And if the component call request is a remote call request, analyzing the URL of the remote call request, calling a remote call function from the component call library, and using the URL as a call parameter of the remote call function to operate the remote call function.
In order to solve the above-mentioned problems, the present application also provides an electronic apparatus including:
a memory storing at least one instruction; a kind of electronic device with high-pressure air-conditioning system
And the processor executes the instructions stored in the memory to realize the component calling method of any one of the above.
In order to solve the above problems, the present application also provides a computer-readable storage medium having stored therein at least one instruction that is executed by a processor in an electronic device to implement the component invoking method of any of the above.
The embodiment of the application firstly distinguishes whether the component call request is a remote call request or a local call request, because if the component call request is a local call request, the remote call request is not needed, the efficiency of component call is improved, and because the remote call request needs to use a server to analyze the URL, and the computing resource and the network are occupied; in addition, the component call uses a unified component path method class, so that the dependency relationship between the component call library and the component is reduced, and the problem of coupling between the component call library and the component is solved; in addition, if the component call request is a remote call request, analyzing the URL of the remote call request, taking the URL as the call parameter of the remote call function, and running the remote call function, wherein the URL is not required to pass through a URL registry, and only the URL is taken as the parameter of the call function and is automatically run, so that the phenomenon that the URL registry occupies memory is reduced, and the efficiency of the whole component call is improved
Further, in the embodiment of the application, the calling parameters required by the local calling function are extracted from the parameter dictionary in the component calling library and transferred to the local calling function, or the calling parameters required by the remote calling function are extracted from the parameter dictionary in the component calling library, and the calling parameters of the visible function are all called by using a unified parameter dictionary, so that the remote component calling and the local component calling are not distinguished, and the component calling efficiency is further improved.
Drawings
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements, and in which the figures of the drawings are not to be taken in a limiting sense, unless otherwise indicated.
FIG. 1 is a schematic flow chart of a component calling method according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a detailed implementation of step S2 of the component invocation method provided in FIG. 1 according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a detailed implementation flow of calling a component call library and running a local call function in a component call method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a detailed implementation flow of a remote call function of a component call library in a component call method according to an embodiment of the present application;
fig. 5 is a schematic diagram of an internal structure of an electronic device for implementing component call according to an embodiment of the present application;
FIG. 6 is a schematic block diagram of a component calling device according to an embodiment of the present application;
the achievement of the objects, functional features and advantages of the present application will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the following detailed description of the embodiments of the present application will be given with reference to the accompanying drawings. However, those of ordinary skill in the art will understand that in various embodiments of the present application, numerous technical details have been set forth in order to provide a better understanding of the present application. However, the claimed application may be practiced without these specific details and with various changes and modifications based on the following embodiments.
The embodiment of the application relates to a component calling method, in the embodiment, a component calling request is divided into a local calling request and a remote calling request, and the local calling request and the remote calling request are respectively processed according to different calling requests, so that the problem of occupying excessive computing resources and memory is solved. The following describes details of the component call implementation of the present embodiment specifically, and the following description is merely provided for convenience of understanding, and is not necessary to implement the present embodiment.
The application aims to reduce the dependency relationship between a component call library (also called middleware) and components, realize the complete decoupling of the component call library and each component, reduce the maintenance cost of the component call library and the components and solve the memory occupation problem.
Referring to fig. 1, a flow chart of a component calling method according to an embodiment of the present application includes:
s1, receiving and analyzing a component call request to obtain a component name to be called.
The components are code blocks which can be reused in packaging, for example, when a technician develops a website, navigation columns are packaged into a component, question answering areas are packaged into a component, editing areas are packaged into a component, page footers are packaged into a component and the like.
Preferably, the component call request may be an instruction, for example, a click key related to the component call request is designed in advance, and the user may generate the instruction of the component call request only by clicking the click key related to the component call request and selecting a component name to be called. If the user A is a webpage developer and needs to call the webpage navigation bar component, the clicking component calls the requested clicking key and selects the webpage navigation bar component, and after the clicking key of the component call request is selected and the webpage navigation bar component is selected according to the user A, the method and the device automatically generate the name navigation bar of the component to be called corresponding to the webpage navigation bar component, and the name of the component to be called is generated to provide an access basis for subsequent access to a local call function or a remote call function.
S2, judging whether the component call request is a remote call request or a local call request.
The local call request is a call request that does not require transmission using a network, such as a user making a component call request only during a local computer non-networking process.
The remote call request generally sends a request to the local through other hardware devices such as a mobile phone, a computer and the like, for example, a mobile phone APP is used for sending a network request for connecting the navigation bar component to the local for component connection.
Further, referring to fig. 2, a detailed implementation flowchart for determining whether a component call request is a remote call request or a local call request includes:
s21, analyzing the component call request to obtain a call IP address corresponding to the component call request;
s22, judging whether the component call request is a remote call request or a local call request according to the call IP address of the component call request.
In detail, if the calling IP address is different from the preset local IP address, the component calling request is a remote calling request, and if the calling IP address is identical to the preset local IP address, the component calling request is a local calling request.
Returning to S3 in FIG. 1, if the component call request is a local call request, the local call function is called and run from the pre-built component call library.
In detail, the detailed implementation method of S3 may be shown in fig. 3:
s31, calling a local component path method class from a pre-built component call library;
s32, searching a local calling function corresponding to the component name to be called in the local component path method class;
s33, extracting calling parameters needed by the local calling function from a parameter dictionary in the component calling library, transmitting the calling parameters to the local calling function, and running the local calling function.
The component call library is a code set of a plurality of module areas which are written in advance through programming languages and are divided according to different component call functions. In a preferred embodiment of the present application, the component call library includes a local component path method class, a remote component path method class, a parameter dictionary, and the like.
The local component path method class is a code block that records different component calling methods. The calling methods of the different components are independently written in advance and generate calling functions, such as writing the calling method of the navigation bar component into a section of independent code to generate the calling function of the navigation bar component, writing the calling method of the question answering area component into a section of independent code to generate the calling function of the question answering area component, writing the calling method of the editing area component into a section of independent code to generate the calling function of the editing area component, and the like. The preferred embodiment of the application can uniformly place the navigation bar component calling function, the question answering area component calling function and the editing area component calling function in the local component path method class, which is convenient to manage on one hand, and on the other hand, compared with the traditional method in which each component calling function is uniformly placed in a component calling library, the scheme realizes complete decoupling of the component calling library and each component, because the most important function for the component calling library is to realize the calling of the component instead of direct management.
In detail, the calling function includes the local calling function and the remote calling function, which are most important differences in that the local calling function does not need to parse URL information, and the remote calling function needs to parse URL information, in other words, the function parameters of the remote calling function include component parameters and also include URL information parameters.
In the preferred embodiment of the application, the naming mode of the local calling function adopts the form of function name, calling parameter and component calling code. The local calling function of the navigation bar component is navigation bar (calling parameter) { as described above
Component calling code
}
Wherein navigation bar is the function name of the function called locally by the navigation bar component.
If the received component call request is to call a navigation bar component, searching by using a keyword navigation bar in the local component path method class until the first place of the navigation bar keyword is found, and marking a navigation bar component local call function.
In detail, the parameters in the parameter dictionary include the calling parameters required by the local calling function and the calling parameters required by the subsequent remote calling function, in other words, all the parameter data are uniformly managed and are all placed in the parameter dictionary.
In detail, the extracting the calling parameters needed by the local calling function and transferring the calling parameters to the local calling function includes: and obtaining the function name of the local calling function, searching the parameter dictionary key which is the same as the function name from the parameter dictionary in the local component path method class by comparing and searching methods, and extracting the calling parameter according to the parameter dictionary key.
The parameter dictionary records calling parameters required by calling functions of different components and records the calling parameters in a key value pair mode. If the application is based on a Python programming language, the recording mode of the parameter dictionary can be { 'function name 1': calling parameter, 'function name 2': calling parameter, 'function name 3': calling parameter, … }, wherein function name 1, function name 2, function name 3 and the like are the parameter dictionary keys, and if the function of calling the function by the navigation bar component is navigation bar, the parameter dictionary key is found from the parameter dictionary to be navigation bar, and then the calling parameter after the colon is found.
In detail, running the native call function includes: compiling the local calling function through a preset integrated development environment, if the local calling function fails to be compiled and displayed in the integrated development environment, the component calling fails, and if the local calling function is successfully compiled and displayed in the integrated development environment, the local calling function is operated to obtain a component calling result.
Returning to S4 in FIG. 1, if the component call request is a remote call request, analyzing the URL of the remote call request, calling a remote call function from the component call library, taking the URL as a call parameter of the remote call function, and running the remote call function.
In detail, the detailed implementation flow of calling a remote call function from the component call library and using the URL as the call parameter of the remote call function is shown in fig. 4:
s41, calling a remote component path method class from the component call library;
s42, searching a remote calling function corresponding to the name of the component to be called in the remote component path method class;
s43, extracting calling parameters needed by the remote calling function from a parameter dictionary in the component calling library, merging the URL and the calling parameters needed by the remote calling function, then transmitting the merged URL and the calling parameters needed by the remote calling function to the remote calling function, and operating the remote calling function.
The remote component path method class is similar to the local component path method class in that code blocks of different component calling methods are recorded, and further, the remote component path method class is added with the code blocks of the analysis function of the URL on the basis of the local component path method class.
The code block of the URL analysis function is used for analyzing the address of the server where the user is located (the address can be represented by an IP address), and then when the component is successfully invoked, the component is transmitted back to the user through the address of the server where the user is located.
Because the remote call request is different from the local call request, the remote call request needs to be transmitted through a network, and therefore the address of the remote call request needs to be determined through the URL, and further the component call is completed.
If the remote calling function still adopts the form of function name, calling parameter and component calling code, the calling parameter adopts the combination form of URL and calling parameter. The navigation bar component call function is navigation bar (URL: call parameter) { as described above
Component calling code
}
Further, after the remote call function is run, the component information is transferred to the remote through the URL, so that component call is realized.
The application also provides electronic equipment for realizing the component call. Fig. 5 is a schematic diagram illustrating an internal structure of an electronic device according to an embodiment of the application.
In this embodiment, the electronic device 1 may be a PC (Personal Computer ), or a terminal device such as a smart phone, a tablet computer, a portable computer, or a server. The electronic device 1 comprises at least a memory 11, a processor 12, a communication bus 13, and a network interface 14.
The memory 11 includes at least one type of readable storage medium including flash memory, a hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a hard disk of the electronic device 1. The memory 11 may in other embodiments also be an external storage device of the electronic device 1, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only for storing application software installed in the electronic device 1 and various types of data, such as code of the component calling program 01, but also for temporarily storing data that has been output or is to be output.
The processor 12 may in some embodiments be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor or other data processing chip for executing program code or processing data stored in the memory 11, such as executing the component calling program 01, etc.
The communication bus 13 is used to enable connection communication between these components.
The network interface 14 may optionally comprise a standard wired interface, a wireless interface (e.g. WI-FI interface), typically used to establish a communication connection between the electronic device 1 and other electronic devices.
Optionally, the electronic device 1 may further comprise a user interface, which may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device 1 and for displaying a visual user interface.
Fig. 5 shows only the electronic device 1 with the components 11-14 and the component invoker 01, it being understood by a person skilled in the art that the structure shown in fig. 1 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or may combine certain components, or a different arrangement of components.
In the embodiment of the electronic device 1 shown in fig. 5, the memory 11 stores therein a component calling program 01; the processor 12 performs the following steps when executing the component calling program 01 stored in the memory 11:
step one, receiving and analyzing a component calling request to obtain a component name to be called.
The components are code blocks which can be reused in packaging, for example, when a technician develops a website, navigation columns are packaged into a component, question answering areas are packaged into a component, editing areas are packaged into a component, page footers are packaged into a component and the like.
Preferably, the component call request may be an instruction, for example, a click key related to the component call request is designed in advance, and the user may generate the instruction of the component call request only by clicking the click key related to the component call request and selecting a component name to be called. If the user A is a webpage developer and needs to call the webpage navigation bar component, the clicking component calls the requested clicking key and selects the webpage navigation bar component, and after the clicking key of the component call request is selected and the webpage navigation bar component is selected according to the user A, the method and the device automatically generate the name navigation bar of the component to be called corresponding to the webpage navigation bar component, and the name of the component to be called is generated to provide an access basis for subsequent access to a local call function or a remote call function.
Step two, judging whether the component call request is a remote call request or a local call request.
The local call request is a call request that does not require transmission using a network, such as a user making a component call request only during a local computer non-networking process.
The remote call request generally sends a request to the local through other hardware devices such as a mobile phone, a computer and the like, for example, a mobile phone APP is used for sending a network request for connecting the navigation bar component to the local for component connection.
Further, the process of determining whether the component call request is a remote call request or a local call request includes: analyzing the component call request to obtain a call IP address corresponding to the component call request; judging whether the component call request is a remote call request or a local call request according to the call IP address of the component call request.
In detail, if the calling IP address is different from the preset local IP address, the component calling request is a remote calling request, and if the calling IP address is identical to the preset local IP address, the component calling request is a local calling request.
And step three, if the component call request is a local call request, calling and running a local call function from a pre-built component call library.
In detail, the calling and running the local calling function from the pre-constructed component call library comprises the following steps: calling a local component path method class from a pre-built component call library; searching a local calling function corresponding to the component name to be called in the local component path method class; and extracting calling parameters required by the local calling function from a parameter dictionary in the component calling library, transmitting the calling parameters to the local calling function, and running the local calling function.
The component call library is a code set of a plurality of module areas which are written in advance through programming languages and are divided according to different component call functions. In a preferred embodiment of the present application, the component call library includes a local component path method class, a remote component path method class, a parameter dictionary, and the like.
The local component path method class is a code block that records different component calling methods. The calling methods of the different components are independently written in advance and generate calling functions, such as writing the calling method of the navigation bar component into a section of independent code to generate the calling function of the navigation bar component, writing the calling method of the question answering area component into a section of independent code to generate the calling function of the question answering area component, writing the calling method of the editing area component into a section of independent code to generate the calling function of the editing area component, and the like. The preferred embodiment of the application can uniformly place the navigation bar component calling function, the question answering area component calling function and the editing area component calling function in the local component path method class, which is convenient to manage on one hand, and on the other hand, compared with the traditional method in which each component calling function is uniformly placed in a component calling library, the scheme realizes complete decoupling of the component calling library and each component, because the most important function for the component calling library is to realize the calling of the component instead of direct management.
In detail, the calling function includes the local calling function and the remote calling function, which are most important differences in that the local calling function does not need to parse URL information, and the remote calling function needs to parse URL information, in other words, the function parameters of the remote calling function include component parameters and also include URL information parameters.
In the preferred embodiment of the application, the naming mode of the local calling function adopts the form of function name, calling parameter and component calling code. The local calling function of the navigation bar component is navigation bar (calling parameter) { as described above
Component calling code
}
Wherein navigation bar is the function name of the function called locally by the navigation bar component.
If the received component call request is to call a navigation bar component, searching by using a keyword navigation bar in the local component path method class until the first place of the navigation bar keyword is found, and marking a navigation bar component local call function.
In detail, the parameters in the parameter dictionary include the calling parameters required by the local calling function and the calling parameters required by the subsequent remote calling function, in other words, all the parameter data are uniformly managed and are all placed in the parameter dictionary.
In detail, the extracting the calling parameters needed by the local calling function and transferring the calling parameters to the local calling function includes: and obtaining the function name of the local calling function, searching the parameter dictionary key which is the same as the function name from the parameter dictionary in the local component path method class by comparing and searching methods, and extracting the calling parameter according to the parameter dictionary key.
The parameter dictionary records calling parameters required by calling functions of different components and records the calling parameters in a key value pair mode. If the application is based on a Python programming language, the recording mode of the parameter dictionary can be { 'function name 1': calling parameter, 'function name 2': calling parameter, 'function name 3': calling parameter, … }, wherein function name 1, function name 2, function name 3 and the like are the parameter dictionary keys, and if the function of calling the function by the navigation bar component is navigation bar, the parameter dictionary key is found from the parameter dictionary to be navigation bar, and then the calling parameter after the colon is found.
In detail, running the native call function includes: compiling the local calling function through a preset integrated development environment, if the local calling function fails to be compiled and displayed in the integrated development environment, the component calling fails, and if the local calling function is successfully compiled and displayed in the integrated development environment, the local calling function is operated to obtain a component calling result.
And step four, if the component call request is a remote call request, analyzing the URL of the remote call request, calling a remote call function from the component call library, taking the URL as a call parameter of the remote call function, and running the remote call function.
In detail, the calling the remote call function from the component call library, taking the URL as a call parameter of the remote call function, includes: calling a remote component path method class from the component call library; searching a remote calling function corresponding to the name of the component to be called in the remote component path method class; extracting calling parameters needed by the remote calling function from a parameter dictionary in the component calling library, merging the URL and the calling parameters needed by the remote calling function, then transmitting the merged URL and the calling parameters needed by the remote calling function to the remote calling function, and operating the remote calling function.
The remote component path method class is similar to the local component path method class in that code blocks of different component calling methods are recorded, and further, the remote component path method class is added with the code blocks of the analysis function of the URL on the basis of the local component path method class.
The code block of the URL analysis function is used for analyzing the address of the server where the user is located (the address can be represented by an IP address), and then when the component is successfully invoked, the component is transmitted back to the user through the address of the server where the user is located.
Because the remote call request is different from the local call request, the remote call request needs to be transmitted through a network, and therefore the address of the remote call request needs to be determined through the URL, and further the component call is completed.
If the remote calling function still adopts the form of function name, calling parameter and component calling code, the calling parameter adopts the combination form of URL and calling parameter. The navigation bar component call function is navigation bar (URL: call parameter) { as described above
Component calling code
}
Further, after the remote call function is run, the component information is transferred to the remote through the URL, so that component call is realized.
The above steps of the methods are divided, for clarity of description, and may be combined into one step or split into multiple steps when implemented, so long as they include the same logic relationship, and they are all within the protection scope of this patent; it is within the scope of this patent to add insignificant modifications to the algorithm or flow or introduce insignificant designs, but not to alter the core design of its algorithm and flow.
Alternatively, in other embodiments, the component calling program may constitute a component calling device, where the component calling device may be divided into one or more modules, and one or more modules are stored in the memory 11 and executed by one or more processors (in this embodiment, the processor 12) to perform the present application, and the modules referred to herein refer to a series of computer program instruction segments capable of performing specific functions for describing the execution of the component calling program in the component calling device.
For example, referring to fig. 6, a program module schematic diagram of a component calling program in an embodiment of the component calling apparatus of the present application is shown, where the component calling program may be divided into a component call request determining module 10, a local call function running module 20, a remote call function running module 30, and an exemplary:
the component call request judging module 10 is configured to: and receiving and analyzing the component call request to obtain the name of the component to be called, and judging whether the component call request is a remote call request or a local call request.
The local call function running module 20 is configured to: and if the component call request is a local call request, calling and running a local call function from a pre-built component call library.
The remote call function running module 30 is configured to: if the component call request is a remote call request, analyzing the URL of the remote call request, calling a remote call function from the component call library, taking the URL as a call parameter of the remote call function, and running the remote call function.
The functions or operation steps implemented when the program modules such as the above-mentioned component call request judging module 10, the local call function running module 20, the remote call function running module 30 and the like are executed are substantially the same as those of the above-mentioned embodiment, and are not described herein again.
In addition, an embodiment of the present application also proposes a computer-readable storage medium having stored thereon a component calling program executable by one or more processors to implement the following operations:
and receiving and analyzing the component call request to obtain the name of the component to be called, and judging whether the component call request is a remote call request or a local call request.
And if the component call request is a local call request, calling and running a local call function from a pre-built component call library.
And if the component call request is a remote call request, analyzing the URL of the remote call request, calling a remote call function from the component call library, and using the URL as a call parameter of the remote call function to operate the remote call function.
It should be noted that, the foregoing reference numerals of the embodiments of the present application are merely for describing the embodiments, and do not represent the advantages and disadvantages of the embodiments. And the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, apparatus, article or method that comprises the element.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present application.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the application, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (9)

1. A component invocation method, the method comprising:
receiving and analyzing a component call request to obtain a component name to be called, and judging whether the component call request is a remote call request or a local call request;
if the component call request is a local call request, calling and running a local call function from a pre-built component call library;
if the component call request is a remote call request, analyzing the URL of the remote call request, calling a remote call function from the component call library, taking the URL as a call parameter of the remote call function, and running the remote call function;
wherein the determining whether the component call request is a remote call request or a local call request includes:
analyzing the component call request to obtain a call IP address of the component call request; judging whether the component call request is a remote call request or a local call request according to the call IP address of the component call request.
2. The component invocation method of claim 1, wherein said determining whether said component invocation request is a remote invocation request or a local invocation request based on the invocation IP address of said component invocation request, comprises:
if the calling IP address is different from the preset local IP address, the component calling request is a remote calling request;
and if the calling IP address is the same as the preset local IP address, the component calling request is a local calling request.
3. The component invocation method of any of claims 1-2, wherein invoking and running a native invocation function from a pre-built component invocation library comprises:
calling a local component path method class from a pre-built component call library, and searching a local call function corresponding to the component name to be called in the local component path method class;
and extracting calling parameters required by the local calling function from a parameter dictionary in the component calling library, transmitting the calling parameters to the local calling function, and running the local calling function.
4. A component invocation method as recited in claim 3, wherein said extracting the invocation parameters required by the native invocation function comprises:
acquiring the function name of the local calling function;
and searching the parameter dictionary key with the same function name from the parameter dictionary by comparing and searching methods, and extracting calling parameters corresponding to the parameter dictionary key.
5. The component invocation method of claim 3, wherein the running the native invocation function comprises:
compiling the local calling function through a preset integrated development environment;
if the local calling function fails to be compiled in the integrated development environment, the component call fails;
and if the local calling function is successfully compiled in the integrated development environment, the local calling function is operated.
6. The component call method according to any one of claims 1 to 2, wherein the calling a remote call function from the component call library, using the URL as a call parameter of the remote call function, includes:
calling a remote component path method class from the component call library, and searching a remote call function corresponding to the component name to be called in the remote component path method class;
extracting calling parameters needed by the remote calling function from a parameter dictionary in the component calling library, merging the URL and the calling parameters needed by the remote calling function, then transmitting the merged URL and the calling parameters needed by the remote calling function to the remote calling function, and operating the remote calling function.
7. A component invocation apparatus, the apparatus comprising:
the component call request judging module is used for receiving and analyzing a component call request to obtain a component name to be called and judging whether the component call request is a remote call request or a local call request; wherein the determining whether the component call request is a remote call request or a local call request includes: analyzing the component call request to obtain a call IP address of the component call request; judging whether the component call request is a remote call request or a local call request local call function operation module according to the call IP address of the component call request, and if the component call request is a local call request, calling and operating a local call function from a pre-built component call library;
and if the component call request is a remote call request, analyzing the URL of the remote call request, calling a remote call function from the component call library, and using the URL as a call parameter of the remote call function to operate the remote call function.
8. An electronic device for component invocation, comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the component invocation method of any of claims 1 to 6.
9. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the component invocation method of any of claims 1 to 6.
CN201911277956.5A 2019-12-12 2019-12-12 Component calling method, device and computer readable storage medium Active CN111158777B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911277956.5A CN111158777B (en) 2019-12-12 2019-12-12 Component calling method, device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911277956.5A CN111158777B (en) 2019-12-12 2019-12-12 Component calling method, device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN111158777A CN111158777A (en) 2020-05-15
CN111158777B true CN111158777B (en) 2023-10-27

Family

ID=70557243

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911277956.5A Active CN111158777B (en) 2019-12-12 2019-12-12 Component calling method, device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111158777B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328330A (en) * 2020-11-25 2021-02-05 北京五八信息技术有限公司 iOS component calling method, device, middleware, electronic equipment and medium
CN112486705A (en) * 2020-11-30 2021-03-12 安徽中科美络信息技术有限公司 Component scheduling method and system of new energy automobile management software

Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6728788B1 (en) * 1999-12-16 2004-04-27 International Business Machines Corporation Method and system for converting a remote procedure call to a local procedure call when the service is on the same device as the calling client
CN101673217A (en) * 2009-08-26 2010-03-17 用友软件股份有限公司 Method for realizing remote program call and system thereof
US7853962B1 (en) * 2005-05-31 2010-12-14 Cisco Technology, Inc. Method and apparatus for optimization of remote procedure call communications
CN103905551A (en) * 2014-04-02 2014-07-02 北京中交兴路车联网科技有限公司 Method and device for calling service
CN104142856A (en) * 2013-05-07 2014-11-12 华为技术有限公司 Service program call method, service program call system and intelligent equipment thereof
CN104270470A (en) * 2014-10-24 2015-01-07 杭州高达软件系统股份有限公司 Remote service invocation method, device and system
EP2988217A1 (en) * 2014-08-21 2016-02-24 licobo GmbH Method and system with client side adaptive universal service interface support
CN105849691A (en) * 2013-06-18 2016-08-10 西安姆贝拉有限公司 Method and apparatus for code virtualization and remote process call generation
CN105988785A (en) * 2015-02-05 2016-10-05 阿里巴巴集团控股有限公司 RPC (remote procedure call) service development method and device
CN107247634A (en) * 2017-06-06 2017-10-13 广州视源电子科技股份有限公司 A kind of method and apparatus of Robotic Dynamic asynchronous remote procedure call
CN107623722A (en) * 2017-08-21 2018-01-23 云宏信息科技股份有限公司 A kind of remote data caching method, electronic equipment and storage medium
CN109062710A (en) * 2018-07-19 2018-12-21 阿里巴巴集团控股有限公司 A kind of remote procedure calling (PRC) method, terminal device and the network equipment
CN109062626A (en) * 2018-07-09 2018-12-21 北京奇艺世纪科技有限公司 Exchange method, device and the equipment of Web page component and Native component
CN109359147A (en) * 2018-09-27 2019-02-19 北京京东尚科信息技术有限公司 Service Component processing method, component server and system
CN109660573A (en) * 2017-10-10 2019-04-19 北京京东尚科信息技术有限公司 Data transmission method and device
CN109725944A (en) * 2018-12-29 2019-05-07 北京三快在线科技有限公司 Remote procedure calling (PRC) method and device, electronic equipment, storage medium
CN110377438A (en) * 2019-07-22 2019-10-25 广州小鹏汽车科技有限公司 The method for routing of striding course communication interface, device and system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8869177B2 (en) * 2007-09-06 2014-10-21 International Business Machines Corporation Decoupling components of a software system at compile time and load time
US7386865B2 (en) * 2004-06-24 2008-06-10 Sap Ag System and method for processing remote function calls
US20110107311A1 (en) * 2009-11-04 2011-05-05 Hewlett-Packard Development Company, L.P. Communicating with Locally Networked Device from Remotely Hosted Browser Based Tool
CN103853532B (en) * 2012-11-29 2017-09-29 国际商业机器公司 Method and apparatus for function call
US10547682B2 (en) * 2016-11-10 2020-01-28 Adobe Inc. Dynamically scaling application components using microservices

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6728788B1 (en) * 1999-12-16 2004-04-27 International Business Machines Corporation Method and system for converting a remote procedure call to a local procedure call when the service is on the same device as the calling client
US7853962B1 (en) * 2005-05-31 2010-12-14 Cisco Technology, Inc. Method and apparatus for optimization of remote procedure call communications
CN101673217A (en) * 2009-08-26 2010-03-17 用友软件股份有限公司 Method for realizing remote program call and system thereof
CN104142856A (en) * 2013-05-07 2014-11-12 华为技术有限公司 Service program call method, service program call system and intelligent equipment thereof
CN105849691A (en) * 2013-06-18 2016-08-10 西安姆贝拉有限公司 Method and apparatus for code virtualization and remote process call generation
CN103905551A (en) * 2014-04-02 2014-07-02 北京中交兴路车联网科技有限公司 Method and device for calling service
EP2988217A1 (en) * 2014-08-21 2016-02-24 licobo GmbH Method and system with client side adaptive universal service interface support
CN104270470A (en) * 2014-10-24 2015-01-07 杭州高达软件系统股份有限公司 Remote service invocation method, device and system
CN105988785A (en) * 2015-02-05 2016-10-05 阿里巴巴集团控股有限公司 RPC (remote procedure call) service development method and device
CN107247634A (en) * 2017-06-06 2017-10-13 广州视源电子科技股份有限公司 A kind of method and apparatus of Robotic Dynamic asynchronous remote procedure call
CN107623722A (en) * 2017-08-21 2018-01-23 云宏信息科技股份有限公司 A kind of remote data caching method, electronic equipment and storage medium
CN109660573A (en) * 2017-10-10 2019-04-19 北京京东尚科信息技术有限公司 Data transmission method and device
CN109062626A (en) * 2018-07-09 2018-12-21 北京奇艺世纪科技有限公司 Exchange method, device and the equipment of Web page component and Native component
CN109062710A (en) * 2018-07-19 2018-12-21 阿里巴巴集团控股有限公司 A kind of remote procedure calling (PRC) method, terminal device and the network equipment
CN109359147A (en) * 2018-09-27 2019-02-19 北京京东尚科信息技术有限公司 Service Component processing method, component server and system
CN109725944A (en) * 2018-12-29 2019-05-07 北京三快在线科技有限公司 Remote procedure calling (PRC) method and device, electronic equipment, storage medium
CN110377438A (en) * 2019-07-22 2019-10-25 广州小鹏汽车科技有限公司 The method for routing of striding course communication interface, device and system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
一种基于原始接口编译远程调用代理存根生成器的研究与实现;张小晶 等;《软件导刊》(09);全文 *
可扩展、高性能Web服务器系统的研究;雷迎春;《中国优秀硕士学位论文全文数据库 信息科技辑》;全文 *
王建新 等.基于NS2的计算机网络远程虚拟实验室的设计与实现.计算机工程与应用.2005,(24),全文. *

Also Published As

Publication number Publication date
CN111158777A (en) 2020-05-15

Similar Documents

Publication Publication Date Title
US11119812B2 (en) Method and device for processing application program page according to a common interface container
WO2021008030A1 (en) Web form configuration method and device, and computer readable storage medium
CN109901834B (en) Document page generation method, device, computer equipment and storage medium
CN105718313A (en) Application operation method and device
US11741002B2 (en) Test automation systems and methods using logical identifiers
CN111158777B (en) Component calling method, device and computer readable storage medium
CN114996619A (en) Page display method and device, computer equipment and storage medium
CN110688096A (en) Method, device, medium and electronic equipment for constructing application program containing plug-in
CN113536185A (en) Application page loading method, storage medium and related equipment thereof
CN110727425A (en) Electronic device, form data verification method and computer-readable storage medium
CN113778393A (en) Component generation method, device, computer system and computer-readable storage medium
US20050197157A1 (en) System enabling easy application development on mobile devices
CN109408057B (en) Method, device, medium and computing equipment for automatically generating codes
CN112835568A (en) Project construction method and device
CN116450723A (en) Data extraction method, device, computer equipment and storage medium
CN110908644A (en) Configuration method and device of state node, computer equipment and storage medium
CN113377458B (en) Plug-in management method and device, electronic equipment and storage medium
CN110599112A (en) Method and device for developing and maintaining network page
CN111857782B (en) Interface updating method and device, computer equipment and storage medium
CN114115855A (en) Code multiplexing method and device, computer readable storage medium and electronic equipment
CN113176907A (en) Interface data calling method and device, computer system and readable storage medium
CN108804236B (en) AIDL file sharing method and system
CN112051952A (en) Picture dynamic browsing method and device, electronic equipment and readable storage medium
CN112104544A (en) Method and device for sending dynamic mail based on Freemarker
JP4007452B2 (en) System and program for displaying device information using browser

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