What is DeZign2DODS
DeZign2DODS integrates two, IMHO very useful products:
- DeZign: a powerful leightweight database modeling tool (see Datanamic )
- DODS: very useful tool to encapsulte database tables into java classes (see DODS )
DeZign allows you to design your database objects in a pretty nice GUI, generate reports and SQL scripts. It stores it's modeling information in a properitary ASCII-format. DeZign is not open source, but the license fees are not too high. The author of Dezign2DODS is not working for Datanamic nor does he get any benefits from Datanamic
The database encapsulation tool DODS is open source. It has mainly two features:
- Provide a GUI for designing your tables. In DODS3 (shipping with Enhydra3.1) it's implemented in a Swing application, DODS4.1 moved toward using the Merlot XML-editor as GUI. I was not satisfied with both, because they are too poor for doing real db design. The DODS-GUI stores its information in a well documented XML file, but the DTDs differ from DODS3 to DODS4.1.
- The more worthful part of DODS is code generation of java classes based on the information with the XML file.
DeZign2DODS simply converts the porpertary ASCII from DeZign into DODS' wanted XML format. The benefit is you can point and click your database model, and automatically generate Java classes encapsulating your tables.
Internally it uses Zeus, a cool framework and toolset for handling XML with Java. The Zeus binary libraries are included.
License and Trademarks
DeZign2DODS has been (and still is) developed by Stefan Armbruster and may be used under the Gnu Public License.
DeZign might be a registered trademark of Datanamic, I'm not sure about this. I just want to note this here, not to get in any trouble with lawyers.
Current status
This software is alpha. It has been successfully tested with a few DeZign data models to convert into a DODS3 XML file. The resulting data objects compile fine. So it works fine for the author's purposes and will be extended if the community asks for.
Use this software on your own risk. This author will not take any responsibility on any damage or loss of data.
To be done:
There's still a lot of work to be done:
- Improve documentation
- Create a nice looking website for Design2DODS
- Run tests with DODS4.1b
- Correct treatment of "use-oid" attribute
- create a ant taskdef
- fails if internal versioning of DeZign is on
- support of inheritance in data objects
Any help and contribution from the community is welcome.
Download
Get the most recent version here.
Installation
- Install ant, you get it on the Apache Ant Website
- Install Enhydra, this includes the old DODS version. If you like beta software, you might use a cvs snapshot of DODS 4.1b (obviously you do, otherwise you wouldn't try to set up Dezign2DODS ;-))
- Compile the sources by calling "ant" in the Dezign2DODS directory
- Generate the sample/sample.doml by calling "ant run" (see below)
Usage
A typical flow of operation with Dezign2DODS looks like this:
- Point and click your DB model with DeZign
- Save the DeZign model
- Generate the create and drop SQL scripts with DeZign and apply them to your database
- Transform the model into a Doml-XML-file
- Generate the java classes encapsulating the database using DODS
- Build you application (most simple task...)
Let's go a little deeper in detail.
Point and click your DB model with DeZign
This is quite straight forward. Simply create your database tables. Take care that every table has a oid (objectid for PostgreSQL) and version attribute, DODS depends on these. To take advantage of some special DODS features, you have to supply the following tags in the description field of the table. It's important to follow the order in the table.
Tag | Description |
<C:partial> | use partial caching for this table |
<C:full> | use full caching for this table |
<L> | use lazy loading for this table |
<A> | This table is declared abstract. Note, this does not prevent the existance of this table in the create.sql script. |
<E:classname> | This table extends a table called classname. Please note, the create.sql script does not handle this correctly. You might modify this by hand. |
After we have defined the table itself, we fill it with attributes. If you want to make an attribute searchable make sure, the description field of this attribute starts with "<Q>". Also take care, that your model does not contain any ciruclar references, this might cause a deadlock in your Enhydra application.
To establish a 1:n relation between two tables, simply use Dezign's standard function. A n:m relation requires a little bit more work: make sure, your n:m relation has and oid and version attribute.
Generating create and drop SQL scripts
Dezign supports the generation of sql scripts containing the DDL statements. DODS creates those too. I suggest to use the one created bei DeZign, because it's more tight bound to the target database. For example, if you create additional indexes in Dezign, they appear in the sql script but not in the DODS's generated one.
Transform the model into a Doml-XML-file
This is the real purpose of Dezign2DODS. It takes your database model stored by Dezign and converts it to a doml file. To use it, call ant -Ddez=<sourcefile> -Dver=<version> -Doutput=<outputfile> -Dappname=<appname> run
Parameter | Description | Example |
sourcefile | path to .dez file stored by Dezign | /home/sam/sample.dez |
version | specifies for which version of DODS the doml file is created. Possible values are: | doml3 |
outputfile | path to output file, normally with extension .doml | /home/sam/sample.doml |
appname | Enhydra's name of the application that uses the database model | sample |
Generate the java classes encapsulating the database using DODS
This is simply done by calling DODS in command line mode:/usr/local/enhydra3.1.1b1/bin/dods sample.doml src/sample/data regen
Implementation
still to be done....
Example
In the sample subdirectory, there is an example illustrating the usage of DeZign2DODS.
Filename | Description |
sample.dez | a sample database model created with DeZign |
create.sql and drop.sql | DDL scripts created by DeZign |
sample.doml | input file for DODS created by DeZign2DODS |