DSL Format configuration

Some of the more attentive visitors to the snapshot documentation may have noticed that old configuration settings have been slowly replaced with a new format called DSL or Domain specific language. While it may look like another coding language, and it does borrow some formatting from something like Java, fret not. In very little time you to can be prepared for the new formatting for Tigase XMPP Server v7.2.0. The one thing to remember about DSL is that like many programming languages, every { requires a }, and all relavent information goes in between. The advantage to this is that unlike previous configuration files all relative inforamtion and settings can be found in one place. Long strings are now replaced by organized formatting, lists are far more managable. So let’s look at a few examples:
The basic building block for Tigase init.properties file had been setting component names and classes, they all each required a unique name and number.
--comp-name-3=socks5
--comp-class-3=tigase.socks5.Socks5Component
This is now replaced by a single line
Socks5 (class: tigase.socks5.Socks5Component) {}
Any settings affecting Socks5 will fall between the brackets, keeping those settings isolated from other components or settings. If we wanted to add a remote address to connect to the proxy, that would be inside those brackets.
Socks5 (class: tigase.socks5.Socks5Component) {
		'remote-addresses' = '192.168.1.205,20.255.13.190'
	}
Take special attention to the parenthesis as well. Although we may declare the default class for Socks5, we can just as well declate a custom class for this component. If this is not properly typed, the server will start, but will not register the assicoated bean (in this case, Socks5). This is also how you can create and call custom components as well. If you are using special characters in your component name, such as -, _, @, : you will need to encapsulate them in single quotes. Session manager by default is called sess-man so it would need to be surrounded by them. Note that children can also have settings under their own brackets as well. Take this section for example:
'sess-man' {
        amp () {
            'store-limit' = 200L
        }
}
Because both store-limit and sess-man have hypens in them, single quotes are needed, but amp does not require them. The same goes for any values that may have special characters. Normally of course session manager would rarely be so bare. So for a more realistic depiction, we will include a list a plugins with the above configuration to see what has become of a formally long unbroken (and hard to read) string.
'sess-man' {
    amp () {}
    'basic-filter' () {}
    'http:' {
         {
            'jabber.org' {
                protocol {
                    commands () {}
                    stats () {}
                }
            }
        }
    }
    'jabber:iq:privacy' () {}
    'jabber:iq:private' () {}
    'jabber:iq:register' () {}
    'jabber:iq:roster' () {}
    'jabber:iq:version' () {}
    'message-archive-xep-0136' () {}
    msgoffline (active: false) {}
    'presence-subscription' () {}
    starttls () {}
    'urn:xmpp:ping' () {}
    'vcard-temp' () {}
    zlib () {}
}
As you can see, DSL makes configuration settings a lot easier to read and tells you what is going on at a glance. Note that values no longer need to declare what type of value they are. Settings will no longer need to include a [S] to denote string, or [I] for integer as the intrepeter automatically adjusts to the appropiate type. Luckily, users of older versions of Tigase don’t have to hand-convert the init.properties file all by themselves. We have create a utility, built into tigase server binary, that will convert the file, save a copy of the original as init.properties.old, and create a new file with the v7.2.0 DSL formatting. To call this function up, start tigase using the following command:
./scripts.tigase.sh upgrade-config etc/tigase.conf
This should do all the above, and prepare Tigase to run the new version. Don't forget to upgrade schemas as well to make sure your repositires are comptible! Do be aware that with this release many properties have been changed, moved, or some even removed entirely. So we highly recommend consulting documentation, and testing v7.2.0 in a test environment before upgrading. We can’t wait to share all the new features and functionalities of our new version with you. Stay tuned for updates and news as we approach release.

Get in touch

We provide software products, consulting and custom development services

Tigase, Inc.
100 Pine Street, Suite 1250
San Francisco, CA 94111, USA
Phone: (415) 315 9771

Follow us on:

Twitter

Back to Top