powered by Jive Software

Delegating roster sharing to GroupProvider

I’'m looking to make a code change to allow the GroupProvider implementations (in my case, JDBCGroupProvider) to determine roster sharing information.

The use case is when using JDBCGroupProvider to populate the groups. Currently, the groups will import as sharing enabled, but with no contact list group name. This prevents the rosters from auto-populating in Spark and XIFF. If you put any contact list group name in and save it, the rosters show up on the clients.

I’‘m looking for suggestions about how to best do this. Perhaps there is even an option for this already that I’'m unaware of.

My initial ideas were:

  1. Delegate to a GroupProvider.loadProperties method.

  2. Put a setting openfire.xml to make all groups shared by default, with a contact list group name equal to the group name.

I assume there is no existing functionality for #2?

Here is my semi-final proposal:

What I’‘m trying to accomplish is to modify GroupProvider to optionally supply the shared group information as well. This would be whether the group is shared (enable/disable), what the shared name should be, whether it’'s shared with additional users/groups (and which ones, ie ALL or certain groups).

My idea was to add new methods to the GroupProvider interface:

bool isPropertyProvider() - returns true/false as to whether this GroupProvider is responsible for shared group info as well. If so, no shared group info will be stored in the Openfire db. It would all be dynamic from the provider.

Map<String, String> getProperties(String name) - returns a Map of the properties for the given group name. This would include at least sharedRoster.displayName, sharedRoster.groupList and sharedRoster.showInRoster.

I would implement these methods for JDBCGroupProvider to function with a new SQL query:

propertiesSQL - Ie, SELECT displayName, groupList, showInRoster FROM …

In order to make sure LDAPGroupProvider and DefaultGroupProvider implement the interface, I would have their isPropertyProvider() return false, and their getProperties return null. The GroupManager would be responsible for checking isPropertyProvider() and then not calling getProperties().

What do you think?

Ended up doing it just a little differently.

New methods:

boolean isPropertyProvider();

Map getAllSharedGroups();




Basically just moved the groups list into a seperate query, where it made more sense. Also needed getAllSharedGroups for GroupManager.