Description:
The open source Web-2-Database System (also known as the 'web2database' or W2DBML system)
is an XML language and associated Java package to reduce the need to hard-code Java server-side
code to a given database schema. Also, the package features extra support for dynamic Web clients.
The W2DBML System has high aims and has already attained some altitude. Its
Gnu General Public License
encourages the pooling of many talents to improve it.
Sourceforge.net helps to host this project.
Download links are below.
Description Detail:
The W2DBML System currently
powers Phraseologic,
a Web-based collaborative Phraseology.
The Web2Database Java package
automates and organizes the Java servlet-based process of taking incoming
HTML form data, validating it, and writing it to a database, and supports fully
dynamic and data-centric logic on the Web client (browser). The only potentially database-specific call it uses is
the 'Statement.getLastInsertId()' method from MySQL's JDBC driver "org.git.mm.mysql" (used for obtaining
the last row updated). A database-independent way of doing this, "getGeneratedKeys", should be upcoming.
Specifically, Web2Database supports incoming HTML form name-value pairs (in Java HTTPServletRequests) organized
partially or wholly into any number of sets of name-value pairs. This support allows client logic (for example,
JavaScript living on a Web browser) to
dynamically generate as many sets of form elements as are needed by the end user, without being limited
by a static HTML form. Currently, the dynamically generated sets of name-value pairs must follow a basic
pattern, detailed elsewhere in the documentation.
Uses: Use the Web2Database package (inluding its XML dialect) to minimize changes to your
Java servlets and other Java server-side code across changes in database input
validation, database schema, and database type, and to support dynamic Web clients. Also use this API to completely
organize your database validation constraints and target JDBC datatypes. This package
abstracts database column value validation, database schema, and target JDBC datatypes completely out of
servlet code that saves incoming HTML form data to a database.
Specifics: Web2Database gives a Java servlet-based Web application permanent datastructure access
to the required information about the application's data storage facilities, schema, and kinds of HTML form inputs.
The information covers the databases, database tables, database table referential integrity, database table special
characteristics, table rows, table columns, the corresponding HTML form inputs to the table columns, and the validation
parameters to be applied.
Web2Database provides this information by using the separate Java package, the
JDOM API, to read
an XML file of the dialect 'W2DBML' version 1.0.
Web2Database provides access to objects that offer:
-
A list of the databases available, in the order that they are to be written to.
-
A list of the tables in each database, in the order that they are to be written to, including information about each table.
-
A list of the columns in each table, in the order that they exist in the table row, including information about each table.
-
Information about any HTML form-input element corresponding to a given database column, including
regular expression information for processing the HTML form-element name (key) or value.
-
A printed list of the data read from the application-specific W2DBML XML file, displayed by default in the
ServletContext's log file. The servlet log file is located under the servlet engine's home
directory.
This provides a visual check that the Java is reading the XML file as intended.
This code is best viewed on a 21" screen (indentation set for this screen width).
Be sure to read the documentation for this class' 'writeToDatabase' method to see the important
current limitations of this package.
Areas for Improvement:
-
Several classes in the 'dbDictionary', 'dataModel', and 'tags' packages need to know about identifiers used in the W2DBML language
definition (DTD or schema). Make them learn what they need to know about the language definition by querying the DOM via JDOM, just as they
obtain the application-specific settings of a given application-specific W2DBML file by querying the DOM via JDOM.
-
Move the SELECT query building out of the 'httpservlet' package and into the 'query' package.
-
Come up with and implement new object abstractions to simplify the conditional logic in the
'Web2Database.writeDatabase' method, and to shorten the 'Web2Database' class.
Things got a little bit overgrown there, and before
any new functionality is added to the 'Web2Database' package, there needs to be some more
decomposition of logic into objects.
-
Currently, referential integrity and unique-columns are supported, but not selective update has
not been tested. Test and if necessary make modifications to support selective update. With selective update, for example, a user could
change their e-mail contact information.
-
In its present form, this package is best used for executing discrete database write operations that are fairly uniform
in length, because its sychronization is not very fine-grained. Refine the granularity of the synchronization.
-
Presently, the
Web2Database class is a servlet. It is a servlet whose
unique functionality can easily be accessed by another servlet via the 'writeToDatabase' method.
And, it can easily be customized. But perhaps it would be very useful to extract all
non-servlet-specific functionality out of Web2Database so that any servlet, not
just a Web2Database servlet, could easily use it.
-
Currently, a weak entity table that does not contain any column elements whose incoming matching HTML/DOM form elements are
dynamically generated on the client is only protected from unnecessary writing by W2DBML unique constraints. This is
definitely sufficient but it is a s-l-o-w way to go about things. In fact, currently it is the only remaining 'slow' aspect of the
W2DBML system. Optimally, the system would keep track of such tables (for example, in the seventh test database,
'contact_permissions') and skip them entirely once they have been written to.
-
Decompose the 'ColumnElement' class into three subtypes, one for each type of column element, leaving 'ColumnElement' as an abstract class.
-
Add database connection pooling.
Links:
Contact web2db A-T treelogic-swe D-O-T com
Last modified: Tue Sep 23 20:57:37 Pacific Daylight Time 2003
|