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 Tue, 27 Aug 2019 16:11:43 GMT
Here is one more thing to try...

Since you said you do see the files generated in the work/docs
directory, those should be made available through a servlet which is
what the links on the left side of the docs page link to.

For example, if I right-click on AttributeRollingWindow and open the
link in new tab, it goes to the following URL:

http://localhost:8080/nifi-docs/components/org.apache.nifi/nifi-stateful-analysis-nar/1.10.0-SNAPSHOT/org.apache.nifi.processors.stateful.analysis.AttributeRollingWindow/index.html

Are you able to navigate directly to your component using the same
path you found in work/docs ?

On Tue, Aug 27, 2019 at 11:27 AM David Perkins
<david.n.perkins@gmail.com> wrote:
>
> I tried another browser just to make sure.  Same behavior.  I checked the logs and didn't
see any errors.  I found the messages where the custom processors were being loaded.  Looked
the same as all the other logs about loading processors.
>
> On 2019/08/26 20:29:59, Bryan Bende <bbende@gmail.com> wrote:
> > Those files are generated when NiFi starts and loads all the NARs.
> >
> > Is it possible your browser has something cached and when you open the
> > docs page it isn't loading the most up to date version?
> >
> > On Mon, Aug 26, 2019 at 4:23 PM David Perkins <david.n.perkins@gmail.com>
wrote:
> > >
> > > Correct.  When I open the documentation from within the application, the list
of the processors on the left hand side does not include my processors.
> > >
> > > I checked and I do see files at the path you mentioned.  I pointed my browser
to one of them and it displayed it with all the information I was expecting.  So the files
are there, but not being displayed in the application documentation.
> > >
> > > Question: How do the files located at NIFI_HOME/work/docs/components/{group-id}/{artifact-id}/{version}/{component}/index.html,
get generated?  Is it when NiFi reads the nar files from the extensions directory?  I was
expecting them to be generated as part of the build and included in the nar file.  I looked
in the nar and didn't find anything.
> > >
> > > On 2019/08/26 18:23:16, Bryan Bende <bbende@gmail.com> wrote:
> > > > So if you open the documentation from with in the application, the
> > > > list of the processors on the left hand side does not include your
> > > > processor?
> > > >
> > > > Is anything generated for your processor under
> > > > NIFI_HOME/work/docs/components/{group-id}/{artifact-id}/{version}/{component}/index.html
> > > > ?
> > > >
> > > > On Mon, Aug 26, 2019 at 1:54 PM David Perkins <david.n.perkins@gmail.com>
wrote:
> > > > >
> > > > > Bryan,
> > > > >
> > > > > I do have many annotations on the Processor class.  The problem is
> > > > > that documentation is not being generated automatically.  I don't
see
> > > > > any errors, so I have been unable to determine why it's not being
> > > > > generated.  The processors appear in NiFi and I'm able to search
for
> > > > > them via the tags I specified.  It's just the documentation that's
not
> > > > > appearing.
> > > > >
> > > > > Thanks for the note on where to put the additional details file.
 That
> > > > > wasn't clear from the documentation.  I'll give it a try.
> > > > >
> > > > > David P.
> > > > >
> > > > > On 2019/08/26 15:21:12, Bryan Bende <bbende@gmail.com> wrote:
> > > > > > 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