Nuxeo Enterprise Platform 5.1

org.nuxeo.runtime.jboss.util
Class ServiceLocator

java.lang.Object
  extended by org.nuxeo.runtime.jboss.util.ServiceLocator

public final class ServiceLocator
extends Object

Helper class to locate MBean services.

Author:
Bogdan Stefanescu

Method Summary
static Object create(Class instance, Class intrface, ObjectName name, MBeanServer server)
          Convenience method for registering an MBean and retrieving a proxy for it.
static Object create(Class instance, Class intrface, ObjectName name, String agentID)
          Convenience method for registering an MBean and retrieving a proxy for it.
static Object get(Class intrface, ObjectName name, MBeanServer server)
          Creates a proxy to an MBean in the given MBean server.
static Object get(Class intrface, ObjectName name, String agentID)
          Creates a proxy to an MBean in the given MBean server.
static Object get(ObjectName name, MBeanServer server)
           
static ClassLoader getClassLoader()
           
static MBeanServer getJBoss()
          Gets the JBoss MBeanServer.
static org.jboss.system.server.ServerConfig getJBossConfiguration()
          Gets the JBoss configuration service.
static Object getService(Class itf, ObjectName name)
          Locates the given service and return it as the given interface.
static Object getService(Class itf, String name)
           
static Object getService(ObjectName name)
          Locates and return the named MBean service.
static Object getService(String name)
           
static org.jboss.system.ServiceControllerMBean getServiceController()
           
static void setClassLoader(ClassLoader cl)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setClassLoader

public static void setClassLoader(ClassLoader cl)

getClassLoader

public static ClassLoader getClassLoader()

getJBoss

public static MBeanServer getJBoss()
Gets the JBoss MBeanServer.

Returns:
the MBean JBoss server

getServiceController

public static org.jboss.system.ServiceControllerMBean getServiceController()

getService

public static Object getService(ObjectName name)
                         throws org.jboss.mx.util.MBeanProxyCreationException
Locates and return the named MBean service.

Parameters:
name - the service name
Returns:
A proxy to the named Mbean
Throws:
org.jboss.mx.util.MBeanProxyCreationException

getService

public static Object getService(String name)
                         throws org.jboss.mx.util.MBeanProxyCreationException,
                                MalformedObjectNameException
Throws:
org.jboss.mx.util.MBeanProxyCreationException
MalformedObjectNameException

getService

public static Object getService(Class itf,
                                String name)
                         throws org.jboss.mx.util.MBeanProxyCreationException,
                                MalformedObjectNameException
Throws:
org.jboss.mx.util.MBeanProxyCreationException
MalformedObjectNameException

getService

public static Object getService(Class itf,
                                ObjectName name)
                         throws org.jboss.mx.util.MBeanProxyCreationException
Locates the given service and return it as the given interface.

Parameters:
itf - the interface
name - the MBean name
Returns:
a proxy to the named MBean implementing the given interface
Throws:
org.jboss.mx.util.MBeanProxyCreationException

getJBossConfiguration

public static org.jboss.system.server.ServerConfig getJBossConfiguration()
Gets the JBoss configuration service.

Returns:
the jboss config service

get

public static Object get(Class intrface,
                         ObjectName name,
                         String agentID)
                  throws org.jboss.mx.util.MBeanProxyCreationException
Creates a proxy to an MBean in the given MBean server.

Parameters:
intrface - the interface this proxy implements
name - object name of the MBean this proxy connects to
agentID - agent ID of the MBean server this proxy connects to
Returns:
proxy instance
Throws:
org.jboss.mx.util.MBeanProxyCreationException - if the proxy could not be created

get

public static Object get(Class intrface,
                         ObjectName name,
                         MBeanServer server)
                  throws org.jboss.mx.util.MBeanProxyCreationException
Creates a proxy to an MBean in the given MBean server.

Parameters:
intrface - the interface this proxy implements
name - object name of the MBean this proxy connects to
server - MBean server this proxy connects to
Returns:
proxy instance
Throws:
org.jboss.mx.util.MBeanProxyCreationException - if the proxy could not be created

get

public static Object get(ObjectName name,
                         MBeanServer server)
                  throws org.jboss.mx.util.MBeanProxyCreationException
Throws:
org.jboss.mx.util.MBeanProxyCreationException

create

public static Object create(Class instance,
                            Class intrface,
                            ObjectName name,
                            String agentID)
                     throws org.jboss.mx.util.MBeanProxyCreationException
Convenience method for registering an MBean and retrieving a proxy for it.

Parameters:
instance - MBean instance to be registered
intrface - the interface this proxy implements
name - object name of the MBean
agentID - agent ID of the MBean server this proxy connects to
Returns:
proxy instance
Throws:
org.jboss.mx.util.MBeanProxyCreationException - if the proxy could not be created

create

public static Object create(Class instance,
                            Class intrface,
                            ObjectName name,
                            MBeanServer server)
                     throws org.jboss.mx.util.MBeanProxyCreationException
Convenience method for registering an MBean and retrieving a proxy for it.

Parameters:
instance - MBean instance to be registered
intrface - the interface this proxy implements
name - object name of the MBean
server - MBean server this proxy connects to
Throws:
org.jboss.mx.util.MBeanProxyCreationException - if the proxy could not be created

Nuxeo Enterprise Platform 5.1

Copyright ? 2007 Nuxeo SAS. All Rights Reserved.