This page describes the database schema DTD. In actuality, the master document for the database schema schema (DTD is just one way of defining an XML schema) is schema.qjml, which is a Quick 3 document. But for the purposes of writing a database schema XML document, that detail is not important.
prompt % java org.apache.xalan.xslt.Process -IN <DB schema XML document> -XSL generate-schema-mysql.xsl -OUT makedatabase.sqlTo run this command, or any other Dovetail command, you should have all the JAR files in the Dovetail lib directory in your CLASSPATH.
You can also use a stylesheet to drop the database schema. You can generate the SQL statements to drop the database by running:
prompt % java org.apache.xalan.xslt.Process -IN <DB schema XML document> -XSL generate-drop-schema-mysql.xsl -OUT dropdatabase.sql
agonism.dovetail.util.DoveTail2Java utility. Here is an example:
c:\myproject> java agonism.dovetail.util.DoveTail2Java my-site.xml c:\java\dovetail\schema\site.qjml my-schema.xml c:\java\dovetail\schema\schema.qjml c:\java\dovetail\xsl outputYou can run
DoveTail2Java with no arguments to get simple usage information.
[package].[schema]Schema, where the [package] and [schema] strings are provided by the DB schema XML document. This Schema class provides a method to get a Java object for each table in the schema. Each of these table objects (located in the same package as the Schema class), has an accessor method for each Column which is defined on that Table.
[package].instance.[table]Instance will be generated.
Each of these instance classes has methods for accomplishing the following:
<schema name="survey" package="dovetail.example.survey.schema"> <table name="RegisteredUser"> ... </table> <table name="Survey"> ... </table> <table name="SurveyResponse"> ... </table> </schema>The following metadata classes will be generated:
schema
schema element is the root of any Dovetail database schema document (hereafter referred to as the 'schema document').
| Name | Description | Required | Default Value |
|---|---|---|---|
name |
name.
| true | |
description |
| false | |
package |
agonism.dovetail.example.survey. The Java code generator will append '.schema' to the package attribute. | true |
| Name | Description | MinOccurs | MaxOccurs |
|---|---|---|---|
table |
| 0 | * |
table
table element represents a database table.
| Name | Description | Required | Default Value |
|---|---|---|---|
name |
| true |
| Name | Description | MinOccurs | MaxOccurs |
|---|---|---|---|
column |
| 0 | * |
constraint |
index element. | 0 | * |
index |
| 0 | * |
column
| Name | Description | Required | Default Value |
|---|---|---|---|
name |
| false | |
isPassword |
| false | false |
isPrimaryKey |
| false | false |
isAutoIncrement |
| false | false |
allowNull |
| false | true |
| Name | Description | MinOccurs | MaxOccurs |
|---|---|---|---|
type |
| 1, unless the column is a reference | 1, unless the column is a reference |
defaultValue |
| 0 | 1 |
reference |
| 1, unless the type is specified | 1 |
displayText |
| 0 | 1 |
comment |
| 1 | 1 |
type
| Name | Description | Required | Default Value |
|---|---|---|---|
size |
| false | -1 |
| Name | Description | MinOccurs | MaxOccurs |
|---|---|---|---|
int |
| 0 | 1 |
float |
| 0 | 1 |
date |
| 0 | 1 |
boolean |
| 0 | 1 |
fixed-string |
| 0 | 1 |
string |
| 0 | 1 |
enum |
| 0 | 1 |
blob |
| 0 | 1 |
enum
| Name | Description | MinOccurs | MaxOccurs |
|---|---|---|---|
value |
| 1 | * |
reference
| Name | Description | Required | Default Value |
|---|---|---|---|
table-name |
| true | |
column-name |
| true |
constraint
| Name | Description | Required | Default Value |
|---|---|---|---|
isUnique |
firstName lastName --------- -------- Ed Wood Phil Woods Woody Allen Paul AllenBut it would prevent the addition of Woody Allen (or any of the other existing firstName/lastName combinations) to the table.
| true |
| Name | Description | MinOccurs | MaxOccurs |
|---|---|---|---|
column-ref |
| 1 | * |
index
| Name | Description | Required | Default Value |
|---|---|---|---|
isUnique |
| true |
| Name | Description | MinOccurs | MaxOccurs |
|---|---|---|---|
column-ref |
| 1 | * |