WO2011050632A1 - 一种宿主程序和插件及插件间进行交互的方法及装置 - Google Patents
一种宿主程序和插件及插件间进行交互的方法及装置 Download PDFInfo
- Publication number
- WO2011050632A1 WO2011050632A1 PCT/CN2010/075318 CN2010075318W WO2011050632A1 WO 2011050632 A1 WO2011050632 A1 WO 2011050632A1 CN 2010075318 W CN2010075318 W CN 2010075318W WO 2011050632 A1 WO2011050632 A1 WO 2011050632A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- plug
- host program
- interface entity
- host
- function
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
Definitions
- the present invention relates to plug-in interaction techniques in an application, and more particularly to a method and apparatus for interacting between a host program and a plug-in and a plug-in. Background technique
- the interaction between the host program and the plugin is a one-way interaction, that is, only the host program can call the plugin, and the plugin cannot call the host program;
- the host Program refers to the application;
- the plugin can only be called by the host program, and the plugins cannot be called each other. Summary of the invention
- the main object of the present invention is to provide a method and apparatus for interacting between a host program and a plug-in and a plug-in, which can implement two-way interaction between a host program and a plug-in, a plug-in, and a plug-in.
- the present invention provides a method for interacting between a host program and a plug-in and a plug-in, and a shared protocol for interacting between the host program and the plug-in; the method further includes:
- the host interface entity is created according to the sharing protocol
- the plug-in During the process of loading the plug-in by the host program, the plug-in generates a plug-in interface entity based on the shared protocol, and the host program saves the generated plug-in interface entity, and the plug-in saves the host interface entity created by the host program;
- the host program and the plugin complete the interaction through their respective counterpart interface entities.
- the completing the interaction operation is: executing a host program calling plug-in between the host program and the plug-in through the respective saved interface entity; specifically:
- the host program finds the plug-in through the stored plug-in identifier, and the host program transmits the call request of the plug-in function ID of the plug-in to be called to the plug-in to be called through the interface entity of both parties, and the plug-in called to call and run the function function corresponding to the plug-in function ID, and execute The corresponding function.
- the completing the interaction operation is as follows: the host device and the plug-in perform the first plug-in calling the second plug-in through the respective saved interface entity; the specific:
- the first plugin sends a call request to the host program to call the second plugin, and the host program finds the second plugin through the stored plugin identifier, and then passes the call request of the plugin function ID of the second plugin to the second plugin through the interface entity of both parties.
- the second plugin calls and runs the function to perform the corresponding function.
- the completing the interaction operation is: executing a plug-in calling host program between the host program and the plug-in through the respective saved interface entity; specifically:
- the plug-in sends a call request to the host program to call the function in the host program.
- the host program finds the called module by the identifier of the called module, and then calls the function function of the called module, and the called module runs the function function to execute the corresponding function.
- the method further includes: the host program calling the plug-in information description method, and outputting the function icon, or function of the plug-in
- the text description can be transmitted to the host program through the interface entity of both the plug-in and the host program.
- the host program adds the function icon to the toolbar of the host program, or adds the function text description menu item to the menu.
- the present invention also provides a device for interacting between a host program and a plug-in and a plug-in, the device comprising: a setting module, an interface entity, a storage module, and a running module;
- the setting module is configured to set a sharing protocol between the host program and the plug-in;
- the interface entity creates a storage module, configured to create and save a host interface entity and a plug-in interface entity according to a sharing protocol set by the setting module;
- the running module is configured to complete the interaction with the host program by using the host entity stored in the storage module by the interface entity; or to perform the interaction with the plug-in by using the plug-in interface entity stored by the interface entity to create the storage module.
- the creating, by the interface entity, the storage module further includes: a host interface entity creating a storage module and a plug-in interface entity to create a storage module;
- the host interface entity creates a storage module, after the host program is started, creates a host interface entity according to a sharing protocol, and transmits the storage module to the plug-in interface entity, and saves the plug-in interface entity generated by the plug-in interface entity to create the storage module;
- the plug-in interface entity creates a storage module for creating a plug-in interface entity based on a shared protocol and transmitting the storage module to the host interface entity, and saving the host interface entity created by the host interface entity to create the storage module.
- the running module further includes: a host program running module and a plug-in running module; wherein,
- the host program running module is configured to complete an interaction with the plug-in through the saved plug-in interface entity
- the plug-in running module is configured to complete an interaction with the host program by using the saved host interface entity.
- the host program running module calls the plug-in through the saved plug-in interface entity
- the host program running module is further used to call the plug-in information description method, and receive the function icon or function text description output by the plug-in running module. And add the function icon to the toolbar of the host program, or add the function text description menu item to the menu;
- the plug-in running module is further used for outputting a function icon, or a function text description, and transmitting to the host program running module.
- the method and device for interacting between a host program and a plug-in and a plug-in provided by the present invention, after the host program is started, a host interface entity is created according to a shared protocol; in the process of loading the plug-in by the host program, the plug-in generates a plug-in interface based on the set sharing protocol.
- the entity, the host program saves the generated plug-in interface entity, and the plug-in saves the host interface entity created by the host program; the host program and the plug-in complete the interaction through the respective interface entities saved by the host.
- the sharing protocol between the host program and the plug-in since the sharing protocol between the host program and the plug-in is set, and the sharing protocol includes the host program and the plug-in for externally calling the method and the self-information description method, the host program and the plug-in can save each other's own The interface entities call each other, and the host programs can call each other for the media.
- the host program may also call the plugin's own information description method, add the plugin function icon to the toolbar of the host program, or add the function text description of the plugin to the menu of the host program, so that the user
- the required plugin functionality can be called in the host program interface.
- FIG. 1 is a schematic flow chart showing a method for implementing interaction between a host program, a plug-in, and a plug-in according to the present invention
- FIG. 2 is a schematic structural diagram of an apparatus for interacting between a host program, a plug-in, and a plug-in according to the present invention. detailed description
- the basic idea of the present invention is: setting a sharing protocol between the host program and the plug-in; after the host program is started, the host interface entity is created according to the sharing protocol, and the plug-in generates the plug-in based on the set sharing protocol during the loading process of the host program.
- the interface entity, the host program saves the generated plug-in interface entity, and the plug-in saves the host interface entity created by the host program; the host program and the plug-in execute the interaction between the host program and the plug-in, or the plug-in and the plug-in through the respective interface entities saved by the host.
- the host program and the plug-in respectively save the interface entity of the other party as follows:
- the host program saves the plug-in interface entity, and the plug-in saves the host interface entity.
- the host interface entity and the plug-in interface entity may be used as a basis for information interaction between a host interface entity and a plug-in interface entity pointer, or reference.
- FIG. 1 is a schematic flowchart of a method for implementing interaction between a host program, a plug-in, and a plug-in according to the present invention. As shown in FIG. 1, the implementation process includes the following steps:
- Step 101 Set a sharing protocol for interaction between the host program and the plug-in;
- the set sharing protocol includes information interaction methods, which may include: a module for external calling method and a module self information description method.
- the module may be a host program or a plug-in; in the method for externally calling the module, the parameter that the module can call externally may be:
- module function ID or identification string
- module's 32-bit data parameters such as data structure pointers, etc.
- the module for external call methods allows other modules, such as host programs or plug-ins, to call this module through the above parameters, such as Plugin or host program;
- the module self-information description method at least includes: outputting a self ID or an identification string, outputting a function ID and a text description of each function item thereof, and/or outputting a function ID and an icon of each function item thereof, if other modules call
- the module itself describes the information, for example: if the host program calls the plugin's own information description method, or if the plugin calls the host program's own information description Method, the plugin or host program can output its own corresponding information.
- Step 102 After the host program is started, the host interface entity is created according to the sharing protocol.
- the host program includes an output function for creating a host interface entity, where the output function has an input parameter of a shared protocol type, and returns the created host interface entity. .
- Step 103 During the process of loading the plug-in by the host program, the plug-in generates a plug-in interface entity based on the set sharing protocol, and the host program saves the generated plug-in interface entity, and the plug-in saves the host interface entity created by the host program;
- the host program stores the plug-in information, such as the plug-in ID, the plug-in function ID, and the data parameters corresponding to the plug-in, into the plug-in library.
- the host program calls the plugin entity creation function with the host interface entity as a parameter, and stores the plugin interface entity returned by the entity creation function in the plugin library. Accordingly, the plugin also saves the host interface entity that the host program has created.
- the plugin's entity creation function is similar to creating a host interface entity creation function in the host program.
- the process of loading the plug-in is a prior art, and is not described in detail herein.
- the plug-in library is located in the host program and is used to store the loaded plug-in information, including: a plug-in interface entity, a plug-in ID, a plug-in function ID, and the like.
- the host interface entity and the plug-in interface entity are used for subsequent information exchange between the host program and the plug-in, and the interaction information may be: a plug-in call request, plug-in information, and a plug-in execution function result.
- Step 104 The host program and the plug-in perform the interaction operations of steps 104a and/or 104b through the interface entities of the two parties;
- Step 104a When the host program calls the plug-in, the host program and the plug-in perform corresponding interaction operations, and then end the current interaction process;
- Step 104b When different plugins call each other, the host program and the plugin perform corresponding interaction operations, and then end the current interaction process;
- the host program calls the plug-in in step 104a, the interaction process performed by the host program and the plug-in is as follows:
- Step A1 The host program calls the plug-in to find the plug-in through the stored plug-in identifier; specifically: the host program can call the plug-in through the plug-in identifier, such as the plug-in ID, or the identifier string, and find the stored place in the plug-in library according to the plug-in identifier.
- the plug-in ID, or identifier string is required, and the corresponding plug-in function ID in the plug-in library is found according to the required plug-in ID, or identifier string.
- the host program transmits the call request to the plugin to be called through the plugin interface entity of the plugin to be called.
- Step C1 After the calling plugin receives the calling request, the function function corresponding to the plugin function ID is called;
- the calling plugin receives the calling request sent by the host program, the corresponding function is called according to the plugin function ID carried in the calling request.
- Step D1 The plug-in running function function is to be called, and the corresponding function is executed.
- the host program may also call the plugin's own information description method, and the plugin outputs its own function icon, or its own functional text description, and transmits it to the host program through the interface entity of both the plugin and the host program, and the host program will The received plugin function icon is added to the host program's toolbar, or the plugin's function text description generation menu item is added to the host program's menu. In this way, the user can select the required plug-in from the menu of the host program, and the host program calls the plug-in to continue the interaction process from step B1 to step D1.
- step 104b When the different plugins are called from each other in step 104b, the interaction between the host program and the plugin is performed.
- the process is as follows:
- Step A2 The plugin sends a call request to the host program to call other plugins, and the host program finds the plugin to be called through the stored plugin identifier;
- the calling request sent by the plug-in to the host program carries the plug-in identifier to be called, such as a plug-in ID, or an identifier string.
- the host program After receiving the call request, the host program searches for the plug-in library to be called according to the plug-in identifier to be called carried in the call request. Go to the plugin to be called. For example: Plug-in A calls plug-in B as needed. The identifier of plug-in B is NewPluginB, and the host program finds plug-in B in the plug-in library based on NewPluginB.
- Step B2 The host program transmits a call request of the plug-in function ID of the plug-in to be called to the plug-in to be called through the interface entity of both parties;
- the interface entities of the two parties are respectively a host interface entity and a plug-in interface entity of the plug-in to be called.
- Step C2 After the plugin to be called receives the new call request, the function function corresponding to the plugin function ID is called;
- the plug-in function ID corresponding to the plug-in function ID is called according to the plug-in function ID carried in the call request.
- Step D2 The plug-in running function function is called, and the corresponding called function is executed.
- the mutual invocation between the plug-ins of the present invention is carried out by the host program, that is, the plug-in notifies the host program of the information about the desired target plug-in, and then the host program calls the function of the corresponding target plug-in.
- the plug-in can also call the host program.
- the process can be: The plug-in sends a call request to the host program to call the function in the host program, and the host program finds the identifier of the called module through the stored Calling the module, and then calling the function function of the called module; the called module runs the function function, and executes the corresponding called function, wherein the identifier of the called module is stored in the writing process of the host program.
- the plugin calls the host process The difference between the call and the plugin is that the called module in the host is part of the host program, not the loaded external plugin.
- the apparatus includes: a setting module, an interface entity, a storage module, and an operation module;
- the setting module is configured to set a sharing protocol between the host program and the plug-in;
- the interface entity creates a storage module, configured to create and save a host interface entity and a plug-in interface entity according to a sharing protocol set by the setting module;
- the running module is configured to complete the interaction with the host program by using the host entity stored in the storage module by the interface entity; or to perform the interaction with the plug-in by using the plug-in interface entity stored by the interface entity to create the storage module.
- the interface entity creates a storage module, further comprising: a host interface entity creating a storage module and a plug-in interface entity to create a storage module; wherein
- the host interface entity creates a storage module, after the host program is started, creates a host interface entity according to a sharing protocol, and transmits the storage module to the plug-in interface entity, and saves the plug-in interface entity generated by the plug-in interface entity to create the storage module;
- the plug-in interface entity creates a storage module for creating a plug-in interface entity based on a shared protocol and transmitting the storage module to the host interface entity, and saving the host interface entity created by the host interface entity to create the storage module.
- the running module further includes: a host program running module and a plug-in running module; wherein the host program running module is configured to complete an interaction operation with the plug-in through the saved plug-in interface entity;
- the plug-in running module is configured to perform an interaction with the host program through the saved host interface entity.
- the host program running module is further configured to call the plugin's own information description method, receive the function icon outputted by the plugin running module, or the function text description, and add the function icon to the toolbar of the host program, or add the function text description generation menu item. In the menu;
- the plug-in running module is further used for outputting a function icon, or a function text description, and transmitting to the host program running module.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Description
一种宿主程序和插件及插件间进行交互的方法及装置 技术领域
本发明涉及应用程序中的插件交互技术, 尤其涉及一种宿主程序和插 件及插件间进行交互的方法及装置。 背景技术
传统应用程序由主要的可执行程序、 配置文件、 数据文件、 图片等信 息组成, 并根据需要在应用程序中加载一些特定功能, 如: 编解码功能、 数据压缩功能等的动态链接库。 随着编程技术的发展, 目前应用程序中具 有特定功能的模块一般通过插件方式实现, 如 Winamp 中的声音解码插件 等等。 但是, 现有的插件技术存在如下不足:
1 ) 由于使用回调函数完成宿主程序和插件之间的交互, 因此宿主程序 和插件之间的交互为单向交互, 即: 只有宿主程序能调用插件, 插件不能 调用宿主程序; 这里, 所述宿主程序是指应用程序;
2 )宿主程序和插件之间无法通过人工选择进行交互, 即: 宿主程序和 插件之间的交互是在应用程序内部进行的, 用户不能在可视的界面上选择 所需要的插件功能;
3 )插件只能被宿主程序调用, 而插件之间不能实现相互调用。 发明内容
有鉴于此, 本发明的主要目的在于提供一种宿主程序和插件及插件间 进行交互的方法及装置, 可实现宿主程序和插件、 插件和插件之间的双向 交互。
为达到上述目的, 本发明的技术方案是这样实现的:
本发明提供了一种宿主程序和插件及插件间进行交互的方法, 设置宿 主程序和插件间进行交互的共用协议; 该方法还包括:
宿主程序启动后, 根据所述共用协议创建宿主接口实体;
宿主程序加载插件过程中, 插件以所述共用协议为依据生成插件接口 实体, 宿主程序保存所生成的插件接口实体, 插件保存宿主程序创建的宿 主接口实体;
宿主程序和插件通过各自保存的对方接口实体完成交互操作。
其中, 所述完成交互操作为: 宿主程序和插件之间通过各自保存的对 方接口实体执行宿主程序调用插件; 具体为:
宿主程序通过存储的插件标识找到插件, 宿主程序将携带待调用插件 的插件功能 ID的调用请求通过双方的接口实体传给待调用插件, 待调用插 件调用并运行插件功能 ID对应的功能函数, 执行相应功能。
其中, 所述完成交互操作为: 宿主程序和插件之间通过各自保存的对 方接口实体执行第一插件调用第二插件; 具体为:
第一插件向宿主程序发送调用请求调用第二插件, 宿主程序通过存储 的插件标识找到第二插件, 之后将携带第二插件的插件功能 ID的调用请求 通过双方的接口实体传给第二插件, 第二插件调用并运行功能函数, 执行 相应功能。
其中, 所述完成交互操作为: 宿主程序和插件之间通过各自保存的对 方接口实体执行插件调用宿主程序; 具体为:
插件向宿主程序发送调用请求调用宿主程序中的功能, 宿主程序通过 被调用模块的标识找到被调用模块, 再调用被调用模块的功能函数, 被调 用模块运行功能函数, 执行相应功能。
上述方案中, 所述宿主程序调用插件的过程中, 该方法还包括: 宿主程序调用插件自身信息描述方法, 将插件输出的功能图标、 或功
能文字描述通过插件和宿主程序双方的接口实体传输给宿主程序, 宿主程 序将功能图标添加在宿主程序的工具条上、 或将功能文字描述生成菜单项 加入菜单中。
本发明还提供了一种宿主程序和插件及插件间进行交互的装置, 该装 置包括: 设置模块、 接口实体创建存储模块和运行模块; 其中,
所述设置模块, 用于设置宿主程序和插件间进行交互的共用协议; 所述接口实体创建存储模块, 用于以设置模块设置的共用协议为依据 创建并保存宿主接口实体和插件接口实体;
所述运行模块, 用于通过接口实体创建存储模块所存储的宿主接口实 体完成与宿主程序的交互操作; 或用于通过接口实体创建存储模块所存储 的插件接口实体完成与插件的交互操作。
其中, 所述接口实体创建存储模块进一步包括: 宿主接口实体创建存 储模块和插件接口实体创建存储模块; 其中,
所述宿主接口实体创建存储模块, 用于在宿主程序启动后, 根据共用 协议创建宿主接口实体并传给插件接口实体创建存储模块, 并保存插件接 口实体创建存储模块生成的插件接口实体;
所述插件接口实体创建存储模块, 用于以共用协议为依据创建插件接 口实体并传给宿主接口实体创建存储模块, 并保存宿主接口实体创建存储 模块创建的宿主接口实体。
其中, 所述运行模块进一步包括: 宿主程序运行模块和插件运行模块; 其中,
所述宿主程序运行模块, 用于通过所保存的插件接口实体完成与插件 的交互操作;
所述插件运行模块, 用于通过所保存的宿主接口实体完成与宿主程序 的交互操作。
其中, 所述宿主程序运行模块通过所保存的插件接口实体调用插件时, 所述宿主程序运行模块, 进一步用于调用插件自身信息描述方法, 接收插 件运行模块输出的功能图标、 或功能文字描述, 并将功能图标加在宿主程 序的工具条上、 或将功能文字描述生成菜单项加入菜单中;
相应的, 所述插件运行模块, 进一步用于输出的功能图标、 或功能文 字描述, 并传输给宿主程序运行模块。
本发明提供的宿主程序和插件及插件间进行交互的方法及装置, 宿主 程序启动后, 根据共用协议创建宿主接口实体; 宿主程序加载插件过程中, 插件以所设置的共用协议为依据生成插件接口实体, 宿主程序保存所生成 的插件接口实体, 插件保存宿主程序创建的宿主接口实体; 宿主程序和插 件通过各自保存的对方接口实体完成交互操作。
本发明中, 由于设置了宿主程序和插件间进行交互的共用协议, 且共 用协议中含有宿主程序和插件供外部调用的方法和自身信息描述方法, 使 得宿主程序和插件可通过自身保存的对方的接口实体相互调用, 同时不同 插件之间可以宿主程序为媒介进行相互调用。
进一步地, 本发明中宿主程序还可调用插件自身信息描述方法, 将插 件功能图标添加在宿主程序的工具条上, 或将插件的功能文字描述生成菜 单项加入宿主程序的菜单中, 这样用户就可以在宿主程序界面中调用所需 的插件功能。 附图说明
图 1 为本发明宿主程序和插件及插件间进行交互的方法实现流程示意 图;
图 2为本发明宿主程序和插件及插件间进行交互的装置结构示意图。
具体实施方式
本发明的基本思想是: 设置宿主程序和插件间进行交互的共用协议; 宿主程序启动后, 根据共用协议创建宿主接口实体, 宿主程序加载插件过 程中, 插件以所设置的共用协议为依据生成插件接口实体, 宿主程序保存 所生成的插件接口实体, 插件保存宿主程序创建的宿主接口实体; 宿主程 序和插件通过各自保存的对方接口实体执行宿主程序和插件、 或插件与插 件间的交互操作。
这里, 所述宿主程序和插件分别保存对方的接口实体具体为: 宿主程 序保存插件接口实体, 插件保存宿主接口实体。
本发明中, 所述的宿主接口实体和插件接口实体, 可为宿主接口实体 和插件接口实体的指针、 或引用等各种进行信息交互的依据。
下面结合附图及具体实施例对本发明作进一步详细说明。
图 1 为本发明宿主程序和插件及插件间进行交互的方法实现流程示意 图, 如图 1所示, 该实现流程包括以下步骤:
步骤 101 : 设置宿主程序和插件间进行交互的共用协议;
这里, 所设置的共用协议中含有信息交互的方法, 可包括: 模块供外 部调用的方法和模块自身信息描述方法。 其中, 所述模块可为宿主程序或 插件; 所述模块供外部调用的方法中, 模块供外部调用的参数可为: 模块
ID、 或标识串, 模块功能 ID, 模块的 32位数据参数, 如数据结构指针等, 所述模块供外部调用的方法使得其它模块, 如宿主程序或插件, 可通过上 述参数调用本模块, 如插件或宿主程序;
所述模块自身信息描述方法至少包括: 输出自身 ID或标识串, 输出自 身每个功能项的功能 ID和文字描述, 和 /或输出自身每个功能项的功能 ID 和图标等, 若其它模块调用本模块自身信息描述方法, 例如: 如果宿主程 序调用插件自身信息描述方法、 或如果插件调用宿主程序自身信息描述方
法, 则插件或宿主程序可输出自身的相应信息。
步骤 102: 宿主程序启动后, 根据共用协议创建宿主接口实体; 这里, 宿主程序中包含有创建宿主接口实体的输出函数, 该输出函数 中带有共用协议类型的输入参数, 返回创建的宿主接口实体。
步骤 103: 宿主程序加载插件过程中, 插件以所设置的共用协议为依据 生成插件接口实体, 宿主程序保存所生成的插件接口实体, 插件保存宿主 程序创建的宿主接口实体;
这里, 宿主程序在加载插件的过程中, 将插件信息, 如插件 ID、 插件 功能 ID , 插件对应的数据参数等存入插件库中。
宿主程序以宿主接口实体为参数调用插件的实体创建函数, 并将实体 创建函数返回的插件接口实体存储在插件库中, 相应的, 插件也保存宿主 程序已创建的宿主接口实体。 所述插件的实体创建函数与宿主程序中创建 宿主接口实体创建函数类似。
其中, 所述加载插件的过程为现有技术, 这里不再详述; 所述插件库 位于宿主程序中, 用于存储已加载插件信息, 包括: 插件接口实体、 插件 ID、 插件功能 ID等。
本发明中, 所述宿主接口实体和插件接口实体用于后续宿主程序与插 件间的信息交互, 所述交互信息可为: 插件的调用请求、 插件信息和插件 执行功能的结果等。
步骤 104: 宿主程序和插件通过双方的接口实体, 执行步骤 104a和 /或 104b的交互操作;
步骤 104a: 宿主程序调用插件时, 宿主程序和插件执行对应的交互操 作, 之后结束当前交互过程;
步骤 104b: 不同插件间相互调用时, 宿主程序和插件执行对应的交互 操作, 之后结束当前交互过程;
其中, 步骤 104a所述宿主程序调用插件时, 宿主程序和插件执行的交 互操作流程具体如下:
步骤 A1 : 宿主程序要调用插件, 通过存储的插件标识查找到插件; 具体为: 宿主程序可通过插件标识, 如插件 ID、 或标识串调用插件, 根据插件标识在插件库中找到已存储的所需插件 ID、 或标识串, 根据所需 插件 ID、 或标识串找到插件库中对应的插件功能 ID。
步骤 B1 : 宿主程序将携带待调用插件的插件功能 ID的调用请求通过 双方的接口实体传给待调用插件;
这里, 宿主程序将调用请求通过待调用插件的插件接口实体传输给待 调用插件。
步骤 C1 : 待调用插件收到调用请求后, 调用插件功能 ID对应的功能 函数;
具体为: 待调用插件收到宿主程序所发的调用请求后, 根据调用请求 中携带的插件功能 ID调用对应的功能函数。
步骤 D1 : 待调用插件运行功能函数, 执行相应功能。
进一步地, 步骤 A1中, 宿主程序还可调用插件自身信息描述方法, 插 件输出自身的功能图标、 或自身的功能文字描述, 并通过插件和宿主程序 双方的接口实体传输给宿主程序, 宿主程序将收到的插件功能图标添加在 宿主程序的工具条上、 或将插件的功能文字描述生成菜单项加入宿主程序 的菜单中。 这样, 用户可以从宿主程序的菜单中选择所需的插件, 则宿主 程序对插件进行调用, 继续完成步骤 B1至步骤 D1的交互过程。
这里, 所述插件功能图标添加在宿主程序工具条上的过程和将插件的 功能文字描述生成菜单项加入宿主程序的菜单中的过程为现有技术, 此处 不再详细描述。
步骤 104b所述不同插件间相互调用时, 宿主程序和插件执行的交互操
作流程具体如下:
步骤 A2: 插件向宿主程序发送调用请求调用其它插件, 宿主程序通过 存储的插件标识找到待调用插件;
这里, 插件向宿主程序发送的调用请求中携带待调用插件标识, 如插 件 ID、 或标识串, 宿主程序收到调用请求后, 根据调用请求中携带的待调 用插件标识在宿主程序插件库中查找到待调用插件。 例如: 插件 A根据需 要调用插件 B, 插件 B的标识为 NewPluginB, 宿主程序以 NewPluginB为 依据在插件库中找到插件 B。
步骤 B2: 宿主程序将携带待调用插件的插件功能 ID的调用请求通过 双方的接口实体传给待调用插件;
这里, 所述双方的接口实体分别为宿主接口实体和待调用插件的插件 接口实体。
步骤 C2: 待调用插件收到新的调用请求后, 调用插件功能 ID对应的 功能函数;
具体为: 待调用插件收到宿主程序所发的调用请求后, 根据调用请求 中携带的插件功能 ID调用自身存储的与插件功能 ID对应的功能函数。
步骤 D2: 待调用插件运行功能函数, 执行相应被调用的功能。
可见, 本发明插件间的相互调用是以宿主程序为媒介进行的, 即: 插 件将所需目标插件的相关信息通知宿主程序, 之后宿主程序调用相应目标 插件的功能。
按上述插件间相互调用的方案, 也可实现插件对宿主程序的调用, 过 程可为: 插件向宿主程序发送调用请求调用宿主程序中的功能, 宿主程序 通过已存储的被调用模块的标识找到被调用模块, 再调用被调用模块的功 能函数; 被调用模块运行功能函数, 执行相应的被调用功能, 其中, 所述 被调用模块的标识在宿主程序的编写过程中已存储。 所述插件调用宿主程
序与插件间的相互调用的不同点在于宿主中的被调用模块为宿主程序的一 部分, 而不是加载的外部插件。
图 2为本发明宿主程序和插件及插件间进行交互的装置结构示意图, 如图 2所示, 该装置包括: 设置模块、 接口实体创建存储模块和运行模块; 其中,
所述设置模块, 用于设置宿主程序和插件间进行交互的共用协议; 所述接口实体创建存储模块, 用于以设置模块设置的共用协议为依据 创建并保存宿主接口实体和插件接口实体;
所述运行模块, 用于通过接口实体创建存储模块所存储的宿主接口实 体完成与宿主程序的交互操作; 或用于通过接口实体创建存储模块所存储 的插件接口实体完成与插件的交互操作。
所述接口实体创建存储模块进一步包括: 宿主接口实体创建存储模块 和插件接口实体创建存储模块; 其中,
所述宿主接口实体创建存储模块, 用于在宿主程序启动后, 根据共用 协议创建宿主接口实体并传给插件接口实体创建存储模块, 并保存插件接 口实体创建存储模块生成的插件接口实体;
所述插件接口实体创建存储模块, 用于以共用协议为依据创建插件接 口实体并传给宿主接口实体创建存储模块, 并保存宿主接口实体创建存储 模块创建的宿主接口实体。
所述运行模块进一步包括: 宿主程序运行模块和插件运行模块; 其中, 所述宿主程序运行模块, 用于通过所保存的插件接口实体完成与插件 的交互操作;
所述插件运行模块, 用于通过所保存的宿主接口实体完成与宿主程序 的交互操作。
所述宿主程序运行模块通过所保存的插件接口实体调用插件时, 所述
宿主程序运行模块进一步用于调用插件自身信息描述方法, 接收插件运行 模块输出的功能图标、 或功能文字描述, 并将功能图标加在宿主程序的工 具条上、 或将功能文字描述生成菜单项加入菜单中;
相应的, 所述插件运行模块, 进一步用于输出的功能图标、 或功能文 字描述, 并传输给宿主程序运行模块。
以上所述, 仅为本发明的较佳实施例而已, 并非用于限定本发明的保 护范围, 凡在本发明的精神和原则之内所作的任何修改、 等同替换和改进 等, 均应包含在本发明的保护范围之内。
Claims
1、 一种宿主程序和插件及插件间进行交互的方法, 其特征在于, 设置 宿主程序和插件间进行交互的共用协议; 该方法还包括:
宿主程序启动后, 根据所述共用协议创建宿主接口实体;
宿主程序加载插件过程中, 插件以所述共用协议为依据生成插件接口 实体, 宿主程序保存所生成的插件接口实体, 插件保存宿主程序创建的宿 主接口实体;
宿主程序和插件通过各自保存的对方接口实体完成交互操作。
2、 根据权利要求 1所述的宿主程序和插件及插件间进行交互的方法, 其特征在于, 所述完成交互操作为: 宿主程序和插件之间通过各自保存的 对方接口实体执行宿主程序调用插件; 具体为:
宿主程序通过存储的插件标识找到插件, 宿主程序将携带待调用插件 的插件功能 ID的调用请求通过双方的接口实体传给待调用插件, 待调用插 件调用并运行插件功能 ID对应的功能函数, 执行相应功能。
3、 根据权利要求 1所述的宿主程序和插件及插件间进行交互的方法, 其特征在于, 所述完成交互操作为: 宿主程序和插件之间通过各自保存的 对方接口实体执行第一插件调用第二插件; 具体为:
第一插件向宿主程序发送调用请求调用第二插件, 宿主程序通过存储 的插件标识找到第二插件, 之后将携带第二插件的插件功能 ID的调用请求 通过双方的接口实体传给第二插件, 第二插件调用并运行功能函数, 执行 相应功能。
4、 根据权利要求 1所述的宿主程序和插件及插件间进行交互的方法, 其特征在于, 所述完成交互操作为: 宿主程序和插件之间通过各自保存的 对方接口实体执行插件调用宿主程序; 具体为:
插件向宿主程序发送调用请求调用宿主程序中的功能, 宿主程序通过 被调用模块的标识找到被调用模块, 再调用被调用模块的功能函数, 被调 用模块运行功能函数, 执行相应功能。
5、 根据权利要求 2所述的宿主程序和插件及插件间进行交互的方法, 其特征在于, 所述宿主程序调用插件的过程中, 该方法还包括:
宿主程序调用插件自身信息描述方法, 将插件输出的功能图标、 或功 能文字描述通过插件和宿主程序双方的接口实体传输给宿主程序, 宿主程 序将功能图标添加在宿主程序的工具条上、 或将功能文字描述生成菜单项 加入菜单中。
6、 一种宿主程序和插件及插件间进行交互的装置, 其特征在于, 该装 置包括: 设置模块、 接口实体创建存储模块和运行模块; 其中,
所述设置模块, 用于设置宿主程序和插件间进行交互的共用协议; 所述接口实体创建存储模块, 用于以设置模块设置的共用协议为依据 创建并保存宿主接口实体和插件接口实体;
所述运行模块, 用于通过接口实体创建存储模块所存储的宿主接口实 体完成与宿主程序的交互操作; 或用于通过接口实体创建存储模块所存储 的插件接口实体完成与插件的交互操作。
7、 根据权利要求 6所述的宿主程序和插件及插件间进行交互的装置, 其特征在于, 所述接口实体创建存储模块进一步包括: 宿主接口实体创建 存储模块和插件接口实体创建存储模块; 其中,
所述宿主接口实体创建存储模块, 用于在宿主程序启动后, 根据共用 协议创建宿主接口实体并传给插件接口实体创建存储模块, 并保存插件接 口实体创建存储模块生成的插件接口实体;
所述插件接口实体创建存储模块, 用于以共用协议为依据创建插件接 口实体并传给宿主接口实体创建存储模块, 并保存宿主接口实体创建存储 模块创建的宿主接口实体。
8、 根据权利要求 6或 7所述的宿主程序和插件及插件间进行交互的装 置, 其特征在于, 所述运行模块进一步包括: 宿主程序运行模块和插件运 行模块; 其中,
所述宿主程序运行模块, 用于通过所保存的插件接口实体完成与插件 的交互操作;
所述插件运行模块, 用于通过所保存的宿主接口实体完成与宿主程序 的交互操作。
9、 根据权利要求 8所述的宿主程序和插件及插件间进行交互的装置, 其特征在于, 所述宿主程序运行模块通过所保存的插件接口实体调用插件 时, 所述宿主程序运行模块, 进一步用于调用插件自身信息描述方法, 接 收插件运行模块输出的功能图标、 或功能文字描述, 并将功能图标加在宿 主程序的工具条上、 或将功能文字描述生成菜单项加入菜单中;
相应的, 所述插件运行模块, 进一步用于输出的功能图标、 或功能文 字描述, 并传输给宿主程序运行模块。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200910236562.5 | 2009-10-26 | ||
CN200910236562.5A CN101699405B (zh) | 2009-10-26 | 2009-10-26 | 一种宿主程序和插件及插件间进行交互的方法及装置 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2011050632A1 true WO2011050632A1 (zh) | 2011-05-05 |
Family
ID=42147865
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2010/075318 WO2011050632A1 (zh) | 2009-10-26 | 2010-07-20 | 一种宿主程序和插件及插件间进行交互的方法及装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN101699405B (zh) |
WO (1) | WO2011050632A1 (zh) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102724356A (zh) * | 2012-05-25 | 2012-10-10 | 中兴通讯股份有限公司 | 接入设备的信息同步方法及装置 |
WO2014036910A1 (zh) * | 2012-09-06 | 2014-03-13 | 腾讯科技(深圳)有限公司 | 自动适配硬件编解码的方法、系统、模块及存储介质 |
Families Citing this family (26)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101699405B (zh) * | 2009-10-26 | 2014-06-11 | 中兴通讯股份有限公司 | 一种宿主程序和插件及插件间进行交互的方法及装置 |
CN102253840B (zh) * | 2011-08-04 | 2013-11-13 | 深圳芯智汇科技有限公司 | 插件管理方法及插件管理器 |
CN102426537B (zh) * | 2011-11-02 | 2014-07-02 | 北京数码大方科技股份有限公司 | Cad中外部集成进程调用主程序进程的方法及装置 |
CN103150154B (zh) * | 2011-12-07 | 2017-06-23 | 腾讯科技(深圳)有限公司 | 一种应用程序插件的实现方法及装置 |
CN102591724B (zh) * | 2011-12-28 | 2015-01-14 | 奇智软件(北京)有限公司 | 消息交互方法及装置 |
CN103297381B (zh) * | 2012-02-22 | 2017-01-18 | 阿里巴巴集团控股有限公司 | 一种基于插件的业务访问方法及其系统 |
CN102915247B (zh) * | 2012-08-31 | 2015-08-19 | 杭州斯凯网络科技有限公司 | Apk插件化管理方法 |
CN103246533B (zh) * | 2013-04-11 | 2017-03-29 | 小米科技有限责任公司 | 一种在通讯录中添加插件的方法、装置和设备 |
CN104572030A (zh) * | 2013-10-09 | 2015-04-29 | 镇江金钛软件有限公司 | 一种插件配置方法 |
CN103699451B (zh) * | 2013-12-31 | 2017-08-11 | 北界创想(北京)软件有限公司 | 应用软件和插件的数据共享方法及装置 |
CN103677979B (zh) * | 2013-12-31 | 2017-02-15 | 北界创想(北京)软件有限公司 | 应用软件和插件的交互方法及装置 |
CN104731623B (zh) * | 2015-03-27 | 2016-11-16 | 北京奇虎科技有限公司 | 主程序中启动插件的方法及装置 |
CN105260204A (zh) * | 2015-09-28 | 2016-01-20 | 北京奇虎科技有限公司 | 进程内工程交互方法和装置 |
CN107092494B (zh) * | 2016-02-18 | 2020-09-01 | 腾讯科技(深圳)有限公司 | 访问apk资源的方法和装置 |
CN106126299B (zh) * | 2016-06-30 | 2020-03-03 | 百度在线网络技术(北京)有限公司 | 业务插件的处理方法及装置 |
CN107423040A (zh) * | 2017-03-24 | 2017-12-01 | 北京潘达互娱科技有限公司 | 直播应用程序开发方法及装置 |
CN107479867B (zh) * | 2017-06-12 | 2020-12-18 | 百度在线网络技术(北京)有限公司 | 应用软件插件化运行方法及装置 |
CN107368334B (zh) * | 2017-07-24 | 2020-08-28 | 北京奇艺世纪科技有限公司 | 一种业务插件交互系统及方法 |
CN108595220B (zh) * | 2018-04-25 | 2021-04-16 | 上海掌门科技有限公司 | 应用组件的处理方法、设备及计算机可读存储介质 |
CN108717365B (zh) * | 2018-06-11 | 2021-03-30 | 广州酷狗计算机科技有限公司 | 在应用程序中执行功能的方法和装置 |
CN109032696A (zh) * | 2018-07-17 | 2018-12-18 | 掌阅科技股份有限公司 | 一种页面调起方法、终端及计算机存储介质 |
CN110851193A (zh) * | 2018-08-01 | 2020-02-28 | 深圳市理邦精密仪器股份有限公司 | 监护设备软件平台插件加载方法、插件运行系统及监护仪 |
CN109684115A (zh) * | 2019-01-08 | 2019-04-26 | 深圳市网心科技有限公司 | 一种应用于插件间的通信方法及相关设备 |
CN110333914B (zh) * | 2019-04-12 | 2023-09-15 | 上海连尚网络科技有限公司 | 一种用于执行目标操作的方法与设备 |
CN112068898B (zh) * | 2020-09-01 | 2024-04-19 | 上海熙菱信息技术有限公司 | 一种可配置插件式服务集成系统及方法 |
CN113590215B (zh) * | 2021-07-15 | 2023-05-12 | 福建星云检测技术有限公司 | 一种插件式上位机通讯方法及系统 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1710535A (zh) * | 2005-05-10 | 2005-12-21 | 上海宝信软件股份有限公司 | 一种gis应用系统及其开发方法 |
CN1924800A (zh) * | 2005-09-02 | 2007-03-07 | 北京灵图软件技术有限公司 | 用于二次开发平台的基于控件的插件管理系统及方法 |
US20080295074A1 (en) * | 2007-05-25 | 2008-11-27 | Schneider James P | Data management interface with configurable plugins |
CN101699405A (zh) * | 2009-10-26 | 2010-04-28 | 中兴通讯股份有限公司 | 一种宿主程序和插件及插件间进行交互的方法及装置 |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7085728B2 (en) * | 2001-07-31 | 2006-08-01 | Iex Corporation | Method for forecasting and managing multimedia contracts |
-
2009
- 2009-10-26 CN CN200910236562.5A patent/CN101699405B/zh not_active Expired - Fee Related
-
2010
- 2010-07-20 WO PCT/CN2010/075318 patent/WO2011050632A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1710535A (zh) * | 2005-05-10 | 2005-12-21 | 上海宝信软件股份有限公司 | 一种gis应用系统及其开发方法 |
CN1924800A (zh) * | 2005-09-02 | 2007-03-07 | 北京灵图软件技术有限公司 | 用于二次开发平台的基于控件的插件管理系统及方法 |
US20080295074A1 (en) * | 2007-05-25 | 2008-11-27 | Schneider James P | Data management interface with configurable plugins |
CN101699405A (zh) * | 2009-10-26 | 2010-04-28 | 中兴通讯股份有限公司 | 一种宿主程序和插件及插件间进行交互的方法及装置 |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102724356A (zh) * | 2012-05-25 | 2012-10-10 | 中兴通讯股份有限公司 | 接入设备的信息同步方法及装置 |
WO2014036910A1 (zh) * | 2012-09-06 | 2014-03-13 | 腾讯科技(深圳)有限公司 | 自动适配硬件编解码的方法、系统、模块及存储介质 |
US9323545B2 (en) | 2012-09-06 | 2016-04-26 | Tencent Technology (Shenzhen) Company Limited | Method, system, module, and storage medium for automatic adaptation of hardware encoding and decoding |
Also Published As
Publication number | Publication date |
---|---|
CN101699405A (zh) | 2010-04-28 |
CN101699405B (zh) | 2014-06-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2011050632A1 (zh) | 一种宿主程序和插件及插件间进行交互的方法及装置 | |
US11829787B2 (en) | Multi-process model for cross-platform applications | |
US20100031233A1 (en) | Extended enterprise connector framework using direct web remoting (dwr) | |
US9569292B2 (en) | Remotable contracts for the web | |
JP5026415B2 (ja) | データセントリックワークフロー | |
US8572578B2 (en) | Script debugging | |
WO2009100156A1 (en) | Automatic connections between application components | |
WO2008110111A1 (fr) | Procédé et dispositif pour appeler une bibliothèque dynamique et serveur de bibliothèque dynamique et dispositif mettant en œuvre un programme maître | |
CN110716720A (zh) | 一种实现应用热部署的方法和装置 | |
WO2021169150A1 (zh) | 宿主平台层中的应用接口实现方法、装置、设备和介质 | |
US11900176B2 (en) | Interoperability bridge for application hosts | |
CN102541549B (zh) | 集成电视应用模块的方法及装置 | |
WO2013013554A1 (zh) | 一种程序回调方法及装置 | |
US7331047B2 (en) | Deterministic system and method for implementing software distributed between a desktop and a remote device | |
US20210218622A1 (en) | Dynamic service creation for microservice-based integration service | |
JP2015026139A (ja) | プログラム生成装置、プログラム生成方法、およびプログラム生成用プログラム | |
US9274622B2 (en) | Device specific data in a unified pointer message | |
Deng et al. | CVM–A communication virtual machine | |
WO2009076877A1 (zh) | 部署、管理sip servlet应用的方法及osgi服务平台 | |
US7779139B2 (en) | Normalization of binary data | |
WO2016061921A1 (zh) | 组合多种应用操作的方法、装置、终端及计算机存储介质 | |
WO2021203343A1 (zh) | Web请求处理方法和装置 | |
KR20080106540A (ko) | 단일 커맨드 라인 유틸리티를 이용하여 함수들을 수행하는 방법 및 컴퓨터 판독 가능 매체 | |
KR20070031378A (ko) | 디바이스 팀 모집을 위한 아키텍쳐 장치 및 방법 그리고보편적 디바이스 상호운용성 플랫폼 관련 애플리케이션들을위한 콘텐트 렌디셔닝 | |
CN110262912B (zh) | 一种过程调用gRPC的调用方法及装置 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 10825995 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 10825995 Country of ref document: EP Kind code of ref document: A1 |