/** */ public static Object get(ObjectName name, MBeanServer server) throws MBeanProxyCreationException { return get(new Class[] { ProxyContext.class, DynamicMBean.class }, name, server); }
/** * Convenience method for registering an MBean and retrieving a proxy for it. * * @param instance MBean instance to be registered * @param intrface the interface this proxy implements * @param name object name of the MBean * @param agentID agent ID of the MBean server this proxy connects to * * @return proxy instance * * @throws MBeanProxyCreationException if the proxy could not be created */ public static Object create(Class instance, Class intrface, ObjectName name, String agentID) throws MBeanProxyCreationException { return create(instance, intrface, name, (MBeanServer)MBeanServerFactory.findMBeanServer(agentID).get(0)); }
public void startService() throws Exception { mgmt = (SleeManagementMBeanImplMBean)MBeanProxy.get(SleeManagementMBeanImplMBean.class, sleeManagementMBeanName, server); } }
/** * Creates a proxy to an MBean in the given MBean server. * * @param intrface the interface this proxy implements * @param name object name of the MBean this proxy connects to * @param server MBean server this proxy connects to * * @return proxy instance * * @throws MBeanProxyCreationException if the proxy could not be created */ public static Object get(Class intrface, ObjectName name, MBeanServer server) throws MBeanProxyCreationException { return get(new Class[] { intrface, ProxyContext.class, DynamicMBean.class }, name, server); }
/** * Creates a proxy to an MBean in the given MBean server. * * @param intrface the interface this proxy implements * @param name object name of the MBean this proxy connects to * @param agentID agent ID of the MBean server this proxy connects to * * @return proxy instance * * @throws MBeanProxyCreationException if the proxy could not be created */ public static Object get(Class intrface, ObjectName name, String agentID) throws MBeanProxyCreationException { return get(intrface, name, (MBeanServer)MBeanServerFactory.findMBeanServer(agentID).get(0)); }
/** Create the deployer service */ protected void createService() throws Exception { mainDeployer = (MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME, server); super.attach(); }
private MainDeployerMBean getMainDeployer() throws MBeanProxyCreationException { MBeanServer server = MBeanServerLocator.locateJBoss(); MainDeployerMBean mainDeployer = (MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME, server); return mainDeployer; } }
private MainDeployerMBean getMainDeployer() throws MBeanProxyCreationException { MBeanServer server = MBeanServerLocator.locateJBoss(); MainDeployerMBean mainDeployer = (MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME, server); return mainDeployer; } }
public Object run() throws Exception { Object proxy = MBeanProxy.get(iface, name, server); Class[] ifaces = {iface}; InvocationHandler secureHandler = new InvocationHandlerAction(proxy); Object secureProxy = Proxy.newProxyInstance(iface.getClassLoader(), ifaces, secureHandler); return secureProxy; } }
/** Create the deployer service */ protected void createService() throws Exception { mainDeployer = (MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME, server); super.attach(); }
/** Create the deployer service */ protected void createService() throws Exception { mainDeployer = (MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME, server); super.attach(); }
private MainDeployerMBean getMainDeployer() throws MBeanProxyCreationException { MBeanServer server = MBeanServerLocator.locateJBoss(); MainDeployerMBean mainDeployer = (MainDeployerMBean)MBeanProxy.get(MainDeployerMBean.class, MainDeployerMBean.OBJECT_NAME, server); return mainDeployer; } }
private void startRMIServer(NullActivityFactoryImpl naf, SleeInternalEndpoint endpoint, EventLookup eventLookup, ObjectName rmiServerInterfaceMBean) { try { logger.debug("creating RmiServerInterface using MBeanProxy"); rmiServerInterfaceMBeanImpl = (RmiServerInterfaceMBean) MBeanProxy .get(RmiServerInterfaceMBean.class, rmiServerInterfaceMBean, mbeanServer); rmiServerInterfaceMBeanImpl.startRMIServer(naf, endpoint, eventLookup, activityContextFactory); } catch (Exception e) { logger.error( "Failed to start HA RMI server for Remote slee service", e); } }
static Object getMBeanProxy(Class iface, ObjectName name, MBeanServer server) throws Exception { Object proxy; if( System.getSecurityManager() == null ) { proxy = MBeanProxy.get(iface, name, server); } else { MBeanProxyAction action = new MBeanProxyAction(iface, name, server); proxy = AccessController.doPrivileged(action); } return proxy; } static ClassLoader getContextClassLoader()
/** * Return a MBean specified by its class and lookup name using JBoss JMX utilities. * @throws NullPointerException * @throws MBeanProxyCreationException * @throws MalformedObjectNameException * @see org.jboss.mx.util.MBeanProxy * @see org.jboss.mx.util.MBeanServerLocator */ public static <T> T findMBean(Class<T> type, String lookupName) { try { MBeanServer mbeanServer = MBeanServerLocator.locateJBoss(); Object mbean = MBeanProxy.get(type, new ObjectName(lookupName), mbeanServer); return type.cast(mbean); } catch( Exception e){ throw new RuntimeException(e); } }
/** Add the hooks to the interceptors */ public void start() { MBeanServer server = MBeanServerLocator.locateJBoss(); try { if (phaseOneInterceptors != null) { for (ObjectName oname : phaseOneInterceptors) { DeployerInterceptorMBean interceptor = (DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server); interceptor.addPhaseOneHook(this); } } if (phaseTwoInterceptors != null) { for (ObjectName oname : phaseTwoInterceptors) { DeployerInterceptorMBean interceptor = (DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server); interceptor.addPhaseTwoHook(this); } } } catch (MBeanProxyCreationException e) { throw new WSFDeploymentException(e); } }
/** Add the hooks to the interceptors */ public void stop() { MBeanServer server = MBeanServerLocator.locateJBoss(); try { if (phaseOneInterceptors != null) { for (ObjectName oname : phaseOneInterceptors) { DeployerInterceptorMBean interceptor = (DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server); interceptor.removePhaseOneHook(this); } } if (phaseTwoInterceptors != null) { for (ObjectName oname : phaseTwoInterceptors) { DeployerInterceptorMBean interceptor = (DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server); interceptor.removePhaseTwoHook(this); } } } catch (MBeanProxyCreationException e) { throw new WSFDeploymentException(e); } }
/** Add the hooks to the interceptors */ public void start() { MBeanServer server = MBeanServerLocator.locateJBoss(); try { if (phaseOneInterceptors != null) { for (ObjectName oname : phaseOneInterceptors) { DeployerInterceptorMBean interceptor = (DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server); interceptor.addPhaseOneHook(this); } } if (phaseTwoInterceptors != null) { for (ObjectName oname : phaseTwoInterceptors) { DeployerInterceptorMBean interceptor = (DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server); interceptor.addPhaseTwoHook(this); } } } catch (MBeanProxyCreationException e) { throw new WSFDeploymentException(e); } }
/** Add the hooks to the interceptors */ public void stop() { MBeanServer server = MBeanServerLocator.locateJBoss(); try { if (phaseOneInterceptors != null) { for (ObjectName oname : phaseOneInterceptors) { DeployerInterceptorMBean interceptor = (DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server); interceptor.removePhaseOneHook(this); } } if (phaseTwoInterceptors != null) { for (ObjectName oname : phaseTwoInterceptors) { DeployerInterceptorMBean interceptor = (DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server); interceptor.removePhaseTwoHook(this); } } } catch (MBeanProxyCreationException e) { throw new WSFDeploymentException(e); } }
/** Add the hooks to the interceptors */ public void stop() { MBeanServer server = MBeanServerLocator.locateJBoss(); try { if (phaseOneInterceptors != null) { for (ObjectName oname : phaseOneInterceptors) { DeployerInterceptorMBean interceptor = (DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server); interceptor.removePhaseOneHook(this); } } if (phaseTwoInterceptors != null) { for (ObjectName oname : phaseTwoInterceptors) { DeployerInterceptorMBean interceptor = (DeployerInterceptorMBean)MBeanProxy.get(DeployerInterceptorMBean.class, oname, server); interceptor.removePhaseTwoHook(this); } } } catch (MBeanProxyCreationException e) { throw new WSFDeploymentException(e); } }