Package org.jivesoftware.openfire.group
Class AbstractGroupProvider
java.lang.Object
org.jivesoftware.openfire.group.AbstractGroupProvider
- All Implemented Interfaces:
GroupProvider
- Direct Known Subclasses:
CrowdGroupProvider,DefaultGroupProvider,JDBCGroupProvider,LdapGroupProvider
Shared base class for Openfire GroupProvider implementations. By default,
all mutator methods throw
UnsupportedOperationException. In
addition, group search operations are disabled.
Subclasses may optionally implement these capabilities, and must also
at minimum implement the GroupProvider.getGroup(String) method.- Author:
- Tom Evans
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SystemProperty<Boolean>protected static final Cache<String,Serializable> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an entity to a group (optional operation).createGroup(String name) Creates a group with the given name (optional operation).voiddeleteGroup(String name) Deletes the group (optional operation).voiddeleteMember(String groupName, org.xmpp.packet.JID user) Deletes an entity from a group (optional operation).Returns an unmodifiable Collection of all public shared groups in the system.Returns the name of the groups that are shared groups.getSharedGroupNames(org.xmpp.packet.JID user) Returns an unmodifiable Collection of all shared groups in the system for a given user.getVisibleGroupNames(String userGroup) Returns an unmodifiable Collection of groups that are visible to the members of the given group.booleanChecks if any shared groups exists.booleanAlways true for a read-only providerbooleanReturns true if the provider supports group search capability.booleanReturns true if this GroupProvider allows group sharing.loadProperties(Group group) Returns a customMapthat updates the database whenever a property value is added, changed, or deleted.Returns a collection of group search results.Returns a collection of group search results.Returns the names of groups that have a property matching the given key/value pair.voidsetDescription(String name, String description) Updates the group's description.voidSets the name of a group to a new name.voidupdateMember(String groupName, org.xmpp.packet.JID user, boolean administrator) Updates the privileges of an entity in a group.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jivesoftware.openfire.group.GroupProvider
getGroup, getGroupCount, getGroupNames, getGroupNames, getGroupNames
-
Field Details
-
SHARED_GROUP_RECURSIVE
-
Constructor Details
-
AbstractGroupProvider
public AbstractGroupProvider()
-
-
Method Details
-
addMember
public void addMember(String groupName, org.xmpp.packet.JID user, boolean administrator) throws GroupNotFoundException Description copied from interface:GroupProviderAdds an entity to a group (optional operation). Implementations should use the bare JID representation of the JID passed as an argument to this method.- Specified by:
addMemberin interfaceGroupProvider- Parameters:
groupName- the group to add the member touser- the (bare) JID of the entity to addadministrator- True if the member is an administrator of the group- Throws:
UnsupportedOperationException- if the provider is read onlyGroupNotFoundException
-
updateMember
public void updateMember(String groupName, org.xmpp.packet.JID user, boolean administrator) throws GroupNotFoundException Description copied from interface:GroupProviderUpdates the privileges of an entity in a group. Implementations should use the bare JID representation of the JID passed as an argument to this method.- Specified by:
updateMemberin interfaceGroupProvider- Parameters:
groupName- the group where the change happeneduser- the (bare) JID of the entity with new privilegesadministrator- True if the member is an administrator of the group- Throws:
UnsupportedOperationException- if the provider is read onlyGroupNotFoundException
-
deleteMember
Description copied from interface:GroupProviderDeletes an entity from a group (optional operation). Implementations should use the bare JID representation of the JID passed as an argument to this method.- Specified by:
deleteMemberin interfaceGroupProvider- Parameters:
groupName- the group name.user- the (bare) JID of the entity to delete.- Throws:
UnsupportedOperationException- if the provider is read only
-
isReadOnly
public boolean isReadOnly()Always true for a read-only provider- Specified by:
isReadOnlyin interfaceGroupProvider- Returns:
- true if the user provider is read-only.
-
createGroup
Description copied from interface:GroupProviderCreates a group with the given name (optional operation).The provider is responsible for setting the creation date and modification date to the current date/time.
- Specified by:
createGroupin interfaceGroupProvider- Parameters:
name- name of the group.- Returns:
- the newly created group.
- Throws:
UnsupportedOperationException- if the provider is read onlyGroupAlreadyExistsException- if a group with the same name already exists.GroupNameInvalidException
-
deleteGroup
Description copied from interface:GroupProviderDeletes the group (optional operation).- Specified by:
deleteGroupin interfaceGroupProvider- Parameters:
name- the name of the group to delete.- Throws:
UnsupportedOperationException- if the provider is read onlyGroupNotFoundException
-
setName
public void setName(String oldName, String newName) throws GroupAlreadyExistsException, GroupNameInvalidException, GroupNotFoundException Description copied from interface:GroupProviderSets the name of a group to a new name.- Specified by:
setNamein interfaceGroupProvider- Parameters:
oldName- the current name of the group.newName- the desired new name of the group.- Throws:
GroupAlreadyExistsException- if the group already existsUnsupportedOperationException- if the provider is read onlyGroupNameInvalidExceptionGroupNotFoundException
-
setDescription
Description copied from interface:GroupProviderUpdates the group's description.- Specified by:
setDescriptionin interfaceGroupProvider- Parameters:
name- the group name.description- the group description.- Throws:
GroupNotFoundException- if the group could not be foundUnsupportedOperationException- if the provider is read only
-
isSearchSupported
public boolean isSearchSupported()Returns true if the provider supports group search capability. This implementation always returns false.- Specified by:
isSearchSupportedin interfaceGroupProvider- Returns:
- true if searching is supported.
-
search
Returns a collection of group search results. This implementation returns an empty collection.- Specified by:
searchin interfaceGroupProvider- Parameters:
query- the search string for group names.- Returns:
- all groups that match the search.
-
search
Returns a collection of group search results. This implementation returns an empty collection.- Specified by:
searchin interfaceGroupProvider- Parameters:
query- the search string for group names.startIndex- start index in results.numResults- number of results to return.- Returns:
- all groups that match the search.
-
getVisibleGroupNames
Description copied from interface:GroupProviderReturns an unmodifiable Collection of groups that are visible to the members of the given group.- Specified by:
getVisibleGroupNamesin interfaceGroupProvider- Parameters:
userGroup- The given group- Returns:
- unmodifiable Collection of group names that are visible to the given group.
-
search
Description copied from interface:GroupProviderReturns the names of groups that have a property matching the given key/value pair. This provides a simple extensible search mechanism for providers with differing property sets and storage models. The semantics of the key/value matching (wildcard support, scoping, etc.) are unspecified by the interface and may vary for each implementation. Before searching or showing a search UI, use theGroupProvider.isSearchSupported()method to ensure that searching is supported.- Specified by:
searchin interfaceGroupProvider- Parameters:
key- The name of a group property (e.g. "sharedRoster.showInRoster")value- The value to match for the given property- Returns:
- unmodifiable Collection of group names that match the given key/value pair.
-
isSharingSupported
public boolean isSharingSupported()Description copied from interface:GroupProviderReturns true if this GroupProvider allows group sharing. Shared groups enable roster sharing.- Specified by:
isSharingSupportedin interfaceGroupProvider- Returns:
- true if the group provider supports group sharing.
-
loadProperties
Returns a customMapthat updates the database whenever a property value is added, changed, or deleted.- Specified by:
loadPropertiesin interfaceGroupProvider- Parameters:
group- The target group- Returns:
- The properties for the given group
-