Plugin configuration

Submitted by kobit on Tue, 2010-04-06 21:22

Plugin configuration is not very straightforward at the moment but we are going to change it soon.

At the moment the best and the simplest way to tell the Tigase server to load or not to load the plugin is via init.properties file. Property --sm-plugins takes a comma separated list of plugin IDs to active at the runtime. Please refer to the documentation for complete description.

Obviously you have to know the list of standard plugin IDs to add your to the set. There are 2 ways to find out the list. One is the log file: logs/tigase-console.log. If you look inside you can find following output:

Loading plugin: jabber:iq:register ...
Loading plugin: jabber:iq:auth ...
Loading plugin: urn:ietf:params:xml:ns:xmpp-sasl ...
Loading plugin: urn:ietf:params:xml:ns:xmpp-bind ...
Loading plugin: urn:ietf:params:xml:ns:xmpp-session ...
Loading plugin: roster-presence ...
Loading plugin: jabber:iq:privacy ...
Loading plugin: jabber:iq:version ...
Loading plugin: http://jabber.org/protocol/stats ...
Loading plugin: starttls ...
Loading plugin: vcard-temp ...
Loading plugin: http://jabber.org/protocol/commands ...
Loading plugin: jabber:iq:private ...
Loading plugin: urn:xmpp:ping ...

 and this is a list of plugins which are loaded in your installation.

Another way is to look inside the session manager source code which has the default list hardcoded:

private static final String[] PLUGINS_FULL_PROP_VAL =
  {"jabber:iq:register", "jabber:iq:auth", "urn:ietf:params:xml:ns:xmpp-sasl",
   "urn:ietf:params:xml:ns:xmpp-bind", "urn:ietf:params:xml:ns:xmpp-session",
   "roster-presence", "jabber:iq:privacy", "jabber:iq:version",
   "http://jabber.org/protocol/stats", "starttls", "msgoffline",
   "vcard-temp", "http://jabber.org/protocol/commands", "jabber:iq:private",
   "urn:xmpp:ping", "basic-filter", "domain-filter"};

 In any way you have to put the list and your plugin IDs as a value to the plugin list property. Let's say our plugin ID is 'message' as in our all examples:

--sm-plugins=jabber:iq:register,jabber:iq:auth,......,message

 Assuming your plugin class is in the classpath it will be loaded and used at the runtime.

There is another part of the plugin configuration though. If you looked at the writing plugin code guide you can remember Map settings processing parameter. This is a map of properties you can set in the configuration file and these setting will be passed to the plugin at the processing time.

Again init.properties is the place to put the stuff. This kind of properties start with a string: sess-man/plugins-conf/, then you add your plugin ID and at the end your setting key and value:

sess-man/plugins-conf/message/key1=val1
sess-man/plugins-conf/message/key2=val2
sess-man/plugins-conf/message/key3=val3