Package org.jivesoftware.openfire.user
Class UserNameManager
- java.lang.Object
-
- org.jivesoftware.openfire.user.UserNameManager
-
public class UserNameManager extends Object
Main responsibility of this class is to return the correct name of XMPP entities. For local entities (i.e. users) theUser
name is used. For remote entities the following logic is used:- Check if a
UserNameProvider
is registered for the entity's domain. If a provider was found then use it to get the entity's name - If no provider was found then retrieve the vCard of the entity and return the name as defined in the vCard. This is not implemented yet.
- If no vCard was found then return the string representation of the entity's JID.
- Author:
- Gaston Dombiak
- Check if a
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addUserNameProvider(String domain, UserNameProvider provider)
Adds the specifiedUserNameProvider
as the provider of users of the specified domain.static String
getUserName(org.xmpp.packet.JID entity)
Returns the name of the XMPP entity.static String
getUserName(org.xmpp.packet.JID entity, String defaultName)
Returns the name of the XMPP entity.static void
removeUserNameProvider(String domain)
Removes anyUserNameProvider
that was associated with the specified domain.
-
-
-
Method Detail
-
addUserNameProvider
public static void addUserNameProvider(String domain, UserNameProvider provider)
Adds the specifiedUserNameProvider
as the provider of users of the specified domain.- Parameters:
domain
- the domain hosted by the UserNameProvider.provider
- the provider that will provide the name of users in the specified domain.
-
removeUserNameProvider
public static void removeUserNameProvider(String domain)
Removes anyUserNameProvider
that was associated with the specified domain.- Parameters:
domain
- the domain hosted by a UserNameProvider.
-
getUserName
public static String getUserName(org.xmpp.packet.JID entity) throws UserNotFoundException
Returns the name of the XMPP entity. If the entity is a local user then the User's name will be returned. However, if the user is not a local user then check if there exists a UserNameProvider that provides name for the specified domain. If none was found then the vCard of the entity might be requested and if none was found then a string representation of the entity's JID will be returned.- Parameters:
entity
- the JID of the entity to get its name.- Returns:
- the name of the XMPP entity.
- Throws:
UserNotFoundException
- if the jid belongs to the local server but no user was found for that jid.
-
getUserName
public static String getUserName(org.xmpp.packet.JID entity, String defaultName) throws UserNotFoundException
Returns the name of the XMPP entity. If the entity is a local user then the User's name will be returned. However, if the user is not a local user then check if there exists a UserNameProvider that provides name for the specified domain. If none was found then the vCard of the entity might be requested and if none was found then a string representation of the entity's JID will be returned.- Parameters:
entity
- the JID of the entity to get its name.defaultName
- default name to return when no name was found.- Returns:
- the name of the XMPP entity.
- Throws:
UserNotFoundException
- if the jid belongs to the local server but no user was found for that jid.
-
-