Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
245 changes: 245 additions & 0 deletions docs/diagrams/plugin-architecture.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="drawio" version="26.0.0">
<diagram name="插件架构图">
<mxGraphModel>
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />

<!-- ========== 图层 1:API 层 ========== -->
<mxCell id="2" value="API 层 (run.ikaros.api.plugin)" style="swimlane;startSize=30;fillColor=#dae8fc;strokeColor=#6c8ebf;container=1;pointerEvents=0;html=1;" vertex="1" parent="1">
<mxGeometry x="30" y="30" width="1100" height="110" as="geometry"/>
</mxCell>

<mxCell id="10" value="BasePlugin&#xa;(插件基类)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="2">
<mxGeometry x="30" y="40" width="160" height="50" as="geometry"/>
</mxCell>
<mxCell id="11" value="IkarosExtensionPoint&#xa;(扩展点接口)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="2">
<mxGeometry x="230" y="40" width="180" height="50" as="geometry"/>
</mxCell>
<mxCell id="12" value="Plugin (@Custom)&#xa;(持久化实体)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="2">
<mxGeometry x="450" y="40" width="160" height="50" as="geometry"/>
</mxCell>
<mxCell id="13" value="PluginAwareEvent&#xa;(事件基类)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="2">
<mxGeometry x="650" y="40" width="160" height="50" as="geometry"/>
</mxCell>
<mxCell id="14" value="PluginConst&#xa;(常量定义)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="2">
<mxGeometry x="850" y="40" width="140" height="50" as="geometry"/>
</mxCell>

<!-- ========== 图层 2:核心管理层 ========== -->
<mxCell id="3" value="核心管理层 (run.ikaros.server.plugin)" style="swimlane;startSize=30;fillColor=#d5e8d4;strokeColor=#82b366;container=1;pointerEvents=0;html=1;" vertex="1" parent="1">
<mxGeometry x="30" y="160" width="1100" height="110" as="geometry"/>
</mxCell>

<mxCell id="20" value="IkarosPluginManager&#xa;(插件管理器)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="3">
<mxGeometry x="30" y="40" width="170" height="50" as="geometry"/>
</mxCell>
<mxCell id="21" value="PluginApplicationInitializer&#xa;(应用上下文初始化器)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="3">
<mxGeometry x="240" y="40" width="190" height="50" as="geometry"/>
</mxCell>
<mxCell id="22" value="PluginApplicationContext&#xa;(插件独立 Spring 上下文)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="3">
<mxGeometry x="470" y="40" width="200" height="50" as="geometry"/>
</mxCell>
<mxCell id="23" value="SharedApplicationContext&#xa;(共享父上下文)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="3">
<mxGeometry x="710" y="40" width="180" height="50" as="geometry"/>
</mxCell>
<mxCell id="24" value="PluginApplicationContextRegistry&#xa;(上下文注册表)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="3">
<mxGeometry x="920" y="40" width="170" height="50" as="geometry"/>
</mxCell>

<!-- ========== 图层 3:描述符与加载器 ========== -->
<mxCell id="4" value="描述符 &amp; 加载器 (Plugin Descriptor &amp; Loader)" style="swimlane;startSize=30;fillColor=#fff2cc;strokeColor=#d6b656;container=1;pointerEvents=0;html=1;" vertex="1" parent="1">
<mxGeometry x="30" y="290" width="1100" height="110" as="geometry"/>
</mxCell>

<mxCell id="30" value="YamlPluginDescriptorFinder&#xa;(YAML 描述符查找器)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="4">
<mxGeometry x="30" y="40" width="190" height="50" as="geometry"/>
</mxCell>
<mxCell id="31" value="YamlPluginFinder +&#xa;YamlPluginLoader" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="4">
<mxGeometry x="260" y="40" width="180" height="50" as="geometry"/>
</mxCell>
<mxCell id="32" value="IkarosPluginDescriptor&#xa;(插件描述符扩展)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="4">
<mxGeometry x="480" y="40" width="180" height="50" as="geometry"/>
</mxCell>
<mxCell id="33" value="IkarosJarPluginLoader&#xa;(部署模式 JAR 加载器)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="4">
<mxGeometry x="700" y="40" width="190" height="50" as="geometry"/>
</mxCell>
<mxCell id="34" value="IkarosDevelopmentPluginLoader&#xa;(开发模式加载器)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="4">
<mxGeometry x="920" y="40" width="170" height="50" as="geometry"/>
</mxCell>

<!-- ========== 图层 4:扩展机制 ========== -->
<mxCell id="5" value="扩展机制 (Extension Mechanism)" style="swimlane;startSize=30;fillColor=#e1d5e7;strokeColor=#9673a6;container=1;pointerEvents=0;html=1;" vertex="1" parent="1">
<mxGeometry x="30" y="420" width="1100" height="110" as="geometry"/>
</mxCell>

<mxCell id="40" value="IkarosExtensionFactory&#xa;(扩展实例工厂)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;" vertex="1" parent="5">
<mxGeometry x="30" y="40" width="180" height="50" as="geometry"/>
</mxCell>
<mxCell id="41" value="IkarosExtensionFinder&#xa;(扩展扫描查找器)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;" vertex="1" parent="5">
<mxGeometry x="250" y="40" width="180" height="50" as="geometry"/>
</mxCell>
<mxCell id="42" value="ExtensionComponentsFinder&#xa;(扩展组件聚合查找器)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;" vertex="1" parent="5">
<mxGeometry x="470" y="40" width="210" height="50" as="geometry"/>
</mxCell>
<mxCell id="43" value="PluginExtensionAnnotationPostProcessor&#xa;(@Extension 注解后处理器)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;" vertex="1" parent="5">
<mxGeometry x="720" y="40" width="240" height="50" as="geometry"/>
</mxCell>
<mxCell id="44" value="BasePluginFactory&#xa;(插件实例工厂)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;" vertex="1" parent="5">
<mxGeometry x="980" y="40" width="110" height="50" as="geometry"/>
</mxCell>

<!-- ========== 图层 5:事件 &amp; Service ========== -->
<mxCell id="6" value="事件 / 监听 &amp; 服务接口 (Event / Listener &amp; Service)" style="swimlane;startSize=30;fillColor=#ffe6cc;strokeColor=#d79b00;container=1;pointerEvents=0;html=1;" vertex="1" parent="1">
<mxGeometry x="30" y="550" width="1100" height="140" as="geometry"/>
</mxCell>

<mxCell id="50" value="PluginPropertiesEnablesInitListener&#xa;(应用启动时加载插件)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="6">
<mxGeometry x="30" y="40" width="220" height="50" as="geometry"/>
</mxCell>
<mxCell id="51" value="PluginStateChangedListener&#xa;(状态变更 → 同步 DB)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="6">
<mxGeometry x="280" y="40" width="210" height="50" as="geometry"/>
</mxCell>
<mxCell id="52" value="PluginAwareEventListener&#xa;(插件间事件广播)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="6">
<mxGeometry x="520" y="40" width="190" height="50" as="geometry"/>
</mxCell>
<mxCell id="53" value="ApplicationReadyEventPluginBroadcaster&#xa;(就绪事件 → 所有插件)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="6">
<mxGeometry x="30" y="80" width="220" height="50" as="geometry"/>
</mxCell>
<mxCell id="54" value="PluginService(接口)&#xa;+ PluginServiceImpl" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="6">
<mxGeometry x="280" y="80" width="210" height="50" as="geometry"/>
</mxCell>
<mxCell id="55" value="PluginCoreEndpoint&#xa;(REST API 端点)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="6">
<mxGeometry x="520" y="80" width="190" height="50" as="geometry"/>
</mxCell>
<mxCell id="56" value="ConfigMapCustomCreate/UpdateEventListener&#xa;(配置变更 → 插件通知)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="6">
<mxGeometry x="740" y="40" width="250" height="50" as="geometry"/>
</mxCell>
<mxCell id="57" value="IkarosPluginDeleteEventListener&#xa;(插件删除 → 清理 DB)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="6">
<mxGeometry x="740" y="80" width="250" height="50" as="geometry"/>
</mxCell>

<!-- ========== 连线 ========== -->

<!-- 继承关系(BasePlugin → PF4J Plugin) -->
<mxCell id="e10" value="extends" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;dashed=1;" edge="1" parent="2" source="11" target="10">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- IkarosPluginManager 使用 PluginApplicationInitializer -->
<mxCell id="e20" value="创建并使用" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="20" target="21">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- PluginApplicationInitializer → PluginApplicationContext -->
<mxCell id="e21" value="创建并管理" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="21" target="22">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- PluginApplicationContext → SharedApplicationContext -->
<mxCell id="e22" value="parent" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" edge="1" parent="1" source="22" target="23">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- PluginApplicationInitializer → PluginApplicationContextRegistry -->
<mxCell id="e23" value="注册" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="21" target="24">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- IkarosPluginManager → YamlPluginDescriptorFinder -->
<mxCell id="e30" value="create" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="20" target="30">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- YamlPluginDescriptorFinder → YamlPluginFinder -->
<mxCell id="e31" value="委托" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="30" target="31">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- YamlPluginFinder → IkarosPluginDescriptor -->
<mxCell id="e32" value="生成" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="31" target="32">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- IkarosPluginManager → IkarosJarPluginLoader / IkarosDevelopmentPluginLoader -->
<mxCell id="e33" value="create" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="20" target="33">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e34" value="create" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.9;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="20" target="34">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- IkarosExtensionFactory → PluginApplicationContext -->
<mxCell id="e40" value="使用插件上下文实例化" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="40" target="22">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- IkarosExtensionFinder → PluginApplicationContext -->
<mxCell id="e41" value="扫描 @Extension Bean" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0;exitDx=0;exitDy=0;entryX=0;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="41" target="22">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- PluginExtensionAnnotationPostProcessor → PluginApplicationContext -->
<mxCell id="e43" value="注册 Bean 定义" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="43" target="22">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- PluginPropertiesEnablesInitListener → IkarosPluginManager -->
<mxCell id="e50" value="触发 loadPlugins()" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="50" target="20">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- PluginService → IkarosPluginManager -->
<mxCell id="e51" value="委托管理操作" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="54" target="20">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- PluginCoreEndpoint → PluginService -->
<mxCell id="e52" value="调用" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="55" target="54">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- PluginStateChangedListener → PluginService -->
<mxCell id="e53" value="同步状态到 DB" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="51" target="54">
<mxGeometry relative="1" as="geometry" />
</mxCell>

<!-- ========== 图例 ========== -->
<mxCell id="legend" value="图例" style="rounded=0;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#666666;verticalAlign=top;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="30" y="720" width="380" height="140" as="geometry"/>
</mxCell>
<mxCell id="leg1" value="" style="rounded=0;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="legend">
<mxGeometry x="10" y="30" width="30" height="16" as="geometry"/>
</mxCell>
<mxCell id="leg1t" value="API 层 — 插件开发者直接依赖的接口和基类" style="text;html=1;align=left;verticalAlign=middle;" vertex="1" parent="legend">
<mxGeometry x="50" y="28" width="300" height="20" as="geometry"/>
</mxCell>
<mxCell id="leg2" value="" style="rounded=0;html=1;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="legend">
<mxGeometry x="10" y="54" width="30" height="16" as="geometry"/>
</mxCell>
<mxCell id="leg2t" value="核心管理层 — 插件生命周期与 Spring 上下文管理" style="text;html=1;align=left;verticalAlign=middle;" vertex="1" parent="legend">
<mxGeometry x="50" y="52" width="300" height="20" as="geometry"/>
</mxCell>
<mxCell id="leg3" value="" style="rounded=0;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="legend">
<mxGeometry x="10" y="78" width="30" height="16" as="geometry"/>
</mxCell>
<mxCell id="leg3t" value="描述符 &amp; 加载器 — 插件发现、解析、加载" style="text;html=1;align=left;verticalAlign=middle;" vertex="1" parent="legend">
<mxGeometry x="50" y="76" width="300" height="20" as="geometry"/>
</mxCell>
<mxCell id="leg4" value="" style="rounded=0;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;" vertex="1" parent="legend">
<mxGeometry x="10" y="102" width="30" height="16" as="geometry"/>
</mxCell>
<mxCell id="leg4t" value="扩展机制 — @Extension 扫描、实例化、聚合" style="text;html=1;align=left;verticalAlign=middle;" vertex="1" parent="legend">
<mxGeometry x="50" y="100" width="300" height="20" as="geometry"/>
</mxCell>
<mxCell id="leg5" value="" style="rounded=0;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="legend">
<mxGeometry x="10" y="126" width="30" height="16" as="geometry"/>
</mxCell>
<mxCell id="leg5t" value="事件/监听 &amp; 服务 — 异步事件、状态同步、REST 端点" style="text;html=1;align=left;verticalAlign=middle;" vertex="1" parent="legend">
<mxGeometry x="50" y="124" width="300" height="20" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
Loading
Loading