nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Bende <bbe...@gmail.com>
Subject Re: How to generate usage documentation for custom Processors
Date Mon, 26 Aug 2019 15:21:12 GMT
Hello,

The documentation for a processor is generated automatically from the
annotations on the processors. If you used the Maven Archetype to
generate your NAR then you should already have a starting point for
this with the example MyProcessor which has the following annotations:

@Tags({"example"})
@CapabilityDescription("Provide a description")
@SeeAlso({})
@ReadsAttributes({@ReadsAttribute(attribute="", description="")})
@WritesAttributes({@WritesAttribute(attribute="", description="")})

For the additionalDetails.html, it may help you to look at how it is
setup in the existing NARs:

https://github.com/apache/nifi/tree/master/nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-2-0-processors/src/main/resources/docs

In the processors Maven module, the location would be
"src/main/resources/docs/{fully-qualified-component-name}/additionalDetails.html"

On Fri, Aug 23, 2019 at 3:43 PM David Perkins <david.n.perkins@gmail.com> wrote:
>
> Hello,
>   I'm having trouble generating documentation for a set of custom NiFi
> processors.  I posted a question with all the details here on Stack
> Overflow.
> https://stackoverflow.com/questions/57530465/how-to-generate-usage-documentation-for-custom-processors
>
> Below is a copy of what I posted.  Thanks for any help with this.
>
> David P.
>
>
> I have created several custom NiFi processors, but have been unable to
> get usage documentation to be generated. 'Usage' documentation refers
> to right clicking on a processor and selecting 'Usage', which should
> bring up documentation about that specific processor. The
> documentation panel is displayed, but none of my custom processors are
> present.
>
> I used several NiFi documentation tags on my custom processor classes
> including several Read/Written attributes. The code compiles and unit
> tests without any issues. The build reports
>
> [INFO] Generating documentation for NiFi extensions in the NAR...
>
> According to the developer guide documentation is supposed to
> automatically be generated.
>
> I also tried creating an additionalDetails.html file and putting it in
> the nar according the documentation.
>
> This file should exist within a directory whose name is the
> fully-qualified name of the Processor, and this directory’s parent
> should be named docs and exist in the root of the Processor’s jar.
>
> However, that broke NiFi and I found this in the logs.
>
>         === End Processor types ===
> 2019-08-16 15:16:36,100 WARN [main]
> org.apache.nifi.web.server.JettyServer Failed to start web server...
> shutting down.
> java.lang.NullPointerException: null
>         at org.apache.nifi.documentation.DocGenerator.generate(DocGenerator.java:62)
>         at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:932)
>         at org.apache.nifi.NiFi.<init>(NiFi.java:158)
>         at org.apache.nifi.NiFi.<init>(NiFi.java:72)
>         at org.apache.nifi.NiFi.main(NiFi.java:297)
> 2019-08-16 15:16:36,100 INFO [Thread-1] org.apache.nifi.NiFi
> Initiating shutdown of Jetty web server...
>
> I'm using the standard nifi-nar-maven-plugin to generate the nar file.
> Here's a snippet of my pom.xmlfile.
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">;
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>com.myorg</groupId>
>   <artifactId>nifi-mylib</artifactId>
>   <packaging>nar</packaging>
>   <version>0.0.3</version>
>   <name>nifi-mylib</name>
>
>   <properties>
>       <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>       <maven.compiler.source>1.8</maven.compiler.source>
>       <maven.compiler.target>1.8</maven.compiler.target>
>       <nifi.version>1.9.2</nifi.version>
>   </properties>
>
>   <dependencies>
>       <dependency>
>           <groupId>org.apache.nifi</groupId>
>           <artifactId>nifi-api</artifactId>
>           <version>${nifi.version}</version>
>       </dependency>
>       ...
>   </dependencies>
>
>   <build>
>       <plugins>
>           <plugin>
>               <groupId>org.apache.nifi</groupId>
>               <artifactId>nifi-nar-maven-plugin</artifactId>
>               <version>1.3.1</version>
>               <extensions>true</extensions>
>           </plugin>
>           <plugin>
>               <groupId>org.apache.maven.plugins</groupId>
>               <artifactId>maven-surefire-plugin</artifactId>
>               <version>2.15</version>
>           </plugin>
>       </plugins>
>   </build>
> </project>
>
> The generated .nar (without the additionalDetails.html file) load
> correctly and appear in the list of processors. It's just the Usage
> documentation that I can't get to work.

Mime
View raw message