Chapter 3. Subscription-based notifications 89
3. Create a new package. In this example, the package is
com.ibm.pvc.ins.sm.apps.
4. Create into the new package a new Java file. In this example, the name of
this file is MonitoringContentAdapter.java.
5. Import the required packages as shown in Example 3-6.
Example 3-6 Required packages for MonitoringContentAdapter class
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.PropertyResourceBundle;
import java.net.Socket;
import com.ibm.pvc.ins.sm.client.ConfigurationException;
import com.ibm.pvc.ins.sm.client.IQueueException;
import com.ibm.pvc.ins.sm.client.SmClientFactory;
import com.ibm.pvc.ins.sm.server.SubscriptionService;
import com.ibm.pvc.we.ins.context.util.SocketListener;
6. Create a new class that extends the SocketListener class. The
SocketListener class listens for an incoming connection request through
sockets. Declare auxiliary variables for the properties file (the fully qualified
class name) and the Subscription Manager client instance as shown in
Example 3-7.
Example 3-7 Auxiliary variables for MonitoringContentAdapter class
public class MonitoringContentAdapter extends SocketListener
{
private final static String propertiesFile = "MonitoringContentAdapter";
private SubscriptionService smClient;
7. Define the constructor method for this class, call the parent constructor to
listen for incoming connection on the specified port, and create a Subscription
Manager client remote instance (which is necessary to publish the content
source into the Subscription Manager).
The method createRemoteSmClient belongs to SmClientFactory class and
allows you to create a remote Subscription Manager client. If a parameter is
not specified, this method uses the default context provider URL
corbaloc:iiop:localhost:2809.
The context provider URL is specified in the XML file insBaseConfig.xml
located in ins_home\config\xml, where ins_home is the Intelligent Notification