org.specrunner.plugins.core.factories
Class PluginFactoryAttribute

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

public class PluginFactoryAttribute
extends PluginFactoryImpl

An implementation which uses a attribute to return the plugin. To map a plugin to a given attribute add a 'plugin_attribute.properties' file and add the name of the class.

i.e. bean=test.PluginAny, then just use attribute bean="anything" anywhere in the specification.

Author:
Thiago Santos

Field Summary
 
Fields inherited from class org.specrunner.plugins.core.factories.PluginFactoryImpl
aliasToTypeNames, aliasToTypes, templates, typeNamesToAlias
 
Constructor Summary
PluginFactoryAttribute()
          Creates the factory loading file 'sr_plugins_attribute.properties'.
 
Method Summary
protected  void byAttribute(IContext context, IPluginGroup result, nu.xom.Element ele)
          Lookup plugin classes using attribute enumeration as reference.
 IPlugin newPlugin(nu.xom.Node node, IContext context)
          Creates a new plugin.
 
Methods inherited from class org.specrunner.plugins.core.factories.PluginFactoryImpl
bind, finalizePlugin, getAlias, getClass, getKind, initialize, test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginFactoryAttribute

public PluginFactoryAttribute()
Creates the factory loading file 'sr_plugins_attribute.properties'.

Method Detail

newPlugin

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

Parameters:
node - The source node for plugin creation.
context - The context.
Returns:
A plugin based on source information.
Throws:
PluginException - On creation error.

byAttribute

protected void byAttribute(IContext context,
                           IPluginGroup result,
                           nu.xom.Element ele)
                    throws PluginException
Lookup plugin classes using attribute enumeration as reference.

Parameters:
context - The context.
result - The result set.
ele - The corresponding element.
Throws:
PluginException - On plugin errors.


Copyright © 2014. All rights reserved.