You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2017/05/03 15:16:15 UTC
nifi git commit: NIFI-3776 Correcting links in documentation for
SeeAlso and properties referencing controller services. This closes #1739
Repository: nifi
Updated Branches:
refs/heads/master ce233bdbb -> e723a2c5c
NIFI-3776 Correcting links in documentation for SeeAlso and properties referencing controller services. This closes #1739
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/e723a2c5
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/e723a2c5
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/e723a2c5
Branch: refs/heads/master
Commit: e723a2c5c4ae49f97b367d3495bf2a6686be8f91
Parents: ce233bd
Author: Bryan Bende <bb...@apache.org>
Authored: Wed May 3 10:20:38 2017 -0400
Committer: Matt Gilman <ma...@gmail.com>
Committed: Wed May 3 11:15:48 2017 -0400
----------------------------------------------------------------------
.../html/HtmlDocumentationWriter.java | 46 +++++++++++++++++---
1 file changed, 40 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/nifi/blob/e723a2c5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java
index 42801ac..e538fed 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java
@@ -23,12 +23,16 @@ import org.apache.nifi.annotation.behavior.Stateful;
import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.SeeAlso;
import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.bundle.Bundle;
+import org.apache.nifi.bundle.BundleCoordinate;
import org.apache.nifi.components.AllowableValue;
import org.apache.nifi.components.ConfigurableComponent;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.controller.ControllerService;
import org.apache.nifi.documentation.DocumentationWriter;
import org.apache.nifi.nar.ExtensionManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.xml.stream.FactoryConfigurationError;
import javax.xml.stream.XMLOutputFactory;
@@ -49,6 +53,8 @@ import java.util.Set;
*/
public class HtmlDocumentationWriter implements DocumentationWriter {
+ public static final Logger LOGGER = LoggerFactory.getLogger(HtmlDocumentationWriter.class);
+
/**
* The filename where additional user specified information may be stored.
*/
@@ -239,13 +245,26 @@ public class HtmlDocumentationWriter implements DocumentationWriter {
xmlStreamWriter.writeCharacters(", ");
}
- final String link = "../" + linkedComponent + "/index.html";
+ final List<Bundle> linkedComponentBundles = ExtensionManager.getBundles(linkedComponent);
- final int indexOfLastPeriod = linkedComponent.lastIndexOf(".") + 1;
+ if (linkedComponentBundles != null && linkedComponentBundles.size() > 0) {
+ final Bundle firstBundle = linkedComponentBundles.get(0);
+ final BundleCoordinate firstCoordinate = firstBundle.getBundleDetails().getCoordinate();
- writeLink(xmlStreamWriter, linkedComponent.substring(indexOfLastPeriod), link);
+ final String group = firstCoordinate.getGroup();
+ final String id = firstCoordinate.getId();
+ final String version = firstCoordinate.getVersion();
- ++index;
+ final String link = "/nifi-docs/components/" + group + "/" + id + "/" + version + "/" + linkedComponent + "/index.html";
+
+ final int indexOfLastPeriod = linkedComponent.lastIndexOf(".") + 1;
+
+ writeLink(xmlStreamWriter, linkedComponent.substring(indexOfLastPeriod), link);
+
+ ++index;
+ } else {
+ LOGGER.warn("Could not link to {} because no bundles were found", new Object[] {linkedComponent});
+ }
}
xmlStreamWriter.writeEndElement();
}
@@ -661,8 +680,23 @@ public class HtmlDocumentationWriter implements DocumentationWriter {
* @param clazz the configurable component to link to
* @throws XMLStreamException thrown if there is a problem writing the XML
*/
- protected void writeLinkForComponent(final XMLStreamWriter xmlStreamWriter, final Class<?> clazz) throws XMLStreamException {
- writeLink(xmlStreamWriter, clazz.getSimpleName(), "../" + clazz.getCanonicalName() + "/index.html");
+ protected void writeLinkForComponent(final XMLStreamWriter xmlStreamWriter, final Class<?> clazz)
+ throws XMLStreamException {
+ final String linkedComponentName = clazz.getName();
+ final List<Bundle> linkedComponentBundles = ExtensionManager.getBundles(linkedComponentName);
+
+ if (linkedComponentBundles != null && linkedComponentBundles.size() > 0) {
+ final Bundle firstLinkedComponentBundle = linkedComponentBundles.get(0);
+ final BundleCoordinate coordinate = firstLinkedComponentBundle.getBundleDetails().getCoordinate();
+
+ final String group = coordinate.getGroup();
+ final String id = coordinate.getId();
+ final String version = coordinate.getVersion();
+
+ writeLink(xmlStreamWriter, clazz.getSimpleName(), "/nifi-docs/components/" + group + "/" + id + "/" + version + "/" + clazz.getCanonicalName() + "/index.html");
+ } else {
+ LOGGER.warn("Could not link to {} because no bundles were found", new Object[] {linkedComponentName});
+ }
}
/**