public class PluginsManager extends Object
| Constructor and Description |
|---|
PluginsManager()
Create a PluginsManager that uses the current thread's context ClassLoader
when loading plugins.
|
PluginsManager(ClassLoader parentClassLoader)
Create a PluginsManager that uses the specified ClassLoader when
loading plugins.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
cleanupJarFileFactory(String... jarNames)
cleanup jar file factory cache
http://loracular.blogspot.com/2009/12/dynamic-class-loader-with.html
|
static void |
closeOpenJars(ClassLoader classLoader)
Workaround for non-released jar file lock by URLClassLoader
http://loracular.blogspot.com/2009/12/dynamic-class-loader-with.html
|
void |
discover(File pluginsDir,
boolean append)
Explores the given file or directory for plug-ins and add them to
this manager.
|
URLClassLoader |
getClassLoader()
Gets the URLClassLoader to use for creating new instance of the
components listed in this manager.
|
List<PluginItem> |
getList()
Gets the list of all the plug-ins currently in this manager.
|
List<String> |
getList(int type)
Gets the list of the class names of all available plug-ins
of a given type currently available in this manager.
|
File |
getPluginsDir()
Gets the directory where the plug-ins are located.
|
ArrayList<URL> |
getURLs()
Gets the list of URLs of the jars containing plug-ins currently in this manager.
|
void |
releaseClassLoader() |
public PluginsManager()
public PluginsManager(ClassLoader parentClassLoader)
parentClassLoader - ClassLoader to be used as the parent of any
ClassLoaders used to load plugins.public void discover(File pluginsDir, boolean append)
pluginsDir - the directory where the plugins are located.append - true to preserve any plug-ins already existing in this
manager, false to reset and start with no plug-in.public List<String> getList(int type)
discover(File, boolean) must be called once before
calling this method.type - the type of plug-ins to list.public List<PluginItem> getList()
public ArrayList<URL> getURLs()
public URLClassLoader getClassLoader()
discover(File, boolean) must be called once before
calling this method.public File getPluginsDir()
public void releaseClassLoader()
public static void closeOpenJars(ClassLoader classLoader)
classLoader - the ClassLoader to use.public static boolean cleanupJarFileFactory(String... jarNames)
jarNames - the names of the jar files.Copyright © 2021. All rights reserved.