The code is divided into big sections:
A database adaptor is a set of classes, within a package. For example, the following package represents a database adaptor:
org.dbview.addons.input.mysql
If you look at this package, you see that it contains 4 classes:
The list of mandatory classes for a database exporter is defined in the following class: org.dbview.input_addons.InputCatalog
See attribut "ADAPTORS
":
private static final ArrayList ADAPTORS = new ArrayList() {{ add("Cli"); add("Configuration"); add("Description"); add("Loader"); }};
Class | Description |
---|---|
Cli | This class is responsible for extracting values from the command line. It creates a XML document that represents the command line configuration. |
Description | This class is used to print a brief description of the adaptor. |
Configuration | This class contains the parameters used to connect to a database. It takes the XML document created by the class "Cli" and process it. |
Loader | This class loads the database's structure and create an internal representation. |
If you plan to add a new adapter ("youNewAdaptor"):
org.dbview.addons.input.youNewAdaptor
"The package that represents the new adaptor must be the package that contains all database adaptors :
org.dbview.addons.input
See attribut "ADD_ON_PATTERN
", of class "org.dbview.input_addons.InputCatalog
".
private static final Pattern ADD_ON_PATTERN = Pattern.compile("^(.+\\.addons\\.input\\.([^\\.]+))\\.([^\\.]+)\\.class$");
A database exporter is a set of classes, within a package. For example, the following packages represent database adaptors:
The adapter's name given through the command line is converted into a "Lower Camel Case" string. See the method below:
org.dbview.utils
Strings
String dashToLowerCamelCase(String in_source)
If you look at these packages, you see that they contain 3 classes:
The list of mandatory classes for a database exporter is defined in the following class: org.dbview.output_addons.OutputCatalog
See attribut "ADAPTORS
":
private static final ArrayList ADAPTORS = new ArrayList() {{ add("Cli"); add("Description"); add("Exporter"); }};
Class | Description |
---|---|
Cli | This class is responsible for extracting values from the command line. It creates a XML document that represents the command line configuration. |
Description | This class is used to print a brief description of the adaptor. |
Exporter | This class is responsible for the generation of the database representation. |
If you plan to add a new exporter ("youNewExporter"):
org.dbview.addons.output.table.youNewExporter
"The package that represents the new exporter must be the package that contains all database exporters :
org.dbview.addons.output.table
See attribut "ADD_ON_PATTERN
", of class "org.dbview.output_addons.OutputCatalog
".
private static final Pattern ADD_ON_PATTERN = Pattern.compile("^(.+\\.addons\\.output\\.[^\\.]+\\.([^\\.]+))\\.([^\\.]+)\\.class$");
All elements that represent a database are defined into the package "org.dbview.db.structure
".
If you need an example on how to use the database representation, you can look at the code of class: "org.dbview.addons.output.table.dotFull.Exporter
".
A resource is a software add-on that extends the application. Now, DbView only define one resource: the soft foreign key detector.
Resources are located in the following package:
org.dbview.resources.theResourceName
Soft foreign key detectors are located into the following packahe:
org.dbview.resources.softforeignkeydetectors
A soft foreign key detector is a class. For example: "FkTargetTableName
"
Adding a new soft foreign key detector is easy:
org.dbview.resources.softforeignkeydetectors
".public Boolean isFk(String in_field_name)
public String referenceTable(String in_field_name)
public String referenceField(String in_field_name)
public String description()
The adapter's name given through the command line is converted into a "Lower Camel Case" string. See the method below:
org.dbview.utils
Strings
String dashToLowerCamelCase(String in_source)
The package "org.dbview.utils
" contains some utilities.
The section "runtime" contains three entries:
org.dbview.runtime
"org.dbview.runtime.actions
"org.dbview.runtime.cli
"Name | Description |
---|---|
org.dbview.runtime | This package contains the entry point. |
org.dbview.runtime.actions | This package contains the actions' implementations. For each command selector, you have a corresponding method. |
org.dbview.runtime.cli | This package contains the command line parser. The parser returns a hash table that contains the information extracted from the command line. |
Directory | Description |
---|---|
src | JAVA source. |
conf | This directory contains configuration files. Now, it contains only one configuration file: "resources.properties". Please note that this file contains information that is used by the ANT script (at compile time) and by the application. |
data | This directory contains run time data. Now, it contains only one file: "profiles.xml". This file contains the profiles' repository. |
doc | Some documentation. |
libs | External software components:
|
test-data | Some files that contain test data. |
Name | Description |
---|---|
build.xml | ANT specification file. Ti compile: ant clean , then ant |
dbview.bat | Script that launches the DbView application under Windows. |
dbview.sh | Script that launches the DbView application under MAC OS, linux, and UNIXes. |
doxygen | Configuration file for DoxyGen. |
data/profile.xml | This is the profiles' repository. |
extensions/databaseAdaptors.jar | This JAR contains all the database adaptors. |
extensions/exporters.jar | This JAR contains all the database exporters. |
extensions/softForeignKeyDetectors.jar | This JAR contains all the soft foreign key detectors. |
Action | Command |
---|---|
Clean | ant clean |
Build all | ant |
Build documentation | ant doc |
Run all JUNIT test suite | ant testall |
Print the CLASSPATH | ant show-classpath |
Print all classes that are part of the DBVIEW application | ant show-class-dbview |
Print all classes that are part of the unitary test suite | ant show-class-test |
Print all classes that represent soft foreign key detectors | ant show-class-fk |
Print all classes that represent database adaptors | ant show-class-input-adaptor |
Print all classes that represent database exporters | ant show-class-output-adaptor |