Class PluginManager

All Implemented Interfaces:
Closeable, AutoCloseable

public class PluginManager extends URLClassLoader
Reads the plugin def xml files and provides methods for adding plugin defined menu entries to window menus.
  • Field Details

  • Method Details

    • getInstance

      public static PluginManager getInstance()
      Get singleton instance
    • addClassLoader

      public void addClassLoader(ClassLoader classloader)
    • removeClassLoader

      public void removeClassLoader(ClassLoader classloader)
    • scanPluginFolder

      public void scanPluginFolder()
      Tell the plugin manager to scan plugins folder.
    • scanPluginFolder

      public void scanPluginFolder(File pluginFolder)
    • addFile

      public void addFile(String path) throws MalformedURLException
      Add a zip/jar file to the dynamic class loader
      Parameters:
      path -
      Throws:
      MalformedURLException
    • addURL

      public void addURL(URL url)
      Overrides:
      addURL in class URLClassLoader
    • getResource

      public URL getResource(String name)
      Overrides:
      getResource in class ClassLoader
    • getResource

      public URL getResource(String name, boolean deep)
    • getResources

      public Enumeration<URL> getResources(String name) throws IOException
      Overrides:
      getResources in class ClassLoader
      Throws:
      IOException
    • getResources

      public Enumeration<URL> getResources(String name, boolean deep) throws IOException
      Throws:
      IOException
    • getResourceAsStream

      public InputStream getResourceAsStream(String name)
      Overrides:
      getResourceAsStream in class URLClassLoader
    • getResourceAsStream

      public InputStream getResourceAsStream(String name, boolean deep)
    • getEntryPoints

      public List<String> getEntryPoints()
      Get entry point names
      Returns:
      list of entry point ids
    • getEntryPoint

      public IPluginEntryPoint getEntryPoint(String name)
      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

      public <T> List<T> getExtensions(Class<T> clazz) throws PluginException
      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

      public <T> List<IPluginExtensionPoint<T>> getExtensionPoints(Class<T> clazz)
      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