Class PluginLoader

java.lang.Object
com.iizix.server.PluginLoader

public class PluginLoader extends Object
The plug-in loader class checking for plug-in dependencies in a Module project.
Author:
Christopher Mindus
  • Constructor Details

    • PluginLoader

      public PluginLoader(PropFactory factory, ClassLoader classLoader)
      Creates the instance.
      Parameters:
      factory - The factory to register the plug-ins in.
      classLoader - The ClassLoader to use when running in a Server environment.
  • Method Details

    • loadPlugins

      public List<IPluginDescriptor<?>> loadPlugins(String names) throws IOException
      Loads required plug-in's.

      Each plug-in must have a class called "name.server.Descriptor" that implement the interface com.iizix.IPluginDescriptor available.

      The plug-in definition should be found at the "name/schema/properties.xml", but the iiziGo modules have the "iizigo" module instead of "iizix". To figure out translation of names, a class called "name.server.Descriptor" is loaded and should implement the interface

      Parameters:
      names - The plug-in name, e.g. "com.iizigo.db,com.iizigo.term,com.iizigo.ws".
      Returns:
      The list of plug-in descriptors.
      Throws:
      IOException - If a plug-in failed to load.
    • getLoadedPlugins

      public String getLoadedPlugins()
      Gets the comma-separated list of loaded plugins.
      Returns:
      The comma-separated list of loaded plugins, empty string for none.
    • createClassLoader

      public ClassLoader createClassLoader(ClassLoader parentClassLoader)
      Creates a new classloader that also handles loading classes from the added plugins.
      Parameters:
      parentClassLoader - The parent class loaders, must be defined.
      Returns:
      A new class loader.