+
+ if (getPassword() != null) {
+ /*
+ * This is a nasty hack, but we don't have another clean solution. We cannot allow
+ * password being set if the injected dispatcher does not have the optional
+ * md5-server-channel-factory set.
+ *
+ * FIXME: this is a use case for Module interfaces, e.g. RibImplModule
+ * should something like isMd5ServerSupported()
+ */
+ final MBeanServer srv = ManagementFactory.getPlatformMBeanServer();
+ try {
+ // FIXME: AbstractRIBImplModule.bgpDispatcherJmxAttribute.getAttributeName()
+ final ObjectName disp = (ObjectName) srv.getAttribute(getRib(), "BgpDispatcher");
+
+ // FIXME: AbstractBGPDispatcherImplModule.md5ChannelFactoryJmxAttribute.getAttributeName()
+ final Object cf = srv.getAttribute(disp, "Md5ChannelFactory");
+ JmxAttributeValidationException.checkCondition(cf != null, "Underlying dispatcher does not support MD5 clients", this.passwordJmxAttribute);
+ } catch (AttributeNotFoundException | InstanceNotFoundException
+ | MBeanException | ReflectionException e) {
+ JmxAttributeValidationException.wrap(e, passwordJmxAttribute);
+ }
+ }