前言:
一直以来,总希望能够完完全全的写完一篇或者一系列的文章,但是,由于自己的不坚定,使得所有的计划都未付诸实现,趁着这次自己负责一个项目的机会,打算完完善善的写好这篇文章,或者,系列文章。
插件
插件的含义,我也不好怎么解释,引用别人的一篇文章:http://www.cnblogs.com/wayfarer/articles/28537.html
从07年,开始接触第一个以插件架构的项目至今,已参加过至少两个插件架构的项目。公司的这两个项目的架构都不错,但是,由于各个项目的设计人员以及出发点不同,使得这些体系架构不能够重用,搞的为了这个项目,我需要重新设计一个新的以满足本地的现有项目以及以后的项目的重用,幸好的是,已有两个很好的框架供我参考。
简单的来说,插件体系,就是为了解决项目后期新的功能点的加入而定义的一些输入和输出等的配置,常见的是以addin结尾的xml配置文件,这样的文件,定义了功能点的标志,以及功能运行所需要加载的运行环境,功能点加入到现有系统的位置,配置文件的解析,所依赖的服务对象等等,当然,也可以根据系统的架构的不同,可以采用mvc等等模式,包括输入模块,业务响应处理模块,输入模块,等等。。。
附上两个配置文件的定义:
1:winform类型的插件体系。
1
<Addin name = "xxxxx"2
author = "xxxxx"3
copyright = "prj:///doc/copyright.txt"4
url = "http://www.xxxx.com.cn"5
description = "xxxxxxxxxxx"6
addInManagerHidden = "true"7
xmlns="http://www.xxxxx.com.cn/2007/addins">8

9
<Manifest>10
<Identity name = "xxxx" version = ":xxxx.Addins.Base.dll"/>11
</Manifest>12

13
<Runtime>14
<Import assembly=":xxxx.Addins.Base">15
<Doozer name="String" class="xxxxAddins.Base.StringDoozer"/>16
<Doozer name="Resource" class="xxxx.Addins.Base.ResourceDoozer"/>17
<Doozer name="MenuItem" class="xxxx.Addins.Base.MenuItemDoozer"/>18
<Doozer name="ToolbarItem" class="xxxx.Addins.Base.ToolbarItemDoozer"/>19
<Doozer name="DialogPanel" class="xxxx.Addins.Base.DialogPanelDoozer"/>20
<Doozer name="Pad" class="xxxx.Addins.Base.PadDoozer"/>21
<Doozer name="Service" class="xxxx.Addins.Base.ServiceDoozer"/>22

23
<Evaluator name="Compare" class="xxxx.Addins.Base.CompareEvaluator"/>24
</Import>25
</Runtime>26

27
<!--资源文件-->28
<Path name = "/xxxx/Workbench/Resources">29

30
</Path>31

32
<!--面板-->33
<Path name = "/xxxx/Workbench/Pads">34

35
</Path>36

37
<!--视图-->38
<Path name = "/xxxx/Workbench/Views">39

40
</Path>41

42
<!--对话框-->43
<Path name = "/xxxx/Workbench/Dialogs">44

45
</Path>46

47
<!--主菜单-->48
<Path name = "/xxxx/Workbench/MainMenu">49
</Path>50

51
<!--工具栏-->52
<Path name = "/xxxx/Workbench/Toolbars">53
</Path>54

55
<!--对象解析器-->56
<Path name = "/xxxx/ObjectParsers">57
58
</Path>59

60
<!--服务-->61
<Path name="/xxxx/Services">62
</Path>63
</Addin>64

2:winform 类型mvc模式
<?xml version="1.0" encoding="utf-8" ?>
<AddIn name = "xxxx ENoss Parameter ParamGroupThresholdCheck"
author = "xxxx ENoss DevTeam"
copyright = "Private"
url = "http://www.xxxx.com.cn"
description = "ParamGroupThresholdCheck"
version = "1.0.0">

<Runtime>
<Import assembly="Busi.Performance.AddIn.dll"/>
<Import assembly="xxxx.ENoss.Framework.AddIn.Gui.dll" />
<Import assembly="xxxx.ENoss.Framework.Busi.Core.dll" />
<Import assembly="Busi.Parameter.UI.dll"/>
<Import assembly="Busi.Parameter.AddIn.dll"/>
<Import assembly="Busi.Parameter.Services.dll"/>
<Import assembly="Busi.Parameter.DomainModel.dll"/>
</Runtime>
<Extension path = "/Services">
<Service id = "ParamGroupThresholdCheckService" class = "Busi.Parameter.Services.ParamGroupThresholdCheckService"/>
</Extension>
<Extension path = "/Commands">
<Command id="xxxx.ENoss.Common.Parameter.Menu.ParamGroupThresholdCheck"
class="xxxx.ENoss.Framework.Busi.Core.Commands.BusinessInvokeCommand"
label="互操作参数组阈值核查">
<Param id="Owner" ref="/DockControls/Right/Busi.Param.ControlPanel" />
<Param id="BusinessPath" value="/Business/Parameter/ParamGroupThresholdCheck"/>
</Command>
</Extension>
<Extension path="/Busi.Parameter/ContextMenuStub">
<ContextMenu id ="ParamGroupThresholdCheckCtxMenu" path="/Busi.Parameter/ParamGroupThresholdCheckCtxMenu"/>
</Extension>
<!--通用性能Grid输出的上下文菜单项-->
<Extension path = "/Busi.Parameter/ParamGroupThresholdCheckCtxMenu">
<!--通用性能Grid输出右键菜单的扩展-->
<Ref id="GeneryParameter" path = "/Busi.Parameter/ContextMenu/ParamCommonQuery"/>
<Ref id="GeneryResource" path="/Busi.Resource/ContextMenu/Resource/ReourceQueryCommand"/>
<Ref id="GeneryPerformance" path ="/Busi.Perf/ContextMenu/Resource/OneKeyGeneralPerf"/>
<Ref id="GisCellLocation" path="/Common/ContextMenu/NETree/Base"/>
<Ref id="ExcelExport" path="/Common/ContextMenu/SimpleGridControl"/>
</Extension>
<Extension path = "/MainMenu/xxxx.ENoss.Framework.Main.Menu.BusiMenus/xxxx.ENoss.Busi.Param.Menu">
<ToolItem id="xxxx.ENoss.Framework.Main.Menu.2G3GInter" label="2G/3G互操作(&I)">
<ToolItem id="xxxx.ENoss.Common.Parameter.Menu.ParamGroupThresholdCheck" insertorder ="5" label="互操作参数组阈值核查(&M)"></ToolItem>
</ToolItem>
</Extension>
<Extension path = "/Business/Parameter">
<!--通用性能查询业务单元-->
<BusinessLogical id="ParamGroupThresholdCheck" description="互操作参数组阈值核查">
<Singleton id="Busi.Parameter.ParamGroupThresholdCheckStratage" class="Busi.Parameter.UI.ParamGroupThresholdCheckStratage"/>
<Singleton id="Busi.Parameter.ParamGroupThresholdCheckTemplate" class="xxxx.ENoss.Framework.Busi.Core.QueryTemplate.QueryTemplateBase">
<Param id="TemplateFile" value="Config\ParamGroupThresholdCheck.xml" ispath="true"/>
</Singleton>
<!--输入控件-->
<BusinessInputer id="Busi.Parameter.ParamGroupThresholdCheckInput" class="Busi.Parameter.UI.ParamGroupThresholdCheckControl">
<Param id="ParamGroupThresholdCheckStratage" ref="Busi.Parameter.ParamGroupThresholdCheckStratage"/>
<Param id="ControlPanel" ref="/DockControls/Right/Busi.Param.ControlPanel"/>
<Param id="Navigate" value="互操作参数组阈值核查"/>
<Param id="Category" value="互操作参数组阈值"/>
</BusinessInputer>
<!--业务处理响应-->
<BusinessActioner id="Busi.Parameter.ParamGroupThresholdCheckAction" class="Busi.Parameter.AddIn.ParamGroupThresholdCheckAction"/>
<!--输出处理-->
<BusinessOutputer id="Busi.Parameter.GeneralOutput" class="xxxx.ENoss.Framework.Busi.Core.GridOutput">
<Param id="ShowName" value="互操作参数组阈值核查"/>
<Param id="Template" ref="Busi.Parameter.ParamGroupThresholdCheckTemplate" />
<Param id="ContextMenu" ref="/Busi.Parameter/ContextMenuStub/ParamGroupThresholdCheckCtxMenu"/>
</BusinessOutputer>
</BusinessLogical>
</Extension>
</AddIn>
由于自己接到的这个项目时间紧,因此,综合这两个体系的优点,打造一个本地简单的插件体系,在以后的过程中,在慢慢的优化。
有事Q我:
姓名:颜昌钢
联系方式:yanchanggang@boco.com.cn
电话:13886086508
QQ:95550107
公司:亿阳集团武汉分公司
移动飞信:647360243
浙公网安备 33010602011771号