KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > management > base > NotificationEmitterService


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.appserv.management.base;
25
26 import javax.management.Notification JavaDoc;
27 import javax.management.NotificationEmitter JavaDoc;
28
29 /**
30     Enables the emitting of JMX Notifications by any code with
31     access to an MBean implementing this interfaces. Targeted for use by
32     server code which has no corresponding MBean from which to emit
33     a Notification.
34     <p>
35     @since AppServer 9.0
36  */

37 public interface NotificationEmitterService
38     extends AMX
39 {
40     /** The j2eeType as returned by {@link com.sun.appserv.management.base.AMX#getJ2EEType}. */
41     public static final String JavaDoc J2EE_TYPE = XTypes.NOTIFICATION_EMITTER_SERVICE;
42     
43     /**
44         Emit an already-formed Notification. Any entity may invoke
45         this method, even clients, but by convention only server
46         code should do so.
47         <p>
48         Notifications emitted through this method usually return
49         an Object from getSource() which is not an ObjectName; if an
50         ObjectName is available then the Notification should usually be
51         emitted by that MBean directly. There may be exceptions to this,
52         for example Notifications emitted on behalf of MBeans found in
53         remote server instances. Otherwise, by convention getSource()
54         should return a String representing the source, and the same
55         String should always be used for the same source. Furthermore,
56         the String should never be translated so that the same source
57         will be seen regardless of the language in which the server
58         is running.
59         <p>
60         Notifications are not checked for duplication; callers should
61         ensure that for any given source (as returned from Notification.getSource())
62         that the sequence number is monotonically increasing.
63         <p>
64         Excluding standard JMX Notification types, Notifications emitted
65         by an AMX MBean implementing this interface must follow the AMX conventions:
66         <ul>
67         <li>getUserData() must return a java.util.Map (possibly null)</li>
68         <li>the Notification as a whole must be Serializable</li>
69         <li>for instances of this interface which are part of AMX,
70             getType() must return a String defined in an AMX interface.</li>
71         </ul>
72         <p>
73         @param notif
74         @see com.sun.appserv.management.util.jmx.NotificationBuilder
75         
76      */

77     public void emitNotification( Notification JavaDoc notif );
78     
79     /**
80         @return number of listeners
81      */

82     public int getListenerCount();
83 }
84
Popular Tags