KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > model > J2EEEventProviderMOMdl


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.enterprise.management.model;
25
26 import javax.management.*;
27 import java.util.Set JavaDoc;
28 import java.util.HashSet JavaDoc;
29 import javax.management.j2ee.Management JavaDoc;
30 import javax.management.j2ee.ManagementHome JavaDoc;
31 //import javax.rmi.PortableRemoteObject;
32
import javax.naming.*;
33
34 /**
35  * The base class for Managed Objects that are event providers
36  */

37
38 public abstract class J2EEEventProviderMOMdl extends J2EEManagedObjectMdl implements NotificationBroadcaster {
39     
40     private NotificationBroadcasterSupport broadcaster;
41     private boolean debug = false;
42     public J2EEEventProviderMOMdl(String JavaDoc name,boolean state, boolean statistics) {
43         super(name,state,statistics,true);
44         broadcaster = new NotificationBroadcasterSupport();
45     }
46     public void addNotificationListener(NotificationListener listener,
47                                     NotificationFilter filter,
48                                     java.lang.Object JavaDoc handback){
49         if(debug)System.out.println("J2EEEventPRoviderMOMdl::addNotificationListener listener added:"+listener);
50         broadcaster.addNotificationListener(listener,filter,handback);
51     }
52     public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException{
53         broadcaster.removeNotificationListener(listener);
54     }
55     public MBeanNotificationInfo[] getNotificationInfo(){
56         return broadcaster.getNotificationInfo();
57     }
58     public void sendNotification(Notification notification){
59         if(debug)System.out.println("J2EEEventPRoviderMOMdl::sendNotification sending notification"+notification);
60         broadcaster.sendNotification(notification);
61     }
62 }
63
Popular Tags