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_r409537271
##########
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()) {
+ emptyHandler.run();
+ } else {
+ setter.accept(value);
+ }
+ }
+
+ private void checkAtlasUrls(List<String> urlStrings, ConfigurationContext
context) {
+ if (urlStrings.isEmpty()) {
+ throw new ProcessException("No Atlas URL has been specified! Set
either the '" + ATLAS_URLS.getDisplayName() + "' " +
+ "property on the processor or the 'atlas.rest.address'
porperty in the atlas configuration file.");
Review comment:
This could be moved to the emptyHandler of the property.
----------------------------------------------------------------
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