public class ExtensionsLoader extends Object
Main, and for DruidModule
extensions during initialization. The design, however, should support
any kind of extension that may be needed in the future.
The extensions are cached so that they can be reported by various REST APIs.| Constructor and Description |
|---|
ExtensionsLoader(ExtensionsConfig config) |
| Modifier and Type | Method and Description |
|---|---|
ExtensionsConfig |
config() |
URLClassLoader |
getClassLoaderForExtension(File extension,
boolean useExtensionClassloaderFirst) |
File[] |
getExtensionFilesToLoad()
Find all the extension files that should be loaded by druid.
|
<T> Collection<T> |
getFromExtensions(Class<T> serviceClass)
Look for implementations for the given class from both classpath and extensions directory, using
ServiceLoader. |
<T> Collection<T> |
getLoadedImplementations(Class<T> clazz)
Returns a collection of implementations loaded.
|
Collection<DruidModule> |
getLoadedModules() |
Map<Pair<File,Boolean>,URLClassLoader> |
getLoadersMap() |
Collection<DruidModule> |
getModules() |
static List<URL> |
getURLsForClasspath(String cp) |
static ExtensionsLoader |
instance(com.google.inject.Injector injector) |
@Inject public ExtensionsLoader(ExtensionsConfig config)
public static ExtensionsLoader instance(com.google.inject.Injector injector)
public ExtensionsConfig config()
public <T> Collection<T> getLoadedImplementations(Class<T> clazz)
T - the service typeclazz - service classpublic Collection<DruidModule> getLoadedModules()
public Map<Pair<File,Boolean>,URLClassLoader> getLoadersMap()
public <T> Collection<T> getFromExtensions(Class<T> serviceClass)
ServiceLoader. A user should never put the same two extensions in classpath and extensions directory, if he/she
does that, the one that is in the classpath will be loaded, the other will be ignored.serviceClass - The class to look the implementations of (e.g., DruidModule)public Collection<DruidModule> getModules()
public File[] getExtensionFilesToLoad()
public URLClassLoader getClassLoaderForExtension(File extension, boolean useExtensionClassloaderFirst)
extension - The File instance of the extension we want to loadCopyright © 2011–2022 The Apache Software Foundation. All rights reserved.