org.apache.ddlutils.task
Class DatabaseTaskBase

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.Task
          extended byorg.apache.ddlutils.task.DatabaseTaskBase
Direct Known Subclasses:
DatabaseToDdlTask, DdlToDatabaseTask

public abstract class DatabaseTaskBase
extends org.apache.tools.ant.Task

Base class for DdlUtils Ant tasks that operate on a database.

Version:
$Revision: 289996 $
Author:
Thomas Dudziak

Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
DatabaseTaskBase()
           
 
Method Summary
protected  void addCommand(Command command)
          Adds a command.
 void addConfiguredDatabase(org.apache.commons.dbcp.BasicDataSource dataSource)
          Adds the data source to use for accessing the database.
 void execute()
          
protected  void executeCommands(Database model)
          Executes the commands.
protected  Iterator getCommands()
          Returns the commands.
 String getDatabaseType()
          Returns the database type.
 org.apache.commons.dbcp.BasicDataSource getDataSource()
          Returns the data source.
protected  Platform getPlatform()
          Creates the platform for the configured database.
protected  boolean hasCommands()
          Determines whether there are commands to perform.
 boolean isUseDelimitedSqlIdentifiers()
          Determines whether delimited SQL identifiers shall be used (the default).
protected abstract  Database readModel()
          Reads the database model on which the commands will work.
 void setDatabaseType(String type)
          Sets the database type.
 void setUseDelimitedSqlIdentifiers(boolean useDelimitedSqlIdentifiers)
          Specifies whether delimited SQL identifiers shall be used.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseTaskBase

public DatabaseTaskBase()
Method Detail

getDatabaseType

public String getDatabaseType()
Returns the database type.

Returns:
The database type

setDatabaseType

public void setDatabaseType(String type)
Sets the database type.

Parameters:
type - The database type

getDataSource

public org.apache.commons.dbcp.BasicDataSource getDataSource()
Returns the data source.

Returns:
The data source

addConfiguredDatabase

public void addConfiguredDatabase(org.apache.commons.dbcp.BasicDataSource dataSource)
Adds the data source to use for accessing the database.

Parameters:
dataSource - The data source

isUseDelimitedSqlIdentifiers

public boolean isUseDelimitedSqlIdentifiers()
Determines whether delimited SQL identifiers shall be used (the default).

Returns:
true if delimited SQL identifiers shall be used

setUseDelimitedSqlIdentifiers

public void setUseDelimitedSqlIdentifiers(boolean useDelimitedSqlIdentifiers)
Specifies whether delimited SQL identifiers shall be used.

Parameters:
useDelimitedSqlIdentifiers - true if delimited SQL identifiers shall be used

addCommand

protected void addCommand(Command command)
Adds a command.

Parameters:
command - The command

hasCommands

protected boolean hasCommands()
Determines whether there are commands to perform.

Returns:
true if there are commands

getCommands

protected Iterator getCommands()
Returns the commands.

Returns:
The commands

getPlatform

protected Platform getPlatform()
Creates the platform for the configured database.

Returns:
The platform

readModel

protected abstract Database readModel()
Reads the database model on which the commands will work.

Returns:
The database model

executeCommands

protected void executeCommands(Database model)
                        throws org.apache.tools.ant.BuildException
Executes the commands.

Parameters:
model - The database model
Throws:
org.apache.tools.ant.BuildException

execute

public void execute()
             throws org.apache.tools.ant.BuildException

Throws:
org.apache.tools.ant.BuildException


Copyright © 2005 Apache Software Foundation. All Rights Reserved.