http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java index 778128f..087e654 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java @@ -21,6 +21,7 @@ import org.apache.nifi.web.api.entity.ControllerServiceReferencingComponentEntit import javax.xml.bind.annotation.XmlType; import java.util.Collection; +import java.util.List; import java.util.Map; import java.util.Set; @@ -32,10 +33,14 @@ public class ControllerServiceDTO extends ComponentDTO { private String name; private String type; + private BundleDTO bundle; + private List<ControllerServiceApiDTO> controllerServiceApis; private String comments; private String state; private Boolean persistsState; private Boolean restricted; + private Boolean isExtensionMissing; + private Boolean multipleVersionsAvailable; private Map<String, String> properties; private Map<String, PropertyDescriptorDTO> descriptors; @@ -76,6 +81,38 @@ public class ControllerServiceDTO extends ComponentDTO { } /** + * The details of the artifact that bundled this controller service type. + * + * @return The bundle details + */ + @ApiModelProperty( + value = "The details of the artifact that bundled this processor type." + ) + public BundleDTO getBundle() { + return bundle; + } + + public void setBundle(BundleDTO bundle) { + this.bundle = bundle; + } + + /** + * Lists the APIs this Controller Service implements. + * + * @return The listing of implemented APIs + */ + @ApiModelProperty( + value = "Lists the APIs this Controller Service implements." + ) + public List<ControllerServiceApiDTO> getControllerServiceApis() { + return controllerServiceApis; + } + + public void setControllerServiceApis(List<ControllerServiceApiDTO> controllerServiceApis) { + this.controllerServiceApis = controllerServiceApis; + } + + /** * @return the comment for the Controller Service */ @ApiModelProperty( @@ -118,6 +155,34 @@ public class ControllerServiceDTO extends ComponentDTO { } /** + * @return whether the underlying extension is missing + */ + @ApiModelProperty( + value = "Whether the underlying extension is missing." + ) + public Boolean getExtensionMissing() { + return isExtensionMissing; + } + + public void setExtensionMissing(Boolean extensionMissing) { + isExtensionMissing = extensionMissing; + } + + /** + * @return whether this controller service has multiple versions available + */ + @ApiModelProperty( + value = "Whether the controller service has multiple versions available." + ) + public Boolean getMultipleVersionsAvailable() { + return multipleVersionsAvailable; + } + + public void setMultipleVersionsAvailable(Boolean multipleVersionsAvailable) { + this.multipleVersionsAvailable = multipleVersionsAvailable; + } + + /** * @return The state of this controller service. Possible values are ENABLED, ENABLING, DISABLED, DISABLING */ @ApiModelProperty(
http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DocumentedTypeDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DocumentedTypeDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DocumentedTypeDTO.java index dc0ea78..e4da9df 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DocumentedTypeDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/DocumentedTypeDTO.java @@ -19,6 +19,8 @@ package org.apache.nifi.web.api.dto; import com.wordnik.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlType; +import java.util.List; +import java.util.Objects; import java.util.Set; /** @@ -28,6 +30,8 @@ import java.util.Set; public class DocumentedTypeDTO { private String type; + private BundleDTO bundle; + private List<ControllerServiceApiDTO> controllerServiceApis; private String description; private String usageRestriction; private Set<String> tags; @@ -75,6 +79,38 @@ public class DocumentedTypeDTO { } /** + * The details of the artifact that bundled this type. + * + * @return The bundle details + */ + @ApiModelProperty( + value = "The details of the artifact that bundled this type." + ) + public BundleDTO getBundle() { + return bundle; + } + + public void setBundle(BundleDTO bundle) { + this.bundle = bundle; + } + + /** + * If this type represents a ControllerService, this lists the APIs it implements. + * + * @return The listing of implemented APIs + */ + @ApiModelProperty( + value = "If this type represents a ControllerService, this lists the APIs it implements." + ) + public List<ControllerServiceApiDTO> getControllerServiceApis() { + return controllerServiceApis; + } + + public void setControllerServiceApis(List<ControllerServiceApiDTO> controllerServiceApis) { + this.controllerServiceApis = controllerServiceApis; + } + + /** * @return The tags associated with this type */ @ApiModelProperty( @@ -88,4 +124,22 @@ public class DocumentedTypeDTO { this.tags = tags; } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + final DocumentedTypeDTO that = (DocumentedTypeDTO) o; + return Objects.equals(type, that.type) && Objects.equals(bundle, that.bundle); + } + + @Override + public int hashCode() { + return Objects.hash(type, bundle); + } } http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java index ee641c9..a119cea 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ProcessorDTO.java @@ -31,6 +31,7 @@ public class ProcessorDTO extends ComponentDTO { private String name; private String type; + private BundleDTO bundle; private String state; private Map<String, String> style; private List<RelationshipDTO> relationships; @@ -40,6 +41,8 @@ public class ProcessorDTO extends ComponentDTO { private Boolean supportsBatching; private Boolean persistsState; private Boolean restricted; + private Boolean isExtensionMissing; + private Boolean multipleVersionsAvailable; private String inputRequirement; private ProcessorConfigDTO config; @@ -83,6 +86,22 @@ public class ProcessorDTO extends ComponentDTO { } /** + * The details of the artifact that bundled this processor type. + * + * @return The bundle details + */ + @ApiModelProperty( + value = "The details of the artifact that bundled this processor type." + ) + public BundleDTO getBundle() { + return bundle; + } + + public void setBundle(BundleDTO bundle) { + this.bundle = bundle; + } + + /** * @return The state of this processor. Possible states are 'RUNNING', 'STOPPED', and 'DISABLED' */ @ApiModelProperty( @@ -140,6 +159,34 @@ public class ProcessorDTO extends ComponentDTO { } /** + * @return whether this processor has multiple versions available + */ + @ApiModelProperty( + value = "Whether the processor has multiple versions available." + ) + public Boolean getMultipleVersionsAvailable() { + return multipleVersionsAvailable; + } + + public void setMultipleVersionsAvailable(Boolean multipleVersionsAvailable) { + this.multipleVersionsAvailable = multipleVersionsAvailable; + } + + /** + * @return whether the underlying extension is missing + */ + @ApiModelProperty( + value = "Whether the underlying extension is missing." + ) + public Boolean getExtensionMissing() { + return isExtensionMissing; + } + + public void setExtensionMissing(Boolean extensionMissing) { + isExtensionMissing = extensionMissing; + } + + /** * @return whether this processor requires elevated privileges */ @ApiModelProperty( http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDescriptorDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDescriptorDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDescriptorDTO.java index f22d883..a1f121d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDescriptorDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/PropertyDescriptorDTO.java @@ -19,8 +19,8 @@ package org.apache.nifi.web.api.dto; import com.wordnik.swagger.annotations.ApiModelProperty; import org.apache.nifi.web.api.entity.AllowableValueEntity; -import java.util.List; import javax.xml.bind.annotation.XmlType; +import java.util.List; /** * A description of a property. @@ -38,6 +38,7 @@ public class PropertyDescriptorDTO { private Boolean dynamic; private Boolean supportsEl; private String identifiesControllerService; + private BundleDTO identifiesControllerServiceBundle; /** * @return set of allowable values for this property. If empty then the allowable values are not constrained @@ -166,10 +167,10 @@ public class PropertyDescriptorDTO { } /** - * @return if this property identifies a controller service, this returns the fully qualified type, null otherwise + * @return if this property identifies a controller service this returns the fully qualified type, null otherwise */ @ApiModelProperty( - value = "If the property identifies a controller service, this returns the fully qualified type." + value = "If the property identifies a controller service this returns the fully qualified type." ) public String getIdentifiesControllerService() { return identifiesControllerService; @@ -179,4 +180,17 @@ public class PropertyDescriptorDTO { this.identifiesControllerService = identifiesControllerService; } + /** + * @return if this property identifies a controller service this returns the bundle of the type, null otherwise + */ + @ApiModelProperty( + value = "If the property identifies a controller service this returns the bundle of the type, null otherwise." + ) + public BundleDTO getIdentifiesControllerServiceBundle() { + return identifiesControllerServiceBundle; + } + + public void setIdentifiesControllerServiceBundle(BundleDTO identifiesControllerServiceBundle) { + this.identifiesControllerServiceBundle = identifiesControllerServiceBundle; + } } http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java index 203fd0e..56b63d9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ReportingTaskDTO.java @@ -30,10 +30,13 @@ public class ReportingTaskDTO extends ComponentDTO { private String name; private String type; + private BundleDTO bundle; private String state; private String comments; private Boolean persistsState; private Boolean restricted; + private Boolean isExtensionMissing; + private Boolean multipleVersionsAvailable; private String schedulingPeriod; private String schedulingStrategy; @@ -91,6 +94,22 @@ public class ReportingTaskDTO extends ComponentDTO { } /** + * The details of the artifact that bundled this processor type. + * + * @return The bundle details + */ + @ApiModelProperty( + value = "The details of the artifact that bundled this processor type." + ) + public BundleDTO getBundle() { + return bundle; + } + + public void setBundle(BundleDTO bundle) { + this.bundle = bundle; + } + + /** * The frequency with which to schedule the reporting task. The format of the value will depend on the value of {@link #getSchedulingStrategy()}. * * @return The scheduling period @@ -135,6 +154,34 @@ public class ReportingTaskDTO extends ComponentDTO { } /** + * @return whether the underlying extension is missing + */ + @ApiModelProperty( + value = "Whether the underlying extension is missing." + ) + public Boolean getExtensionMissing() { + return isExtensionMissing; + } + + public void setExtensionMissing(Boolean extensionMissing) { + isExtensionMissing = extensionMissing; + } + + /** + * @return whether this reporting task has multiple versions available + */ + @ApiModelProperty( + value = "Whether the reporting task has multiple versions available." + ) + public Boolean getMultipleVersionsAvailable() { + return multipleVersionsAvailable; + } + + public void setMultipleVersionsAvailable(Boolean multipleVersionsAvailable) { + this.multipleVersionsAvailable = multipleVersionsAvailable; + } + + /** * @return current scheduling state of the reporting task */ @ApiModelProperty( http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/TemplateDTO.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/TemplateDTO.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/TemplateDTO.java index 83e2339..b36e63d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/TemplateDTO.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/TemplateDTO.java @@ -29,7 +29,7 @@ import java.util.Date; */ @XmlRootElement(name = "template") public class TemplateDTO { - public static final String MAX_ENCODING_VERSION = "1.0"; + public static final String MAX_ENCODING_VERSION = "1.1"; private String uri; http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InstantiateTemplateRequestEntity.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InstantiateTemplateRequestEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InstantiateTemplateRequestEntity.java index f4e55d4..8945f36 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InstantiateTemplateRequestEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/InstantiateTemplateRequestEntity.java @@ -17,6 +17,7 @@ package org.apache.nifi.web.api.entity; import com.wordnik.swagger.annotations.ApiModelProperty; +import org.apache.nifi.web.api.dto.FlowSnippetDTO; import javax.xml.bind.annotation.XmlRootElement; @@ -26,12 +27,15 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "instantiateTemplateRequestEntity") public class InstantiateTemplateRequestEntity extends Entity { - private String templateId; private Double originX; private Double originY; + private String templateId; + private String encodingVersion; + private FlowSnippetDTO snippet; + @ApiModelProperty( - value = "The identifier of the template." + value = "The identifier of the template." ) public String getTemplateId() { return templateId; @@ -42,7 +46,7 @@ public class InstantiateTemplateRequestEntity extends Entity { } @ApiModelProperty( - value = "The x coordinate of the origin of the bounding box where the new components will be placed." + value = "The x coordinate of the origin of the bounding box where the new components will be placed." ) public Double getOriginX() { return originX; @@ -53,7 +57,7 @@ public class InstantiateTemplateRequestEntity extends Entity { } @ApiModelProperty( - value = "The y coordinate of the origin of the bounding box where the new components will be placed." + value = "The y coordinate of the origin of the bounding box where the new components will be placed." ) public Double getOriginY() { return originY; @@ -62,4 +66,31 @@ public class InstantiateTemplateRequestEntity extends Entity { public void setOriginY(Double originY) { this.originY = originY; } + + @ApiModelProperty( + value = "The encoding version of the flow snippet. If not specified, this is automatically " + + "populated by the node receiving the user request. If the snippet is specified, the version " + + "will be the latest. If the snippet is not specified, the version will come from the underlying " + + "template. These details need to be replicated throughout the cluster to ensure consistency." + ) + public String getEncodingVersion() { + return encodingVersion; + } + + public void setEncodingVersion(String encodingVersion) { + this.encodingVersion = encodingVersion; + } + + @ApiModelProperty( + value = "A flow snippet of the template contents. If not specified, this is automatically " + + "populated by the node receiving the user request. These details need to be replicated " + + "throughout the cluster to ensure consistency." + ) + public FlowSnippetDTO getSnippet() { + return snippet; + } + + public void setSnippet(FlowSnippetDTO snippet) { + this.snippet = snippet; + } } http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/ConfigurableComponentInitializer.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/ConfigurableComponentInitializer.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/ConfigurableComponentInitializer.java deleted file mode 100644 index 361d3d1..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/ConfigurableComponentInitializer.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.documentation; - -import org.apache.nifi.components.ConfigurableComponent; -import org.apache.nifi.reporting.InitializationException; - -/** - * An interface for initializing and tearing down a ConfigurableComponent. It is up to the - * implementer to call "init" so that you can call - * ConfigurableComponent.getPropertyDescriptors() - * - */ -public interface ConfigurableComponentInitializer { - - /** - * Initializes a configurable component to the point that you can call - * getPropertyDescriptors() on it - * - * @param component the component to initialize - * @throws InitializationException if the component could not be initialized - */ - void initialize(ConfigurableComponent component) throws InitializationException; - - /** - * Calls the lifecycle methods that should be called when a flow is shutdown. - * - * @param component the component to initialize - */ - void teardown(ConfigurableComponent component); -} http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java index 116fda5..9ae1705 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/DocGenerator.java @@ -16,22 +16,16 @@ */ package org.apache.nifi.documentation; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.OutputStream; -import java.util.HashSet; -import java.util.Set; +import org.apache.nifi.bundle.Bundle; +import org.apache.nifi.bundle.BundleCoordinate; import org.apache.nifi.components.ConfigurableComponent; import org.apache.nifi.controller.ControllerService; import org.apache.nifi.documentation.html.HtmlDocumentationWriter; import org.apache.nifi.documentation.html.HtmlProcessorDocumentationWriter; -import org.apache.nifi.documentation.init.ControllerServiceInitializer; -import org.apache.nifi.documentation.init.ProcessorInitializer; -import org.apache.nifi.documentation.init.ReportingTaskingInitializer; +import org.apache.nifi.init.ConfigurableComponentInitializer; +import org.apache.nifi.init.ConfigurableComponentInitializerFactory; import org.apache.nifi.nar.ExtensionManager; +import org.apache.nifi.nar.ExtensionMapping; import org.apache.nifi.processor.Processor; import org.apache.nifi.reporting.InitializationException; import org.apache.nifi.reporting.ReportingTask; @@ -39,6 +33,14 @@ import org.apache.nifi.util.NiFiProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Set; + /** * Uses the ExtensionManager to get a list of Processor, ControllerService, and * Reporting Task classes that were loaded and generate documentation for them. @@ -54,25 +56,44 @@ public class DocGenerator { * NiFiProperties. * * @param properties to lookup nifi properties + * @param extensionMapping extension mapping */ - public static void generate(final NiFiProperties properties) { - @SuppressWarnings("rawtypes") - final Set<Class> extensionClasses = new HashSet<>(); - extensionClasses.addAll(ExtensionManager.getExtensions(Processor.class)); - extensionClasses.addAll(ExtensionManager.getExtensions(ControllerService.class)); - extensionClasses.addAll(ExtensionManager.getExtensions(ReportingTask.class)); - + public static void generate(final NiFiProperties properties, final ExtensionMapping extensionMapping) { final File explodedNiFiDocsDir = properties.getComponentDocumentationWorkingDirectory(); - logger.debug("Generating documentation for: " + extensionClasses.size() + " components in: " - + explodedNiFiDocsDir); + logger.debug("Generating documentation for: " + extensionMapping.size() + " components in: " + explodedNiFiDocsDir); + + documentConfigurableComponent(ExtensionManager.getExtensions(Processor.class), explodedNiFiDocsDir); + documentConfigurableComponent(ExtensionManager.getExtensions(ControllerService.class), explodedNiFiDocsDir); + documentConfigurableComponent(ExtensionManager.getExtensions(ReportingTask.class), explodedNiFiDocsDir); + } + /** + * Documents a type of configurable component. + * + * @param extensionClasses types of a configurable component + * @param explodedNiFiDocsDir base directory of component documentation + */ + private static void documentConfigurableComponent(final Set<Class> extensionClasses, final File explodedNiFiDocsDir) { for (final Class<?> extensionClass : extensionClasses) { if (ConfigurableComponent.class.isAssignableFrom(extensionClass)) { + final String extensionClassName = extensionClass.getCanonicalName(); + + final Bundle bundle = ExtensionManager.getBundle(extensionClass.getClassLoader()); + if (bundle == null) { + logger.warn("No coordinate found for {}, skipping...", new Object[] {extensionClassName}); + continue; + } + final BundleCoordinate coordinate = bundle.getBundleDetails().getCoordinate(); + + final String path = coordinate.getGroup() + "/" + coordinate.getId() + "/" + coordinate.getVersion() + "/" + extensionClassName; + final File componentDirectory = new File(explodedNiFiDocsDir, path); + componentDirectory.mkdirs(); + final Class<? extends ConfigurableComponent> componentClass = extensionClass.asSubclass(ConfigurableComponent.class); try { logger.debug("Documenting: " + componentClass); - document(explodedNiFiDocsDir, componentClass); + document(componentDirectory, componentClass); } catch (Exception e) { logger.warn("Unable to document: " + componentClass, e); } @@ -85,33 +106,29 @@ public class DocGenerator { * check to see if an "additionalDetails.html" file exists and will link * that from the generated documentation. * - * @param docsDir the work\docs\components dir to stick component - * documentation in + * @param componentDocsDir the component documentation directory * @param componentClass the class to document * @throws InstantiationException ie * @throws IllegalAccessException iae * @throws IOException ioe * @throws InitializationException ie */ - private static void document(final File docsDir, final Class<? extends ConfigurableComponent> componentClass) + private static void document(final File componentDocsDir, final Class<? extends ConfigurableComponent> componentClass) throws InstantiationException, IllegalAccessException, IOException, InitializationException { final ConfigurableComponent component = componentClass.newInstance(); - final ConfigurableComponentInitializer initializer = getComponentInitializer(componentClass); + final ConfigurableComponentInitializer initializer = ConfigurableComponentInitializerFactory.createComponentInitializer(componentClass); initializer.initialize(component); final DocumentationWriter writer = getDocumentWriter(componentClass); - final File directory = new File(docsDir, componentClass.getCanonicalName()); - directory.mkdirs(); - - final File baseDocumentationFile = new File(directory, "index.html"); + final File baseDocumentationFile = new File(componentDocsDir, "index.html"); if (baseDocumentationFile.exists()) { logger.warn(baseDocumentationFile + " already exists, overwriting!"); } try (final OutputStream output = new BufferedOutputStream(new FileOutputStream(baseDocumentationFile))) { - writer.write(component, output, hasAdditionalInfo(directory)); + writer.write(component, output, hasAdditionalInfo(componentDocsDir)); } initializer.teardown(component); @@ -138,28 +155,6 @@ public class DocGenerator { } /** - * Returns a ConfigurableComponentInitializer for the type of component. - * Currently Processor, ControllerService and ReportingTask are supported. - * - * @param componentClass the class that requires a - * ConfigurableComponentInitializer - * @return a ConfigurableComponentInitializer capable of initializing that - * specific type of class - */ - private static ConfigurableComponentInitializer getComponentInitializer( - final Class<? extends ConfigurableComponent> componentClass) { - if (Processor.class.isAssignableFrom(componentClass)) { - return new ProcessorInitializer(); - } else if (ControllerService.class.isAssignableFrom(componentClass)) { - return new ControllerServiceInitializer(); - } else if (ReportingTask.class.isAssignableFrom(componentClass)) { - return new ReportingTaskingInitializer(); - } - - return null; - } - - /** * Checks to see if a directory to write to has an additionalDetails.html in * it already. * http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java index 974e3eb..8097ece 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java @@ -91,7 +91,7 @@ public class HtmlDocumentationWriter implements DocumentationWriter { xmlStreamWriter.writeStartElement("link"); xmlStreamWriter.writeAttribute("rel", "stylesheet"); - xmlStreamWriter.writeAttribute("href", "../../css/component-usage.css"); + xmlStreamWriter.writeAttribute("href", "/nifi-docs/css/component-usage.css"); xmlStreamWriter.writeAttribute("type", "text/css"); xmlStreamWriter.writeEndElement(); http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java deleted file mode 100644 index 8bef0d3..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.documentation.init; - -import org.apache.nifi.annotation.lifecycle.OnShutdown; -import org.apache.nifi.components.ConfigurableComponent; -import org.apache.nifi.controller.ControllerService; -import org.apache.nifi.controller.ControllerServiceInitializationContext; -import org.apache.nifi.documentation.ConfigurableComponentInitializer; -import org.apache.nifi.documentation.mock.MockConfigurationContext; -import org.apache.nifi.documentation.mock.MockControllerServiceInitializationContext; -import org.apache.nifi.documentation.mock.MockComponentLogger; -import org.apache.nifi.documentation.util.ReflectionUtils; -import org.apache.nifi.logging.ComponentLog; -import org.apache.nifi.nar.ExtensionManager; -import org.apache.nifi.nar.NarCloseable; -import org.apache.nifi.reporting.InitializationException; - -/** - * Initializes a ControllerService using a MockControllerServiceInitializationContext - * - * - */ -public class ControllerServiceInitializer implements ConfigurableComponentInitializer { - - @Override - public void initialize(ConfigurableComponent component) throws InitializationException { - ControllerService controllerService = (ControllerService) component; - ControllerServiceInitializationContext context = new MockControllerServiceInitializationContext(); - try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(component.getClass(), context.getIdentifier())) { - controllerService.initialize(context); - } - } - - @Override - public void teardown(ConfigurableComponent component) { - try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(component.getClass(), component.getIdentifier())) { - ControllerService controllerService = (ControllerService) component; - - final ComponentLog logger = new MockComponentLogger(); - final MockConfigurationContext context = new MockConfigurationContext(); - ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnShutdown.class, controllerService, logger, context); - } finally { - ExtensionManager.removeInstanceClassLoaderIfExists(component.getIdentifier()); - } - } -} http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java deleted file mode 100644 index 4d38641..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.documentation.init; - -import org.apache.nifi.annotation.lifecycle.OnShutdown; -import org.apache.nifi.components.ConfigurableComponent; -import org.apache.nifi.documentation.ConfigurableComponentInitializer; -import org.apache.nifi.documentation.mock.MockProcessContext; -import org.apache.nifi.documentation.mock.MockProcessorInitializationContext; -import org.apache.nifi.documentation.mock.MockComponentLogger; -import org.apache.nifi.documentation.util.ReflectionUtils; -import org.apache.nifi.logging.ComponentLog; -import org.apache.nifi.nar.ExtensionManager; -import org.apache.nifi.nar.NarCloseable; -import org.apache.nifi.processor.Processor; -import org.apache.nifi.processor.ProcessorInitializationContext; - -/** - * Initializes a Procesor using a MockProcessorInitializationContext - * - * - */ -public class ProcessorInitializer implements ConfigurableComponentInitializer { - - @Override - public void initialize(ConfigurableComponent component) { - Processor processor = (Processor) component; - ProcessorInitializationContext initializationContext = new MockProcessorInitializationContext(); - try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(component.getClass(), initializationContext.getIdentifier())) { - processor.initialize(initializationContext); - } - } - - @Override - public void teardown(ConfigurableComponent component) { - Processor processor = (Processor) component; - try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(component.getClass(), component.getIdentifier())) { - - final ComponentLog logger = new MockComponentLogger(); - final MockProcessContext context = new MockProcessContext(); - ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnShutdown.class, processor, logger, context); - } finally { - ExtensionManager.removeInstanceClassLoaderIfExists(component.getIdentifier()); - } - } -} http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java deleted file mode 100644 index a47959b..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.documentation.init; - -import org.apache.nifi.annotation.lifecycle.OnShutdown; -import org.apache.nifi.components.ConfigurableComponent; -import org.apache.nifi.documentation.ConfigurableComponentInitializer; -import org.apache.nifi.documentation.mock.MockConfigurationContext; -import org.apache.nifi.documentation.mock.MockComponentLogger; -import org.apache.nifi.documentation.mock.MockReportingInitializationContext; -import org.apache.nifi.documentation.util.ReflectionUtils; -import org.apache.nifi.nar.ExtensionManager; -import org.apache.nifi.nar.NarCloseable; -import org.apache.nifi.reporting.InitializationException; -import org.apache.nifi.reporting.ReportingInitializationContext; -import org.apache.nifi.reporting.ReportingTask; - -/** - * Initializes a ReportingTask using a MockReportingInitializationContext; - * - * - */ -public class ReportingTaskingInitializer implements ConfigurableComponentInitializer { - - @Override - public void initialize(ConfigurableComponent component) throws InitializationException { - ReportingTask reportingTask = (ReportingTask) component; - ReportingInitializationContext context = new MockReportingInitializationContext(); - try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(component.getClass(), context.getIdentifier())) { - reportingTask.initialize(context); - } - } - - @Override - public void teardown(ConfigurableComponent component) { - ReportingTask reportingTask = (ReportingTask) component; - try (NarCloseable narCloseable = NarCloseable.withComponentNarLoader(component.getClass(), component.getIdentifier())) { - - final MockConfigurationContext context = new MockConfigurationContext(); - ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnShutdown.class, reportingTask, new MockComponentLogger(), context); - } finally { - ExtensionManager.removeInstanceClassLoaderIfExists(component.getIdentifier()); - } - } -} http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockComponentLogger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockComponentLogger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockComponentLogger.java deleted file mode 100644 index dd2f1b3..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockComponentLogger.java +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.documentation.mock; - -import org.apache.nifi.logging.ComponentLog; -import org.apache.nifi.logging.LogLevel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Stubs out the functionality of a ComponentLog so that it can - * be used during initialization of a component. - * - */ -public class MockComponentLogger implements ComponentLog { - - private static final Logger logger = LoggerFactory - .getLogger(MockComponentLogger.class); - - @Override - public void warn(String msg, Throwable t) { - logger.warn(msg, t); - } - - @Override - public void warn(String msg, Object[] os) { - logger.warn(msg, os); - } - - @Override - public void warn(String msg, Object[] os, Throwable t) { - logger.warn(msg, os); - logger.warn("", t); - } - - @Override - public void warn(String msg) { - logger.warn(msg); - } - - @Override - public void trace(String msg, Throwable t) { - logger.trace(msg, t); - } - - @Override - public void trace(String msg, Object[] os) { - logger.trace(msg, os); - } - - @Override - public void trace(String msg) { - logger.trace(msg); - } - - @Override - public void trace(String msg, Object[] os, Throwable t) { - logger.trace(msg, os); - logger.trace("", t); - } - - @Override - public boolean isWarnEnabled() { - return logger.isWarnEnabled(); - } - - @Override - public boolean isTraceEnabled() { - return logger.isTraceEnabled(); - } - - @Override - public boolean isInfoEnabled() { - return logger.isInfoEnabled(); - } - - @Override - public boolean isErrorEnabled() { - return logger.isErrorEnabled(); - } - - @Override - public boolean isDebugEnabled() { - return logger.isDebugEnabled(); - } - - @Override - public void info(String msg, Throwable t) { - logger.info(msg, t); - } - - @Override - public void info(String msg, Object[] os) { - logger.info(msg, os); - } - - @Override - public void info(String msg) { - logger.info(msg); - - } - - @Override - public void info(String msg, Object[] os, Throwable t) { - logger.trace(msg, os); - logger.trace("", t); - - } - - @Override - public String getName() { - return logger.getName(); - } - - @Override - public void error(String msg, Throwable t) { - logger.error(msg, t); - } - - @Override - public void error(String msg, Object[] os) { - logger.error(msg, os); - } - - @Override - public void error(String msg) { - logger.error(msg); - } - - @Override - public void error(String msg, Object[] os, Throwable t) { - logger.error(msg, os); - logger.error("", t); - } - - @Override - public void debug(String msg, Throwable t) { - logger.debug(msg, t); - } - - @Override - public void debug(String msg, Object[] os) { - logger.debug(msg, os); - } - - @Override - public void debug(String msg, Object[] os, Throwable t) { - logger.debug(msg, os); - logger.debug("", t); - } - - @Override - public void debug(String msg) { - logger.debug(msg); - } - - @Override - public void log(LogLevel level, String msg, Throwable t) { - switch (level) { - case DEBUG: - debug(msg, t); - break; - case ERROR: - case FATAL: - error(msg, t); - break; - case INFO: - info(msg, t); - break; - case TRACE: - trace(msg, t); - break; - case WARN: - warn(msg, t); - break; - } - } - - @Override - public void log(LogLevel level, String msg, Object[] os) { - switch (level) { - case DEBUG: - debug(msg, os); - break; - case ERROR: - case FATAL: - error(msg, os); - break; - case INFO: - info(msg, os); - break; - case TRACE: - trace(msg, os); - break; - case WARN: - warn(msg, os); - break; - } - } - - @Override - public void log(LogLevel level, String msg) { - switch (level) { - case DEBUG: - debug(msg); - break; - case ERROR: - case FATAL: - error(msg); - break; - case INFO: - info(msg); - break; - case TRACE: - trace(msg); - break; - case WARN: - warn(msg); - break; - } - } - - @Override - public void log(LogLevel level, String msg, Object[] os, Throwable t) { - switch (level) { - case DEBUG: - debug(msg, os, t); - break; - case ERROR: - case FATAL: - error(msg, os, t); - break; - case INFO: - info(msg, os, t); - break; - case TRACE: - trace(msg, os, t); - break; - case WARN: - warn(msg, os, t); - break; - } - } -} http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockConfigurationContext.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockConfigurationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockConfigurationContext.java deleted file mode 100644 index b8d4a9f..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockConfigurationContext.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.documentation.mock; - -import java.util.Collections; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.apache.nifi.components.PropertyDescriptor; -import org.apache.nifi.components.PropertyValue; -import org.apache.nifi.controller.ConfigurationContext; - -public class MockConfigurationContext implements ConfigurationContext { - - @Override - public PropertyValue getProperty(PropertyDescriptor property) { - return null; - } - - @Override - public Map<PropertyDescriptor, String> getProperties() { - return Collections.emptyMap(); - } - - @Override - public String getSchedulingPeriod() { - return "0 secs"; - } - - @Override - public Long getSchedulingPeriod(final TimeUnit timeUnit) { - return 0L; - } -} http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceInitializationContext.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceInitializationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceInitializationContext.java deleted file mode 100644 index 195934b..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceInitializationContext.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.documentation.mock; - -import java.io.File; -import org.apache.nifi.components.state.StateManager; -import org.apache.nifi.controller.ControllerServiceInitializationContext; -import org.apache.nifi.controller.ControllerServiceLookup; -import org.apache.nifi.logging.ComponentLog; - -/** - * A Mock ControllerServiceInitializationContext so that ControllerServices can - * be initialized for the purpose of generating documentation. - * - * - */ -public class MockControllerServiceInitializationContext implements ControllerServiceInitializationContext { - - @Override - public String getIdentifier() { - return "mock-controller-service"; - } - - @Override - public ControllerServiceLookup getControllerServiceLookup() { - return new MockControllerServiceLookup(); - } - - @Override - public ComponentLog getLogger() { - return new MockComponentLogger(); - } - - @Override - public StateManager getStateManager() { - return null; - } - - @Override - public String getKerberosServicePrincipal() { - return null; - } - - @Override - public File getKerberosServiceKeytab() { - return null; - } - - @Override - public File getKerberosConfigurationFile() { - return null; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceLookup.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceLookup.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceLookup.java deleted file mode 100644 index e92e801..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceLookup.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.documentation.mock; - -import java.util.Collections; -import java.util.Set; - -import org.apache.nifi.controller.ControllerService; -import org.apache.nifi.controller.ControllerServiceLookup; - -/** - * A Mock ControllerServiceLookup that can be used so that - * ConfigurableComponents can be initialized for the purpose of generating - * documentation - * - * - */ -public class MockControllerServiceLookup implements ControllerServiceLookup { - - @Override - public ControllerService getControllerService(final String serviceIdentifier) { - return null; - } - - @Override - public boolean isControllerServiceEnabled(final String serviceIdentifier) { - return false; - } - - @Override - public boolean isControllerServiceEnabled(final ControllerService service) { - return false; - } - - @Override - public Set<String> getControllerServiceIdentifiers(final Class<? extends ControllerService> serviceType) throws IllegalArgumentException { - return Collections.emptySet(); - } - - @Override - public boolean isControllerServiceEnabling(final String serviceIdentifier) { - return false; - } - - @Override - public String getControllerServiceName(final String serviceIdentifier) { - return serviceIdentifier; - } -} http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockNodeTypeProvider.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockNodeTypeProvider.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockNodeTypeProvider.java deleted file mode 100644 index 75df16f..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockNodeTypeProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.documentation.mock; - -import org.apache.nifi.controller.NodeTypeProvider; - -/** - * A Mock NodeTypeProvider that can be used so that - * ConfigurableComponents can be initialized for the purpose of generating - * documentation - * - * - */ -public class MockNodeTypeProvider implements NodeTypeProvider { - - @Override - public boolean isClustered() { - return false; - } - - @Override - public boolean isPrimary() { - return false; - } - -} http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java deleted file mode 100644 index 22e9727..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.documentation.mock; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; - -import org.apache.nifi.components.PropertyDescriptor; -import org.apache.nifi.components.PropertyValue; -import org.apache.nifi.components.state.StateManager; -import org.apache.nifi.controller.ControllerServiceLookup; -import org.apache.nifi.processor.ProcessContext; -import org.apache.nifi.processor.Relationship; - -public class MockProcessContext implements ProcessContext { - - @Override - public PropertyValue getProperty(PropertyDescriptor descriptor) { - return null; - } - - @Override - public PropertyValue getProperty(String propertyName) { - return null; - } - - @Override - public PropertyValue newPropertyValue(String rawValue) { - return null; - } - - @Override - public void yield() { - - } - - @Override - public int getMaxConcurrentTasks() { - return 0; - } - - @Override - public String getAnnotationData() { - return ""; - } - - @Override - public Map<PropertyDescriptor, String> getProperties() { - return Collections.emptyMap(); - } - - @Override - public String encrypt(String unencrypted) { - return unencrypted; - } - - @Override - public String decrypt(String encrypted) { - return encrypted; - } - - @Override - public ControllerServiceLookup getControllerServiceLookup() { - return new MockControllerServiceLookup(); - } - - @Override - public Set<Relationship> getAvailableRelationships() { - return Collections.emptySet(); - } - - @Override - public boolean hasIncomingConnection() { - return true; - } - - @Override - public boolean hasNonLoopConnection() { - return true; - } - - @Override - public boolean hasConnection(Relationship relationship) { - return false; - } - - @Override - public boolean isExpressionLanguagePresent(PropertyDescriptor property) { - return false; - } - - @Override - public StateManager getStateManager() { - return null; - } - - @Override - public String getName() { - return null; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorInitializationContext.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorInitializationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorInitializationContext.java deleted file mode 100644 index d86ea4c..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorInitializationContext.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.documentation.mock; - -import java.io.File; -import org.apache.nifi.controller.ControllerServiceLookup; -import org.apache.nifi.controller.NodeTypeProvider; -import org.apache.nifi.logging.ComponentLog; -import org.apache.nifi.processor.ProcessorInitializationContext; - -/** - * A Mock ProcessorInitializationContext that can be used so that Processors can - * be initialized for the purpose of generating documentation. - * - * - */ -public class MockProcessorInitializationContext implements ProcessorInitializationContext { - - @Override - public String getIdentifier() { - return "mock-processor"; - } - - @Override - public ComponentLog getLogger() { - return new MockComponentLogger(); - } - - @Override - public ControllerServiceLookup getControllerServiceLookup() { - return new MockControllerServiceLookup(); - } - - @Override - public NodeTypeProvider getNodeTypeProvider() { - return new MockNodeTypeProvider(); - } - - @Override - public String getKerberosServicePrincipal() { - return null; - } - - @Override - public File getKerberosServiceKeytab() { - return null; - } - - @Override - public File getKerberosConfigurationFile() { - return null; - } -} http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockReportingInitializationContext.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockReportingInitializationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockReportingInitializationContext.java deleted file mode 100644 index 49d7933..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockReportingInitializationContext.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.documentation.mock; - -import java.io.File; -import java.util.concurrent.TimeUnit; - -import org.apache.nifi.controller.ControllerServiceLookup; -import org.apache.nifi.logging.ComponentLog; -import org.apache.nifi.reporting.ReportingInitializationContext; -import org.apache.nifi.scheduling.SchedulingStrategy; - -/** - * A Mock ReportingInitializationContext that can be used to initialize a - * ReportingTask for the purposes of documentation generation. - * - */ -public class MockReportingInitializationContext implements ReportingInitializationContext { - - @Override - public String getIdentifier() { - return "mock-reporting-task"; - } - - @Override - public String getName() { - return ""; - } - - @Override - public long getSchedulingPeriod(TimeUnit timeUnit) { - return 0; - } - - @Override - public ControllerServiceLookup getControllerServiceLookup() { - return new MockControllerServiceLookup(); - } - - @Override - public String getSchedulingPeriod() { - return ""; - } - - @Override - public SchedulingStrategy getSchedulingStrategy() { - return SchedulingStrategy.TIMER_DRIVEN; - } - - @Override - public ComponentLog getLogger() { - return new MockComponentLogger(); - } - - @Override - public String getKerberosServicePrincipal() { - return null; - } - - @Override - public File getKerberosServiceKeytab() { - return null; - } - - @Override - public File getKerberosConfigurationFile() { - return null; - } -} http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/util/ReflectionUtils.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/util/ReflectionUtils.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/util/ReflectionUtils.java deleted file mode 100644 index 1d3de36..0000000 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/util/ReflectionUtils.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.documentation.util; - -import java.lang.annotation.Annotation; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.apache.nifi.logging.ComponentLog; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * This class is a copy of org.apache.nifi.util.ReflectionUtils. Ultimately the - * documentation generation component should be moved to a place where it can - * depend on this directly instead of copying it in. - * - * - */ -public class ReflectionUtils { - - private final static Logger LOG = LoggerFactory.getLogger(ReflectionUtils.class); - - /** - * Invokes all methods on the given instance that have been annotated with - * the given annotation. If the signature of the method that is defined in - * <code>instance</code> uses 1 or more parameters, those parameters must be - * specified by the <code>args</code> parameter. However, if more arguments - * are supplied by the <code>args</code> parameter than needed, the extra - * arguments will be ignored. - * - * @param annotation annotation - * @param instance instance - * @param logger the ComponentLog to use for logging any errors. If null, - * will use own logger, but that will not generate bulletins or easily tie - * to the Processor's log messages. - * @param args args - * @return <code>true</code> if all appropriate methods were invoked and - * returned without throwing an Exception, <code>false</code> if one of the - * methods threw an Exception or could not be invoked; if <code>false</code> - * is returned, an error will have been logged. - */ - public static boolean quietlyInvokeMethodsWithAnnotation( - final Class<? extends Annotation> annotation, final Object instance, final ComponentLog logger, final Object... args) { - - for (final Method method : instance.getClass().getMethods()) { - if (method.isAnnotationPresent(annotation)) { - - final boolean isAccessible = method.isAccessible(); - method.setAccessible(true); - - try { - final Class<?>[] argumentTypes = method.getParameterTypes(); - if (argumentTypes.length > args.length) { - if (logger == null) { - LOG.error("Unable to invoke method {} on {} because method expects {} parameters but only {} were given", - new Object[]{method.getName(), instance, argumentTypes.length, args.length}); - } else { - logger.error("Unable to invoke method {} on {} because method expects {} parameters but only {} were given", - new Object[]{method.getName(), instance, argumentTypes.length, args.length}); - } - - return false; - } - - for (int i = 0; i < argumentTypes.length; i++) { - final Class<?> argType = argumentTypes[i]; - if (!argType.isAssignableFrom(args[i].getClass())) { - if (logger == null) { - LOG.error("Unable to invoke method {} on {} because method parameter {} is expected to be of type {} but argument passed was of type {}", - new Object[]{method.getName(), instance, i, argType, args[i].getClass()}); - } else { - logger.error("Unable to invoke method {} on {} because method parameter {} is expected to be of type {} but argument passed was of type {}", - new Object[]{method.getName(), instance, i, argType, args[i].getClass()}); - } - - return false; - } - } - - try { - if (argumentTypes.length == args.length) { - method.invoke(instance, args); - } else { - final Object[] argsToPass = new Object[argumentTypes.length]; - for (int i = 0; i < argsToPass.length; i++) { - argsToPass[i] = args[i]; - } - - method.invoke(instance, argsToPass); - } - } catch (final InvocationTargetException ite) { - if (logger == null) { - LOG.error("Unable to invoke method {} on {} due to {}", new Object[]{method.getName(), instance, ite.getCause()}); - LOG.error("", ite.getCause()); - } else { - logger.error("Unable to invoke method {} on {} due to {}", new Object[]{method.getName(), instance, ite.getCause()}); - } - } catch (final IllegalAccessException | IllegalArgumentException t) { - if (logger == null) { - LOG.error("Unable to invoke method {} on {} due to {}", new Object[]{method.getName(), instance, t}); - LOG.error("", t); - } else { - logger.error("Unable to invoke method {} on {} due to {}", new Object[]{method.getName(), instance, t}); - } - - return false; - } - } finally { - if (!isAccessible) { - method.setAccessible(false); - } - } - } - } - - return true; - } -} http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java index b7c4db9..b00ab8a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/DocGeneratorTest.java @@ -16,16 +16,11 @@ */ package org.apache.nifi.documentation; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; -import java.util.Set; - import org.apache.commons.io.FileUtils; +import org.apache.nifi.bundle.Bundle; +import org.apache.nifi.bundle.BundleCoordinate; import org.apache.nifi.nar.ExtensionManager; +import org.apache.nifi.nar.ExtensionMapping; import org.apache.nifi.nar.NarClassLoaders; import org.apache.nifi.nar.NarUnpacker; import org.apache.nifi.util.NiFiProperties; @@ -33,6 +28,14 @@ import org.junit.Assert; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; +import java.util.Set; + public class DocGeneratorTest { @Test @@ -44,15 +47,19 @@ public class DocGeneratorTest { NiFiProperties.COMPONENT_DOCS_DIRECTORY, temporaryFolder.getRoot().getAbsolutePath()); - NarUnpacker.unpackNars(properties); + final Bundle systemBundle = ExtensionManager.createSystemBundle(properties); + final ExtensionMapping mapping = NarUnpacker.unpackNars(properties, systemBundle); NarClassLoaders.getInstance().init(properties.getFrameworkWorkingDirectory(), properties.getExtensionsWorkingDirectory()); - ExtensionManager.discoverExtensions(NarClassLoaders.getInstance().getExtensionClassLoaders()); + ExtensionManager.discoverExtensions(systemBundle, NarClassLoaders.getInstance().getBundles()); - DocGenerator.generate(properties); + DocGenerator.generate(properties, mapping); - File processorDirectory = new File(temporaryFolder.getRoot(), "org.apache.nifi.processors.WriteResourceToStream"); + final String extensionClassName = "org.apache.nifi.processors.WriteResourceToStream"; + final BundleCoordinate coordinate = mapping.getProcessorNames().get(extensionClassName).stream().findFirst().get(); + final String path = coordinate.getGroup() + "/" + coordinate.getId() + "/" + coordinate.getVersion() + "/" + extensionClassName; + File processorDirectory = new File(temporaryFolder.getRoot(), path); File indexHtml = new File(processorDirectory, "index.html"); Assert.assertTrue(indexHtml + " should have been generated", indexHtml.exists()); String generatedHtml = FileUtils.readFileToString(indexHtml); http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java index 0402a9f..7131684 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/HtmlDocumentationWriterTest.java @@ -22,10 +22,10 @@ import org.apache.nifi.documentation.example.ControllerServiceWithLogger; import org.apache.nifi.documentation.example.FullyDocumentedControllerService; import org.apache.nifi.documentation.example.FullyDocumentedReportingTask; import org.apache.nifi.documentation.example.ReportingTaskWithLogger; -import org.apache.nifi.documentation.init.ControllerServiceInitializer; -import org.apache.nifi.documentation.init.ReportingTaskingInitializer; -import org.apache.nifi.documentation.mock.MockControllerServiceInitializationContext; -import org.apache.nifi.documentation.mock.MockReportingInitializationContext; +import org.apache.nifi.init.ControllerServiceInitializer; +import org.apache.nifi.init.ReportingTaskingInitializer; +import org.apache.nifi.mock.MockControllerServiceInitializationContext; +import org.apache.nifi.mock.MockReportingInitializationContext; import org.apache.nifi.reporting.InitializationException; import org.apache.nifi.reporting.ReportingTask; import org.junit.Assert; http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java index cf30fbc..ddb3325 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java @@ -21,7 +21,7 @@ import org.apache.nifi.documentation.DocumentationWriter; import org.apache.nifi.documentation.example.FullyDocumentedProcessor; import org.apache.nifi.documentation.example.NakedProcessor; import org.apache.nifi.documentation.example.ProcessorWithLogger; -import org.apache.nifi.documentation.init.ProcessorInitializer; +import org.apache.nifi.init.ProcessorInitializer; import org.junit.Assert; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/nifi/blob/d90cf846/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties index c6b5d36..38cbd91 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/resources/conf/nifi.properties @@ -14,7 +14,6 @@ # limitations under the License. # Core Properties # -nifi.version=nifi-test 3.0.0 nifi.flow.configuration.file=./target/flow.xml.gz nifi.flow.configuration.archive.dir=./target/archive/ nifi.flowcontroller.autoResumeState=true
