Class PluginLoader

  • public class PluginLoader
    extends java.lang.Object
    The plug-in loader class checking for plug-in dependencies in a Module project.
    Christopher Mindus
    • Constructor Summary

      Constructor Description
      PluginLoader​(PropFactory factory, java.lang.ClassLoader classLoader)
      Creates the instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.ClassLoader createClassLoader​(java.lang.ClassLoader parentClassLoader)
      Creates a new classloader that also handles loading classes from the added plugins.
      java.lang.String getLoadedPlugins()
      Gets the comma-separated list of loaded plugins.
      java.util.List<IPluginDescriptor<?>> loadPlugins​(java.lang.String names)
      Loads required plug-in's.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PluginLoader

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

      • loadPlugins

        public java.util.List<IPluginDescriptor<?>> loadPlugins​(java.lang.String names)
        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

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

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

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