Class JabberMethods
- java.lang.Object
-
- io.toro.martini.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 Summary
Constructors Constructor Description JabberMethods(io.toro.martini.jabber.JabberConnectionManager esbJabberConnectionManager)
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static JabberConnection
createJabberConnection(String name, Map configuration)
Deprecated, for removal: This API element is subject to removal in a future version.this method was move to XmppMethodsstatic JabberConnection
createJabberConnection(String name, Map configuration, Closure closure)
Deprecated, for removal: This API element is subject to removal in a future version.this method was move to XmppMethodsstatic void
jabber(String endpointName, Closure closure)
Deprecated, for removal: This API element is subject to removal in a future version.this method was move to XmppMethodsstatic void
jabberChat(String endpointName, String jid, Closure closure)
Deprecated, for removal: This API element is subject to removal in a future version.this method was move to XmppMethodsstatic void
jabberGroupchat(String endpointName, String roomJID, Closure closure)
Deprecated, for removal: This API element is subject to removal in a future version.this method was move to XmppMethodsstatic void
sendGroupMessage(String endpointName, String nickname, String roomJID, boolean leaveOnFinish, String message)
Deprecated, for removal: This API element is subject to removal in a future version.this method was move to XmppMethodsstatic void
sendGroupMessage(String endpointName, String nickname, String password, String roomJID, boolean leaveOnFinish, String message)
Deprecated, for removal: This API element is subject to removal in a future version.this method was move to XmppMethodsstatic void
sendMessage(String endpointName, String jid, String message)
Deprecated, for removal: This API element is subject to removal in a future version.this method was move to XmppMethods
-
-
-
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 XmppMethodsSend 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 packagemessage
- the message to sendjid
- 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 XmppMethodsInvoke a closure which can operate on a provided
Chat
object. TheChat
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 packagejid
- the Jabber ID of the userclosure
- 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 XmppMethodsSend 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 packagenickname
- the name to use in the chat roomroomJID
- the Jabber ID of the chat roomleaveOnFinish
- determines whether or not to leave the chat room after message deliverymessage
- 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 XmppMethodsSend 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 packagenickname
- the name to use in the chat roompassword
- the password of the chat roomroomJID
- the Jabber ID of the chat roomleaveOnFinish
- determines whether or not to leave the chat room after message deliverymessage
- 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 XmppMethodsInvoke a closure which can operate on a provided
MultiUserChat
object. TheMultiUserChat
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 packageroomJID
- the Jabber ID of the chat roomclosure
- 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 XmppMethodsInvoke a closure which can operate on a provided
JabberConnection
object. TheJabberConnection
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 packageclosure
- 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 XmppMethodsCreate 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 createdconfiguration
- configuration for the Jabber connectionclosure
- 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 XmppMethodsCreate 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 createdconfiguration
- configuration for the Jabber connection- Returns:
- the Jabber connection created from the configuration
- Throws:
ToroException
- Since:
- 1.0
- See Also:
JabberConnection.buildConfiguration(Map)
-
-