public class BaseModuleManager extends Object implements ModuleManager
| Constructor and Description |
|---|
BaseModuleManager(ModuleRegistry registry,
org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Creates a new module manager instance.
|
BaseModuleManager(ModuleRegistry registry,
org.codehaus.plexus.classworlds.realm.ClassRealm parentRealm,
ClassLoader classLoader)
Creates a new module manager instance.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addToLocalClassPath(URL... urls)
Adds the given url(s) as URIs to the local class path.
|
static void |
blacklist(String name)
Blacklists the given directory / file name so folders
with the same name will be ignored during the discovery process.
|
static void |
enableThoroughSearch(boolean toggle)
Toggles the state of the "thorough search" mode.
|
static URL |
findClassLoaderRootURL(Class aClass)
Tries to find the root URL from the given class by getting the full URL to the class file itself first,
then removing the additional path again.
|
com.google.common.base.Optional<ModuleInformation> |
getInformation(Class<? extends Module> module)
Gets information about a specific module.
|
Injector |
getInjector()
Gets the underlying field injector.
|
ModuleLoader |
getLoader()
Gets the used module loader instance.
|
<M extends Module> |
getModule(Class<M> module)
Gets a specific module by its class.
|
ModuleRegistry |
getRegistry()
Gets the registry containing all registered (loaded) Modules.
|
static void |
include(URI... uris)
Adds the given URIs to the local classpath which will be checked when loading modules.
|
static void |
includeFullClassPath()
Includes all elements in the current java class path as retrieved by the "java.class.path" system property.
|
<M extends Module> |
loadModule(Class<M> moduleClass,
Filter... filters)
Loads only the given module class and its dependencies.
|
Collection<Module> |
loadModules(Collection<URI> uris,
String root,
Filter... filters)
Loads modules from a collection of URIs with support for a resource package filter.
|
Collection<Module> |
loadModules(File file,
Filter... filters)
Loads modules from the given file.
|
Collection<Module> |
loadModules(String resource,
Filter... filters)
Loads modules inside the current class path with the given string representing either
a class file directly or a package and thus functioning as a filter.
|
Collection<Module> |
loadModules(URI uri,
Filter... filters)
Load modules from a URI.
|
Collection<Module> |
loadModules(URI uri,
String packageName,
Filter... filters)
Loads modules from a URI with support for a resource package filter.
|
static org.codehaus.plexus.classworlds.realm.ClassRealm |
newRealm(org.codehaus.plexus.classworlds.realm.ClassRealm parent,
ClassLoader classLoader)
Creates a new class realm.
|
<T extends Module> |
provide(T module)
Stores the given module instance in the registry,
but also executes all injection magic and calls the usual methods.
|
<T extends Module> |
provideSimple(T module)
Simply provides a module instance and stores it in the registry.
|
void |
shutdown()
Tells the manager to shut down and destroy all loaded modules.
|
protected void |
shutdown(Iterator<Module> iterator) |
static boolean |
thoroughSearchEnabled()
Indicates whether or not the "thorough search mode" is enabled.
|
public BaseModuleManager(ModuleRegistry registry, org.codehaus.plexus.classworlds.realm.ClassRealm parentRealm, ClassLoader classLoader)
registry - A registry instanceparentRealm - The parent realm, can be left at nullclassLoader - A parent class loader, can be left at nullpublic BaseModuleManager(ModuleRegistry registry, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
registry - A registry instancerealm - The class realm to load our modules inpublic final ModuleRegistry getRegistry()
ModuleManagergetRegistry in interface ModuleManagerpublic final Injector getInjector()
ModuleManagergetInjector in interface ModuleManagerpublic final ModuleLoader getLoader()
ModuleManagergetLoader in interface ModuleManagerpublic <T extends Module> T provideSimple(T module)
ModuleManagerprovideSimple in interface ModuleManagerT - The module typemodule - The module instanceModuleManager.provide(Module)public <T extends Module> T provide(T module)
ModuleManagerprovide in interface ModuleManagerT - The module typemodule - The module instanceModuleManager.provideSimple(Module)public <M extends Module> M loadModule(Class<M> moduleClass, Filter... filters)
ModuleManagerloadModule in interface ModuleManagerM - The module typemoduleClass - The class of the module to loadfilters - An array of filters to usepublic Collection<Module> loadModules(String resource, Filter... filters)
ModuleManagerloadModules in interface ModuleManagerresource - The resource string, can be the fully qualified class name or a package namefilters - An array of filters to usepublic Collection<Module> loadModules(File file, Filter... filters)
ModuleManagerModuleManager.loadModules(URI, Filter...).loadModules in interface ModuleManagerfile - The file to load the modules fromfilters - An array of filters to usepublic Collection<Module> loadModules(URI uri, Filter... filters)
ModuleManagerloadModules in interface ModuleManageruri - The URI to load the modules fromfilters - An array of filters to usepublic Collection<Module> loadModules(URI uri, String packageName, Filter... filters)
ModuleManagerloadModules in interface ModuleManageruri - The URI to load the modules frompackageName - The root package name to look forfilters - An array of filters to usepublic Collection<Module> loadModules(Collection<URI> uris, String root, Filter... filters)
ModuleManagerloadModules in interface ModuleManageruris - A collection of URIs to load the modules fromroot - The root package name to look forfilters - An array of filters to usepublic <M extends Module> com.google.common.base.Optional<M> getModule(Class<M> module)
ModuleManagergetModule in interface ModuleManagerM - The module typemodule - The module classpublic com.google.common.base.Optional<ModuleInformation> getInformation(Class<? extends Module> module)
ModuleManagergetInformation in interface ModuleManagermodule - The module classpublic void shutdown()
ModuleManagershutdown in interface ModuleManagerpublic static org.codehaus.plexus.classworlds.realm.ClassRealm newRealm(org.codehaus.plexus.classworlds.realm.ClassRealm parent,
ClassLoader classLoader)
parent - The parent realm, if any - can be left at nullclassLoader - The parent class loader, if any - can be left at nullRuntimeException - When a realm of the same name already exists,
as we're using UUIDs this should never happen...public static void blacklist(String name)
name - The name of the directory or filepublic static void include(URI... uris)
uris - The URIs to addpublic static void includeFullClassPath()
public static void enableThoroughSearch(boolean toggle)
-Dmodular.thoroughSearch property).toggle - True if the mode should be enabled, false if disabledpublic static boolean thoroughSearchEnabled()
enableThoroughSearch(boolean)public static void addToLocalClassPath(URL... urls)
urls - The url(s) to addpublic static URL findClassLoaderRootURL(Class aClass)
aClass - The class to get the URL forCopyright © 2014–2015 MountainBlade. All rights reserved.