use of org.apache.nifi.annotation.behavior.SystemResourceConsideration in project nifi by apache.
the class HtmlDocumentationWriter method writeSystemResourceConsiderationInfo.
/**
* Writes all the system resource considerations for this component
*
* @param configurableComponent the component to describe
* @param xmlStreamWriter the xml stream writer to use
* @throws XMLStreamException thrown if there was a problem writing the XML
*/
private void writeSystemResourceConsiderationInfo(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
SystemResourceConsideration[] systemResourceConsiderations = configurableComponent.getClass().getAnnotationsByType(SystemResourceConsideration.class);
writeSimpleElement(xmlStreamWriter, "h3", "System Resource Considerations:");
if (systemResourceConsiderations.length > 0) {
xmlStreamWriter.writeStartElement("table");
xmlStreamWriter.writeAttribute("id", "system-resource-considerations");
xmlStreamWriter.writeStartElement("tr");
writeSimpleElement(xmlStreamWriter, "th", "Resource");
writeSimpleElement(xmlStreamWriter, "th", "Description");
xmlStreamWriter.writeEndElement();
for (SystemResourceConsideration systemResourceConsideration : systemResourceConsiderations) {
xmlStreamWriter.writeStartElement("tr");
writeSimpleElement(xmlStreamWriter, "td", systemResourceConsideration.resource().name());
writeSimpleElement(xmlStreamWriter, "td", systemResourceConsideration.description().trim().isEmpty() ? "Not Specified" : systemResourceConsideration.description());
xmlStreamWriter.writeEndElement();
}
xmlStreamWriter.writeEndElement();
} else {
xmlStreamWriter.writeCharacters("None specified.");
}
}
Aggregations