给openfire写一个HellowWorld插件的简明教程

一开始要给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的东西

<?xml version="1.0" encoding="UTF-8" ?> 
- <!--   Plugin configuration for the broadcast plugin.

  --> 
- <plugin>
  <class>org.jivesoftware.openfire.plugin.MyPlugin</class> 
  <name>Broadcast</name> 
  <description>Broadcasts messages to users.</description> 
  <author>Jive Software</author> 
  <version>1.8.2</version> 
  <date>4/19/2010</date> 
  <url>http://www.igniterealtime.org</url> 
  <minServerVersion>3.7.0</minServerVersion> 
  </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

public class plugin implements Plugin {  
    /** 
     * Constructs a new client control plugin. 
     */  
    public plugin() {  
    }  
  
    // Plugin Interface  
  
    public void initializePlugin(PluginManager manager, File pluginDirectory) {  
        System.out.println("Hellow Openfire!");  
    }  
      
    public void destroyPlugin() {  
    }  
}  
简单的写一个hellowWorld

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

插件就自动打包好了。

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

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

就会看到,hellowOpenfire,偶~

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值