org.apache.ojb.broker.ant
Class VerifyMappingsTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.apache.ojb.broker.ant.VerifyMappingsTask

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

An Ant task that will read the OJB repository xml file and confirm the following: a)Mapped classes exist. b)Mapped class fields exist c)Mapped database tables exist. d)Mapped database columns exist. e)Mapped database columns jdbc type matches the "jdbc-type" attribute. Obviously you should have built your classes, written your OJB repository.xml file and built your database schema before running this task.

Version:
$Id: VerifyMappingsTask.java,v 1.1 2007-08-24 22:17:41 ewestfal Exp $
Author:
Daren Drummond

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
VerifyMappingsTask()
           
 
Method Summary
 org.apache.tools.ant.types.Path createClasspath()
          Create the classpath for loading the driver.
 void execute()
           
protected  int getErrorCount()
           
 boolean getFailOnError()
          Determines whether this task stops by throwing a BuildException when the first error is encountered.
 boolean getIgnoreFieldNameCase()
          Determines whether the task ignores the case of the db column name case when looking for db columns.
 String getJdbcDriver()
          Gets the value set by setJdbcDriver(String jdbcClass)
 String getLogon()
          Gets the value set by setLogon(String logon)
 String getPassword()
          Gets the value set by setPassword(String password)
 Class getPersistentFieldClass()
          Returns the Class object of the class specified in the OJB.properties file for the "PersistentFieldClass" property.
 String getPropertiesFile()
          Gets the value set by setPropertiesFile(String path)
 String getRepositoryFile()
          Gets the path to the OJB repository file.
 String getUrl()
          Gets the value set by setUrl(String url)
 boolean getUseStrictTypeChecking()
          Gets the boolean equivalent of the value set by setUseStrictTypeChecking(String sTypeCheckingFlag)
 boolean getUseXMLValidation()
          Determines whether the xml syntax is verified.
protected  int getWarningCount()
           
 boolean hasConnectionInfo()
          Tests to see if the jdbc connection information was specified in the tag xml.
 void logInfo(String msg)
          Log an Info message with the Ant out stream.
 void logWarning(String msg)
          Log a warning with the Ant out stream.
 void setClasspath(org.apache.tools.ant.types.Path classpath)
          Set the classpath for loading the driver.
 void setClasspathRef(org.apache.tools.ant.types.Reference r)
          Set the classpath for loading the driver using the classpath reference.
protected  void setErrorCount(int count)
           
 void setFailOnError(String sFailFlag)
          Sets a flag indicating that this Ant task should throw a BuildException if it encounters any verification errors.
 void setIgnoreFieldNameCase(String sIgnoreCaseFlag)
          Sets the flag for ignoring the db column name case when looking for db columns.
 void setJdbcDriver(String jdbcClass)
          Sets the fully qualified class name of the jdbc driver to use.
 void setLogon(String logon)
          Sets the database logon account that the utility should use.
 void setPassword(String password)
          Sets the password for the database logon account.
 void setPropertiesFile(String path)
          Sets the fully qualified path and file name of the OJB properties file.
 void setRepositoryFile(String path)
           
 void setUrl(String url)
          Sets the url connection string for the jdbc driver.
 void setUseStrictTypeChecking(String sTypeCheckingFlag)
          Sets the flag for stict type checking of database column types.
 void setUseXMLValidation(String sValidationFlag)
          Turns on W3C xml validation of the OJB repository.xml file (on by default).
protected  void setWarningCount(int count)
           
 
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

VerifyMappingsTask

public VerifyMappingsTask()
Method Detail

setRepositoryFile

public void setRepositoryFile(String path)

getRepositoryFile

public String getRepositoryFile()
Gets the path to the OJB repository file. (Includes the file name)

Returns:
The path and file name of the OJB repository file

setPropertiesFile

public void setPropertiesFile(String path)
Sets the fully qualified path and file name of the OJB properties file.

Parameters:
path - The path and file name of the OJB properties file

getPropertiesFile

public String getPropertiesFile()
Gets the value set by setPropertiesFile(String path)

Returns:
The path and file name of the OJB properties file

setJdbcDriver

public void setJdbcDriver(String jdbcClass)
Sets the fully qualified class name of the jdbc driver to use.

Parameters:
jdbcClass - Fully qualified class name of the jdbc driver

getJdbcDriver

public String getJdbcDriver()
Gets the value set by setJdbcDriver(String jdbcClass)

Returns:
Fully qualified class name of the jdbc driver

setUrl

public void setUrl(String url)
Sets the url connection string for the jdbc driver.

Parameters:
url - The connection string for the jdbc driver

getUrl

public String getUrl()
Gets the value set by setUrl(String url)

Returns:
The connection string for the jdbc driver

setLogon

public void setLogon(String logon)
Sets the database logon account that the utility should use.

Parameters:
logon - The database logon account

getLogon

public String getLogon()
Gets the value set by setLogon(String logon)

Returns:
The database logon account

setPassword

public void setPassword(String password)
Sets the password for the database logon account.

Parameters:
password - The password for the database logon account

getPassword

public String getPassword()
Gets the value set by setPassword(String password)

Returns:
The password for the database logon account

setUseXMLValidation

public void setUseXMLValidation(String sValidationFlag)
Turns on W3C xml validation of the OJB repository.xml file (on by default).

Parameters:
sValidationFlag - Whether to validate the xml

getUseXMLValidation

public boolean getUseXMLValidation()
Determines whether the xml syntax is verified.

Returns:
A flag indicating if W3c xml validation will be used to verify the OJB repository.xml file

setFailOnError

public void setFailOnError(String sFailFlag)
Sets a flag indicating that this Ant task should throw a BuildException if it encounters any verification errors. In most cases, this will have the effect of stopping the build process.

Parameters:
sFailFlag - Whether to stop the task upon the first error

getFailOnError

public boolean getFailOnError()
Determines whether this task stops by throwing a BuildException when the first error is encountered.

Returns:
A flag indicating that the Ant task will throw a BuildException if it encounters any validation errors

setIgnoreFieldNameCase

public void setIgnoreFieldNameCase(String sIgnoreCaseFlag)
Sets the flag for ignoring the db column name case when looking for db columns.

Parameters:
sIgnoreCaseFlag - Whether the case of the db column name is ignored

getIgnoreFieldNameCase

public boolean getIgnoreFieldNameCase()
Determines whether the task ignores the case of the db column name case when looking for db columns.

Returns:
Flag indicating if the field name case will be ignored when searching for table column names

setUseStrictTypeChecking

public void setUseStrictTypeChecking(String sTypeCheckingFlag)
Sets the flag for stict type checking of database column types. If this value is set to "true" then the task will log a warning if the table column jdbc type doesn't match the type specified in the OJB repository field descriptor.

Parameters:
sTypeCheckingFlag - Whether to use strict type checking

getUseStrictTypeChecking

public boolean getUseStrictTypeChecking()
Gets the boolean equivalent of the value set by setUseStrictTypeChecking(String sTypeCheckingFlag)

Returns:
Flag indicating if strict type checking will be used when searching for database table columns

setClasspath

public void setClasspath(org.apache.tools.ant.types.Path classpath)
Set the classpath for loading the driver.

Parameters:
classpath - the classpath

createClasspath

public org.apache.tools.ant.types.Path createClasspath()
Create the classpath for loading the driver.

Returns:
the classpath

setClasspathRef

public void setClasspathRef(org.apache.tools.ant.types.Reference r)
Set the classpath for loading the driver using the classpath reference.

Parameters:
r - reference to the classpath

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

logWarning

public void logWarning(String msg)
Log a warning with the Ant out stream.

Parameters:
msg - The message to log

logInfo

public void logInfo(String msg)
Log an Info message with the Ant out stream. Info messages can be suppressed from the command line by starting ant with the -quiet option.

Parameters:
msg - The message to log

getErrorCount

protected int getErrorCount()

setErrorCount

protected void setErrorCount(int count)

getWarningCount

protected int getWarningCount()

setWarningCount

protected void setWarningCount(int count)

hasConnectionInfo

public boolean hasConnectionInfo()
Tests to see if the jdbc connection information was specified in the tag xml.

Returns:
true if the jdbc connection information was supplied in the tag xml

getPersistentFieldClass

public Class getPersistentFieldClass()
Returns the Class object of the class specified in the OJB.properties file for the "PersistentFieldClass" property.

Returns:
Class The Class object of the "PersistentFieldClass" class specified in the OJB.properties file.


Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.