Class PluginManager

Class PluginManager finds and loads plug-ins. Upon creation it calls its method loadPlugins which in turn calls method findPlugins to locate any plug-ins to be loaded and to create a class loader for them. Method findPlugins uses method readJar to get the class names from any Java archive (JAR) file found. readJar finds out the URLs for respective plug-in classes too.

Once all JAR files are searched, the found classes are loaded by method loadPlugins. Method plugins returns all loaded plug-ins as an Enumeration.

Restrictions for making plug-ins available to SimplyHTML

Plug-in classes and their accompanying classes are to be installed as Java archive (JAR) files. They are to be placed into package com.lightdev.app.shtm.plugin.installed. The plug-ins in this package need to be present in the directory where package com.lightdev.app.shtm is installed. This restriction makes it easier and faster to locate and load plug-ins.

If the actual plug-in class (the class implementing interface SHTMLPlugin, that is) needs additional classes as part of a plug-in package, the additional classes are best placed in sub-packages of package .plugin.installed . This makes it faster to load the actual plug-in classes too.

How plug-ins are found

PluginManager looks for JAR files in the directory where the class file of PluginManager is installed (the application directory of SimplyHTML, that is). PluginManager opens any JAR file found and goes through all content of the JAR file. Any class name found in package com.lightdev.app.shtm.plugin.installed. is stored along with its URL.

A class loader is created for the found URLs and all found classes are loaded.