Chapter 2. Simple notifications 59
The steps to implement a simple notification functionality in an application are:
1. Include in the Java classpath the Intelligent Notification Services JAR files
insUtil.jar and insNmClient.jar. These JAR files are located in the directory
ins_home\lib, where ins_home is in the installation directory, C:\Program
Files\WebSphere\INS.
2. Import the following packages:
– javax.naming.Context
– java.util.*
– com.ibm.pvc.ins.nm.client.*
– com.ibm.pvc.ins.nm.server.Request
– com.ibm.pvc.ins.nm.server.NotificationService
3. Create a Notification Manager client instance.
The NmClientFactory class allows you to create a local Enterprise JavaBean
(EJB) or a remote EJB for the Notification Manager client instance. You must
specify a context provider URL to create this instance. By default, it is
corbaloc:iiop:localhost:2809. However, it is possible to specify an alternate
context provider URL.
The context provider URL is specified in the XML file insBaseConfig.xml that
is located in ins_home\config\xml, where ins_home is the Intelligent
Notification Services home installation directory (for example C:\Program
Files\WebSphere\INS).
The available methods to create a Notification Manager client instance are:
– createLocalNmClient(): creates a local instance using default initial
context provider URL of corbaloc:iiop:localhost:2809
– createLocalNmClient(java.util.Hashtable): creates a local instance using
context provider URL specified.
– createRemoteNmClient(): creates a remote instance using default initial
context provider URL of corbaloc:iiop:localhost:2809
– createRemoteNmClient(java.util.Hashtable): creates a remote instance
using context provider URL specified.
4. Create a notification object, which is necessary to build the message.
Note: The imported Intelligent Notification Services packages are part of
the ins_home\lib\insNmClient.jar file, where ins_home is the Intelligent
Notification Services home installation directory (for example C:\Program
Files\WebSphere\INS).