Class HtmlDocumentationWriter
java.lang.Object
org.apache.nifi.documentation.html.HtmlDocumentationWriter
- All Implemented Interfaces:
DocumentationWriter
- Direct Known Subclasses:
HtmlProcessorDocumentationWriter
Generates HTML documentation for a ConfigurableComponent. This class is used
to generate documentation for ControllerService, ParameterProvider, and ReportingTask because
they have no additional information.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe filename where additional user specified information may be stored.private final ExtensionManagerstatic final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleancontainsExpressionLanguage(ConfigurableComponent component) Indicates whether or not the component contains at least one property that supports Expression Language.private StringgetDefaultValue(PropertyDescriptor propertyDescriptor) protected StringgetDescription(ConfigurableComponent configurableComponent) Gets a description of the ConfigurableComponent using the CapabilityDescription annotation.private List<DynamicProperty> getDynamicProperties(ConfigurableComponent configurableComponent) protected StringgetTitle(ConfigurableComponent configurableComponent) Gets the class name of the component.protected voiditerateAndLinkComponents(XMLStreamWriter xmlStreamWriter, Class<? extends ConfigurableComponent>[] linkedComponents, String[] classNames, String separator, String sourceContextName) Writes a link to another configurable component(package private) static Stringprivate Class<? extends ControllerService>[]lookupControllerServiceImpls(Class<? extends ControllerService> parent) Uses theExtensionManagerto discover anyControllerServiceimplementations that implement a specific ControllerService API.voidwrite(ConfigurableComponent configurableComponent, OutputStream streamToWriteTo, boolean includesAdditionalDocumentation) protected voidwriteAdditionalBodyInfo(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) This method may be overridden by sub classes to write additional information to the body of the documentation.private voidwriteBody(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter, boolean hasAdditionalDetails) Writes the body section of the documentation, this consists of the component description, the tags, and the PropertyDescriptors.private voidwriteDeprecationWarning(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) Writes a warning about the deprecation of a component.protected voidwriteDescription(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter, boolean hasAdditionalDetails) Writes a description of the configurable component.private voidwriteDynamicProperties(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) protected voidwriteHead(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) Writes the head portion of the HTML documentation.private voidwriteHeader(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) Write the header to be displayed when loaded outside an iframe.private voidwriteInputRequirementInfo(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) Add in the documentation information regarding the component whether it accepts an incoming relationship or not.protected voidwriteLink(XMLStreamWriter xmlStreamWriter, String text, String location) A helper method to write a linkprotected voidwriteMultiComponentUseCases(ConfigurableComponent component, XMLStreamWriter xmlStreamWriter) protected voidwriteProperties(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) Writes the PropertyDescriptors out as a table.private voidwriteRestrictedInfo(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) Write the description of the Restricted annotation if provided in this component.private voidwriteSeeAlso(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) Writes the list of components that may be linked from this component.protected static voidwriteSimpleElement(XMLStreamWriter writer, String elementName, String characters) Writes a begin element, then text, then end element for the element of a users choosing.protected static voidwriteSimpleElement(XMLStreamWriter writer, String elementName, String characters, String id) Writes a begin element, an id attribute(if specified), then text, then end element for element of the users choosing.private voidwriteStatefulInfo(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) Write the description of the Stateful annotation if provided in this component.private voidwriteSupportsSensitiveDynamicProperties(ConfigurableComponent configurableComponent, XMLStreamWriter writer) private voidwriteSystemResourceConsiderationInfo(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) Writes all the system resource considerations for this componentprivate voidwriteTags(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) private voidwriteUseCaseConfiguration(String configuration, XMLStreamWriter xmlStreamWriter) protected voidwriteUseCases(ConfigurableComponent component, XMLStreamWriter xmlStreamWriter) private voidwriteValidValueDescription(XMLStreamWriter xmlStreamWriter, String description) protected voidwriteValidValues(XMLStreamWriter xmlStreamWriter, PropertyDescriptor property) Interrogates a PropertyDescriptor to get a list of AllowableValues, if there are none, nothing is written to the stream.
-
Field Details
-
LOGGER
public static final org.slf4j.Logger LOGGER -
ADDITIONAL_DETAILS_HTML
The filename where additional user specified information may be stored.- See Also:
-
extensionManager
-
-
Constructor Details
-
HtmlDocumentationWriter
-
-
Method Details
-
write
public void write(ConfigurableComponent configurableComponent, OutputStream streamToWriteTo, boolean includesAdditionalDocumentation) throws IOException - Specified by:
writein interfaceDocumentationWriter- Throws:
IOException
-
writeHead
protected void writeHead(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException Writes the head portion of the HTML documentation.- Parameters:
configurableComponent- the component to describexmlStreamWriter- the stream to write to- Throws:
XMLStreamException- thrown if there was a problem writing to the stream
-
getTitle
Gets the class name of the component.- Parameters:
configurableComponent- the component to describe- Returns:
- the class name of the component
-
writeBody
private void writeBody(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter, boolean hasAdditionalDetails) throws XMLStreamException Writes the body section of the documentation, this consists of the component description, the tags, and the PropertyDescriptors.- Parameters:
configurableComponent- the component to describexmlStreamWriter- the stream writerhasAdditionalDetails- whether there are additional details present or not- Throws:
XMLStreamException- thrown if there was a problem writing to the XML stream
-
writeHeader
private void writeHeader(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException Write the header to be displayed when loaded outside an iframe.- Parameters:
configurableComponent- the component to describexmlStreamWriter- the stream writer to use- Throws:
XMLStreamException- thrown if there was a problem writing the XML
-
writeInputRequirementInfo
private void writeInputRequirementInfo(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException Add in the documentation information regarding the component whether it accepts an incoming relationship or not.- Parameters:
configurableComponent- the component to describexmlStreamWriter- the stream writer to use- Throws:
XMLStreamException- thrown if there was a problem writing the XML
-
writeStatefulInfo
private void writeStatefulInfo(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException Write the description of the Stateful annotation if provided in this component.- Parameters:
configurableComponent- the component to describexmlStreamWriter- the stream writer to use- Throws:
XMLStreamException- thrown if there was a problem writing the XML
-
writeRestrictedInfo
private void writeRestrictedInfo(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException Write the description of the Restricted annotation if provided in this component.- Parameters:
configurableComponent- the component to describexmlStreamWriter- the stream writer to use- Throws:
XMLStreamException- thrown if there was a problem writing the XML
-
writeDeprecationWarning
private void writeDeprecationWarning(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException Writes a warning about the deprecation of a component.- Parameters:
configurableComponent- the component to describexmlStreamWriter- the stream writer- Throws:
XMLStreamException- thrown if there was a problem writing to the XML stream
-
writeSeeAlso
private void writeSeeAlso(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException Writes the list of components that may be linked from this component.- Parameters:
configurableComponent- the component to describexmlStreamWriter- the stream writer to use- Throws:
XMLStreamException- thrown if there was a problem writing the XML
-
writeAdditionalBodyInfo
protected void writeAdditionalBodyInfo(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException This method may be overridden by sub classes to write additional information to the body of the documentation.- Parameters:
configurableComponent- the component to describexmlStreamWriter- the stream writer- Throws:
XMLStreamException- thrown if there was a problem writing to the XML stream
-
writeTags
private void writeTags(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException - Throws:
XMLStreamException
-
join
-
writeDescription
protected void writeDescription(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter, boolean hasAdditionalDetails) throws XMLStreamException Writes a description of the configurable component.- Parameters:
configurableComponent- the component to describexmlStreamWriter- the stream writerhasAdditionalDetails- whether there are additional details available as 'additionalDetails.html'- Throws:
XMLStreamException- thrown if there was a problem writing to the XML stream
-
getDescription
Gets a description of the ConfigurableComponent using the CapabilityDescription annotation.- Parameters:
configurableComponent- the component to describe- Returns:
- a description of the configurableComponent
-
writeUseCases
protected void writeUseCases(ConfigurableComponent component, XMLStreamWriter xmlStreamWriter) throws XMLStreamException - Throws:
XMLStreamException
-
writeMultiComponentUseCases
protected void writeMultiComponentUseCases(ConfigurableComponent component, XMLStreamWriter xmlStreamWriter) throws XMLStreamException - Throws:
XMLStreamException
-
writeUseCaseConfiguration
private void writeUseCaseConfiguration(String configuration, XMLStreamWriter xmlStreamWriter) throws XMLStreamException - Throws:
XMLStreamException
-
writeProperties
protected void writeProperties(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException Writes the PropertyDescriptors out as a table.- Parameters:
configurableComponent- the component to describexmlStreamWriter- the stream writer- Throws:
XMLStreamException- thrown if there was a problem writing to the XML Stream
-
getDefaultValue
-
containsExpressionLanguage
Indicates whether or not the component contains at least one property that supports Expression Language.- Parameters:
component- the component to interrogate- Returns:
- whether or not the component contains at least one sensitive property.
-
writeDynamicProperties
private void writeDynamicProperties(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException - Throws:
XMLStreamException
-
writeSupportsSensitiveDynamicProperties
private void writeSupportsSensitiveDynamicProperties(ConfigurableComponent configurableComponent, XMLStreamWriter writer) throws XMLStreamException - Throws:
XMLStreamException
-
getDynamicProperties
-
writeValidValueDescription
private void writeValidValueDescription(XMLStreamWriter xmlStreamWriter, String description) throws XMLStreamException - Throws:
XMLStreamException
-
writeValidValues
protected void writeValidValues(XMLStreamWriter xmlStreamWriter, PropertyDescriptor property) throws XMLStreamException Interrogates a PropertyDescriptor to get a list of AllowableValues, if there are none, nothing is written to the stream.- Parameters:
xmlStreamWriter- the stream writer to useproperty- the property to describe- Throws:
XMLStreamException- thrown if there was a problem writing to the XML Stream
-
writeSimpleElement
protected static void writeSimpleElement(XMLStreamWriter writer, String elementName, String characters, String id) throws XMLStreamException Writes a begin element, an id attribute(if specified), then text, then end element for element of the users choosing. Example: <p id="p-id">text</p>- Parameters:
writer- the stream writer to useelementName- the name of the elementcharacters- the text of the elementid- the id of the element. specifying null will cause no element to be written.- Throws:
XMLStreamException- xse
-
writeSimpleElement
protected static void writeSimpleElement(XMLStreamWriter writer, String elementName, String characters) throws XMLStreamException Writes a begin element, then text, then end element for the element of a users choosing. Example: <p>text</p>- Parameters:
writer- the stream writer to useelementName- the name of the elementcharacters- the characters to insert into the element- Throws:
XMLStreamException
-
writeLink
protected void writeLink(XMLStreamWriter xmlStreamWriter, String text, String location) throws XMLStreamException A helper method to write a link- Parameters:
xmlStreamWriter- the stream to write totext- the text of the linklocation- the location of the link- Throws:
XMLStreamException- thrown if there was a problem writing to the stream
-
writeSystemResourceConsiderationInfo
private void writeSystemResourceConsiderationInfo(ConfigurableComponent configurableComponent, XMLStreamWriter xmlStreamWriter) throws XMLStreamException Writes all the system resource considerations for this component- Parameters:
configurableComponent- the component to describexmlStreamWriter- the xml stream writer to use- Throws:
XMLStreamException- thrown if there was a problem writing the XML
-
lookupControllerServiceImpls
private Class<? extends ControllerService>[] lookupControllerServiceImpls(Class<? extends ControllerService> parent) Uses theExtensionManagerto discover anyControllerServiceimplementations that implement a specific ControllerService API.- Parameters:
parent- the controller service API- Returns:
- an array of controller services that implement the controller service API
-
iterateAndLinkComponents
protected void iterateAndLinkComponents(XMLStreamWriter xmlStreamWriter, Class<? extends ConfigurableComponent>[] linkedComponents, String[] classNames, String separator, String sourceContextName) throws XMLStreamException Writes a link to another configurable component- Parameters:
xmlStreamWriter- the xml stream writerlinkedComponents- the array of configurable component to link toclassNames- the array of class names in string format to link toseparator- a separator used to split the values (in case more than 1. If the separator is enclosed in between "invalid input: '<'" and ">" (.e.g "
" it is treated as a tag and written to the xmlStreamWriter as an empty tagsourceContextName- the source context/name of the item being linked- Throws:
XMLStreamException- thrown if there is a problem writing the XML
-