|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.figure8.join.services.notification.im.XMPPNotifier
public class XMPPNotifier
This is an implementation of SubscribersNotifier
using the Instant
Messenger as notification media. This implementation uses the Jabber/XMPP
protocol for message sending. It uses the Smack libray for that (see
http://www.jivesoftware.org/smack for details)
Field Summary | |
---|---|
protected static java.util.List |
parameters
List of ParameterDefinition s supported by this notifier |
static java.lang.String |
PASSWORD_PARAM
Name of configurable parameter denoting the password for connecting to IM. |
protected static ParameterDefinition |
passwordParam
ParameterDefinition representation of parameter denoting the password for connecting to IM. |
static java.lang.String |
PORT_PARAM
Name of configurable parameter denoting the port of IM server. |
protected static ParameterDefinition |
portParam
ParameterDefinition representation of parameter denoting the port of the IM server. |
static java.lang.String |
PSEUDO_PARAM
Name of configurable parameter denoting the nick name for joining chat room. |
protected static ParameterDefinition |
pseudoParam
ParameterDefintion representation of parameter denoting the nick name for joining chat room. |
static java.lang.String |
ROOM_PARAM
Name of configurable parameter denoting the chat room where to send message. |
protected static ParameterDefinition |
roomParam
ParameterDefintion representation of parameter denoting the chat room where to send messages. |
static java.lang.String |
SERVER_PARAM
Name of configurable parameter denoting the name of IM server. |
protected static ParameterDefinition |
serverParam
ParameterDefinition representation of parameter denoting the name of the IM server. |
static java.lang.String |
USER_PARAM
Name of configurable parameter denoting the user name for connecting to IM. |
protected static ParameterDefinition |
userParam
ParameterDefinition representation of parameter denoting the user name for connecting to IM. |
Constructor Summary | |
---|---|
XMPPNotifier()
Creates a new instance of XMPPNotifier |
|
XMPPNotifier(java.lang.String server,
int port,
java.lang.String username,
java.lang.String password)
Creates a new instance of XMPPNotifier with mandatory attributes for connecting to IM |
Method Summary | |
---|---|
protected XMPPConnection |
connect()
Create a new connection and log in. |
java.lang.String[] |
extractRecipients(RemoteSubscriber[] subscribers)
Extract mail addresses for subscribers to provide recipients. |
java.lang.String |
getChatRoom()
|
ParameterDefinition[] |
getParameterDefinitions()
Get this object parameters definitions as an array |
java.util.List |
getParameterDefinitionsAsList()
Get this object parameters definitions as a list |
java.lang.String |
getPassword()
|
int |
getPort()
|
java.lang.String |
getPseudo()
|
java.lang.String |
getServer()
|
java.lang.String |
getUsername()
|
void |
notify(RemoteSubscriber[] subscribers,
java.lang.String title,
java.lang.String content)
Notify subscribers of mailing list defined into Join application |
void |
notify(java.lang.String[] recipients,
java.lang.String title,
java.lang.String content)
Notifier are able to notify recipients and use a title and a content within their notification messages. |
void |
setChatRoom(java.lang.String chatRoom)
|
void |
setParameter(ParameterDefinition parameter,
java.lang.String parameterValue)
Set the value of a parameter using its definitions |
void |
setParameter(java.lang.String parameterName,
java.lang.String parameterValue)
Set the value of a parameter using its nama |
void |
setParameters(java.util.Properties parameters)
Convenient methods for setting all attributes values using a single method. |
void |
setPassword(java.lang.String password)
|
void |
setPort(int port)
|
void |
setPseudo(java.lang.String pseudo)
|
void |
setServer(java.lang.String server)
|
void |
setUsername(java.lang.String username)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String PORT_PARAM
public static final java.lang.String SERVER_PARAM
public static final java.lang.String USER_PARAM
public static final java.lang.String PASSWORD_PARAM
public static final java.lang.String ROOM_PARAM
public static final java.lang.String PSEUDO_PARAM
protected static java.util.List parameters
ParameterDefinition
s supported by this notifier
protected static final ParameterDefinition portParam
protected static final ParameterDefinition serverParam
protected static final ParameterDefinition userParam
protected static final ParameterDefinition passwordParam
protected static final ParameterDefinition roomParam
protected static final ParameterDefinition pseudoParam
Constructor Detail |
---|
public XMPPNotifier()
public XMPPNotifier(java.lang.String server, int port, java.lang.String username, java.lang.String password)
server
- The name of IM server to connect toport
- The port of IM server to connect tousername
- The username for connecting to IM serverpassword
- The password for connecting to IM serverMethod Detail |
---|
public int getPort()
public void setPort(int port)
port
- The port of IM server to connect topublic java.lang.String getServer()
public void setServer(java.lang.String server)
server
- The name of IM server to connect topublic java.lang.String getUsername()
public void setUsername(java.lang.String username)
public java.lang.String getPassword()
public void setPassword(java.lang.String password)
password
- The password for connecting to IM serverpublic java.lang.String getChatRoom()
public void setChatRoom(java.lang.String chatRoom)
chatRoom
- The name of chat room to send messages to (if group publishing)public java.lang.String getPseudo()
public void setPseudo(java.lang.String pseudo)
pseudo
- The pseudo to use for joining chat room (if group publishing)public java.lang.String[] extractRecipients(RemoteSubscriber[] subscribers)
extractRecipients
in interface SubscribersNotifier
subscribers
- The subscribers to get recipients for
public void notify(RemoteSubscriber[] subscribers, java.lang.String title, java.lang.String content) throws NotificationException
notify
in interface SubscribersNotifier
subscribers
- The subscriber of mailing list to notifytitle
- The title of notification message to sendcontent
- The content of notification message to send
NotificationException
- if an exception occurs during the notification operation
(usually they are network related exceptions)public void notify(java.lang.String[] recipients, java.lang.String title, java.lang.String content) throws NotificationException
notify
in interface Notifier
recipients
- An array of recipients to notify. Recipient is described with a Stringtitle
- The title of notification message to sendcontent
- The content of notification message to send
NotificationException
- if an exception occurs during the notification operation
(usually they are network related exceptions)public java.util.List getParameterDefinitionsAsList()
getParameterDefinitionsAsList
in interface Configurable
ParameterDefinition
objectspublic ParameterDefinition[] getParameterDefinitions()
getParameterDefinitions
in interface Configurable
ParameterDefinition
objectspublic void setParameter(java.lang.String parameterName, java.lang.String parameterValue) throws InvalidParameterException
setParameter
in interface Configurable
parameterName
- The name of parameter so set value forparameterValue
- The value of the paramater
InvalidParameterException
- if this parameter is not supported by this objectpublic void setParameter(ParameterDefinition parameter, java.lang.String parameterValue) throws InvalidParameterException
setParameter
in interface Configurable
parameter
- The definitino of the paramater to setparameterValue
- The value of the parameter
InvalidParameterException
- if this parameter is not supported by this objectpublic void setParameters(java.util.Properties parameters) throws InvalidParameterException
setParameters
in interface Configurable
parameters
- Properties where keys are parameter names
InvalidParameterException
- if one of these parameters is not supported by this objectprotected XMPPConnection connect() throws NotificationException
NotificationException
- if an exception occurs while creating exception.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |