org.apache.ojb.broker.util.dbhandling
Class DBHandlingTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.apache.ojb.broker.util.dbhandling.DBHandlingTask

public class DBHandlingTask
extends org.apache.tools.ant.Task

Ant task for performing basic db setup functions.

Author:
Thomas Dudziak

Field Summary
private  String _commands
          The commands to perform
private  ArrayList _fileSets
          The input files
private  String _handling
          The name of the db handling to use
private  String _jcdAlias
          The alias of the jdbc connection to use (empty = default connection)
private  String _propertiesFile
          The path to the properties file
private  String _workDir
          The working directory
private static String COMMAND_CREATE
          The commands
private static String COMMAND_INIT
           
private static String HANDLING_TORQUE
          The name of the known db handlings
 
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
DBHandlingTask()
           
 
Method Summary
 void addFileset(org.apache.tools.ant.types.FileSet fileset)
          Adds a fileset.
private  void addIncludes(DBHandling handling, org.apache.tools.ant.types.FileSet fileSet)
          Adds the includes of the fileset to the handling.
private  DBHandling createDBHandling()
          Creates a db handling object.
 void execute()
           
 String getCommands()
          Returns the list of commands.
 String getHandling()
          Returns the name of the handling that is used.
 String getJcdAlias()
          Returns the alias of the jdbc connection.
 String getPropertiesFile()
          Returns the properties file.
 String getWorkDir()
          Returns the working directory.
 void setCommands(String listOfCommands)
          Sets the list of commands to perform.
 void setHandling(String name)
          Sets the name of the handling to use.
 void setJcdAlias(String alias)
          Sets the alias of the jdbc connection to use.
 void setPropertiesFile(String path)
          Sets the properties file (OJB.properties).
 void setWorkDir(String dir)
          Sets the working directory.
 
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

HANDLING_TORQUE

private static final String HANDLING_TORQUE
The name of the known db handlings

See Also:
Constant Field Values

COMMAND_CREATE

private static final String COMMAND_CREATE
The commands

See Also:
Constant Field Values

COMMAND_INIT

private static final String COMMAND_INIT
See Also:
Constant Field Values

_handling

private String _handling
The name of the db handling to use


_propertiesFile

private String _propertiesFile
The path to the properties file


_jcdAlias

private String _jcdAlias
The alias of the jdbc connection to use (empty = default connection)


_workDir

private String _workDir
The working directory


_fileSets

private ArrayList _fileSets
The input files


_commands

private String _commands
The commands to perform

Constructor Detail

DBHandlingTask

public DBHandlingTask()
Method Detail

setHandling

public void setHandling(String name)
Sets the name of the handling to use.

Parameters:
name - The short name of the handling

getHandling

public String getHandling()
Returns the name of the handling that is used.

Returns:
The short name of the handling

setPropertiesFile

public void setPropertiesFile(String path)
Sets the properties file (OJB.properties).

Parameters:
path - The path to the properties file

getPropertiesFile

public String getPropertiesFile()
Returns the properties file.

Returns:
The path to the properties file

setJcdAlias

public void setJcdAlias(String alias)
Sets the alias of the jdbc connection to use.

Parameters:
alias - The alias of the connection

getJcdAlias

public String getJcdAlias()
Returns the alias of the jdbc connection.

Returns:
The alias

setWorkDir

public void setWorkDir(String dir)
Sets the working directory. If none is given, then the system's temporary directory is used.

Parameters:
dir - The working directory

getWorkDir

public String getWorkDir()
Returns the working directory.

Returns:
The working directory

addFileset

public void addFileset(org.apache.tools.ant.types.FileSet fileset)
Adds a fileset.

Parameters:
fileset - The additional input files

setCommands

public void setCommands(String listOfCommands)
Sets the list of commands to perform.

Parameters:
listOfCommands - The comma-separated list of commands

getCommands

public String getCommands()
Returns the list of commands.

Returns:
The comma-separated list of commands

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

createDBHandling

private DBHandling createDBHandling()
                             throws org.apache.tools.ant.BuildException
Creates a db handling object.

Returns:
The db handling object
Throws:
org.apache.tools.ant.BuildException - If the handling is invalid

addIncludes

private void addIncludes(DBHandling handling,
                         org.apache.tools.ant.types.FileSet fileSet)
                  throws org.apache.tools.ant.BuildException
Adds the includes of the fileset to the handling.

Parameters:
handling - The handling
fileSet - The fileset
Throws:
org.apache.tools.ant.BuildException


Copyright © 2007-2011 The Kuali Foundation. All Rights Reserved.