Package ca.phon.plugin
Class PluginManager
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
ca.phon.plugin.PluginManager
- All Implemented Interfaces:
Closeable
,AutoCloseable
Reads the plugin def xml files and provides methods
for adding plugin defined menu entries to window menus.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addClassLoader
(ClassLoader classloader) void
Add a zip/jar file to the dynamic class loadervoid
getEntryPoint
(String name) Get the entry point identified by the given plugin id.Get entry point names<T> List<IPluginExtensionPoint<T>>
getExtensionPoints
(Class<T> clazz) Get the extension points for the given class.<T> List<T>
getExtensions
(Class<T> clazz) Get initilized extension points for the given class.static PluginManager
Get singleton instancegetResource
(String name) getResource
(String name, boolean deep) getResourceAsStream
(String name) getResourceAsStream
(String name, boolean deep) getResources
(String name) getResources
(String name, boolean deep) void
removeClassLoader
(ClassLoader classloader) void
Tell the plugin manager to scan plugins folder.void
scanPluginFolder
(File pluginFolder) Methods inherited from class java.net.URLClassLoader
close, definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Field Details
-
PLUGIN_FOLDER
Plugin folder- See Also:
-
-
Method Details
-
getInstance
Get singleton instance -
addClassLoader
-
removeClassLoader
-
scanPluginFolder
public void scanPluginFolder()Tell the plugin manager to scan plugins folder. -
scanPluginFolder
-
addFile
Add a zip/jar file to the dynamic class loader- Parameters:
path
-- Throws:
MalformedURLException
-
addURL
- Overrides:
addURL
in classURLClassLoader
-
getResource
- Overrides:
getResource
in classClassLoader
-
getResource
-
getResources
- Overrides:
getResources
in classClassLoader
- Throws:
IOException
-
getResources
- Throws:
IOException
-
getResourceAsStream
- Overrides:
getResourceAsStream
in classURLClassLoader
-
getResourceAsStream
-
getEntryPoints
Get entry point names- Returns:
- list of entry point ids
-
getEntryPoint
Get the entry point identified by the given plugin id.- Parameters:
name
- the name of the entry point to retrieve- Returns:
- the plugin entry point or NULL if not found
-
getExtensions
Get initilized extension points for the given class. This method should only be used when there is a default constructor available for the given class.- Parameters:
clazz
-- Throws:
PluginException
- if there is a problem with creating the list of objects.
-
getExtensionPoints
Get the extension points for the given class.- Parameters:
clazz
- the class for extensions- Returns:
- the list of loaded extension points for the given class
-