private synchronized <T> ControlMBean<?> getControlMBean(String controlId, Class<T> controlInterface) { ControlMBean<?> bean = mbeans.get(controlId); if (bean == null) return null; if (bean.getControlInterface() != controlInterface) return null; return bean; } }
Method method = findMethod(mbean.getControlInterface(), methodName, argumentCount); logger.warn("Unable to find method \"{}\" with {} args in {}", methodName, argumentCount, mbean.getControlInterface().getName()); return new JsonPrimitive(Boolean.FALSE); executeMethod(method, mbean.getControl(), getArguments(method, args));
@Override public <T> T getControl(String type, String alias, Class<T> controlInterface) { String controlId = getControlId(type, null, alias); ControlMBean<?> bean = getControlMBean(controlId, controlInterface); return bean != null ? controlInterface.cast(bean.getControl()) : null; }
/** * {@inheritDoc} * <P> * All control service MBeans must be valid according * to {@link Controls#isControlServiceMBean(Class)}. * </P> * * @see Controls#isControlServiceMBean(Class) */ @Override public synchronized <T> String registerControl(String type, String id, String alias, Class<T> controlInterface, T control) { if (!Controls.isControlServiceMBean(controlInterface)) throw new IllegalArgumentException(); final String controlId = getControlId(type, id, alias); if (mbeans.containsKey(controlId)) { logger.error("Control id: {} already exists", controlId); throw new IllegalStateException(); } logger.trace("Register control id: {}", controlId); mbeans.put(controlId, new ControlMBean<T>(controlInterface, control)); return controlId; }
Method method = findMethod(mbean.getControlInterface(), methodName, argumentCount); logger.warn("Unable to find method \"{}\" with {} args in {}", methodName, argumentCount, mbean.getControlInterface().getName()); return new JsonPrimitive(Boolean.FALSE); executeMethod(method, mbean.getControl(), getArguments(method, args));
@Override public <T> T getControl(String type, String alias, Class<T> controlInterface) { String controlId = getControlId(type, null, alias); ControlMBean<?> bean = getControlMBean(controlId, controlInterface); return bean != null ? controlInterface.cast(bean.getControl()) : null; }
/** * {@inheritDoc} * <P> * All control service MBeans must be valid according * to {@link Controls#isControlServiceMBean(Class)}. * </P> * * @see Controls#isControlServiceMBean(Class) */ @Override public synchronized <T> String registerControl(String type, String id, String alias, Class<T> controlInterface, T control) { if (!Controls.isControlServiceMBean(controlInterface)) throw new IllegalArgumentException(); final String controlId = getControlId(type, id, alias); if (mbeans.containsKey(controlId)) { logger.error("Control id: {} already exists", controlId); throw new IllegalStateException(); } logger.trace("Register control id: {}", controlId); mbeans.put(controlId, new ControlMBean<T>(controlInterface, control)); return controlId; }
private synchronized <T> ControlMBean<?> getControlMBean(String controlId, Class<T> controlInterface) { ControlMBean<?> bean = mbeans.get(controlId); if (bean == null) return null; if (bean.getControlInterface() != controlInterface) return null; return bean; } }