Interface ChatServer

  • All Known Implementing Classes:
    EJabberdServer, OpenfireServer

    public interface ChatServer
    This interface represents a Chat server. An implementation of this interface has to implement the access to a concrete chat server. Configuration available in Silverpeas-Core/core-configuration/src/main/config/ properties/org/silverpeas/chat/settings/chat.properties
    Author:
    remipassmoilesel
    • Method Detail

      • getChatSettings

        static ChatSettings getChatSettings()
        Gets the settings on the chat service. These settings provide the endpoint definitions as well all the required parameters to communicate correctly with the remote chat server.
        Returns:
        a bundle of settings on the chat service.
      • isEnabled

        static boolean isEnabled()
        Is a chat server enabled? A chat server is enabled if there is a chat server defined for Silverpeas and the chat service is explicitly enabled. The definition of a chat server and the activation of the chat service are both done through the properties file org/silverpeas/chat/settings/chat.properties.
        Returns:
        true if both the chat service is enabled and a chat server is defined in the Silverpeas configuration. False otherwise.
      • createUser

        void createUser​(User user)
        Creates an account in the chat server for the specified user. The user login in lower case (without any domain part if any) is used as the chat login and the API token is used as password. Be caution with email addresses used as login because they contain a domain part and domain parts are not supported in login by chat servers. Before creating the account, all domain part or so such interpreted, are first removed from the user login.
        Parameters:
        user - a Silverpeas user.
        Throws:
        ChatServerException - if an error occurs while creating the user in the chat server.
      • deleteUser

        void deleteUser​(User user)
        Deletes in the chat server the account of the specified user.
        Parameters:
        user - a Silverpeas user.
        Throws:
        ChatServerException - if an error occurs while deleting the user in the chat server.
      • createRelationShip

        void createRelationShip​(User user1,
                                User user2)
        Creates a relationship between the two specified user in the chat server. If the relationship already exists, does nothing.
        Parameters:
        user1 - a Silverpeas user.
        user2 - another Silverpeas user.
        Throws:
        ChatServerException - if an error occurs while creating a relationship between the two users in the chat server.
      • deleteRelationShip

        void deleteRelationShip​(User user1,
                                User user2)
        Deletes the relationship existing between the two specified user in the chat server.
        Parameters:
        user1 - a Silverpeas user.
        user2 - another Silverpeas user.
        Throws:
        ChatServerException - if an error occurs while deleting a relationship between the two users in the chat server.
      • isUserExisting

        boolean isUserExisting​(User user)
        Is the specified user has already an account in the chat server?
        Parameters:
        user - a Silverpeas user.
        Returns:
        true if the user has an account in the chat server, false otherwise.
        Throws:
        ChatServerException - if an error occurs while communicating with the chat server.
      • isUserDomainSupported

        default boolean isUserDomainSupported​(String domainId)
        Is the specified Silverpeas domain is supported by the chat server? The domain is supported if it exists a mapping between it and a setting in the chat server. In that case, any users in the domain can be registered and retrieved in the chat server.
        Parameters:
        domainId - the unique identifier of a user domain in Silverpeas.
        Returns:
        true if the domain is supported by the chat server.
      • isAllowed

        default boolean isAllowed​(User user)
        Is the specified user is allowed to access the chat service? A guest user and the anonymous user isn't allowed to access the chat service. For others constrains on the access, please consult the documentation of ChatUser.isChatEnabled() about the conditions a user has to satisfy to allow his access on the chat server.
        Parameters:
        user - a user in Silverpeas
        Returns:
        true if the user is allowed to access the chat server, false otherwise.