com.ibm.pvc.we.ins
Class NotificationService

java.lang.Object
  |
  +--com.ibm.pvc.we.ins.ANotificationService
        |
        +--com.ibm.pvc.we.ins.NotificationService

public class NotificationService
extends ANotificationService

An instance of NotificationService can be used to send messages to a Notification Server of same version

Since:
1 February 2001

Inner Class Summary
protected  class NotificationService.NSConnection
           
 
Inner classes inherited from class com.ibm.pvc.we.ins.ANotificationService
ANotificationService.IConnectionListener, ANotificationService.IListener
 
Field Summary
protected  NotificationService.NSConnection connection
          The connection to the notification server
protected  java.lang.String host
          Host name of notification server
protected  java.util.Map outstandingRequests
          Outstanding requests.
protected  int port
          Port number of notification server
 
Fields inherited from class com.ibm.pvc.we.ins.ANotificationService
ASYNCHRONOUS_REQUEST, DELIVERY_NOT_POSSIBLE, INCOMPATIBLE_REALMS_FOR_COMMUNICATION, INCORRECT_REQUEST_SPECIFICATION, OK, RUNTIME_ERROR, UND_DELIVERY_FAILURE
 
Constructor Summary
NotificationService()
           
NotificationService(java.lang.String host, int port)
          Creates a NotificationService instance
NotificationService(java.lang.String host, int port, ANotificationService.IConnectionListener conListener)
          Creates a NotificationService instance
 
Method Summary
 int getNumberOutstandingRequests()
           
 void init(java.lang.String initString)
           
 boolean isConnected()
           
 int sendMessage(java.lang.String notificationML, DeliveryOptionsExtended senderPrefs, ANotificationService.IListener listener)
          Send a notification and be notified of the success or failure of the notification through a listener object.
 void setConnectionListener(ANotificationService.IConnectionListener conListener)
          insert comment
 void start()
          insert comment
 void stop()
           
 
Methods inherited from class com.ibm.pvc.we.ins.ANotificationService
create, sendMessage, sendMessage, specifyDevices
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

host

protected java.lang.String host
Host name of notification server

port

protected int port
Port number of notification server

connection

protected NotificationService.NSConnection connection
The connection to the notification server

outstandingRequests

protected java.util.Map outstandingRequests
Outstanding requests. The key is the request id and the value is the IListener object.
Constructor Detail

NotificationService

public NotificationService(java.lang.String host,
                           int port)
Creates a NotificationService instance
Parameters:
host - domain name of the Notification Service host
port - TCP port number of the notification server

NotificationService

public NotificationService(java.lang.String host,
                           int port,
                           ANotificationService.IConnectionListener conListener)
Creates a NotificationService instance
Parameters:
host - domain name of the Notification Service host
port - TCP port number of the notification server

NotificationService

public NotificationService()
Method Detail

init

public void init(java.lang.String initString)
          throws NotificationServiceException
Overrides:
init in class ANotificationService

setConnectionListener

public void setConnectionListener(ANotificationService.IConnectionListener conListener)
insert comment
Overrides:
setConnectionListener in class ANotificationService

isConnected

public boolean isConnected()
Overrides:
isConnected in class ANotificationService

sendMessage

public int sendMessage(java.lang.String notificationML,
                       DeliveryOptionsExtended senderPrefs,
                       ANotificationService.IListener listener)
                throws java.io.IOException
Send a notification and be notified of the success or failure of the notification through a listener object.
Overrides:
sendMessage in class ANotificationService
Parameters:
notificationML - the notification ML
senderPrefs - the send preferences
listener - where the result of the notification is sent. My be null if the result is to be ignored.
Returns:
completion status of the operation. Possible values are:
UND_DELIVERY_FAILURE : if delivery adaptors, such as instant messaging adaptor, could not send the message (for example because the recipient is offline on instant messaging)
RUNTIME_ERROR : request processing cut short by internal UND error
INCORRECT_REQUEST_SPECIFICATION : request was not made of usable Notification ML
DELIVERY_NOT_POSSIBLE : delivery was not possible, as no user devices on which to deliver were exposed. This may be for a number of reasons. For example, the user may have no devices, but they may have also specified that the sender is not entitled to use their devices. The difference cannot be revealed without breaching the recipients privacy, and therefore that information is not revealed. The same error is returned if the the user is inactive, non-existent, or if the device database is out of service
INCOMPATIBLE_REALMS_FOR_COMMUNICATION : The sender and the recipient are in realms that are not entitled to communicate with each other. The request is therefore rejected.
ASYNCHRONOUS_REQUEST : The listener object will get the real result. OK : The listener was null. The message was sent to the Notification Server.
Throws:
java.io.IOException -
If there are problems with the Universal Notification Dispatcher connection. Any subclass of IOException can be thrown. Its name and associated message provide more information on the error that has occured.

Common examples are:
java.net.ConnectException if no process on the destination host accepts the connection
java.net.BindException if the connection is local and could not be made, for example because of port clash
java.net.UnknownHostException if the requested host is unknown
java.net.NoRouteToHostException if there is no route available for the requested host
java.io.InterruptedIOException if the IO stream is prematurely terminated.

start

public void start()
           throws java.io.IOException
insert comment
Overrides:
start in class ANotificationService
Throws:
java.io.IOException -  

stop

public void stop()
          throws java.io.IOException
Overrides:
stop in class ANotificationService
Throws:
java.io.IOException -  

getNumberOutstandingRequests

public int getNumberOutstandingRequests()
Overrides:
getNumberOutstandingRequests in class ANotificationService
Returns: