Class JabberMethods


  • public final class JabberMethods
    extends Object
    Provides utility methods for easily creating, sending, and receiving instant messages from Jabber endpoints. Jabber an open technology for instant messaging and presence.
    • Constructor Detail

      • JabberMethods

        @Autowired
        JabberMethods​(io.toro.martini.jabber.JabberConnectionManager esbJabberConnectionManager)
    • Method Detail

      • sendMessage

        @Deprecated(since="2.0",
                    forRemoval=true)
        public static void sendMessage​(String endpointName,
                                       String jid,
                                       String message)
                                throws ToroException
        Deprecated, for removal: This API element is subject to removal in a future version.
        this method was move to XmppMethods

        Send a message to a user. This will reuse the Jabber connection created by the endpoint. This one-liner requires the endpoint to be started.

        Example usage:

         'endpoint'.sendMessage( 'user@your.org', 'Hello, earthling!' )
         

        Parameters:
        endpointName - the name of the endpoint belonging to the current package
        message - the message to send
        jid - the Jabber ID of the recipient
        Throws:
        ToroException
        Since:
        1.0
      • jabberChat

        @Deprecated(since="2.0",
                    forRemoval=true)
        public static void jabberChat​(String endpointName,
                                      String jid,
                                      Closure closure)
                               throws ToroException
        Deprecated, for removal: This API element is subject to removal in a future version.
        this method was move to XmppMethods

        Invoke a closure which can operate on a provided Chat object. The Chat object is constructed based on the provided JID, and the Jabber connection created by the endpoint. This one-liner requires the endpoint to be started.

        Example usage:

         'endpoint'.jabberChat('user@your.org') {
             chat -> chat.sendMessage('Hello, earthling!')
         }
         

        Parameters:
        endpointName - the name of the endpoint belonging to the current package
        jid - the Jabber ID of the user
        closure - the closure to invoke
        Throws:
        ToroException
        Since:
        1.0
      • sendGroupMessage

        @Deprecated(since="2.0",
                    forRemoval=true)
        public static void sendGroupMessage​(String endpointName,
                                            String nickname,
                                            String roomJID,
                                            boolean leaveOnFinish,
                                            String message)
                                     throws ToroException
        Deprecated, for removal: This API element is subject to removal in a future version.
        this method was move to XmppMethods

        Send a message to a chat room. This will reuse the Jabber connection created by the endpoint. This one-liner requires the endpoint to be started.

        Example usage:

         'endpoint'.sendGroupMessage( 'NotAnAlien' , 'room@your.org' , true, 'Hello, earthlings!' )
         

        Parameters:
        endpointName - the name of the endpoint belonging to the current package
        nickname - the name to use in the chat room
        roomJID - the Jabber ID of the chat room
        leaveOnFinish - determines whether or not to leave the chat room after message delivery
        message - the message to send
        Throws:
        ToroException
        Since:
        1.0
      • sendGroupMessage

        @Deprecated(since="2.0",
                    forRemoval=true)
        public static void sendGroupMessage​(String endpointName,
                                            String nickname,
                                            String password,
                                            String roomJID,
                                            boolean leaveOnFinish,
                                            String message)
                                     throws ToroException
        Deprecated, for removal: This API element is subject to removal in a future version.
        this method was move to XmppMethods

        Send a message to a chatroom. This will reuse the Jabber connection created by the endpoint. This one-liner requires the endpoint to be started.

        Example usage:

         'endpoint'.sendGroupMessage( 'NotAnAlien', 'room@your.org' , true, 'I can speak English.' )
         

        Parameters:
        endpointName - the name of the endpoint belonging to the current package
        nickname - the name to use in the chat room
        password - the password of the chat room
        roomJID - the Jabber ID of the chat room
        leaveOnFinish - determines whether or not to leave the chat room after message delivery
        message - the message to send
        Throws:
        ToroException
        Since:
        1.0
      • jabberGroupchat

        @Deprecated(since="2.0",
                    forRemoval=true)
        public static void jabberGroupchat​(String endpointName,
                                           String roomJID,
                                           Closure closure)
                                    throws ToroException
        Deprecated, for removal: This API element is subject to removal in a future version.
        this method was move to XmppMethods

        Invoke a closure which can operate on a provided MultiUserChat object. The MultiUserChat object is constructed based on the provided JID, and the Jabber connection created by the endpoint. This one-liner requires the endpoint to be started.

        Example usage:

         'endpoint'.jabberGroupchat( 'room@your.org' ) {
             chat -> chat.sendMessage( 'But can you do this?' )
         }
         

        Parameters:
        endpointName - the name of the endpoint belonging to the current package
        roomJID - the Jabber ID of the chat room
        closure - the closure to invoke
        Throws:
        ToroException
        Since:
        1.0
      • jabber

        @Deprecated(since="2.0",
                    forRemoval=true)
        public static void jabber​(String endpointName,
                                  Closure closure)
                           throws ToroException
        Deprecated, for removal: This API element is subject to removal in a future version.
        this method was move to XmppMethods

        Invoke a closure which can operate on a provided JabberConnection object. The JabberConnection object is obtained from the named endpoint. This one-liner requires the endpoint to be started.

        The closure must avoid disconnecting the connection. To properly disconnect the connection, stop the endpoint instead. If the connection is closed, this one-liner will attempt to reconnect the connection.

        Example usage:

         'endpoint'.jabber() {
             connection -> connection.sendMessage( 'alien@not.earth', 'Why are you green?' )
         }
         

        Parameters:
        endpointName - the name of the endpoint belonging to the current package
        closure - the closure to execute
        Throws:
        ToroException
        Since:
        1.0
      • createJabberConnection

        @Deprecated(since="2.0",
                    forRemoval=true)
        public static JabberConnection createJabberConnection​(String name,
                                                              Map configuration,
                                                              Closure closure)
                                                       throws ToroException
        Deprecated, for removal: This API element is subject to removal in a future version.
        this method was move to XmppMethods

        Create a Jabber connection using the provided configuration.

        Example usage:

         def configuration = [ serviceName: 'service' , username: 'user@your.org', password: 'superS3CR3Tpa$$word' ]
         'connection'.createJabberConnection( configuration ) {
             connection -> println "${connection.getName()}"
         }
         

        Parameters:
        name - the name of the connection to be created
        configuration - configuration for the Jabber connection
        closure - optional closure for executing more actions against the Jabber connection (eg. send a message)
        Returns:
        the Jabber connection created from the configuration
        Throws:
        ToroException
        Since:
        1.0
        See Also:
        JabberConnection.buildConfiguration(Map)
      • createJabberConnection

        @Deprecated(since="2.0",
                    forRemoval=true)
        public static JabberConnection createJabberConnection​(String name,
                                                              Map configuration)
                                                       throws ToroException
        Deprecated, for removal: This API element is subject to removal in a future version.
        this method was move to XmppMethods

        Create a Jabber connection using the provided configuration.

        Example usage:

         def configuration = [ serviceName: 'service' , username: 'user@your.org', password: 'superS3CR3Tpa$$word']
         def connection = 'connection'.createJabberConnection( configuration )
         
        Parameters:
        name - the name of the connection to be created
        configuration - configuration for the Jabber connection
        Returns:
        the Jabber connection created from the configuration
        Throws:
        ToroException
        Since:
        1.0
        See Also:
        JabberConnection.buildConfiguration(Map)