Spring Framework MBeanExporter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework MBeanExporter class.

This code example shows how to use the following methods:afterPropertiesSet, afterSingletonsInstantiated
 
	/** 
	 * Start the specified {@link MBeanExporter}. 
	 */ 
	protected void start(MBeanExporter exporter) {
		exporter.afterPropertiesSet();
		exporter.afterSingletonsInstantiated();
	} 
 
	protected void assertIsRegistered(String message, ObjectName objectName) {
		assertTrue(message, getServer().isRegistered(objectName));
	} 
 
	protected void assertIsNotRegistered(String message, ObjectName objectName) {
		assertFalse(message, getServer().isRegistered(objectName));
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:createAndConfigureMBean, doRegister, isMBean
     */ 
    @SuppressWarnings("unchecked") 
    public ObjectName registerMBean(Object managedResource, ObjectName objectName)
    { 
        Object mbean;
        if (isMBean(managedResource.getClass()))
        { 
            mbean = managedResource;
        } 
        else 
        { 
            mbean = createAndConfigureMBean(managedResource, managedResource.getClass().getName());
        } 
        ObjectName actualObjectName = objectName;
        try 
        { 
            doRegister(mbean, actualObjectName);
        } 
        catch (JMException e)
        { 

6
CodeRank
This code example shows how to use the following methods:setBeanFactory
This code example shows how to use the following methods:getServer
This code example shows how to use the following methods:registerManagedResource
    } 
 
    public void registerMBean(String objectName, Object bean) {
    	try { 
    		ObjectName oName = new ObjectName(objectName);
    		exporter.registerManagedResource(bean, oName);
    	} catch (MalformedObjectNameException e) {
    		throw new IllegalStateException("Unable to register MBean", e);
    	} 
    } 
 
    /** 
     * Utility to retrieve a JMXControl bean from the given application context. 
     * <p> 
     * This is intended to be used by client code that needs to store a reference to the bean, but 
     * can't take the bean as an up-front injected dependency, because it would cause circular 
     * references. Can call this method after getting the context via a post-initialisation event. 
     */ 
    public static JMXControl getFromContext(ApplicationContext ctx) {
    	// will throw an RTE if it's not there, which we can live with 
3
CodeRank
This code example shows how to use the following methods:
import javax.management.ObjectName; 
 
import org.springframework.jmx.export.MBeanExportException; 
import org.springframework.jmx.export.MBeanExporter; 
 
public class MockMBeanExporter extends MBeanExporter { 
 
	@Override 
	public void registerManagedResource(Object arg0, ObjectName arg1) 
			throws MBeanExportException { 
		// no-op 
	} 
 
} 
4
CodeRank
See Code Examples for Spring Framework MBeanExporter Methods: