`
buerkai
  • 浏览: 166923 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

openfire(1)配置属性

 
阅读更多



 在openfire中有3中配置属性

1.

 

在openfire_src\src\conf\openfire.xml:

<jive>
    <adminConsole>
               <port>9090</port>此处为openfire访问端口
               <securePort>9091</securePort>此处为openfire加密访问端口
    </adminConsole>

    <locale>en</locale>

</jive>

此文件为openfire的原始文件。

当运行openfire后,会增加下面的属性:

   <connectionProvider>
    <className>org.jivesoftware.database.DefaultConnectionProvider</className>
  </connectionProvider>

  <!--connectionProvider为数据库的连接属性,所有的ConnectionProvider都必须实现此接口,DefaultConnectionProvider使用的org.logicalcobwebs.proxool.ProxoolDriver代理连接池,此类主要实现了数据连接词,及其相关配置参数  -->

 

<!--- 下面为连接池的参数 --->
  <database>
    <defaultProvider>
      <driver>com.mysql.jdbc.Driver</driver>
      <serverURL>jdbc:mysql://localhost:3306/openfire?useUnicode=true&amp;amp;characterEncoding=UTF-8&amp;amp;zeroDateTimeBehavior=convertToNull</serverURL>
      <username>root</username>
      <password>admin</password>
      <testSQL>select 1</testSQL>
      <testBeforeUse>false</testBeforeUse>
      <testAfterUse>false</testAfterUse>
      <minConnections>5</minConnections>
      <maxConnections>25</maxConnections>
      <connectionTimeout>1.0</connectionTimeout>
    </defaultProvider>
  </database>

 

<!--- 次参数标识系统是否初始化,如果已经初始化,openfire.xml文件中会有此参数 --->
  <setup>true</setup>

 

2.在数据库中的配置参数:

数据库中的表:ofproperty,记录一些属性,可以是系统属性,也可以是插件属性。

 

3.在插件开发中会有plugin.xml这个文件,主要记录插件信息

<plugin>

    <!-- 插件类 -->
    <class>org.jivesoftware.openfire.plugin.ClientControlPlugin</class>
   
    <!-- 插件信息-->
    <name>Client Control</name> --插件名字
    <description>Controls clients allowed to connect and available features</description> --插件描述
    <author>Jive Software</author> --插件开发的作者
    <version>1.1.0</version>--插件版本
    <date>12/1/2009</date>--开发日期
    <minServerVersion>3.7.0</minServerVersion>


    <databaseKey>clientcontrol</databaseKey>-- 插件自动生成数据的版本标识
    <databaseVersion>0</databaseVersion>--版本号
 
    <!-- 在控制台的页面展示,暂时不做过多介绍-->
    <adminconsole>  
         </adminconsole>
   
</plugin>

 

下面主要介绍openfire中配置属性的读取和写入以及删除。

在openfire中 JiveGlobals类提供读取xml和数据配置的方法:

 

 private static XMLProperties xmlProperties = null;
 private static JiveProperties properties = null;

XMLProperties ,主要获取本地的xml配置文件属性

对于 JiveProperties有如下sql,

private static final String LOAD_PROPERTIES = "SELECT name, propValue FROM ofProperty";
private static final String INSERT_PROPERTY = "INSERT INTO ofProperty(name, propValue) VALUES(?,?)";private static final String UPDATE_PROPERTY = "UPDATE ofProperty SET propValue=? WHERE name=?";
private static final String DELETE_PROPERTY = "DELETE FROM ofProperty WHERE name LIKE ?";

 

JiveProperties中提供了相关的删除属性,修改属性,创建属性,查询全部属性的方法,其中很多方法都涉及数据库的操作,数据库链接很费时,这样可能会影响系统性能。要是这个地方能够优化一下,系统就更好了。

 

而对于JiveGlobals,只是对2中属性处理的一种封装,以及一些通用格式日期和字符串的方法。



 

此篇文章就到此,稍后会有更多关于openfire的个人解读。

联系方式(qq):851392159

出处:http://buerkai.iteye.com

  • 大小: 83.1 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics