Package org.jivesoftware.openfire.group
Class JDBCGroupProvider
java.lang.Object
org.jivesoftware.openfire.group.AbstractGroupProvider
org.jivesoftware.openfire.group.JDBCGroupProvider
- All Implemented Interfaces:
GroupProvider
The JDBC group provider allows you to use an external database to define the composition of groups.
It is best used with the JDBCAuthProvider to provide integration between your external system and
Openfire. All data is treated as read-only so any set operations will result in an exception.
To enable this provider, set the following in the system properties:
provider.group.className = org.jivesoftware.openfire.group.JDBCGroupProvider
jdbcProvider.driver = com.mysql.jdbc.DriverjdbcProvider.connectionString = jdbc:mysql://localhost/dbname?user=username&password=secretjdbcGroupProvider.groupCountSQL = SELECT count(*) FROM myGroupsjdbcGroupProvider.allGroupsSQL = SELECT groupName FROM myGroupsjdbcGroupProvider.userGroupsSQL = SELECT groupName FORM myGroupUsers WHERE username=?jdbcGroupProvider.descriptionSQL = SELECT groupDescription FROM myGroups WHERE groupName=?jdbcGroupProvider.loadMembersSQL = SELECT username FORM myGroupUsers WHERE groupName=? AND isAdmin='N'jdbcGroupProvider.loadAdminsSQL = SELECT username FORM myGroupUsers WHERE groupName=? AND isAdmin='Y'
jdbcGroupProvider.useConnectionProvider = true
- Author:
- David Snopek
-
Field Summary
Fields inherited from class org.jivesoftware.openfire.group.AbstractGroupProvider
SHARED_GROUP_RECURSIVE, sharedGroupMetaCache -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanXMPP disallows some characters in identifiers, requiring them to be escaped.Returns a group based on its name.intReturns the number of groups in the system.Returns the Collection of all group names in the system.getGroupNames(int start, int num) Returns the Collection of all groups in the system.getGroupNames(org.xmpp.packet.JID user) Returns the Collection of group names that an entity belongs to.Methods inherited from class org.jivesoftware.openfire.group.AbstractGroupProvider
addMember, createGroup, deleteGroup, deleteMember, getPublicSharedGroupNames, getSharedGroupNames, getSharedGroupNames, getVisibleGroupNames, hasSharedGroups, isReadOnly, isSearchSupported, isSharingSupported, loadProperties, search, search, search, setDescription, setName, updateMember
-
Constructor Details
-
JDBCGroupProvider
public JDBCGroupProvider()Constructor of the JDBCGroupProvider class.
-
-
Method Details
-
assumePersistedDataIsEscaped
protected boolean assumePersistedDataIsEscaped()XMPP disallows some characters in identifiers, requiring them to be escaped. This implementation assumes that the database returns properly escaped identifiers, but can apply escaping by setting the value of the 'jdbcGroupProvider.isEscaped' property to 'false'.- Returns:
- 'false' if this implementation needs to escape database content before processing.
-
getGroup
Description copied from interface:GroupProviderReturns a group based on its name.- Parameters:
name- the name of the group.- Returns:
- the group with the given name.
- Throws:
GroupNotFoundException- If no group with that ID could be found
-
getGroupCount
public int getGroupCount()Description copied from interface:GroupProviderReturns the number of groups in the system.- Returns:
- the number of groups in the system.
-
getGroupNames
Description copied from interface:GroupProviderReturns the Collection of all group names in the system.- Returns:
- the Collection of all groups.
-
getGroupNames
Description copied from interface:GroupProviderReturns the Collection of all groups in the system.- Parameters:
start- start index in results.num- number of results to return.- Returns:
- the Collection of all group names given the
startIndexandnumResults.
-
getGroupNames
Description copied from interface:GroupProviderReturns the Collection of group names that an entity belongs to. Implementations should use the bare JID representation of the JID passed as an argument to this method.- Parameters:
user- the (bare) JID of the entity.- Returns:
- the Collection of group names that the user belongs to.
-