@Override public PropertyDescriptor getPropertyDescriptor(String propertyName) { return configurableComponent.getPropertyDescriptor(propertyName); }
for (final Map.Entry<String, String> entry : properties.entrySet()) { final PropertyDescriptor descriptor = getComponent().getPropertyDescriptor(entry.getKey()); if (descriptor.isDynamicClasspathModifier()) { classpathChanged = true;
for (final Map.Entry<String, String> entry : properties.entrySet()) { final PropertyDescriptor descriptor = getComponent().getPropertyDescriptor(entry.getKey()); if (descriptor.isDynamicClasspathModifier()) { classpathChanged = true;
public boolean removeProperty(final String property) { Objects.requireNonNull(property); final PropertyDescriptor fullyPopulatedDescriptor = component.getPropertyDescriptor(property); String value = null; if ((value = properties.remove(fullyPopulatedDescriptor)) != null) { if (!value.equals(fullyPopulatedDescriptor.getDefaultValue())) { component.onPropertyModified(fullyPopulatedDescriptor, value, null); } return true; } return false; }
@Override public PropertyValue getProperty(final String propertyName) { final PropertyDescriptor descriptor = component.getPropertyDescriptor(propertyName); if (descriptor == null) { return null; } final String setPropertyValue = properties.get(descriptor); final String propValue = (setPropertyValue == null) ? descriptor.getDefaultValue() : setPropertyValue; return new MockPropertyValue(propValue, this, variableRegistry, (enableExpressionValidation && allowExpressionValidation) ? descriptor : null); }
private StringBuilder addPropertyFingerprint(final StringBuilder builder, final ConfigurableComponent component, final String propName, final String propValue) throws FingerprintException { // If we have a component to use, first determine if the value given is the default value for the specified property. // If so, we do not add the property to the fingerprint. // We do this because if a component is updated to add a new property, whenever we connect to the cluster, we have issues because // the Cluster Coordinator's flow comes from disk, where the flow.xml doesn't have the new property but our FlowController does have the new property. // This causes the fingerprints not to match. As a result, we just ignore default values, and this resolves the issue. if (component != null) { final PropertyDescriptor descriptor = component.getPropertyDescriptor(propName); if (descriptor != null && propValue != null && propValue.equals(descriptor.getDefaultValue())) { return builder; } } // check if there is a value if (propValue == null) { return builder; } // append name builder.append(propName).append("="); // append value if (isEncrypted(propValue)) { // propValue is non null, no need to use getValue builder.append(decrypt(propValue)); } else { builder.append(getValue(propValue, NO_VALUE)); } return builder; }
/** * Updates the value of the property with the given PropertyDescriptor to * the specified value IF and ONLY IF the value is valid according to the * descriptor's validator. Otherwise, the property value is not updated. In * either case, the ValidationResult is returned, indicating whether or not * the property is valid * * @param descriptor of property to modify * @param value new value * @return result */ public ValidationResult setProperty(final PropertyDescriptor descriptor, final String value) { requireNonNull(descriptor); requireNonNull(value, "Cannot set property to null value; if the intent is to remove the property, call removeProperty instead"); final PropertyDescriptor fullyPopulatedDescriptor = component.getPropertyDescriptor(descriptor.getName()); final ValidationResult result = fullyPopulatedDescriptor.validate(value, new MockValidationContext(this, stateManager, variableRegistry)); String oldValue = properties.put(fullyPopulatedDescriptor, value); if (oldValue == null) { oldValue = fullyPopulatedDescriptor.getDefaultValue(); } if ((value == null && oldValue != null) || (value != null && !value.equals(oldValue))) { component.onPropertyModified(fullyPopulatedDescriptor, oldValue, value); } return result; }
@Override public PropertyDescriptor getPropertyDescriptor(final String name) { try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(extensionManager, getComponent().getClass(), getComponent().getIdentifier())) { return getComponent().getPropertyDescriptor(name); } }
private void setProperty(final String name, final String value) { if (null == name || null == value) { throw new IllegalArgumentException("Name or Value can not be null"); } final PropertyDescriptor descriptor = getComponent().getPropertyDescriptor(name); final String oldValue = properties.put(descriptor, value); if (!value.equals(oldValue)) { if (descriptor.getControllerServiceDefinition() != null) { if (oldValue != null) { final ControllerServiceNode oldNode = serviceProvider.getControllerServiceNode(oldValue); if (oldNode != null) { oldNode.removeReference(this); } } final ControllerServiceNode newNode = serviceProvider.getControllerServiceNode(value); if (newNode != null) { newNode.addReference(this); } } try { onPropertyModified(descriptor, oldValue, value); } catch (final Exception e) { // nothing really to do here... } } }
final PropertyDescriptor descriptor = getComponent().getPropertyDescriptor(name); String value = null;
public boolean removeProperty(final String property) { Objects.requireNonNull(property); final PropertyDescriptor fullyPopulatedDescriptor = component.getPropertyDescriptor(property); String value = null; if ((value = properties.remove(fullyPopulatedDescriptor)) != null) { if (!value.equals(fullyPopulatedDescriptor.getDefaultValue())) { component.onPropertyModified(fullyPopulatedDescriptor, value, null); } return true; } return false; }
@Override public PropertyValue getProperty(final String propertyName) { final PropertyDescriptor descriptor = component.getPropertyDescriptor(propertyName); if (descriptor == null) { return null; } final String setPropertyValue = properties.get(descriptor); final String propValue = (setPropertyValue == null) ? descriptor.getDefaultValue() : setPropertyValue; return new MockPropertyValue(propValue, this, variableRegistry, (enableExpressionValidation && allowExpressionValidation) ? descriptor : null); }
/** * Updates the value of the property with the given PropertyDescriptor to * the specified value IF and ONLY IF the value is valid according to the * descriptor's validator. Otherwise, the property value is not updated. In * either case, the ValidationResult is returned, indicating whether or not * the property is valid * * @param descriptor of property to modify * @param value new value * @return result */ public ValidationResult setProperty(final PropertyDescriptor descriptor, final String value) { requireNonNull(descriptor); requireNonNull(value, "Cannot set property to null value; if the intent is to remove the property, call removeProperty instead"); final PropertyDescriptor fullyPopulatedDescriptor = component.getPropertyDescriptor(descriptor.getName()); final ValidationResult result = fullyPopulatedDescriptor.validate(value, new MockValidationContext(this, stateManager, variableRegistry)); String oldValue = properties.put(fullyPopulatedDescriptor, value); if (oldValue == null) { oldValue = fullyPopulatedDescriptor.getDefaultValue(); } if ((value == null && oldValue != null) || (value != null && !value.equals(oldValue))) { component.onPropertyModified(fullyPopulatedDescriptor, oldValue, value); } return result; }
@Override public PropertyDescriptor getPropertyDescriptor(final String name) { try (final NarCloseable narCloseable = NarCloseable.withComponentNarLoader(getComponent().getClass(), getComponent().getIdentifier())) { return getComponent().getPropertyDescriptor(name); } }
private void setProperty(final String name, final String value) { if (null == name || null == value) { throw new IllegalArgumentException("Name or Value can not be null"); } final PropertyDescriptor descriptor = getComponent().getPropertyDescriptor(name); final String oldValue = properties.put(descriptor, value); if (!value.equals(oldValue)) { if (descriptor.getControllerServiceDefinition() != null) { if (oldValue != null) { final ControllerServiceNode oldNode = serviceProvider.getControllerServiceNode(oldValue); if (oldNode != null) { oldNode.removeReference(this); } } final ControllerServiceNode newNode = serviceProvider.getControllerServiceNode(value); if (newNode != null) { newNode.addReference(this); } } try { onPropertyModified(descriptor, oldValue, value); } catch (final Exception e) { // nothing really to do here... } } }
final PropertyDescriptor descriptor = getComponent().getPropertyDescriptor(name); String value = null;