org.specrunner.plugins.core.factories
Class PluginFactoryText

java.lang.Object
  extended by org.specrunner.plugins.core.factories.PluginFactoryText
All Implemented Interfaces:
IPluginFactory

public class PluginFactoryText
extends Object
implements IPluginFactory

A factory for Text elements.

Author:
Thiago Santos

Constructor Summary
PluginFactoryText()
           
 
Method Summary
 IPluginFactory bind(PluginKind type, 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. i.e.
 IPlugin newPlugin(nu.xom.Node node, IContext context)
          Creates a new plugin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginFactoryText

public PluginFactoryText()
Method Detail

newPlugin

public IPlugin newPlugin(nu.xom.Node node,
                         IContext context)
Description copied from interface: IPluginFactory
Creates a new plugin.

Specified by:
newPlugin in interface IPluginFactory
Parameters:
node - The source node for plugin creation.
context - The context.
Returns:
A plugin based on source information.

getClass

public Class<? extends IPlugin> getClass(String alias)
                                  throws PluginException
Description copied from interface: IPluginFactory
Given a name, return the corresponding plugin class associated. i.e. For 'include' the class PluginInclude of core plugins package is returned or if 'bean' is requested the PluginBean is returned.

Specified by:
getClass in interface IPluginFactory
Parameters:
alias - The plugin alias.
Returns:
The class, if type is mapped, null, otherwise.
Throws:
PluginException - On reference lookup failure.

getAlias

public String getAlias(Class<? extends IPlugin> type)
Description copied from interface: IPluginFactory
Given a class, for example, return the corresponding alias for the plugin.

Specified by:
getAlias in interface IPluginFactory
Parameters:
type - The plugin type, i.e. 'PluginInclude.class', 'PluginConnection', etc.
Returns:
The alias, if type is mapped, null, otherwise. Null does not means a invalid plugin, but the plugin is either not mapped in the usual way, or the factory of plugins is not based on alias premises.

bind

public IPluginFactory bind(PluginKind type,
                           String alias,
                           IPlugin plugin)
Description copied from interface: IPluginFactory
Bind a plugin instance to a given kind.

Specified by:
bind in interface IPluginFactory
Parameters:
type - The plugin kind.
alias - The alias.
plugin - The plugin instance.
Returns:
The factory itself.

finalizePlugin

public boolean finalizePlugin(nu.xom.Node source,
                              IContext context,
                              IPlugin plugin)
                       throws PluginException
Description copied from interface: IPluginFactory
Finalize a plugin.

Specified by:
finalizePlugin in interface IPluginFactory
Parameters:
source - The source Node..
context - The context.
plugin - The previously created plugin for this node.
Returns:
true, if finalized, false, otherwise.
Throws:
PluginException - On finalization error.


Copyright © 2014. All rights reserved.