@Override public void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue) { if (descriptor.isDynamic()) { final Set<String> newDynamicPropertyNames = new HashSet<>(dynamicPropertyNames); if (newValue == null) { // removing a property newDynamicPropertyNames.remove(descriptor.getName()); } else if (oldValue == null) { // adding a new property newDynamicPropertyNames.add(descriptor.getName()); } this.dynamicPropertyNames = Collections.unmodifiableSet(newDynamicPropertyNames); } }
@Override public Map<String, String> getAllProperties() { final Map<String,String> propValueMap = new LinkedHashMap<>(); for (final Map.Entry<PropertyDescriptor, String> entry : getProperties().entrySet()) { propValueMap.put(entry.getKey().getName(), entry.getValue()); } return propValueMap; }
@Override public Map<String, String> getAllProperties() { final Map<String,String> propValueMap = new LinkedHashMap<>(); for (final Map.Entry<PropertyDescriptor, String> entry : getProperties().entrySet()) { propValueMap.put(entry.getKey().getName(), entry.getValue()); } return propValueMap; }
@Override public Map<String, String> getAllProperties() { final Map<String,String> propValueMap = new LinkedHashMap<>(); for (final Map.Entry<PropertyDescriptor, String> entry : getProperties().entrySet()) { propValueMap.put(entry.getKey().getName(), entry.getValue()); } return propValueMap; }
@Override public Map<String, String> getAllProperties() { verifyTaskActive(); final Map<String,String> propValueMap = new LinkedHashMap<>(); for (final Map.Entry<PropertyDescriptor, String> entry : getProperties().entrySet()) { propValueMap.put(entry.getKey().getName(), entry.getValue()); } return propValueMap; }
@Override public Map<String,String> getAllProperties() { final Map<String,String> propValueMap = new LinkedHashMap<>(); for (final Map.Entry<PropertyDescriptor, PropertyValue> entry : getProperties().entrySet()) { propValueMap.put(entry.getKey().getName(), entry.getValue().getValue()); } return propValueMap; }
@Override protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) { SpringContextConfigValidator v = new SpringContextConfigValidator(); return Collections.singletonList(v.validate(CTX_CONFIG_PATH.getName(), null, validationContext)); }
private static Map<String, String> getTruststoreProperties() { final Map<String, String> map = new HashMap<>(); map.put(StandardSSLContextService.TRUSTSTORE.getName(), "src/test/resources/truststore.jks"); map.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "passwordpassword"); map.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), "JKS"); return map; } }
protected Map<String, String> getDefaultMaxValueProperties(final ProcessContext context, final FlowFile flowFile) { final Map<String, String> defaultMaxValues = new HashMap<>(); context.getProperties().forEach((k, v) -> { final String key = k.getName(); if (key.startsWith(INITIAL_MAX_VALUE_PROP_START)) { defaultMaxValues.put(key.substring(INITIAL_MAX_VALUE_PROP_START.length()), context.getProperty(k).evaluateAttributeExpressions(flowFile).getValue()); } }); return defaultMaxValues; } }
private static Map<String, String> getKeystoreProperties() { final Map<String, String> map = new HashMap<>(); map.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/keystore.jks"); map.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "passwordpassword"); map.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS"); return map; }
private Map<String, String> getDynamicAttributesMap(ProcessContext context, FlowFile flowFile) { final Map<String, String> attributes = new HashMap<>(); for (final Map.Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) { if (entry.getKey().isDynamic()) { final String value = context.getProperty(entry.getKey()).evaluateAttributeExpressions(flowFile).getValue(); attributes.put(entry.getKey().getName(), value); } } return attributes; }
@Override public PropertyValue getProperty(final PropertyDescriptor descriptor) { final PropertyDescriptor fullPropDescriptor = config.getService().getPropertyDescriptor(descriptor.getName()); if (fullPropDescriptor == null) { return null; } String configuredValue = config.getProperties().get(fullPropDescriptor.getName()); if (configuredValue == null) { configuredValue = fullPropDescriptor.getDefaultValue(); } return new StandardPropertyValue(configuredValue, null, variableRegistry); }
@OnEnabled public void onEnabled(final ConfigurationContext context) { final Map<String,DBCPService> serviceMap = new HashMap<>(); for (final PropertyDescriptor descriptor : context.getProperties().keySet()) { if (descriptor.isDynamic()) { final DBCPService dbcpService = context.getProperty(descriptor).asControllerService(DBCPService.class); serviceMap.put(descriptor.getName(), dbcpService); } } dbcpServiceMap = Collections.unmodifiableMap(serviceMap); }
@OnScheduled public void createRecordPaths(final ProcessContext context) { recordPathCache = new RecordPathCache(context.getProperties().size() * 2); final List<String> recordPaths = new ArrayList<>(context.getProperties().size() - 2); for (final PropertyDescriptor property : context.getProperties().keySet()) { if (property.isDynamic()) { recordPaths.add(property.getName()); } } this.recordPaths = recordPaths; }
@Override public PropertyValue getProperty(final PropertyDescriptor descriptor) { verifyTaskActive(); final String setPropertyValue = properties.get(descriptor); if (setPropertyValue != null) { return new StandardPropertyValue(setPropertyValue, this, preparedQueries.get(descriptor), procNode.getVariableRegistry()); } // Get the "canonical" Property Descriptor from the Processor final PropertyDescriptor canonicalDescriptor = procNode.getProcessor().getPropertyDescriptor(descriptor.getName()); final String defaultValue = canonicalDescriptor.getDefaultValue(); return new StandardPropertyValue(defaultValue, this, preparedQueries.get(descriptor), procNode.getVariableRegistry()); }
@Override protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) { final List<ValidationResult> results = new ArrayList<>(); final SSLContextService sslContextService = validationContext.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class); if (sslContextService != null && sslContextService.isTrustStoreConfigured() == false) { results.add(new ValidationResult.Builder() .explanation("The context service must have a truststore configured for the lumberjack forwarder client to work correctly") .valid(false).subject(SSL_CONTEXT_SERVICE.getName()).build()); } return results; }
@Override protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) { final List<ValidationResult> results = new ArrayList<>(); final SSLContextService sslContextService = validationContext.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class); if (sslContextService != null && sslContextService.isTrustStoreConfigured() == false) { results.add(new ValidationResult.Builder() .explanation("The context service must have a truststore configured for the beats forwarder client to work correctly") .valid(false).subject(SSL_CONTEXT_SERVICE.getName()).build()); } return results; }