org.pf.plugin
Class PluginCollector

java.lang.Object
  extended by org.pf.plugin.PluginCollector

public class PluginCollector
extends java.lang.Object

The responsibility of this class is to detect all properties files with a specific name on a given classpath and load the defined classes that fit to a given class/interface into a class regitry.

Since version 1.3 it is possible to specify a system property named "org.pf.plugin.path" to define the path on which the plugin collector must search for plug-ins.

Version:
1.3
Author:
Manfred Duchrow

Constructor Summary
PluginCollector()
          Initialize the new instance with default values.
PluginCollector(ClassRegistry registry)
          Initialize the new instance with a class registry.
 
Method Summary
 ClassRegistry getClassRegistry()
          Returns the class registry that contains all loaded plugins
 ClassRegistry loadPlugins(java.lang.String filename)
          Load the class definitions from all files with the given name that can be found in the system classpath.
 ClassRegistry loadPlugins(java.lang.String filename, Classpath classpath)
          Load the class definitions from all files with the given name that can be found in the specified classpath.
 ClassRegistry loadPlugins(java.lang.String filename, java.lang.String classpath)
          Load the class definitions from all files with the given name that can be found in the specified classpath.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginCollector

public PluginCollector()
Initialize the new instance with default values.


PluginCollector

public PluginCollector(ClassRegistry registry)
Initialize the new instance with a class registry.

Method Detail

getClassRegistry

public ClassRegistry getClassRegistry()
Returns the class registry that contains all loaded plugins


loadPlugins

public ClassRegistry loadPlugins(java.lang.String filename)
Load the class definitions from all files with the given name that can be found in the system classpath.

Parameters:
filename - The name of the properties file that contains the class definitions

loadPlugins

public ClassRegistry loadPlugins(java.lang.String filename,
                                 java.lang.String classpath)
Load the class definitions from all files with the given name that can be found in the specified classpath.

Parameters:
filename - The name of the properties file that contains the class definitions
classpath - The classpath the specified filename to be looked up in

loadPlugins

public ClassRegistry loadPlugins(java.lang.String filename,
                                 Classpath classpath)
Load the class definitions from all files with the given name that can be found in the specified classpath.

Parameters:
filename - The name of the properties file that contains the class definitions
classpath - The classpath on which to lookup the the specified filename