public abstract class PluginFactoryImpl extends Object implements IPluginFactory
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,String> |
aliasToTypeNames
Map from alias to class name.
|
protected Map<String,Class<? extends IPlugin>> |
aliasToTypes
Map from alias to types.
|
protected String |
file
File to be loaded.
|
protected boolean |
initialized
Initialization status.
|
protected PluginKind |
kind
Kind of factory.
|
protected Map<String,IPlugin> |
templates
Map from alias to templates.
|
protected Map<String,String> |
typeNamesToAlias
Map from alias to names.
|
| Modifier | Constructor and Description |
|---|---|
protected |
PluginFactoryImpl(String file,
PluginKind kind)
Creates a factory loading the given file.
|
| Modifier and Type | Method and Description |
|---|---|
IPluginFactory |
bind(PluginKind kind,
String alias,
IPlugin plugin)
Bind a plugin instance to a given kind.
|
boolean |
finalizePlugin(nu.xom.Node source,
IContext context,
IPlugin plugin)
Finalize a plugin.
|
String |
getAlias(Class<? extends IPlugin> type)
Given a class, for example, return the corresponding alias for the
plugin.
|
Class<? extends IPlugin> |
getClass(String alias)
Given a name, return the corresponding plugin class associated.
|
PluginKind |
getKind()
Get the kind to factory.
|
void |
initialize()
Initialize a factory.
|
protected boolean |
test(PluginKind type)
Test if the factory accept the plugin.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnewPluginprotected PluginKind kind
protected String file
protected boolean initialized
protected PluginFactoryImpl(String file, PluginKind kind)
file - The file to be loaded.kind - The factory kind.public PluginKind getKind()
public void initialize()
throws PluginException
IPluginFactoryinitialize in interface IPluginFactoryPluginException - On initialization errors.public Class<? extends IPlugin> getClass(String alias) throws PluginException
IPluginFactorygetClass in interface IPluginFactoryalias - The plugin alias.PluginException - On reference lookup failure.public String getAlias(Class<? extends IPlugin> type) throws PluginException
IPluginFactorygetAlias in interface IPluginFactorytype - The plugin type, i.e. 'PluginInclude.class',
'PluginConnection', etc.PluginException - On alias lookup name failure.public IPluginFactory bind(PluginKind kind, String alias, IPlugin plugin) throws PluginException
IPluginFactorybind in interface IPluginFactorykind - The plugin kind.alias - The alias.plugin - The plugin instance.PluginException - On bind errors.protected boolean test(PluginKind type)
type - The plugin type.true, if accept the type, false,
otherwise.public boolean finalizePlugin(nu.xom.Node source,
IContext context,
IPlugin plugin)
throws PluginException
IPluginFactoryfinalizePlugin in interface IPluginFactorysource - The source Node..context - The context.plugin - The previously created plugin for this node.PluginException - On finalization error.Copyright © 2016. All rights reserved.