KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jmx > remote > internal > ListenerInfo


1 /*
2  * @(#)ListenerInfo.java 1.4 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.jmx.remote.internal;
9
10 import javax.management.NotificationFilter JavaDoc;
11 import javax.management.NotificationListener JavaDoc;
12 import javax.management.ObjectName JavaDoc;
13
14 import javax.security.auth.Subject JavaDoc;
15
16
17 /**
18  * <p>An identified listener. A listener has an Integer id that is
19  * unique per connector server. It selects notifications based on the
20  * ObjectName of the originator and an optional
21  * NotificationFilter.</p>
22  *
23  * <p>Two ListenerInfo objects are considered equal if and only if
24  * they have the same listenerId. This means that ListenerInfo
25  * objects can be stored in a Set or Map and retrieved using another
26  * ListenerInfo with the same listenerId but arbitrary ObjectNme and
27  * NotificationFilter values.</p>
28  */

29 public class ListenerInfo {
30     public ListenerInfo(Integer JavaDoc listenerID,
31             ObjectName JavaDoc name,
32             NotificationFilter JavaDoc filter) {
33     this.listenerID = listenerID;
34     this.name = name;
35     this.filter = filter;
36     }
37
38     public ListenerInfo(Integer JavaDoc listenerID,
39             ObjectName JavaDoc name,
40             NotificationListener JavaDoc listener,
41             NotificationFilter JavaDoc filter,
42             Object JavaDoc handback,
43             Subject JavaDoc delegationSubject) {
44     this.listenerID = listenerID;
45     this.name = name;
46     this.listener = listener;
47     this.filter = filter;
48     this.handback = handback;
49     this.delegationSubject = delegationSubject;
50     }
51
52     public boolean equals(Object JavaDoc o) {
53     if (!(o instanceof ListenerInfo)) {
54         return false;
55     }
56
57     return listenerID.equals(((ListenerInfo)o).listenerID);
58     }
59
60     public int hashCode() {
61     return listenerID.intValue();
62     }
63
64     public ObjectName JavaDoc getObjectName() {
65     return name;
66     }
67
68     public Integer JavaDoc getListenerID() {
69     return listenerID;
70     }
71
72     public NotificationFilter JavaDoc getNotificationFilter() {
73     return filter;
74     }
75
76     public NotificationListener JavaDoc getListener() {
77     return listener;
78     }
79
80     public Object JavaDoc getHandback() {
81     return handback;
82     }
83
84     public Subject JavaDoc getDelegationSubject() {
85     return delegationSubject;
86     }
87
88     private ObjectName JavaDoc name;
89     private Integer JavaDoc listenerID;
90     private NotificationFilter JavaDoc filter;
91
92     private NotificationListener JavaDoc listener = null;
93     private Object JavaDoc handback = null;
94     private Subject JavaDoc delegationSubject = null;
95 }
96
Popular Tags