public static JBossASServerConfig locate() { if (instance == null) { instance = (JBossASServerConfig) MBeanProxyExt.create(JBossASServerConfig.class, ServerConfigImplMBean.OBJECT_NAME); } return instance; } }
ClassLoader cl = (ClassLoader) AccessController.doPrivileged(action); Class[] ifaces = {MBeanProxyInstance.class, intf}; InvocationHandler handler = new MBeanProxyExt(name, server, lazyInit); return Proxy.newProxyInstance(cl, ifaces, handler);
/** * Construct an MBeanProxy. */ MBeanProxyExt(final ObjectName name, final MBeanServer server, boolean lazyInit) { this.name = name; this.server = server; if (lazyInit == false) init(); }
public JmxKernelAbstraction(MBeanServer server) { super(server); serviceController = (ServiceControllerMBean) MBeanProxyExt.create(ServiceControllerMBean.class, ServiceControllerMBean.OBJECT_NAME, server); }
/** * Create an MBean proxy. * @param intf The interface which the proxy will implement. * @param name The name of the MBean to proxy invocations to. * @param server The MBeanServer that contains the MBean to proxy to. * @return A MBean proxy. */ public static Object create(final Class intf, final ObjectName name, final MBeanServer server) { return create(intf, name, server, false); }
/** * Create an MBean proxy. * @param intf The interface which the proxy will implement. * @param name A string used to construct the ObjectName of the MBean to * proxy to. * @return A MBean proxy. * @throws javax.management.MalformedObjectNameException Invalid object * name. */ public static Object create(final Class intf, final String name) throws MalformedObjectNameException { return create(intf, new ObjectName(name)); }
public MBeanDelegate(MBeanServer server) { try { mbeanEjbTimerService = (EJBTimerService)MBeanProxyExt.create(EJBTimerService.class, EJBTimerService.OBJECT_NAME, server); } catch (Exception e) { throw new IllegalStateException("Cannot create EJBTimerService proxy: " + e.getMessage()); } }
/** * Create an MBean proxy. * @param intf The interface which the proxy will implement. * @param name A string used to construct the ObjectName of the MBean to * proxy to. * @param server The MBeanServer that contains the MBean to proxy to. * @return A MBean proxy. * @throws javax.management.MalformedObjectNameException Invalid object * name. */ public static Object create(final Class intf, final String name, final MBeanServer server) throws MalformedObjectNameException { return create(intf, new ObjectName(name), server); }
/** * Create an MBean proxy. * @param intf The interface which the proxy will implement. * @param name The name of the MBean to proxy invocations to. * @return A MBean proxy. */ public static Object create(final Class intf, final ObjectName name) { return create(intf, name, MBeanServerLocator.locateJBoss()); }
public static CoreServerMBean getCoreServer() { MBeanServer mbs = getJBossMBeanServer(); CoreServerMBean rhqServer = (CoreServerMBean) MBeanProxyExt.create(CoreServerMBean.class, CoreServerMBean.OBJECT_NAME, mbs); return rhqServer; }
protected EJBTimerService getEJBTimerService() { return (EJBTimerService) MBeanProxyExt.create(EJBTimerService.class, EJBTimerService.OBJECT_NAME, MBeanServerLocator.locateJBoss()); }
public void startService() { this.mbeanServer = MBeanServerFactory.createMBeanServer(); MBeanProxyExt.create(SleeManagementMBeanImplMBean.class, objectName, this.mbeanServer); }
public static PluginDeploymentScannerMBean getPluginDeploymentScanner() { MBeanServer jBossMBeanServer = getJBossMBeanServer(); PluginDeploymentScannerMBean scanner = (PluginDeploymentScannerMBean) MBeanProxyExt.create( PluginDeploymentScannerMBean.class, PluginDeploymentScannerMBean.OBJECT_NAME, jBossMBeanServer); return scanner; }
public static ServerPluginServiceMBean getServerPluginService() { MBeanServer jBossMBeanServer = getJBossMBeanServer(); ServerPluginServiceMBean service = (ServerPluginServiceMBean) MBeanProxyExt.create( ServerPluginServiceMBean.class, ServerPluginServiceMBean.OBJECT_NAME, jBossMBeanServer); return service; }
/** * Get a reference to the ServiceController */ protected void startService() throws Exception { serviceController = (ServiceControllerMBean) MBeanProxyExt.create(ServiceControllerMBean.class, ServiceControllerMBean.OBJECT_NAME, server); sleeManagementMBean = (SleeManagementMBeanImplMBean) MBeanProxyExt.create(SleeManagementMBeanImplMBean.class, sleeManagementMBeanName, server); sleeDeploymentMBean = (DeploymentMBean) MBeanProxyExt.create(DeploymentMBean.class, sleeManagementMBean.getDeploymentMBean(), server); resourceManagementMBean = (ResourceManagementMBean) MBeanProxyExt.create(ResourceManagementMBean.class, sleeManagementMBean.getResourceManagementMBean(), server); serviceManagementMBean = (ServiceManagementMBean) MBeanProxyExt.create(ServiceManagementMBean.class, sleeManagementMBean.getServiceManagementMBean(), server); // register with MainDeployer super.startService(); }
public void inject(Object instance) { Class clazz = field.getType(); Object value = null; if (clazz == ObjectName.class) { value = on; } else { MBeanServer server = MBeanServerLocator.locateJBoss(); value = MBeanProxyExt.create(clazz, on, server); } try { field.set(instance, value); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
public void inject(Object instance) { Class clazz = method.getParameterTypes()[0]; Object value = null; if (clazz == ObjectName.class) { value = on; } else { MBeanServer server = MBeanServerLocator.locateJBoss(); value = MBeanProxyExt.create(clazz, on, server); } try { method.invoke(instance, value); } catch (InvocationTargetException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
/** * Creates a JMX proxy PojoCacheMBean for the given object name. * * @param objectName the object name * @return the proxy * @throws ClusteringNotSupportedException if there is a problem */ private static PojoCacheMBean getPojoCacheMBean(String objectName) throws ClusteringNotSupportedException { try { ObjectName cacheServiceName = new ObjectName(objectName); // Create Proxy-Object for this service return (PojoCacheMBean) MBeanProxyExt.create(PojoCacheMBean.class, cacheServiceName); } catch (Throwable t) { String str = "Could not access TreeCache service " + (objectName == null ? "<null>" : objectName) + " for Tomcat clustering"; log_.debug(str); throw new ClusteringNotSupportedException(str, t); } }
protected void initEntityCommand(JDBCEntityCommandMetaData entityCommand) throws DeploymentException { String objectName = entityCommand.getAttribute("SQLExceptionProcessor"); if(objectName != null) { try { exceptionProcessor = (SQLExceptionProcessorMBean) MBeanProxyExt.create(SQLExceptionProcessorMBean.class, objectName); } catch(MalformedObjectNameException e) { throw new DeploymentException("Invalid object name for SQLExceptionProcessor: ", e); } } }