KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > tools > remote > http > HTTPConnectionHandler


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.tools.remote.http;
10
11 import java.io.IOException JavaDoc;
12
13 import javax.management.InstanceNotFoundException JavaDoc;
14 import javax.management.ListenerNotFoundException JavaDoc;
15 import javax.management.ObjectName JavaDoc;
16 import javax.management.remote.NotificationResult JavaDoc;
17 import javax.security.auth.Subject JavaDoc;
18
19 import mx4j.tools.remote.ConnectionManager;
20 import mx4j.tools.remote.JMXConnection;
21 import mx4j.tools.remote.JMXConnectionHandler;
22
23 /**
24  * @version $Revision: 1.4 $
25  */

26 public class HTTPConnectionHandler extends JMXConnectionHandler implements HTTPConnection
27 {
28    public HTTPConnectionHandler(JMXConnection connection, ConnectionManager manager, String JavaDoc connectionId)
29    {
30       super(connection, manager, connectionId);
31    }
32
33    public String JavaDoc connect(Object JavaDoc credentials) throws IOException JavaDoc, SecurityException JavaDoc
34    {
35       throw new Error JavaDoc("Method connect() must not be forwarded to the invocation chain");
36    }
37
38    public Integer JavaDoc addNotificationListener(ObjectName JavaDoc name, Object JavaDoc filter, Subject JavaDoc delegate) throws InstanceNotFoundException JavaDoc, IOException JavaDoc
39    {
40       if (isClosed()) throw new IOException JavaDoc("Connection has been closed");
41       return ((HTTPConnection)getConnection()).addNotificationListener(name, filter, delegate);
42    }
43
44    public void removeNotificationListeners(ObjectName JavaDoc name, Integer JavaDoc[] listenerIDs, Subject JavaDoc delegate) throws InstanceNotFoundException JavaDoc, ListenerNotFoundException JavaDoc, IOException JavaDoc
45    {
46       if (isClosed()) throw new IOException JavaDoc("Connection has been closed");
47       ((HTTPConnection)getConnection()).removeNotificationListeners(name, listenerIDs, delegate);
48    }
49
50    public NotificationResult JavaDoc fetchNotifications(long clientSequenceNumber, int maxNotifications, long timeout) throws IOException JavaDoc
51    {
52       if (isClosed()) throw new IOException JavaDoc("Connection has been closed");
53       return ((HTTPConnection)getConnection()).fetchNotifications(clientSequenceNumber, maxNotifications, timeout);
54    }
55 }
56
Popular Tags