NIFI-655:

- Ensuring the login identity provider is able to switch context classloaders via the standard NAR mechanisms.
This commit is contained in:
Matt Gilman 2015-11-10 14:58:04 -05:00
parent e61ccea7a0
commit 0281e2773f
2 changed files with 7 additions and 12 deletions

View File

@ -39,9 +39,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Scans through the classpath to load all FlowFileProcessors,
* FlowFileComparators, and ReportingTasks using the service provider API and
* running through all classloaders (root, NARs).
* Scans through the classpath to load all FlowFileProcessors, FlowFileComparators, and ReportingTasks using the service provider API and running through all classloaders (root, NARs).
*
* @ThreadSafe - is immutable
*/
@ -61,18 +59,16 @@ public class ExtensionManager {
definitionMap.put(ReportingTask.class, new HashSet<Class>());
definitionMap.put(ControllerService.class, new HashSet<Class>());
definitionMap.put(AuthorityProvider.class, new HashSet<Class>());
definitionMap.put(LoginIdentityProvider.class, new HashSet<Class>());
definitionMap.put(ProvenanceEventRepository.class, new HashSet<Class>());
definitionMap.put(ComponentStatusRepository.class, new HashSet<Class>());
definitionMap.put(FlowFileRepository.class, new HashSet<Class>());
definitionMap.put(FlowFileSwapManager.class, new HashSet<Class>());
definitionMap.put(ContentRepository.class, new HashSet<Class>());
definitionMap.put(LoginIdentityProvider.class, new HashSet<Class>());
}
/**
* Loads all FlowFileProcessor, FlowFileComparator, ReportingTask class
* types that can be found on the bootstrap classloader and by creating
* classloaders for all NARs found within the classpath.
* Loads all FlowFileProcessor, FlowFileComparator, ReportingTask class types that can be found on the bootstrap classloader and by creating classloaders for all NARs found within the classpath.
*/
public static void discoverExtensions() {
final ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
@ -115,8 +111,7 @@ public class ExtensionManager {
}
/**
* Registers extension for the specified type from the specified
* ClassLoader.
* Registers extension for the specified type from the specified ClassLoader.
*
* @param type the extension type
* @param classloaderMap mapping of classname to classloader
@ -154,9 +149,7 @@ public class ExtensionManager {
}
/**
* Determines the effective classloader for classes of the given type. If
* returns null it indicates the given type is not known or was not
* detected.
* Determines the effective classloader for classes of the given type. If returns null it indicates the given type is not known or was not detected.
*
* @param classType to lookup the classloader of
* @return String of fully qualified class name; null if not a detected type

View File

@ -23,6 +23,7 @@ import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import org.apache.nifi.authentication.LoginIdentityProvider;
import org.apache.nifi.authorization.AuthorityProvider;
import org.apache.nifi.components.Validator;
@ -58,6 +59,7 @@ public class NarThreadContextClassLoader extends URLClassLoader {
narSpecificClasses.add(StreamCallback.class);
narSpecificClasses.add(ControllerService.class);
narSpecificClasses.add(AuthorityProvider.class);
narSpecificClasses.add(LoginIdentityProvider.class);
narSpecificClasses.add(ProvenanceEventRepository.class);
narSpecificClasses.add(ComponentStatusRepository.class);
narSpecificClasses.add(FlowFileRepository.class);