openfire 插件编写

一开始要给openfire写一个插件有点没有头绪,去官网上找了一找,

有这么一篇文章http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/source-build.html讲解了一下如何部署源码。

其他的文档在这里,其中也有插件结构的http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/index.html

openfire的源码中有一个build文件夹,可以用ant来给他打包,

先要把插件的结构整好,最重要的是一个叫做plugin.xml的东西

  1. <?xml version="1.0" encoding="UTF-8" ?>   
  2. <!--   Plugin configuration for the broadcast plugin. 
  3.  
  4.   -->   
  5. <plugin>  
  6.   <class>org.jivesoftware.openfire.plugin.MyPlugin</class>   
  7.   <name>Broadcast</name>   
  8.   <description>Broadcasts messages to users.</description>   
  9.   <author>Jive Software</author>   
  10.   <version>1.8.2</version>   
  11.   <date>4/19/2010</date>   
  12.   <url>http://www.igniterealtime.org</url>   
  13.   <minServerVersion>3.7.0</minServerVersion>   
  14.   </plugin>  

其中最重要的是这个<class>标签,前面一定要写成org.jivesoftware.openfire.plugin.MyPlugin,

logo_large.gif  logo_small.gif  changelog.html  readme.html

这4个文件可以不用管

文件夹内的结构参照http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/plugin-dev-guide.html

  1. public class plugin implements Plugin {    
  2.     /**  
  3.      * Constructs a new client control plugin.  
  4.      */    
  5.     public plugin() {    
  6.     }    
  7.     
  8.     // Plugin Interface    
  9.     
  10.     public void initializePlugin(PluginManager manager, File pluginDirectory) {    
  11.         System.out.println("Hellow Openfire!");    
  12.     }    
  13.         
  14.     public void destroyPlugin() {    
  15.     }    
  16. }    
简单的写一个hellowWorld

吧文件夹的结构弄好之后在openfire_src 的 bulid 目录下运行ant plugins                                     

插件就自动打包好了。

如果结构不对或者,程序出错,打包过程中会报错,但是uploading plugin时还是会显示plugin uploading successfully,这个有点坑跌。

一切正确后,再次运行Openfire点击start

就会看到,hellowOpenfire,偶~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值