atlassian JIRA 插件开发(六) — JIRA系统的插件体系,总体一瞥
2015-09-04 21:16
483 查看
【原文地址:http://blog.sina.com.cn/s/blog_3e7397cf0100k395.html,原作者博客:Rocky的博客http://blog.sina.com.cn/yuzhenxin】
JIRA系统是一个非常优秀的项目管理系统,在JIRA系统上可以进行流程定义、表单定义、丰富的权限管理等等。但其最有特色的,我认为还是其高可配置、灵活的插件体系。在JIRA所提供的插件体系下,我们可以进行二次开发,通过功能扩展以满足差异化的需求。如:自定义菜单、扩展自定义属性、扩展流程的验证规则、扩展流程的流转条件、扩展流程的PostFunction等等。
JIRA的插件体系是基于OSGI可插拔式的,每一个插件实际上就是一个jar包。这个插件jar包放到%JIRA_HOME%\atlassian-jira\WEB-INF\lib目录下,重启JIRA系统,即可实现插件的动态部署。(转者注:插件version2,可以采用UPM方式,具体可见:/article/8435869.html)
那么JIRA是怎么能识别出插件的呢? 所有的JIRA插件jar包中,都必须要包含一个以atlassian-plugin.xml 命名的配置文件。下面是一个 atlassian-plugin.xml样例。(以jira-suite-utilities插件的配置文件为例子,红色部分是注释说明)
当然,在这个JIRA插件配置文件中,定义的自定义属性、流程验证器、流程流转条件以及流程流转后处理方法等,也是需要按照JIRA的规范实现相关的接口的。这里,暂时先不展开描述。在后续的连载中,尽量详细介绍(因为我很懒,不知道什么时候会更新Blog)。
还是以刚刚的jira-suite-utilities插件为例。将jira-suite-utilities-0.7.7.jar拷贝到 %JIRA_HOME%\atlassian-jira\WEB-INF\lib目录下,重启JIRA系统。 登陆JIRA系统,我们在自定义属性中,就可以看见在原有的自定义属性类型中新增加了一种“LocationText Field”类型的字段。(转者注:可以清晰的看到,作者定义的这个插件atlassian-plugin.xml文件中有version=2的字样,所以采用UPM也是可以的。)如下所示:
同样,我们在流程的验证器中,也能发现系统中多了一些原来所没有的验证器,如“User Is In AnyGroups”验证器。
选中该验证器后点击下一步:
以上的这些功能,都是通过插件方式提供的,而没有对JIRA系统做任何破坏性、侵入式的修改!
JIRA系统是一个非常优秀的项目管理系统,在JIRA系统上可以进行流程定义、表单定义、丰富的权限管理等等。但其最有特色的,我认为还是其高可配置、灵活的插件体系。在JIRA所提供的插件体系下,我们可以进行二次开发,通过功能扩展以满足差异化的需求。如:自定义菜单、扩展自定义属性、扩展流程的验证规则、扩展流程的流转条件、扩展流程的PostFunction等等。
JIRA的插件体系是基于OSGI可插拔式的,每一个插件实际上就是一个jar包。这个插件jar包放到%JIRA_HOME%\atlassian-jira\WEB-INF\lib目录下,重启JIRA系统,即可实现插件的动态部署。(转者注:插件version2,可以采用UPM方式,具体可见:/article/8435869.html)
那么JIRA是怎么能识别出插件的呢? 所有的JIRA插件jar包中,都必须要包含一个以atlassian-plugin.xml 命名的配置文件。下面是一个 atlassian-plugin.xml样例。(以jira-suite-utilities插件的配置文件为例子,红色部分是注释说明)
<atlassian-pluginkey="com.googlecode.jira-suite-utilities" name="JIRA Suite Utilities" plugin-version="2"> <plugin-info> <description>Many objects to extendJIRA</description> <version>0.7.7</version> <application-version min="3.5"max="4.1"/> <vendor name="Quadratica SRL" url=""/> </plugin-info> <!—在JIRA中增加自定义属性,如这里定义了一个“Location Text Field” 类型的自定义字段 --> <customfield-type key="locationtextfield" name="Location Text Field" class="com.atlassian.jira.issue.customfields.impl.TextCFType" i18n-name-key="custom.field.type.text_field.name"> <resource type="i18n" name="i18n"location="com.googlecode.jsu.maps.resources" /><!—国际化资源文件--> <descriptionkey="custom.field.type.text_field.description">Saving locations and showing it atmaps.</description> <!—自定义字段的查看、编辑的显示模板--> <resource type="velocity" name="view"location="templates/jira/fields/view/view-location.vm"/> <resource type="velocity"name="edit"location="templates/plugins/fields/edit/edit-basictext.vm"/> <resource type="velocity" name="xml"location="templates/plugins/fields/xml/xml-basictext.vm"/> </customfield-type> <!—流程流转的条件规则定义,如这里定义了一个“用户是否属于某个群组”的判断条件定义--> <workflow-conditionkey="userIsInAnyGroups-condition" name="User Is In Any Groups" class="com.googlecode.jsu.workflow.WorkflowUserIsInAnyGroupsConditionPluginFactory"> <description>It allows only users inany given groups to execute thetransition.</description> <!—条件定义的具体实现类--> <condition-class>com.googlecode.jsu.workflow.condition.UserIsInAnyGroupsCondition</condition-class> <resource type="velocity" name="view"location="templates/jira/workflow/userIsInAnyGroups-condition-view.vm"/> <resource type="velocity" name="input-parameters"location="templates/jira/workflow/userIsInAnyGroups-condition-edit.vm"/> <resource type="velocity" name="edit-parameters"location="templates/jira/workflow/userIsInAnyGroups-condition-edit.vm"/> </workflow-condition> <!—流程处理方式在提交时的校验定义,下面的例子是定义了一个时间比较的验证类 --> <workflow-validator key="dateCompare-validator"name="Date Compare" class="com.googlecode.jsu.workflow.WorkflowDateCompareValidatorPluginFactory"> <description>Compare two datefields during a workflowtransition.</description> <validator-class> com.googlecode.jsu.workflow.validator.DateCompareValidator </validator-class> <resource type="velocity" name="view"location="templates/jira/workflow/validator/datecompare-validator-view.vm"/> <resource type="velocity" name="input-parameters"location="templates/jira/workflow/validator/datecompare-validator-input.vm"/> <resource type="velocity" name="edit-parameters"location="templates/jira/workflow/validator/datecompare-validator-edit.vm"/> </workflow-validator> <!—流程在提交后的处理函数定义,下面的例子是一个从其他字段中拷贝值的方法定义 --> <workflow-functionkey="copyValueFromOtherField-function" name="Copy Value From OtherField" class="com.googlecode.jsu.workflow.WorkflowCopyValueFromOtherFieldPostFunctionPluginFactory"> <description>It copies the value ofone field toanother.</description> <function-class> com.googlecode.jsu.workflow.function.CopyValueFromOtherFieldPostFunction </function-class> <orderable>true</orderable> <unique>false</unique> <deletable>true</deletable> <default>false</default> <resource type="velocity" name="view"location="templates/jira/workflow/copyvaluefromfield-function-view.vm"/> <resource type="velocity" name="input-parameters"location="templates/jira/function/copyvaluefromfield-function-input.vm"/> <resource type="velocity" name="edit-parameters"location="templates/jira/workflow/copyvaluefromfield-function-edit.vm"/> </workflow-function> <!—下面的XML是定义了Dashboard上可显示的Portlet --> <issue-tabpanelkey="transitions-summary-tabpanel" name="TransitionsSummary Tab Panel" class="com.googlecode.jsu.transitionssummary.issuetabpanel.TransitionsSummaryTabPanel"> <description key="transition.summary.description"/> <label key="transition.summary.transitions"/> <resourcetype="i18n" name="i18n" location="com.googlecode.jsu.transitionssummary.transitionssummary"/> <resource type="velocity" name="view" location="templates/jira/issuetabpanel/transitionssummary/transitions-summary-view.vm"/> </issue-tabpanel> </atlassian-plugin> |
还是以刚刚的jira-suite-utilities插件为例。将jira-suite-utilities-0.7.7.jar拷贝到 %JIRA_HOME%\atlassian-jira\WEB-INF\lib目录下,重启JIRA系统。 登陆JIRA系统,我们在自定义属性中,就可以看见在原有的自定义属性类型中新增加了一种“LocationText Field”类型的字段。(转者注:可以清晰的看到,作者定义的这个插件atlassian-plugin.xml文件中有version=2的字样,所以采用UPM也是可以的。)如下所示:
同样,我们在流程的验证器中,也能发现系统中多了一些原来所没有的验证器,如“User Is In AnyGroups”验证器。
选中该验证器后点击下一步:
以上的这些功能,都是通过插件方式提供的,而没有对JIRA系统做任何破坏性、侵入式的修改!
相关文章推荐
- 序列加密
- 搭建web项目结合spring+cxf的webservice服务
- 1058. A+B in Hogwarts (20)
- 如何去掉Navigation下方的分割线
- 实现一颗二叉树,检查二叉树是否平衡(java实现)
- WEB前段助手 FeHelper
- 使用Keepalived构建高可用热备
- 百练2775 九度 1114
- layoutSubviews的使用总结
- loadrunner测试sql语句性能
- 【HDU3360】【二分匹配】
- 自定义视图
- 利用归并排序求逆序对
- 第三方支付寒冬来临:基本功能被砍 银行梦破碎
- 将博客搬至CSDN
- MongoVUE破解
- Caffe学习:使用pycaffe进行网络训练与测试
- Leveraging Big Data Technologies to Build a Common Repository for Security
- Velocity Conference Santa Clara 2015: Complete Video Compilation
- 监听所有rtp/rtcp包