/** * Get the Service interface through which the mbean given by objectName will be managed. * * @param objectName the object name * @param server the mbean server * @return The Service value * @throws Exception for any error */ public static Service getServiceProxy(ObjectName objectName, MBeanServer server) throws Exception { return getServiceProxy(objectName, server, true); }
/** * Get the Service interface through which the mbean given by objectName will be managed. * * @param objectName the object name * @param server the mbean server * @param includeLifecycle include lifecycle * @return The Service value * @throws Exception for any error */ public static Service getServiceProxy(ObjectName objectName, MBeanServer server, boolean includeLifecycle) throws Exception { if (includeLifecycle) { MBeanInfo info = server.getMBeanInfo(objectName); MBeanOperationInfo[] opInfo = info.getOperations(); Class<?>[] interfaces = { Service.class }; InvocationHandler handler = new ServiceProxy(objectName, server, opInfo); return (Service) Proxy.newProxyInstance(Service.class.getClassLoader(), interfaces, handler); } else { return NO_LIFECYCLE_CALLOUT; } }
/** * Get the Service interface through which the mbean given by objectName will be managed. * * @param objectName the object name * @param server the mbean server * @param includeLifecycle include lifecycle * @return The Service value * @throws Exception for any error */ public static Service getServiceProxy(ObjectName objectName, MBeanServer server, boolean includeLifecycle) throws Exception { Service service = null; MBeanInfo info = server.getMBeanInfo(objectName); MBeanOperationInfo[] opInfo = info.getOperations(); Class<?>[] interfaces = { Service.class }; InvocationHandler handler = new ServiceProxy(objectName, server, opInfo); if (includeLifecycle == false) service = NO_LIFECYCLE_CALLOUT; else service = (Service) Proxy.newProxyInstance(Service.class.getClassLoader(), interfaces, handler); return service; }
/** * Get the Service interface through which the mbean given by objectName will be managed. * * @param objectName the object name * @param server the mbean server * @return The Service value * @throws Exception for any error */ public static Service getServiceProxy(ObjectName objectName, MBeanServer server) throws Exception { return getServiceProxy(objectName, server, true); }
/** * Get the service proxy * * @return the service proxy * @throws Exception for any error */ public Service getServiceProxy() throws Exception { if (serviceContext.proxy != null) return serviceContext.proxy; MBeanServer server = serviceController.getMBeanServer(); if (server != null) serviceContext.proxy = ServiceProxy.getServiceProxy(objectName, server, includeLifecycle); return serviceContext.proxy; }
/** * Get the service proxy * * @return the service proxy * @throws Exception for any error */ public Service getServiceProxy() throws Exception { if (serviceContext.proxy != null) return serviceContext.proxy; MBeanServer server = serviceController.getMBeanServer(); if (server != null) serviceContext.proxy = ServiceProxy.getServiceProxy(objectName, server, includeLifecycle); return serviceContext.proxy; }