@Override public NamedAddressSpace getAddressSpace(final String name) { if(name == null || name.trim().equals("")) { Broker<?> broker = getAncestor(Broker.class); VirtualHostNode defaultVirtualHostNode = broker.findDefautVirtualHostNode(); return defaultVirtualHostNode == null ? null : defaultVirtualHostNode.getVirtualHost(); } return null; } }
@Override protected void validateChange(final ConfiguredObject<?> proxyForValidation, final Set<String> changedAttributes) { super.validateChange(proxyForValidation, changedAttributes); VirtualHostNode updated = (VirtualHostNode) proxyForValidation; if (changedAttributes.contains(DEFAULT_VIRTUAL_HOST_NODE) && updated.isDefaultVirtualHostNode()) { VirtualHostNode existingDefault = _broker.findDefautVirtualHostNode(); if (existingDefault != null && existingDefault != this) { throw new IntegrityViolationException("Cannot make '" + getName() + "' the default virtual host node for" + " the Broker as virtual host node '" + existingDefault.getName() + "' is already the default."); } } }
@Override protected void validateOnCreate() { super.validateOnCreate(); if (isDefaultVirtualHostNode()) { VirtualHostNode existingDefault = _broker.findDefautVirtualHostNode(); if (existingDefault != null) { throw new IllegalConfigurationException("The existing virtual host node '" + existingDefault.getName() + "' is already the default for the Broker."); } } }
@Override protected void validateChange(final ConfiguredObject<?> proxyForValidation, final Set<String> changedAttributes) { super.validateChange(proxyForValidation, changedAttributes); VirtualHostNode updated = (VirtualHostNode) proxyForValidation; if (changedAttributes.contains(DEFAULT_VIRTUAL_HOST_NODE) && updated.isDefaultVirtualHostNode()) { VirtualHostNode existingDefault = _broker.findDefautVirtualHostNode(); if (existingDefault != null && existingDefault != this) { throw new IntegrityViolationException("Cannot make '" + getName() + "' the default virtual host node for" + " the Broker as virtual host node '" + existingDefault.getName() + "' is already the default."); } } }
@Override protected void validateOnCreate() { super.validateOnCreate(); if (isDefaultVirtualHostNode()) { VirtualHostNode existingDefault = _broker.findDefautVirtualHostNode(); if (existingDefault != null) { throw new IntegrityViolationException("The existing virtual host node '" + existingDefault.getName() + "' is already the default for the Broker."); } } }
@Override public final NamedAddressSpace getAddressSpace(final String name) { VirtualHostNode<?> node = null; if (matches(name)) { node = getVirtualHostNode(); if (node == null) { Broker<?> broker = getAncestor(Broker.class); node = broker.findDefautVirtualHostNode(); } } return node == null ? null : node.getVirtualHost(); }