Package org.jivesoftware.openfire.roster
Class RosterManager
java.lang.Object
org.jivesoftware.openfire.container.BasicModule
org.jivesoftware.openfire.roster.RosterManager
- All Implemented Interfaces:
Module
,GroupEventListener
,UserEventListener
A simple service that allows components to retrieve a roster based solely on the ID
of the owner. Users have convenience methods for obtaining a roster associated with
the owner. However there are many components that need to retrieve the roster
based solely on the generic ID owner key. This interface defines a service that can
do that. This allows classes that generically manage resource for resource owners
(such as presence updates) to generically offer their services without knowing or
caring if the roster owner is a user, chatbot, etc.
- Author:
- Iain Shigeoka
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SystemProperty<Integer>
The number of threads to keep in the thread pool that is used to invoke roster event listeners, even if they are idle.static final SystemProperty<Integer>
The maximum number of threads to allow in the thread pool that is used to invoke roster event listeners.static final SystemProperty<Duration>
The number of threads in the thread pool that is used to invoke roster event listeners is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
adminAdded
(Group group, Map<String, ?> params) An administrator was added to a group.void
adminRemoved
(Group group, Map<String, ?> params) An administrator was removed from a group.void
deleteRoster
(org.xmpp.packet.JID user) Removes the entire roster of a given user.Returns the list of shared groups whose visibility is public.Returns the roster for the given username.static RosterItemProvider
getSharedGroups
(String username) Returns a collection with all the groups that the user may include in his roster.void
groupCreated
(Group group, Map<String, ?> params) A group was created.void
groupDeleting
(Group group, Map<String, ?> params) A group is being deleted.void
groupModified
(Group group, Map<String, ?> params) A group's name, description, or an extended property was changed.void
initialize
(XMPPServer server) Initializes the basic module.boolean
isGroupVisible
(Group group, org.xmpp.packet.JID user) Returns true if a given group is visible to a given user.static boolean
isPublicSharedGroup
(Group group) Returns true if the specified Group may be seen by all users in the system.static boolean
Returns true if the roster service is enabled.static boolean
Returns true if the roster versioning is enabled.static boolean
isSharedGroup
(Group group) Returns true if the specified Group may be included in a user roster.void
memberAdded
(Group group, Map<String, ?> params) A member was added to a group.void
memberRemoved
(Group group, Map<String, ?> params) A member was removed from a group.void
start()
Starts the basic module.void
stop()
Stops the basic module.void
userCreated
(User newUser, Map<String, Object> params) A new user has been created so members of public shared groups need to have their rosters updated.void
userDeleting
(User user, Map<String, Object> params) A user is being deleted.void
userModified
(User user, Map<String, Object> params) A user's name, email, or an extended property was changed.Methods inherited from class org.jivesoftware.openfire.container.BasicModule
destroy, getName
-
Field Details
-
EXECUTOR_CORE_POOL_SIZE
The number of threads to keep in the thread pool that is used to invoke roster event listeners, even if they are idle. -
EXECUTOR_MAX_POOL_SIZE
The maximum number of threads to allow in the thread pool that is used to invoke roster event listeners. -
EXECUTOR_POOL_KEEP_ALIVE
The number of threads in the thread pool that is used to invoke roster event listeners is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating.
-
-
Constructor Details
-
RosterManager
public RosterManager()
-
-
Method Details
-
isRosterServiceEnabled
public static boolean isRosterServiceEnabled()Returns true if the roster service is enabled. When disabled it is not possible to retrieve users rosters or broadcast presence packets to roster contacts.- Returns:
- true if the roster service is enabled.
-
isRosterVersioningEnabled
public static boolean isRosterVersioningEnabled()Returns true if the roster versioning is enabled.- Returns:
- true if the roster versioning is enabled.
-
getRoster
Returns the roster for the given username.- Parameters:
username
- the username to search for.- Returns:
- the roster associated with the ID.
- Throws:
UserNotFoundException
- if the ID does not correspond to a known entity on the server.
-
deleteRoster
public void deleteRoster(org.xmpp.packet.JID user) Removes the entire roster of a given user. This is necessary when a user account is being deleted from the server.- Parameters:
user
- the user.
-
groupCreated
Description copied from interface:GroupEventListener
A group was created.- Specified by:
groupCreated
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
groupDeleting
Description copied from interface:GroupEventListener
A group is being deleted.- Specified by:
groupDeleting
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
groupModified
Description copied from interface:GroupEventListener
A group's name, description, or an extended property was changed.- Specified by:
groupModified
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
initialize
Description copied from class:BasicModule
Initializes the basic module.
Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.
- Specified by:
initialize
in interfaceModule
- Overrides:
initialize
in classBasicModule
- Parameters:
server
- the server hosting this module.
-
memberAdded
Description copied from interface:GroupEventListener
A member was added to a group.- Specified by:
memberAdded
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
memberRemoved
Description copied from interface:GroupEventListener
A member was removed from a group.- Specified by:
memberRemoved
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
adminAdded
Description copied from interface:GroupEventListener
An administrator was added to a group.- Specified by:
adminAdded
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
adminRemoved
Description copied from interface:GroupEventListener
An administrator was removed from a group.- Specified by:
adminRemoved
in interfaceGroupEventListener
- Parameters:
group
- the group.params
- event parameters.
-
userCreated
A new user has been created so members of public shared groups need to have their rosters updated. Members of public shared groups need to have a roster item with subscription FROM for the new user since the new user can see them.- Specified by:
userCreated
in interfaceUserEventListener
- Parameters:
newUser
- the newly created user.params
- event parameters.
-
userDeleting
Description copied from interface:UserEventListener
A user is being deleted.- Specified by:
userDeleting
in interfaceUserEventListener
- Parameters:
user
- the user.params
- event parameters.
-
userModified
Description copied from interface:UserEventListener
A user's name, email, or an extended property was changed.- Specified by:
userModified
in interfaceUserEventListener
- Parameters:
user
- the user.params
- event parameters.
-
isGroupVisible
Returns true if a given group is visible to a given user. That means, if the user can see the group in his roster.- Parameters:
group
- the group to check if the user can see.user
- the JID of the user to check if he may see the group.- Returns:
- true if a given group is visible to a given user.
-
start
Description copied from class:BasicModule
Starts the basic module.
Inheriting classes that choose to override this method MUST call this start() method before accessing BasicModule resources.
- Specified by:
start
in interfaceModule
- Overrides:
start
in classBasicModule
- Throws:
IllegalStateException
- If start is called before initialize successfully returns
-
stop
public void stop()Description copied from class:BasicModule
Stops the basic module.
Inheriting classes that choose to override this method MUST call this stop() method before accessing BasicModule resources.
- Specified by:
stop
in interfaceModule
- Overrides:
stop
in classBasicModule
-
getRosterItemProvider
-