org.specrunner.hibernate3
Class PluginSchemaExport

java.lang.Object
  extended by org.specrunner.parameters.core.ParameterHolder
      extended by org.specrunner.plugins.core.AbstractPlugin
          extended by org.specrunner.hibernate3.PluginSchemaExport
All Implemented Interfaces:
IParameterHolder, IActionType, IParalelPlugin, IPlugin, ISleepPlugin, ITestPlugin, ITimedPlugin, IWaitPlugin

public class PluginSchemaExport
extends AbstractPlugin

Creates a schema based on Hibernate annotated classes.

Author:
Thiago Santos

Field Summary
protected  String configuration
          The configuration name.
protected  boolean drop
          To drop schema.
protected  boolean export
          To export/update schema.
protected  String factory
          The factory name.
protected  String schema
          The schema name.
protected  boolean script
          To show/generate script.
 
Fields inherited from class org.specrunner.plugins.core.AbstractPlugin
FEATURE_CONDITION, FEATURE_NORMALIZED, FEATURE_NORMALIZER, FEATURE_SLEEP, FEATURE_THREADSAFE, FEATURE_TIMEOUT, FEATURE_WAIT
 
Fields inherited from class org.specrunner.parameters.core.ParameterHolder
parameters
 
Constructor Summary
PluginSchemaExport()
           
 
Method Summary
protected  void createSchema(IContext context, org.hibernate.SessionFactory sf)
          Perform create schema.
 ENext doStart(IContext context, IResultSet result)
           
protected  void dropSchema(IContext context, org.hibernate.SessionFactory sf)
          Perform drop schema.
 ActionType getActionType()
           
 String getConfiguration()
          Name of configuration to be used.
 String getFactory()
          Name of session factory to be used.
 String getSchema()
          Gets the schema name.
 boolean isDrop()
          true, if schema has to be dropped, false, otherwise.
 boolean isExport()
          true, to perform schema creation on database, false, otherwise.
 boolean isScript()
          true, if script must be writen to System.out.
 void setConfiguration(String configuration)
          Set the configuration.
 void setDrop(boolean drop)
          Set the drop behavior.
 void setExport(boolean export)
          Sets export status.
 void setFactory(String factory)
          Set a session factory.
 void setSchema(String schema)
          Set the default schema.
 void setScript(boolean script)
          Set script output status.
 
Methods inherited from class org.specrunner.plugins.core.AbstractPlugin
copy, doEnd, getCondition, getConditionModel, getNormalized, getNormalized, getNormalizer, getParent, getSleep, getSleepModel, getThreadsafe, getTimeout, getTimeoutModel, getWait, getWaitModel, initialize, setCondition, setConditionModel, setNormalized, setNormalizer, setParent, setSleep, setSleepModel, setThreadsafe, setTimeout, setTimeoutModel, setWait, setWaitModel, toString
 
Methods inherited from class org.specrunner.parameters.core.ParameterHolder
getParameters, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.specrunner.parameters.IParameterHolder
getParameters, setParameters
 

Field Detail

configuration

protected String configuration
The configuration name.


factory

protected String factory
The factory name.


schema

protected String schema
The schema name.


script

protected boolean script
To show/generate script.


drop

protected boolean drop
To drop schema.


export

protected boolean export
To export/update schema.

Constructor Detail

PluginSchemaExport

public PluginSchemaExport()
Method Detail

getConfiguration

public String getConfiguration()
Name of configuration to be used.

Returns:
The configuration name, if not set PluginConnection.SESSION_CONFIGURATION will be used.

setConfiguration

public void setConfiguration(String configuration)
Set the configuration.

Parameters:
configuration - A configuration.

getFactory

public String getFactory()
Name of session factory to be used.

Returns:
The session factory name, if not set PluginConnection.SESSION_FACTORY will be used.

setFactory

public void setFactory(String factory)
Set a session factory.

Parameters:
factory - A factory.

getSchema

public String getSchema()
Gets the schema name.

Returns:
The schema name.

setSchema

public void setSchema(String schema)
Set the default schema.

Parameters:
schema - The schema.

isScript

public boolean isScript()
true, if script must be writen to System.out. Default is 'false'.

Returns:
true, if show script, false, otherwise.

setScript

public void setScript(boolean script)
Set script output status.

Parameters:
script - true, for show, false, otherwise.

isDrop

public boolean isDrop()
true, if schema has to be dropped, false, otherwise. Default is true.

Returns:
Schema drop mode.

setDrop

public void setDrop(boolean drop)
Set the drop behavior.

Parameters:
drop - The drop behavior flag.

isExport

public boolean isExport()
true, to perform schema creation on database, false, otherwise. Default is 'true'.

Returns:
true, if export is enabled, false, otherwise.

setExport

public void setExport(boolean export)
Sets export status.

Parameters:
export - The export status.

getActionType

public ActionType getActionType()

doStart

public ENext doStart(IContext context,
                     IResultSet result)
              throws PluginException
Specified by:
doStart in interface IPlugin
Overrides:
doStart in class AbstractPlugin
Throws:
PluginException

dropSchema

protected void dropSchema(IContext context,
                          org.hibernate.SessionFactory sf)
                   throws PluginException
Perform drop schema.

Parameters:
context - The context.
sf - The session factory.
Throws:
PluginException - On drop errors.

createSchema

protected void createSchema(IContext context,
                            org.hibernate.SessionFactory sf)
                     throws PluginException
Perform create schema.

Parameters:
context - The context.
sf - The session factory.
Throws:
PluginException - On creation errors.


Copyright © 2016. All rights reserved.