01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package mx4j.remote;
10:
11: import java.io.IOException;
12: import javax.management.NotificationFilter;
13: import javax.management.NotificationListener;
14: import javax.management.ObjectName;
15: import javax.management.remote.NotificationResult;
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: * Returns a unique ID for a client-side NotificationListener
28: *
29: * @see #addNotificationListener
30: */
31: public Integer generateListenerID(ObjectName name,
32: NotificationFilter filter);
33:
34: /**
35: * Returns the unique server side listener that will represent client-side listeners
36: * on MBeans.
37: */
38: public NotificationListener 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 id,
46: NotificationTuple tuple);
47:
48: /**
49: * Removes the listener with the given ID from this handler
50: *
51: * @see #addNotificationListener
52: */
53: public NotificationTuple removeNotificationListener(Integer id);
54:
55: /**
56: * Fetches notifications from the notification buffer in order to send them
57: * to the client side
58: *
59: * @throws IOException If this handler has already been closed
60: */
61: public NotificationResult fetchNotifications(long sequenceNumber,
62: int maxNotifications, long timeout) throws IOException;
63:
64: /**
65: * Closes this handler, that will not accept anymore add or removal of listeners
66: *
67: * @return The NotificationTuples currently held
68: * @see #fetchNotifications
69: */
70: public NotificationTuple[] close();
71: }
|