Search in sources :

Example 1 with Stateful

use of org.apache.nifi.annotation.behavior.Stateful in project nifi by apache.

the class HtmlDocumentationWriter method writeStatefulInfo.

/**
 * Write the description of the Stateful annotation if provided in this component.
 *
 * @param configurableComponent the component to describe
 * @param xmlStreamWriter the stream writer to use
 * @throws XMLStreamException thrown if there was a problem writing the XML
 */
private void writeStatefulInfo(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
    final Stateful stateful = configurableComponent.getClass().getAnnotation(Stateful.class);
    writeSimpleElement(xmlStreamWriter, "h3", "State management: ");
    if (stateful != null) {
        xmlStreamWriter.writeStartElement("table");
        xmlStreamWriter.writeAttribute("id", "stateful");
        xmlStreamWriter.writeStartElement("tr");
        writeSimpleElement(xmlStreamWriter, "th", "Scope");
        writeSimpleElement(xmlStreamWriter, "th", "Description");
        xmlStreamWriter.writeEndElement();
        xmlStreamWriter.writeStartElement("tr");
        writeSimpleElement(xmlStreamWriter, "td", join(stateful.scopes(), ", "));
        writeSimpleElement(xmlStreamWriter, "td", stateful.description());
        xmlStreamWriter.writeEndElement();
        xmlStreamWriter.writeEndElement();
    } else {
        xmlStreamWriter.writeCharacters("This component does not store state.");
    }
}
Also used : Stateful(org.apache.nifi.annotation.behavior.Stateful)

Aggregations

Stateful (org.apache.nifi.annotation.behavior.Stateful)1