Oct 26
Post on AJug Mailing List
icon1 steve | icon2 DCAF | icon4 10 26th, 2005| icon31 Comment »

I have invited discussion of DCAF on the AJUG mailing list, and below is a reply to a question that adds to the knowledgebase of DCAF.

Its been many long years now, finding time between work and being the only hands on the project doesn’t allow it to move that fast. I guess its been ready to show to the world for over a year now, but just havn’t had the time to get everything together and actually show it off.

More detail on DCAF, ok let me start with the basics.
DCAF maps data sources (not only RDBMS) to ‘entities’ each of these entities is a complex class that extend the BaseDO. This approach differs from other persistance engines in that all of the persistance logic is accessible via the entity itself. Ie with just a User entity you can persist the data, refresh the data or even locate related objects.

There are 4 layers to DCAF, the Persistance layer, the entity layer, the business layer and the List layer.

The perisistance layer is configured to which dialect of SQL or which data source to connect to, DCAF has focused on ORACLE, Mckoi, MySql and MSSQL.
All of the syntacic logic for each system is included with the base DCAF product.

The entity layer is an automatically generated layer (using DCAFg) driven by a config file. This layer is the end classes used by the developer to access the data source. Each entity maps onto a specific table and has cool features like read locking for transaction committing.

The business layer is another automatically generated layer that models the business relationships between the data source entities. This layer is again automatically generated using DCAFg. So you might have a Customer entity that has Orders, to access the orders you would get the Customer then invoke getOrdersCount() to see how many orders exist, or getOrder(int i) to get a specific order.

The list layer is the 3rd auto generated layer. This layer replaces the need for SQL and acts as a container for business objects. Code like the following would show you the orders for delivery in the future.


OrderList list = new OrderList();
list.addSearchField(OrderList.DELIVER_DATE, BindVariable.CONSTRAINT_GREATER_THAN, new Date()));
list.loadEntries();

By NOT using SQL I have found that changes to the database are much easily managed, as there are compile time constraints on the bind columns allowing what once were major changes to happen easily.

I hope that gives a bit more of an idea of the structure, as for what I think the benefits are.

Simple Devloper Access
I really find that when using DCAF a developer doesn’t really even know they are accessing a data source. The code above for loading orders doesn’t require SQL knowledge or even that there is a data source. It reduces accessing the data source to a series of simple Java commands. Lets say u need to update user 123′s last name to “Smith” the code would be the following.


User user = new User(123);
user.setLastName("Smith");
user.save();

All of the logic for loading the entity updating the column and committing the transaction is done automagically, no need to understand transactions etc..

Business Relationships
Most persistance engines that I’ve looked at (tho not in depth) stop at the entity level. You can read and write data from a table, but you then still need to understand the relationships between the tables and how to load them. DCAF allows you to configure this in the XML file and autogenerate the relationships. Then using lazy loading allow you access to these related objects with a single method call.

Transaction Management
All save calls are wrapped in Transactions, but more to that, as there are
business relationships a save to a top level element will persist all
changes to related objects. So there may be a User table and an
UserPreference table, we could modify some UserPref’s and/or add some new
ones, then with a simple user.save(); call not only would any changes to the
user be saved, but also the UserPref changes. The newly added user prefs
would be automatically populated with the foreign key details from the user,
all done seemlessly to the developer.

I havn’t had a heap of experience with other persistance engines like
Hibernate. I started working on DCAF over 6 years ago (as part of a uni
project) and its evolved to where it is today. I did see hibernate come,
and tried it but never long enough to know it in and out. But from what I
have read DCAF does all the core function hibernate does, but does it in a
different fashion that I think makes data access simpler.

This is the type of discussion I was hoping to start, so please feel free to
ask any/all questions.. I know that code speaks louder than words, so I’m
hoping to get an example app up onto my site in the next day or so.

Oct 25
DCAF Overview
icon1 steve | icon2 DCAF | icon4 10 25th, 2005| icon3No Comments »

There is very little written down about what DCAF is and how it works, this series of articles will hopefully shed some light onto the structure of using DCAF within your applications.

For all of these examples I will discuss the mapping to a RDBMS as this is the most stable and developed function, other persistances exist for remote object access and other non database data sources like XML.

The DCAF core is a series of base abstract classes that get extended for each entity to be mapped in the system. The second half of the library is the actual persistance logic that does the mapping between the entity classes and the implementation on the backend (ie Oracle, Access, Mysql, etc..).

A DCAF entity is the definition of a specific table within the database, for each table in the database a single entity is created, and each entity is made up of 4 classes, 2 being used internally by DCAF and the other 2 for developer access.

The four classes required for each entity are the DO, BO, List and Main objects.
A brief overview below:
DO
This is the lowest level mapping object that handles the columns of a specific table. Each DO has the information related to the columns that exist, their data type and name. The DO is the element that contains the actual values from the data source and the logic to determine which values have been updated or changed.
BO
The BO is a logical wrapper for the DO, but also adds the logic of maintaining the business relationships between the BO’s as defined by relationships in the datasource such as foreign key or logical relationships.
List
The List object is the data object that manages loading multiple entities from the datasource and is the main data container used when discussing collections of entities. No SQL like syntax is used, and so allows compile time checking of logic (one of the biggest plus’ of DCAF).
Main
All developer code is placed in the Main object as all of the 3 previous objects can be automatically generated/re-generated using DCAFg. The main object is the extenstion of the BO for the entity but is not re-created on each generation and so keeps any additional business logic intact.

This is just a quick primer on the DCAF structure, check back soon for more information related to using DCAF with your application and code snippits to get up and running in less than 15 mins.

Oct 25

Whitesquare software would like to announce the updated release of DCAF and the initial public release of DCAFg. These two release co-incide with the revitalised effort in progressing the technology to meet the requirements of modern persistance management systems.

DCAF (data connectivity application framework) is a persistance engine that handles mapping between data sources such as RDBMS’, but takes the features of a persistance manager the next level. DCAF not only manages the interaction with the datasource, but additionally assists the developer in managing the business relationships between the data elements.

Download DCAF v1.1.0 evaluation now

DCAFg is an application that generates the base DO/BO/List and main objects. The developer now only needs to configure a basic XML file (or even generate it from and existing database), run DCAFg and the entire set of base classes are written allowing fully jdk 1.2 –> 5.0 compatible code to be complied and with 4-5 lines of wrapper code instant access to the data source without writing a line of SQL.

Download DCAFg v1.0.0 evaluation now

Over the next few weeks we will be releasing articles outlining each of the new and powerful features that DCAF puts into the hands of the developer, allowing more time for you to write productive logic and not housekeeping code.

Oct 25

I have got my stuff together and finally put up a site to explain and discuss all of the development going on withing the virtual walls of whitesquare software.

I’m hoping to get some more discussion of some of the modules underway by contacting the Ajug group.

So thats all for this post, I’m off to start writing up some of the documentation for DCAF and DCAFg the initial releases coming out of whitesquare.

Next Entries »