Software Reality
Programming with
a dose of satire.

Site Map Search


Agile Development
 
Extreme Programming
 
Code Generation


Articles
Lifecycle
Design
Programming
Soapbox
Reviews
Cthulhu

Java Swing
Swing's greatest threat isn't SWT, it's Flash
Swing Survival Guide


 
Check out our ageing Reviews Section


Use Case Driven
Use Case Driven Object Modeling with UML: Theory and Practice
Get from use cases to working, maintainable source code. Examples use Spring Framework, JUnit and Enterprise Architect

Agile UML
Agile Development with ICONIX Process
A practical subset of agile development techniques, illustrated by example

Get Controversial!
Extreme Programming Refactored
Extreme Programming with a dose of satire
Available now:



Programming

Code-Generating a Message Forum With JGenerator

<< Back to the article

Here's the final BDL (Business Definition Language) file for our generated forum example:

 

#
# COPYRIGHT Javelin/Felstar 2001, ALL RIGHTS RESERVED
#


#GENERATOR ##########################################

$PACKAGE=com.softwarereality.forum
$CONTEXTNAME=Forum
$ROOT=c:/forum/web
$GENERATOR=com.javelin.generator
jsp.pathName=$ROOT

OnlySetParsed=true

#GENERATE IN THIS DIRECTORY
default.pathName=$ROOT/web-inf/classes
classes.pathName=$ROOT/web-inf/classes

#PACKAGES

#READ FROM DATABASE
reader.0=$GENERATOR.properties.PropertiesReader

#GENERATE THESE FILES

writer.0=$GENERATOR.AggregateWriter beans
writer.1=$GENERATOR.properties.SortedPropertiesWriter
writer.2=$GENERATOR.AggregateWriter jdbc
writer.3=$GENERATOR.AggregateWriter jsp
#writer.3=$GENERATOR.AggregateWriter junit

# BEAN DEFINITIONS ##########################################

useIterator=true

#Class Context

ForumContext=public class $PACKAGE.$CONTEXTNAMEContext extends $BEANS.AbstractClassContext

ContextProperties=$PACKAGE.jdbc.JdbcContextProperties

JdbcContextProperties.code.0=com.javelin.util.jdbc.JPool.setRelativePath( "jdbc.properties" );
JdbcContextProperties.code.1=com.javelin.util.jdbc.JPool.setRelativeClass( $PACKAGE.jdbc.JdbcContextProperties.class );

#ForumContext.code.0=Logger.getLogger( "forum" ).setLevel( Level.OFF );


#Header
Copyright=Copyright Software Reality, All rights reserved.
Version=Generated Message Forum 1.1
Author=Maff

#AUTOMATICALLY CREATE THE INDEXES FOR KEYS
index=key

# DATABASE ##########################################

source=forum
source.read=false

#sybase,oracle,ms,ibm
target=forum
forum.vendor=ms

tableType=TABLE

primaryKey.suffix=ID

# TABLES

readTable.0=Forum
readColumn.Forum.0=forum INTEGER PRIMARY KEY
readColumn.Forum.1=forumName VARCHAR(50) NULL
readColumn.Forum.2=forumSection VARCHAR(50) NULL
readColumn.Forum.3=forumDescription VARCHAR(255) NULL $CREATE $MULTILINE.width=60,$MULTILINE.height=16
readColumn.Forum.4=url VARCHAR(255) NULL $CREATE $CLIENT.width=60
readColumn.Forum.5=createDateTime DATETIME NOT NULL $CREATE $READONLY
Forum.createDateTime.default=new Date()

Forum=$CREATE $CREATOR

readTable.1=Message
readColumn.Message.0=msg INTEGER PRIMARY KEY
readColumn.Message.1=forum INTEGER NOT NULL DEPENDENTS Forum
readColumn.Message.2=forumUser VARCHAR(255) NULL
readColumn.Message.3=location VARCHAR(100) NULL
readColumn.Message.4=msgTitle VARCHAR(255) NULL $CREATE $CLIENT.width=60
readColumn.Message.5=msgBody VARCHAR(1024) NULL $CREATE $MULTILINE.width=60,$MULTILINE.height=16
readColumn.Message.6=ip VARCHAR(16) NULL
readColumn.Message.7=createDateTime DATETIME NOT NULL $CREATE $READONLY
Message.createDateTime.default=new Date()

# when showing messages for a forum we show them in date order
Message.forum.sortOrder=createDateTime DESC

Message=$CREATE $CREATOR

readTable.2=LatestMessageForum
LatestMessageForum.view=true

# must have column name for second column, also must specify top 100 percent in sql server to get an ordered view
LatestMessageForum.sql=SELECT top 100 percent forumID, MAX(createDateTime) as lastMessageDateTime FROM Message GROUP BY forumID ORDER BY 2 DESC

readColumn.LatestMessageForum.0=forum INTEGER NOT NULL ASSOCIATE Forum
readColumn.LatestMessageForum.1=lastMessageDateTime DATETIME NOT NULL

LatestMessageForum=$CREATE $CREATOR


<< Back to the article

All trademarks and copyrights on this page are owned by their respective owners.
Stories and articles are owned by the original author.
All the rest Copyright © 1998-2008 Matt Stephens. ALL RIGHTS RESERVED.