@Override protected void validateChange(final ConfiguredObject<?> proxyForValidation, final Set<String> changedAttributes) { super.validateChange(proxyForValidation, changedAttributes); final CloudFoundryDashboardManagementGroupProvider<?> validationProxy = (CloudFoundryDashboardManagementGroupProvider<?>) proxyForValidation; validateSecureEndpoint(validationProxy); validateMapping(validationProxy); }
@Override protected void validateChange(final ConfiguredObject<?> proxyForValidation, final Set<String> changedAttributes) { super.validateChange(proxyForValidation, changedAttributes); if (changedAttributes.contains(ROLE)) { NodeRole currentRole = getRole(); if (NodeRole.REPLICA != currentRole) { throw new IllegalArgumentException("Cannot transfer mastership when not in replica role." + " Current role " + currentRole); } NodeRole newRole = (NodeRole) ((BDBHARemoteReplicationNode<?>) proxyForValidation).getAttribute(ROLE); if (NodeRole.MASTER != newRole) { throw new IllegalArgumentException("Changing role to other value then " + NodeRole.MASTER + " is unsupported"); } } if (changedAttributes.contains(JOIN_TIME)) { throw new IllegalArgumentException("Cannot change derived attribute " + JOIN_TIME); } if (changedAttributes.contains(LAST_KNOWN_REPLICATION_TRANSACTION_ID)) { throw new IllegalArgumentException("Cannot change derived attribute " + LAST_KNOWN_REPLICATION_TRANSACTION_ID); } }
@Override protected void validateChange(final ConfiguredObject<?> proxyForValidation, final Set<String> changedAttributes) { super.validateChange(proxyForValidation, changedAttributes); validateOrCreateAlternateBinding(((Exchange<?>) proxyForValidation), false); if (changedAttributes.contains(ConfiguredObject.DESIRED_STATE) && proxyForValidation.getDesiredState() == State.DELETED) { doChecks(); } }
@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 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."); } } }
ConfiguredObject<?> proxyForValidation = createProxyForValidation(attributes); authoriseSetAttributes(proxyForValidation, attributes); validateChange(proxyForValidation, attributes.keySet());
@Override protected void validateChange(final ConfiguredObject<?> proxyForValidation, final Set<String> changedAttributes) { super.validateChange(proxyForValidation, changedAttributes); Queue<?> queue = (Queue) proxyForValidation; for (String attrName : NON_NEGATIVE_NUMBERS) { if (changedAttributes.contains(attrName)) { Object value = queue.getAttribute(attrName); if (!(value instanceof Number) || ((Number) value).longValue() < 0) { throw new IllegalConfigurationException( "Only positive integer value can be specified for the attribute " + attrName); } } } if (changedAttributes.contains(ALTERNATE_BINDING)) { validateOrCreateAlternateBinding(queue, false); } if (changedAttributes.contains(ConfiguredObject.DESIRED_STATE) && proxyForValidation.getDesiredState() == State.DELETED) { if(hasReferrers()) { throw new MessageDestinationIsAlternateException(getName()); } } }
@Override protected void validateChange(final ConfiguredObject<?> proxyForValidation, final Set<String> changedAttributes) { super.validateChange(proxyForValidation, changedAttributes); QueueManagingVirtualHost<?> virtualHost = (QueueManagingVirtualHost<?>) proxyForValidation; if(changedAttributes.contains(GLOBAL_ADDRESS_DOMAINS)) { if(virtualHost.getGlobalAddressDomains() != null) { for(String name : virtualHost.getGlobalAddressDomains()) { validateGlobalAddressDomain(name); } } } if(changedAttributes.contains(NODE_AUTO_CREATION_POLICIES)) { if(getNodeAutoCreationPolicies() != null) { for(NodeAutoCreationPolicy policy : virtualHost.getNodeAutoCreationPolicies()) { validateNodeAutoCreationPolicy(policy); } } } if (changedAttributes.contains(CONNECTION_THREAD_POOL_SIZE) || changedAttributes.contains(NUMBER_OF_SELECTORS)) { validateConnectionThreadPoolSettings(virtualHost); } }
@Override public final ListenableFuture<Void> deleteAsync() { final State currentDesiredState = getDesiredState(); if (currentDesiredState == State.DELETED) { return Futures.immediateFuture(null); } Map<String, Object> attributes = Collections.singletonMap(ConfiguredObject.DESIRED_STATE, State.DELETED); ConfiguredObject<?> proxyForValidation = createProxyForValidation(attributes); authoriseSetAttributes(proxyForValidation, attributes); validateChange(proxyForValidation, attributes.keySet()); checkReferencesOnDelete(getHierarchyRoot(this), this); // for DELETED state we should invoke transition method first to make sure that object can be deleted. // If method results in exception being thrown due to various integrity violations // then object cannot be deleted without prior resolving of integrity violations. // The state transition should be disallowed. if(_parent instanceof AbstractConfiguredObject<?>) { ((AbstractConfiguredObject<?>)_parent).validateChildDelete(AbstractConfiguredObject.this); } else if (_parent instanceof AbstractConfiguredObjectProxy) { ((AbstractConfiguredObjectProxy)_parent).validateChildDelete(AbstractConfiguredObject.this); } return deleteNoChecks(); }
@Override protected void validateChange(final ConfiguredObject<?> proxyForValidation, final Set<String> changedAttributes) super.validateChange(proxyForValidation, changedAttributes); Port<?> updated = (Port<?>)proxyForValidation;