mirror of https://github.com/apache/nifi.git
NIFI-632 using NarThreadContextClassLoader when generating documentation
This commit is contained in:
parent
6f36c7939b
commit
4074ec3785
|
@ -26,6 +26,10 @@
|
|||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-framework-core-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-properties</artifactId>
|
||||
|
|
|
@ -33,6 +33,7 @@ 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.nar.ExtensionManager;
|
||||
import org.apache.nifi.nar.NarThreadContextClassLoader;
|
||||
import org.apache.nifi.processor.Processor;
|
||||
import org.apache.nifi.reporting.InitializationException;
|
||||
import org.apache.nifi.reporting.ReportingTask;
|
||||
|
@ -68,6 +69,11 @@ public class DocGenerator {
|
|||
logger.debug("Generating documentation for: " + extensionClasses.size() + " components in: "
|
||||
+ explodedNiFiDocsDir);
|
||||
|
||||
// save the original class loader and use a NarThreadContextClassLoader
|
||||
final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
try {
|
||||
Thread.currentThread().setContextClassLoader(NarThreadContextClassLoader.getInstance());
|
||||
|
||||
for (final Class<?> extensionClass : extensionClasses) {
|
||||
if (ConfigurableComponent.class.isAssignableFrom(extensionClass)) {
|
||||
final Class<? extends ConfigurableComponent> componentClass = extensionClass
|
||||
|
@ -80,6 +86,9 @@ public class DocGenerator {
|
|||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
Thread.currentThread().setContextClassLoader(originalClassLoader);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue