turcsanyip commented on a change in pull request #4213: NIFI-7280 Use Atlas
metadata namespace in Atlas Reporting Task
URL: https://github.com/apache/nifi/pull/4213#discussion_r409545352
##########
File path:
nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/src/main/java/org/apache/nifi/atlas/reporting/ReportLineageToAtlas.java
##########
@@ -585,12 +594,58 @@ private void initAtlasProperties(ConfigurationContext
context) throws IOExceptio
if (confDir != null) {
// If atlasConfDir is not set, atlas-application.properties will
be searched under classpath.
Properties props = System.getProperties();
- final String atlasConfProp = "atlas.conf";
+ final String atlasConfProp =
ApplicationProperties.ATLAS_CONFIGURATION_DIRECTORY_PROPERTY;
props.setProperty(atlasConfProp, confDir.getAbsolutePath());
getLogger().debug("{} has been set to: {}", new
Object[]{atlasConfProp, props.getProperty(atlasConfProp)});
}
}
+ private void parseAtlasUrls(final PropertyValue atlasUrlsProp, final
Consumer<String> urlStrConsumer) {
+ setValue(
+ value -> Arrays.stream(value.split(ATLAS_URL_DELIMITER))
+ .map(String::trim)
+ .forEach(urlStrConsumer),
+ () -> {},
+ atlasUrlsProp,
+ atlasProperties.getProperty(ATLAS_PROPERTY_REST_ADDRESS)
+ );
+ }
+
+ private void setValue(Consumer<String> setter, Runnable emptyHandler,
PropertyValue elPropertyValue, String... properties) {
+ String value = StringSelector
+ .of(elPropertyValue.evaluateAttributeExpressions().getValue())
+ .or(properties)
+ .toString();
+
+ if (value == null || value.isEmpty()) {
Review comment:
Having a reference to the StringSelector and using `if (selector.found()) {
... }` would be more elegant I think.
Otherwise, it is less reasonable to use the StringSelector over
`StringUtils.firstNonEmpty()` and then null check.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services