KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > remoting > network > NetworkNotification


1 /***************************************
2  * *
3  * JBoss: The OpenSource J2EE WebOS *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  ***************************************/

9 package org.jboss.remoting.network;
10
11 import javax.management.Notification JavaDoc;
12 import javax.management.ObjectName JavaDoc;
13 import org.jboss.remoting.InvokerLocator;
14 import org.jboss.remoting.detection.ServerInvokerMetadata;
15 import org.jboss.remoting.ident.Identity;
16
17 /**
18  * NetworkNotification is a JMX Notification that is sent when changes occur to the network layout as
19  * tracked by a NetworkRegistryMBean.
20  *
21  * @author <a HREF="mailto:jhaynie@vocalocity.net">Jeff Haynie</a>
22  * @version $Revision: 1.3 $
23  */

24 public class NetworkNotification extends Notification JavaDoc
25 {
26    public static final String JavaDoc SERVER_ADDED = "jboss.network.server.added";
27    public static final String JavaDoc SERVER_UPDATED = "jboss.network.server.updated";
28    public static final String JavaDoc SERVER_REMOVED = "jboss.network.server.removed";
29    public static final String JavaDoc DOMAIN_CHANGED = "jboss.network.domain.changed";
30
31    private final Identity identity;
32    private final ServerInvokerMetadata serverInvokers[];
33    private final InvokerLocator locators[];
34
35
36    public NetworkNotification(ObjectName JavaDoc source, String JavaDoc type, Identity identity, ServerInvokerMetadata serverInvokers[])
37    {
38       super(type, source, System.currentTimeMillis());
39       this.identity = identity;
40       this.serverInvokers = serverInvokers;
41       this.locators = null;
42    }
43
44    public NetworkNotification(ObjectName JavaDoc source, String JavaDoc type, Identity identity, InvokerLocator locators[])
45    {
46       super(type, source, System.currentTimeMillis());
47       this.identity = identity;
48       this.serverInvokers = null;
49       this.locators = locators;
50    }
51
52    /**
53     * return the identity of the notification
54     *
55     * @return
56     */

57    public final Identity getIdentity()
58    {
59       return identity;
60    }
61
62    /**
63     * return the locators affected by the notification
64     *
65     * @return
66     */

67    public final InvokerLocator[] getLocator()
68    {
69       if(locators != null)
70       {
71          return locators;
72       }
73       else
74       {
75          InvokerLocator[] locators = new InvokerLocator[serverInvokers.length];
76          for(int x = 0; x < serverInvokers.length; x++)
77          {
78             locators[x] = serverInvokers[x].getInvokerLocator();
79          }
80          return locators;
81       }
82    }
83
84    /**
85     * Gets all the server invoker metadata for the servers running on
86     * specified server. Will include locator and supported subsystems
87     * for that locator.
88     *
89     * @return
90     */

91    public final ServerInvokerMetadata[] getServerInvokers()
92    {
93       return serverInvokers;
94    }
95 }
96
Popular Tags