Pubsub Extensions for Smack

I have included the work I have done for adding pubsub support to Smack. The three jars contain the binaries, source and javadoc. I will try to create some user documentation as soon as I get the chance. It was suggested to upload it as an eclipse patch, but this is entirely new code with no alterations to the existing Smack library, so I just uploaded the source code as is.

This code has been tested against a customized version of OpenFire in which I fixed a couple of existing bugs, I will be uploading those as real patches as soon as possible. It was designed around version 1.12 of the spec, and the current OpenFire implementation supports 1.8 (I believe). Some of the basic functionality should still work with that spec, I will try to document the issues when I get the chance.

For anyone that wants to give it a try, start at the PubSubManager class, it should be pretty simple from there (famous last words).

I have created a new thread instead of posting to the existing one (http://www.igniterealtime.org/community/message/191247#191247) since I wasn’t sure if the patch tag would get picked up by the powers that be.

Updated to version 0.6 - Fixed some bugs - Node from previous version is now LeafNode. Node is a base class for LeafNode and CollectionNode. Please note though, CollectionNode exists as a placeholder for future usage, it has not been tested! That being said, some of the basic functionality from the base class (Node) should still work since it is not specific to either node type. - There is now an Item and PayloadItem vs. the Item type that previously existed. - Source code jar has been removed and will now only reside in the JIRA task. Javadoc still needs to be updated to reflect these changes.
smackx-pubsub.0.6.jar (113747 Bytes)
smackx-pubsub-doc.jar (538560 Bytes)

Awesome.

rcollier, I hope you don’t mind, I’ve mavenised this and started making the tests work with ejabberd too. It’s up at github: http://github.com/squaremo/smackx-pubsub/tree/master

At the minute I am pointing to your profile here as the original author. Let me know if I can do better.

cheers

mikeb

That’s great. I don’t have the time and resources right now to test against other implementations, so any help in that domain is definitely appreciated.

Changing the node naming convention should work in OpenFire as well (although I haven’t tried it), as I didn’t see any restrictions when perusing that code.

Also, I have a newer version that fixes a bug I found. Just one file to update so I will see if I can manage that in github (haven’t used it before).

OK, I probably don’t have permissions for updating the source, so I will include the file here.

I replaces the existing one in org.jivesoftware.smackx.pubsub
PubSubManager.java (9970 Bytes)

If you follow smackx-pubsub on github, I will spot you and add you as a developer (let me know your username there if it’s not rcollier); or, if you prefer, you can fork it and pull across changesets.

In the meantime I’ll apply your patch – thanks!

mikeb.

I have created an account there under rcollier as well.

The new LeafNode/CollectionNode and Item/PayloadItem organization is much better than 0.4. Thanks for your job!

BTW, the PubSubManager.getNodes() was missing in 0.6. Is there any alternative?

Thanks for the feedback and I am glad you like the changes.

I removed it since it didn’t actually do as was advertised (get all nodes). It was only returning all nodes under root, the same as discoverNodes(), and then creating ready to use Node objects. Since the node creation could also be an issue fi there were a significant number of nodes, I removed it. You can use discoverNodes() to get the same list of node id’s and then call getNode(id) to retrieve the actual Node object, so no actual functionality is missing.

I am hoping to get a chance to work on the CollectionNode in the near future so that will have the ability to get the child nodes and drill down a hierarchy.

Hi Rob,

Excellent work on the pubsub extensions for Smack. Very well written code. Your 15years of experience shows for itself

Thank you, I am not sure how I am going to get my head through the door now

HI
I’d like to know how to add this code in Openfire?

and create a node pubsub?

thanks

Not sure what you mean. This is a client library, so it is inherently meant for developers to use to access the pubsub features of an XMPP server, such as OpenFire. If you want some kind of admin console or UI for creating nodes, to my knowledge neither one exists for OpenFire specifically, but you may be able to find one that supports that functionality from a third party. Personally, I don’t know of one, but I haven’t looked either.

There is a Jira task for Openfire already to create a pubsub admin console, but it is not done yet.

thank you
is that your code allows me or help me create a node in Openfire?

rechercher

I’m in the same situation as you I d’ont know how to integrate this code, although in Openfire is a link to download the plugin and I can not download the plugin rcollier

thank you for help

@loic: this library isn’t a server plugin – OpenFire already supports XEP-0060 (pubsub). It’s a client library, which you can use to drive pubsub operations in OpenFire and with some luck, ejabberd and others.

@talsam You can indeed use it to create a node and publish to it. The unit tests have examples of doing that.

Hi

I had just to run the jar file smackx-pubsub.0.6.jar???

No. It is a library, not an application. That means it is used by developers to write applications for using pubsub features.

An application which allows the user to administer (create/edit) nodes would be an example of such usage that someone could use this library for.

thank you for your patience robin

can tell you how you made a node in your server Openfire

we use the library of rcollier I added this connection and I installed Openfire on my machine but there is always a connection problem, where is the problem?
can you help me!!

public class Test
{

public static void main(String[] args) {

       //PubSubManager test = new PubSubManager(connection, "");

XMPPConnection connection = new XMPPConnection(“127.0.0”);

PubSubManager test = new PubSubManager(“127.0.0”);
test.connection(“127.0.0”);
test.createNode(“firstnode”);

//System.out.println(test.createNode);

System.out.println(test.getNodes());

}

}

You still need smack.jar and smackx.jar on your classpath (before smacx-pubsub.jar). You have classpath issues, plus the output is not even from the Test class specified, but from another one called Toto?!? There is also no connection method on PubSubManager. Please look at the Hello World example as that is working code. The only thing missing is the connect and login to your server. Look at the last posting which explains how to setup the PubSubManager.