Project

General

Profile

Embedded Tigase / Non-OSGI / Programmatic Configuration

Kenneth Keith
Added over 2 years ago

Just wanted to say that i'm very impressed with the coding effort associated with tigase. Compared to other "products" your flexibility and open coding principals makes navigating and development significantly less complex. Now for the question.

Just wondering if you could provide documentation or an example of how i would go about embedded a tigase server internally to my own web application via spring. I would like to be able to control the lifecycle of the server within the context of my own application using some programmatic method of configuration. Ive read through the source and various code bits, and it seems as if it is pretty hardcoded to using the properties file. It would be nice if there was a builder pattern like configuration ability so that we could do something like the following.

@

TigaseConfigurationBuilder builder = new TigaseConfigurationBuilder();

builder.setPort(5222);

builder.setAuthRepository(some implementation)

..

..

TigaseConfiguration configuration = builder.build();

XMPPServer server = new XMPPServer(configuration);

server.start();

@

Thanks!

Kenneth


Replies (5)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 2 years ago

Take a look at the class: tigase.server.XMPPServer. Method main() and start()@. If I was going to do something like you are trying to do, I would write own version of this class with @start() method for non-OSGI mode - if ( !isOSGi() ){ part. As you can see there, you can provide your own implementation of the Configurator for the Tigase server which can take runtime parameters from anywhere.

Added by Kenneth Keith over 2 years ago

I see the configurator, but while reading through the source, it is not really that clear to me how i would go about specifying my own implementations of classes/interfaces and getting the server fully started via code. I see a lot of string parsing and manipulations for setting system properties, i guess the instantiation is happening somewhere else. I was able to get the server to start via java, but it still required the etc/* files. Some services, such as the XMPPService required the .xml files for cross domain. Here is a little more background behind what i am attempting to do.

I already have existing systems for presence, user authentication, groups, chat system, etc. What i am wanting to do is essentially provide an xmpp wrapper around these services. This would allow integration of XMPP clients into my existing services and infrastructure that is already integrated into others as well. Therefore my thoughts are:

Custom tigase user authentication against my existing user auth.

Presence against my existing representation of presences.

Messaging against my existing representation of messaging.

Group Chat against my existing representation of message channels and groups.

Roster against my existing representation of "buddy lists".

Perhaps there is another way of achieving this that you can suggest. But i was thinking that i could write my own implementations for the various components that would integrate into my existing services, and by having the xmpp server available, i could somewhat make the environment transparent to the users.

Added by Kenneth Keith over 2 years ago

Just noticed that the jars from the installation is different than the source i have... perhaps i'll look a little further.

Added by Wojciech Kapcia TigaseTeam over 2 years ago

Kenneth Keith wrote:

I see the configurator, but while reading through the source, it is not really that clear to me how i would go about specifying my own implementations of classes/interfaces and getting the server fully started via code. I see a lot of string parsing and manipulations for setting system properties, i guess the instantiation is happening somewhere else. I was able to get the server to start via java, but it still required the etc/* files. Some services, such as the XMPPService required the .xml files for cross domain. Here is a little more background behind what i am attempting to do.

You can pass as args an array of Strings where each item would be a "key=value" pair similar as those you would normally put in init.properties file (take a look at tigase.conf.ConfiguratorAbstract#parseArgs@). However there would still be some dependency on other @etc/* files, depending whether you would use default components or different implementations.

Please also take a look at tigase.server.MessageRouter#setProperties

I already have existing systems for presence, user authentication, groups, chat system, etc. What i am wanting to do is essentially provide an xmpp wrapper around these services. This would allow integration of XMPP clients into my existing services and infrastructure that is already integrated into others as well.

How would you imagine the mapping and representing entities in both systems? 1:1 or different type of addressing? Maybe using an XMPP transport would be more viable option?

Added by Kenneth Keith over 2 years ago

Wojciech,

Thanks for the response. I'll look into these classes and see what shakes out.

With regards to mapping. My domain model is actually far more rich than the XMPP standard. However, when designing the model I took in account the structure and concept of what XMPP would have. Of course it is not a complete 1:1. But I think it would not be that difficult to map as it was apart of the original concept. For instance, I can reference the group chats by name within my model where they are unique, however my model is flexible as I can do many different types of "referencing" via metadata. I'm not sure exactly what you mean by transport, but my goal is that you could point a xmpp client to the server and utilize it as if the server was a xmpp server, while the server is more integrated from other aspects. Not really sure I'm making much sense to you. But as the project is organization internal, I am unable to share to many concrete details.

The easiest way to explain is can be referenced in a previous message. Ie... XMPP Presence/Rosters -> My Project representation of presence and friends lists etc. So while a XMPP transport may be able to do this, i would like to avoid maintaining a connection state for each user.

    (1-5/5)