KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > remote > RemoteNotificationServerHandler


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package mx4j.remote;
10
11 import java.io.IOException JavaDoc;
12 import javax.management.NotificationFilter JavaDoc;
13 import javax.management.NotificationListener JavaDoc;
14 import javax.management.ObjectName JavaDoc;
15 import javax.management.remote.NotificationResult JavaDoc;
16
17 /**
18  * Handles remote notification sending on server side.
19  * It takes care of collecting requests for listener addition and removal, and to send
20  * notifications back to the client side.
21  *
22  * @version $Revision: 1.7 $
23  * @see RemoteNotificationClientHandler
24  */

25 public interface RemoteNotificationServerHandler
26 {
27    /**
28     * Returns a unique ID for a client-side NotificationListener
29     *
30     * @see #addNotificationListener
31     */

32    public Integer JavaDoc generateListenerID(ObjectName JavaDoc name, NotificationFilter JavaDoc filter);
33
34    /**
35     * Returns the unique server side listener that will represent client-side listeners
36     * on MBeans.
37     */

38    public NotificationListener JavaDoc getServerNotificationListener();
39
40    /**
41     * Adds the given tuple with the given listener ID to this handler
42     *
43     * @see #removeNotificationListener
44     */

45    public void addNotificationListener(Integer JavaDoc id, NotificationTuple tuple);
46
47    /**
48     * Removes the listener with the given ID from this handler
49     *
50     * @see #addNotificationListener
51     */

52    public NotificationTuple removeNotificationListener(Integer JavaDoc id);
53
54    /**
55     * Fetches notifications from the notification buffer in order to send them
56     * to the client side
57     *
58     * @throws IOException If this handler has already been closed
59     */

60    public NotificationResult JavaDoc fetchNotifications(long sequenceNumber, int maxNotifications, long timeout) throws IOException JavaDoc;
61
62    /**
63     * Closes this handler, that will not accept anymore add or removal of listeners
64     *
65     * @return The NotificationTuples currently held
66     * @see #fetchNotifications
67     */

68    public NotificationTuple[] close();
69 }
70
Popular Tags