Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.ddlutils.task
Class DatabaseTaskBase

    java.lang.Object
      org.apache.tools.ant.ProjectComponent
          org.apache.tools.ant.Task
              org.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 $

Field Summary
`protected org.apache.commons.logging.Log` | `_log` The log.

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 PlatformConfiguration` | `getPlatformConfiguration()` Creates the platform configuration.
`protected boolean` | `hasCommands()` Determines whether there are commands to perform.
`boolean` | `isShutdownDatabase()` Determines whether the database shall be shut down after the task has finished.
`boolean` | `isSortForeignKeys()` Determines whether a table's foreign keys read from a live database shall be sorted alphabetically.
`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` | `setCatalogPattern(String catalogPattern)` Specifies a pattern that defines which database catalogs to use.
`void` | `setDatabaseType(String type)` Specifies the database type.
`void` | `setSchemaPattern(String schemaPattern)` Specifies a pattern that defines which database schemas to use.
`void` | `setShutdownDatabase(boolean shutdownDatabase)` Specifies whether DdlUtils shall shut down the database after the task has finished.
`void` | `setSimpleLogging(boolean simpleLogging)` Specifies whether simple logging (configured by the task via the `verbosity` setting) shall be used, or whether logging is configured outside of the task (e.g.
`void` | `setSortForeignKeys(boolean sortForeignKeys)` Specifies whether DdlUtils shall sort the foreign keys of a table read from a live database or leave them in the order in which they are returned by the database/JDBC driver.
`void` | `setUseDelimitedSqlIdentifiers(boolean useDelimitedSqlIdentifiers)` Specifies whether DdlUtils shall use delimited (quoted) identifiers (such as table and column names).
`void` | `setVerbosity(VerbosityLevel level)` Specifies the verbosity of the task's debug output.

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`

Field Detail

### _log

    protected org.apache.commons.logging.Log _log

  The log.

Constructor Detail

### DatabaseTaskBase

    public DatabaseTaskBase()

Method Detail

### setSimpleLogging

    public void setSimpleLogging(boolean simpleLogging)

  Specifies whether simple logging (configured by the task via the `verbosity` setting) shall be used, or whether logging is configured outside of the task (e.g. via a log4j properties file).

  Parameters:
    `simpleLogging` - Whether to use simple logging or not

### setVerbosity

    public void setVerbosity(VerbosityLevel level)

  Specifies the verbosity of the task's debug output.

  Parameters:
    `level` - The verbosity level

### getDatabaseType

    public String getDatabaseType()

  Returns the database type.

  Returns:
    The database type

### setDatabaseType

    public void setDatabaseType(String type)

  Specifies the database type. You should only need to set this if DdlUtils is not able to derive the setting from the name of the used jdbc driver or the jdbc connection url. If you have to specify this, please post your jdbc driver and connection url combo to the user mailing list so that DdlUtils can be enhanced to support this combo.
  Valid values are currently:
  `axion, cloudscape, db2, derby, firebird, hsqldb, interbase, maxdb, mckoi, mssql, mysql, mysql5, oracle, oracle9, oracle10, postgresql, sapdb, sybase`

  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

### setCatalogPattern

    public void setCatalogPattern(String catalogPattern)

  Specifies a pattern that defines which database catalogs to use. For some more info on catalog patterns and JDBC, see java.sql.DatabaseMetaData.

  Parameters:
    `catalogPattern` - The catalog pattern

### setSchemaPattern

    public void setSchemaPattern(String schemaPattern)

  Specifies a pattern that defines which database schemas to use. For some more info on schema patterns and JDBC, see java.sql.DatabaseMetaData.

  Parameters:
    `schemaPattern` - The schema pattern

### 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 DdlUtils shall use delimited (quoted) identifiers (such as table and column names). Most databases convert undelimited identifiers to uppercase and ignore the case of identifiers when performing any SQL command. Undelimited identifiers also cannot be reserved words and can only contain alphanumerical characters and the underscore.
  These limitations do not exist for delimited identifiers where identifiers have to be enclosed in double quotes. Delimited identifiers can contain unicode characters, and even reserved words can be used as identifiers. Please be aware though, that they always have to enclosed in double quotes, and that the case of the identifier will be important in every SQL command executed against the database.

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

### isSortForeignKeys

    public boolean isSortForeignKeys()

  Determines whether a table's foreign keys read from a live database shall be sorted alphabetically. Is `false` by default.

  Returns:
    `true` if the foreign keys shall be sorted

### setSortForeignKeys

    public void setSortForeignKeys(boolean sortForeignKeys)

  Specifies whether DdlUtils shall sort the foreign keys of a table read from a live database or leave them in the order in which they are returned by the database/JDBC driver. Note that the sort is case sensitive only if delimited identifier mode is on (`useDelimitedSqlIdentifiers` is set to `true`).

  Parameters:
    `sortForeignKeys` - `true` if the foreign keys shall be sorted

### isShutdownDatabase

    public boolean isShutdownDatabase()

  Determines whether the database shall be shut down after the task has finished.

  Returns:
    `true` if the database shall be shut down

### setShutdownDatabase

    public void setShutdownDatabase(boolean shutdownDatabase)

  Specifies whether DdlUtils shall shut down the database after the task has finished. This is mostly useful for embedded databases.

  Parameters:
    `shutdownDatabase` - `true` if the database shall be shut down

### 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

### getPlatformConfiguration

    protected PlatformConfiguration getPlatformConfiguration()

  Creates the platform configuration.

  Returns:
    The platform configuration

### 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

  Overrides:
    `execute` in class `org.apache.tools.ant.Task`
  Throws:
    `org.apache.tools.ant.BuildException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.