KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > mx > notification > MBeanServerListenerRegistrationFactory


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.mx.notification;
23
24 import javax.management.NotificationBroadcaster JavaDoc;
25 import javax.management.NotificationFilter JavaDoc;
26 import javax.management.NotificationListener JavaDoc;
27 import javax.management.ObjectName JavaDoc;
28
29 /**
30  * The listener registration factory to create registrations
31  * in the mbeanserver for an object name.
32  *
33  * @see org.jboss.mx.notification.ListenerRegistry
34  * @see org.jboss.mx.notification.ListenerRegistration
35  *
36  * @author <a HREF="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>.
37  * @version $Revision: 37459 $
38  */

39 public class MBeanServerListenerRegistrationFactory
40    implements ListenerRegistrationFactory
41 {
42    /**
43     * The object name
44     */

45    private ObjectName JavaDoc name;
46
47    /**
48     * The broadcaster
49     */

50    private NotificationBroadcaster JavaDoc broadcaster;
51
52    /**
53     * Construct a listener registration factory for the given object name
54     *
55     * @param name the object name
56     * @param name the notification broadcaster
57     * @exception IllegalArgumentException for a null object name
58     */

59    public MBeanServerListenerRegistrationFactory(ObjectName JavaDoc name, NotificationBroadcaster JavaDoc broadcaster)
60    {
61       if (name == null)
62          throw new IllegalArgumentException JavaDoc("Null name");
63       this.name = name;
64       this.broadcaster = broadcaster;
65    }
66
67    public ListenerRegistration create(NotificationListener JavaDoc listener,
68                                       NotificationFilter JavaDoc filter,
69                                       Object JavaDoc handback)
70    {
71       return new MBeanServerListenerRegistration(name, broadcaster, listener, filter, handback);
72    }
73 }
74
Popular Tags