KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.Set JavaDoc;
12 import javax.management.MBeanServer JavaDoc;
13 import javax.management.ObjectInstance JavaDoc;
14 import javax.management.ObjectName JavaDoc;
15
16 /**
17  * NetworkRegistryFinder is a utility class for finding the ObjectName to the NetworkRegistryMBean
18  *
19  * @author <a HREF="mailto:jhaynie@vocalocity.net">Jeff Haynie</a>
20  * @version $Revision: 1.2 $
21  */

22 public class NetworkRegistryFinder
23 {
24    /**
25     * find the ObjectName to the NetworkRegistryMBean instance on the MBeanServer
26     *
27     * @param server
28     * @return
29     */

30    public static ObjectName JavaDoc find(MBeanServer JavaDoc server)
31    {
32       Set JavaDoc set = server.queryMBeans(null, new NetworkRegistryQuery());
33       if(set.isEmpty())
34       {
35          return null;
36       }
37       return ((ObjectInstance JavaDoc) set.iterator().next()).getObjectName();
38    }
39 }
40
Popular Tags