预订演示
前页 后页

编写自定义集成插件

我们生活在一个高度互联的世界,虽然专业云服务器提供了大量开箱即用的集成,但任何具有标准 Web 服务接口的产品都可以创建自定义(专有)集成。此功能既会将Enterprise Architect存储库的内容开放给外部工具,也会使外部工具中的信息在Enterprise Architect中可用。例如,项目管理工具可能定义在Enterprise Architect中可视化的工作页面,或者自动化测试工具可以定义与Enterprise Architect中的实现和规范元素相关的测试用例和测试过程。这将需要一些技术专业知识才能使用 C++ 或 C# 等多种编程语言之一创建集成,但这只需要完成一次,并且可以在任意数量的存储库中使用。

专业云服务器和Enterprise Architect将承担主要工作,管理员无需更改专业云服务器的任何基本安全设置,因为新的集成将通过现有的端口和防火墙运行。开发人员也无需编写 http 监听代码,而是聚焦于确定和配置 RESTful API 调用,以便将外部项目信息传入和传出服务器。

安装专业云服务器时,请启用“SBPI 示例”组件以包含自定义集成示例。启用后,示例文件的默认位置位于“SBPI 示例\ExampleIntegrationPlugins”文件夹中。例如:

C:\Program Files (x86)\ Sparx Systems \专业云服务器\SBPI Examples\ExampleIntegrationPlugins

有关更多信息,请参阅专业云服务器安装帮助主题。

注记默认情况下,“SBPI 示例”安装选项未启用。如果您已安装专业云服务器但不包含“SBPI 示例”,则可以执行完全重新安装(启用“SBPI 示例”),或使用安装程序的“更改”选项仅添加“SBPI 示例”组件。

要编写您自己的自定义集成插件,您可以从头开始,也可以复制其中一个示例并进行修改。该插件可以用 C++ 或 C# 编写。

这些示例是使用 Visual Studio 2017 编写的,但这不是先决条件。

自定义集成插件必须实现ISBPIIntegrationPlugin中定义的接口,该接口包含在ISBPIIntegrationPlugin.h(对于C++)或ISBPIIntegrationPlugin.cs(对于C#)中。

该程序的一般流程是:

  • 用户在Enterprise Architect中执行操作,需要来自集成插件的信息
  • 该插件将接收对相应接口方法的一次调用(或多次调用)
  • 该插件解析请求,并在需要时向实际数据提供者发出自己的请求
  • 该插件从实际提供者处接收结果,并解析数据
  • 插件通过提供的回调函数将响应发送给Enterprise Architect ;这可以是请求的实际数据或错误值
  • Enterprise Architect接收回调数据并将其显示给用户

Function/Class

Details

See also

CheckVersion

(Not required in C#.)

input: unsigned int version

Returns true if your Plug-in supports the requested version.

Version 2 adds notifications when elements in Enterprise Architect are linked or unlinked to the external item, or when they are modified.

Version 2 extends version 1, so returns true for versions up to and including the version supported.

e.g. return (version <= 2);

Create Plug-in

(Not required in C#.)

The Plug-in must implement this export function:

     extern "C" SBPI_API SBPI_INTEGRATION_PLUGIN CreatePlugin();

It must return a pointer to a class that implements the ISBPIIntegrationPlugin interface. The recommended implementation is:

     SBPI_INTEGRATION_PLUGIN CreatePlugin()

     {

           return new ExampleIntegrationPlugin;

     }

The newly created ISBPIIntegrationPlugin can be deleted when it receives the ISBPIIntegrationPlugin::Release method.

ISBPIIntegrationPlugin Interface

The dll Plug-in must implement all methods in the ISBPIIntegrationPlugin interface.

ISBPIIntegrationPlugin interface