powered by Jive Software

Attaching my data structures to existing Openfire User data structure (exended property?)

Kind Attn: Matt Tucker

Is there a way using Openfire APIs so that I can inject/plugin/attach/associate my own data structure (e.g., a simple field(s)) which I want to use to store a user’s custom information (specific to my Openfire server).

The class User has a method insertProperty

private void insertProperty(String propName, String propValue)

which stores a key-value pair (which is perfect for me) in the data member called properties which is of type Map<String,String>. However, this is a private function and I cannot insert my own property at will from somewhere else (e.g., my plugin).

Basically I want to use Openfire’s storage mechanism to store an extra attribute per user. i want to do some custom processing in my plugin using the value of this attribute. Till now the best solution I have been able to come up with is to have my own data structures but that leads to more complexity (and I might need persistent attributes).

Is there a built in mechanism in Openfire or do I have to reinvent the wheel.

I think if this insertProperty(string, string) was a public method it would have solved my problem as there exists a corresponding getProperties method

public Map<String,String> getProperties()

The documentation for this method says that it returns ‘the extended properties’. But how do u set these extended properties, I couldnt find anywhere how to set an extended property although the documentation does talk of extended properties in addition to username, email, etc.

Or there could have been a generic setProperty() method just like the existing setName(), setEMail(), etc.

Any help is highly appreciated.

Thanks for your time.