Package org.apache.openjpa.jdbc.ant
Class MappingToolTask
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.Task
-
- org.apache.tools.ant.taskdefs.MatchingTask
-
- org.apache.openjpa.lib.ant.AbstractTask
-
- org.apache.openjpa.jdbc.ant.MappingToolTask
-
- All Implemented Interfaces:
java.lang.Cloneable
,org.apache.tools.ant.types.selectors.SelectorContainer
public class MappingToolTask extends AbstractTask
Executes theMappingTool
on the specified files. This task can take the following arguments:action
meta
schemaAction
rollbackBeforeDDL
dropTables
ignoreErrors
readSchema
primaryKeys
foreignKeys
indexes
file
schemaFile
sqlFile
sqlEncode
sqlTerminator
tmpClassLoader
action
is required.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MappingToolTask.Action
static class
MappingToolTask.SchemaAction
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
file
protected MappingTool.Flags
flags
protected java.lang.String
schemaFile
protected java.lang.String
sqlEncode
protected java.lang.String
sqlFile
protected boolean
tmpClassLoader
-
Fields inherited from class org.apache.openjpa.lib.ant.AbstractTask
classpath, fileSets, haltOnError, isolate, useParent
-
-
Constructor Summary
Constructors Constructor Description MappingToolTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
executeOn(java.lang.String[] files)
Perform the task action on the given files.protected ConfigurationImpl
newConfiguration()
Implement this method to return a configuration object for the product in use.void
setAction(MappingToolTask.Action act)
Set the enumerated MappingTool action type.void
setDropSequences(boolean dropSequences)
Set whether the MappingTool should drop sequences.void
setDropTables(boolean dropTables)
Set whether the MappingTool should drop tables.void
setFile(java.lang.String file)
Set the output file we want the MappingTool to write to.void
setForeignKeys(boolean fks)
Set whether to generate foreign key information.void
setIgnoreErrors(boolean ignoreErrors)
Set whether we want the MappingTool to ignore SQL errors.void
setIndexes(boolean idxs)
Set whether to generate index information.void
setMeta(boolean meta)
Set whether this action applies to metadata as well as mappings.void
setOpenJPATables(boolean openjpaTables)
Set whether to drop OpenJPA tables.void
setPrimaryKeys(boolean pks)
Set whether to generate primary key information.void
setReadSchema(boolean readSchema)
Set whether the MappingTool should read the full schema.void
setRollbackBeforeDDL(boolean rollbackBeforeDDL)
Set whether the MappingTool should rollback will be performed before each DDL statement is executed.void
setSchemaAction(MappingToolTask.SchemaAction act)
Set the enumerated SchemaTool action type.void
setSchemaFile(java.lang.String schemaFile)
Set the output file for an XML representation of the planned schema.void
setSequences(boolean sequences)
Set whether the MappingTool should manipulate sequences.void
setSQLEncode(java.lang.String sqlEncode)
Set the output file charset encoding we want the MappingTool to use.void
setSQLFile(java.lang.String sqlFile)
Set the output file we want the MappingTool to write a SQL script to.void
setSQLTerminator(java.lang.String t)
Sets the characters used to terminate a generated SQL.void
setTmpClassLoader(boolean tmpClassLoader)
Set whether a temporary ClassLoader should be used by the MappingTool.-
Methods inherited from class org.apache.openjpa.lib.ant.AbstractTask
addFileset, assertFiles, createClasspath, createConfig, execute, getClassLoader, getConfiguration, setClasspath, setHaltOnError, setIsolate, setUseParentClassloader
-
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems
-
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
-
-
-
-
Field Detail
-
flags
protected MappingTool.Flags flags
-
file
protected java.lang.String file
-
schemaFile
protected java.lang.String schemaFile
-
sqlFile
protected java.lang.String sqlFile
-
sqlEncode
protected java.lang.String sqlEncode
-
tmpClassLoader
protected boolean tmpClassLoader
-
-
Method Detail
-
setAction
public void setAction(MappingToolTask.Action act)
Set the enumerated MappingTool action type.
-
setSchemaAction
public void setSchemaAction(MappingToolTask.SchemaAction act)
Set the enumerated SchemaTool action type.
-
setReadSchema
public void setReadSchema(boolean readSchema)
Set whether the MappingTool should read the full schema.
-
setIgnoreErrors
public void setIgnoreErrors(boolean ignoreErrors)
Set whether we want the MappingTool to ignore SQL errors.
-
setDropTables
public void setDropTables(boolean dropTables)
Set whether the MappingTool should drop tables.
-
setRollbackBeforeDDL
public void setRollbackBeforeDDL(boolean rollbackBeforeDDL)
Set whether the MappingTool should rollback will be performed before each DDL statement is executed.
-
setOpenJPATables
public void setOpenJPATables(boolean openjpaTables)
Set whether to drop OpenJPA tables.
-
setDropSequences
public void setDropSequences(boolean dropSequences)
Set whether the MappingTool should drop sequences.
-
setSequences
public void setSequences(boolean sequences)
Set whether the MappingTool should manipulate sequences.
-
setPrimaryKeys
public void setPrimaryKeys(boolean pks)
Set whether to generate primary key information.
-
setForeignKeys
public void setForeignKeys(boolean fks)
Set whether to generate foreign key information.
-
setIndexes
public void setIndexes(boolean idxs)
Set whether to generate index information.
-
setFile
public void setFile(java.lang.String file)
Set the output file we want the MappingTool to write to.
-
setSchemaFile
public void setSchemaFile(java.lang.String schemaFile)
Set the output file for an XML representation of the planned schema.
-
setSQLFile
public void setSQLFile(java.lang.String sqlFile)
Set the output file we want the MappingTool to write a SQL script to.
-
setSQLEncode
public void setSQLEncode(java.lang.String sqlEncode)
Set the output file charset encoding we want the MappingTool to use.
-
setSQLTerminator
public void setSQLTerminator(java.lang.String t)
Sets the characters used to terminate a generated SQL. By default, a semicolon.
-
setMeta
public void setMeta(boolean meta)
Set whether this action applies to metadata as well as mappings.
-
newConfiguration
protected ConfigurationImpl newConfiguration()
Description copied from class:AbstractTask
Implement this method to return a configuration object for the product in use.- Specified by:
newConfiguration
in classAbstractTask
-
executeOn
protected void executeOn(java.lang.String[] files) throws java.lang.Exception
Description copied from class:AbstractTask
Perform the task action on the given files.- Specified by:
executeOn
in classAbstractTask
- Throws:
java.lang.Exception
-
setTmpClassLoader
public void setTmpClassLoader(boolean tmpClassLoader)
Set whether a temporary ClassLoader should be used by the MappingTool. The default value is true
- Parameters:
tmpClassLoader
- Whether the temporary ClassLoader should be used.
-
-