|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.processmining.framework.plugin.PluginCollection
public abstract class PluginCollection
Defines a collection of plugins of a certain type.
This class is declared abstract, because subclasses need to specify which type of
plugins are accepted by the particular collection (i.e. they should override the
abstract isValidPlugin
method).
Subclasses should also be implemented using the singleton pattern. This means that there is only a single collection of algorithms during the execution of the program.
In general, a subclass will look as follows:
public class MyCollection extends PluginCollection {
private static MyCollection instance = null;
protected MyCollection() {}
public static MyCollection getInstance() {
if (instance == null) {
instance = new MyCollection();
}
return instance;
}
public boolean isValidPlugin(Plugin plugin) {
return plugin instanceof MyPlugin;
}
}
Constructor Summary | |
---|---|
protected |
PluginCollection()
|
Method Summary | |
---|---|
protected void |
addPlugin(Plugin plugin,
java.lang.String sortName,
ProMSplash splash)
|
Plugin |
get(int index)
Get a plugin by its index in the collection. |
Plugin |
get(java.lang.String name)
Get a plugin by its name. |
Plugin |
getByKey(java.lang.String key)
Get a plugin by its name. |
java.util.ArrayList<Plugin> |
getPlugins()
Return the whole plugin collection. |
abstract boolean |
isValidPlugin(Plugin plugin)
Subclasses should implement this method to check whether this Plugin object is valid for this collection. |
void |
loadFromIni(java.lang.String filename,
ProMSplash splash)
Load plugins from ini file. |
protected void |
loadPlugin(java.lang.String name,
java.lang.String sortName,
ProMSplash splash)
Loads a single plugin. |
int |
size()
Number of plugins in the collection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected PluginCollection()
Method Detail |
---|
public abstract boolean isValidPlugin(Plugin plugin)
MiningPlugin
's might do something like
return plugin instanceof MiningPlugin;
Plugins are only loaded when they are valid according to this method (i.e. it returns true).
plugin
- the plugin to check whether it is valid
public void loadFromIni(java.lang.String filename, ProMSplash splash)
filename
- ini file to load plugins fromsplash
- splashscreen to write messages topublic int size()
public Plugin get(int index)
index
- the index of the plugin in the list (in the range [0..size() - 1])
public java.util.ArrayList<Plugin> getPlugins()
public Plugin get(java.lang.String name)
name
- the name of the plugin to get
public Plugin getByKey(java.lang.String key)
name
- the name of the plugin to get
protected void addPlugin(Plugin plugin, java.lang.String sortName, ProMSplash splash)
protected void loadPlugin(java.lang.String name, java.lang.String sortName, ProMSplash splash)
name
- the class name of the plugin to loadsortName
- the sort keysplash
- the splashscreen to write messages to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |