Package net.groboclown.util.jplugin.v2

The jplugin package allows for easy use of "plugins" into your application.

See:
          Description

Interface Summary
IClassInspector Extracts the class instance based on the class name.
IFileInspector Examines a given file or URL, and adds it to the correct list based on its attributes.
ILocationSearcher Searches for all file types using the given base URL
 

Class Summary
BaseClassInspector Extracts the class instance based on the class name.
ClassAttributes Maintains a list attributes and a collection of values that each attribute may contain.
ClassAttributes.NoCaseStr A Non-case sensitive string
ClassAttributes.ValueSet A collection of values
ClassCollection Maintains all the discovered classes, attributes, and all other data associated with plugins.
ClassFileInspector Examines a given file or URL, and adds it to the correct list based on its attributes.
ClassWrapper Maintains all the information discovered about the given class.
FileIdentifiers Searches for all file types using the given base URL
FileSearcher Examines a given file or URL, and adds it to the correct list based on its attributes.
JarFileInspector Examines a given Jar, and adds it to the correct list based on its attributes.
ManifestFileInspector Examines a given Jar, and adds it to the correct list based on its attributes.
NetSearcher Examines a given URL, and gives it directly to the File Inspectors.
PluginLoader Entry-point for loading plugins.
URLAnalyzer Examines the given URLs in all known ways.
URLClassInspector Extracts the class instance based on the class name.
 

Package net.groboclown.util.jplugin.v2 Description

The jplugin package allows for easy use of "plugins" into your application.

A plugin is a collection of code which can be bound to at run-time, allowing for a more dynamic application. This is useful for allowing easy upgrades, and addition of new functionality.

Usage

  1. instantiate an instance of PluginLoader, specifying where the plugins should be located:
            PluginLoader pl = new PluginLoader( new URL( "file:"+baseDir ) );
            
  2. next, tell the loader to find all classes which match any of the specified class or attribute sets.
            pl.findPlugins();
            
    By default, this will load all manifest files ("*.MF"), class files ("*.class"), and all those files contained in Jar files ("*.jar" or "*.zip"). You may add to this list by adding IFileInspectors to the plugin.

    Once you find the plugins, you can no longer add URLs or finder classes. The findPlugins() method may only be invoked once per PluginLoader instance.

  3. to find all classes which match a set criteria, make a call with the criteria initially specified, as so:
            ClassWrapper cw[] = pl.getPlugins( BasePluginSuperclass.class );
            cw = pl.getPlugins( "bean", "true" );
            cw = pl.getPlugins( "aPlugin" );
            
    where in the first example, the classes are found based on a base-class (returns all classes which are assignment compatible with the given class), the second returns all classes which have an attribute name "bean" and its corresponding value is "true" (case insensitive for both). The last example returns all classes which have the attribute "aPlugin", without caring for the corresponding value.
  4. the ClassWrapper will contain detailed information about the specific plugin.



Written under the LGPL