Jaffa Logo
 
SourceForge.net
Home Contact Us FAQs Site Map
Source Forge: Homepage Bugs @ Sourceforge Mailing Lists @ Sourceforge Task Manager @ Sourceforge CVS @ Sourceforge
Jaffa Site
Jaffa Runtime
Jaffa RAD
Sub-Projects
Tools / Patterns / Applicationorg.jaffa.tools.patternmetaengine

The application builder is part of the 'Application Quick Start' concept withing Jaffa. Once you have generated you domain model what is the next step....To build the application that uses it.

The app builder is focused on using the domain model to create Finder, Viewer, Lookup and Maintenance components for all your domain objects. It is not just a 'simple' CRUD (Create, Read, Update, Delete) application, it uses the relationship information to provide for example, lookups in the maintenance screens for foreign keys, views of child records for a given object in its viewer. links to viewers for foriegn keys.

So with the power of the relationships you get a fully inter-relates set of components that can then be modified to suite you applications needs, either by modifying the pattern's XML itself, or by adding customizations into the pattern generated code.

Using The Application Builder

In your project, create A Directory under /source called /appbuilder

Now create an AppBuilder.xml Configuration File. The defines all the information needed to build the application, and allows various controll over how and what is built.

appbuilder.xml
<?xml version="1.0" encoding="US-ASCII"?>
<application-builder>
  <application-name>myapp</application-name>
  <package-prefix>org.jaffa</package-prefix>
  <full-package-names>false</full-package-names>
  <output-root>c:/sandbox/MyApp/</output-root>
  <output-java>source/java/</output-java>
  <output-finders>source/java/resources/tools/patternengine/object_finder_1_0/</output-finders>
  <output-viewers>source/java/resources/tools/patternengine/object_viewer_1_0/</output-viewers>
  <output-lookups>source/java/resources/tools/patternengine/object_lookup_1_0/</output-lookups>
  <output-maintenance>source/java/resources/tools/patternengine/object_maintenance_1_0/</output-maintenance>
  <domain-object-path>c:/sandbox/MyApp/source/java/resources/tools/patternengine/domain_creator_1_0/</domain-object-path>
  <module>
    <name>module</name>
    <finders-domain-pattern>org.jaffa.myapp.mymodule.domain.*</finders-domain-pattern>
    <viewers-domain-pattern>org.jaffa.myapp.mymodule.domain.*</viewers-domain-pattern>
    <maintenance-domain-pattern>org.jaffa.myapp.mymodule.domain.*</maintenance-domain-pattern>
    <labels>merge</labels>
  </module>
  <module>
    <name>user</name>
    <finders-domain-pattern>org.jaffa.myapp.user.domain.*</finders-domain-pattern>
    <viewers-domain-pattern>org.jaffa.myapp.user.domain.*</viewers-domain-pattern>
    <maintenance-domain-pattern>org.jaffa.myapp.user.domain.*</maintenance-domain-pattern>
    <labels>merge</labels>
  </module>
</application-builder>

The above configuration is pretty self explanatory.

The first section defines the app name, the package structure, the locations of input and output files in your sandbox.

The second section defines a 'module' you want building. Here you can specify what domain objects should be used to build the various component in the module. The labels parameter allows you to ignore, overwrite or merge the labels from the app builder with any existing label fragments that already exist for that module.

In this example we create two modules, based on the packages that the domain objects live in.

At this point the tool is using the domain object pattern defintions, not the generated code, so make sure that your domain patterns are current and match your code.

Running the tool

To make life easy, create a ant 'build.xml' to help automate the build process...

source/appbuilder/build.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================= -->
<!-- File: build.xml (appbuilder)                            -->
<!--                                                         -->
<!-- Description: Ant Build for generating the base app      -->
<!--                                                         -->
<!-- Author: PaulE @ 6-Apr-03                                -->
<!--                                                         -->
<!-- ======================================================= -->
<project basedir="../.." default="core" name="Qualcomm">
    <property environment="env"/>
    <property file="./build/Sample.ant.properties"/>
    <!-- ======================================================= -->
    <!-- ClassPath containing all the jars in the lib folder     -->
    <!-- and the Java libraries                                  -->
    <!-- ======================================================= -->
    <path id="project.class.path">
        <fileset dir="${project.lib}">
            <include name="**/*.jar"/>
            <include name="**/*.zip"/>
        </fileset>
        <fileset dir="${jaffa.lib}">
            <include name="**/*.jar"/>
            <include name="**/*.zip"/>
        </fileset>
        <fileset dir="${jaffa.lib.ext}">
            <include name="**/*.jar"/>
            <include name="**/*.zip"/>
        </fileset>
        <fileset dir="${java.home}/lib">
            <include name="**/*.jar"/>
            <include name="**/*.zip"/>
        </fileset>
    </path>
    <!-- ======================================================= -->
    <!-- Clean up various files and directories.                 -->
    <!-- ======================================================= -->
    <target name="clean">
        <delete dir="${dist}" quiet="true"/>
    </target>
    <!-- ============================================================ -->
    <!-- Use AppBuilder to generate Component Meta Data               -->
    <!-- ============================================================ -->
    <target name="generate-app">
        <!-- Now merge the fragment files into the temporary file -->
        <java classname="org.jaffa.tools.patternmetaengine.AppBuilder" failonerror="true" fork="yes">
            <classpath refid="project.class.path"/>
            <!-- 1) The location of the AppBuilder XML File -->
            <arg value="${basedir}/source/appbuilder/AppBuilder.xml"/>
        </java>
    </target>
    <!-- ============================================================ -->
    <!-- Genrate Code From Patterns                                   -->
    <!-- ============================================================ -->
    <target name="generate-code">
        <!--
            NOTE: If you want the JSP's regenerated, delete them first as
                  most patterns won't overwrite or merge a JSP file
        -->
   <ant
       antfile="${src.java}/resources/tools/patternengine/main.xml"
       target="core"
       inheritAll="false"
   />
    </target>
    <!-- ============================================================ -->
    <!-- Build WAR file for Full Application                          -->
    <!-- ============================================================ -->
    <target name="build-war">
   <ant
       antfile="${basedir}/build/build.xml"
       target="war"
       inheritAll="false"
   />
    </target>
    <!-- ============================================================ -->
    <!-- Deploy Application                                           -->
    <!-- ============================================================ -->
    <target name="deploy">
   <ant
       antfile="${basedir}/build/build.xml"
       target="deployTomcat"
       inheritAll="false"
   />
    </target>
    <!-- ============================================================ -->
    <!-- Do a test app build -> generate -> compile -> assemble       -->
    <!-- ============================================================ -->
    <target name="test">
   <antcall target="generate-app"/>
   <antcall target="generate-code"/>
   <antcall target="build-war"/>
   <antcall target="deploy"/>
    </target>
    <!-- ============================================================ -->
    <!-- Core                                                         -->
    <!-- ============================================================ -->
    <target name="core">
    </target>
</project>

NOTE: This makes some assumptions about a related 'build.xml' in the /build folder with two targets called 'build-war' and deployTomcat'

It also uses Sample.ant.properties which looks like...

build/Sample.ant.properties
appname=MyApp
project=${basedir}
project.lib=${project}/lib
project.build=${project}/build
project.docs=${project}/docs
jaffa.lib=${project.lib}/jaffa
jaffa.lib.ext=${project.lib}/jaffaext
src=${project}/source
src.java=${src}/java
src.html=${src}/html
src.sql=${src}/sql
dist=${project}/dist
dist.javadoc=${dist}/javadoc
dist.classes=${dist}/classes
dist.classpath=${dist.classes}
dist.html=${dist}/html
dist.jar=${dist}/jar
dist.war=${dist}/war
dist.temp=${dist}/temp
dist.tomcat.stop.sleep=1
cvs.excludes=.nbattrs,CVS

To execute the generation of all the XML descriptors for the components needed for each domain object execute the target 'genrate-app' in /source/appbuilder/build.xml

If you need to apply any customizations to these XML patterns, do so at this point.

Now to generate the real source code execute the target 'generate-code' in /source/appbuilder/build.xml This assumes that you have a set of ant build scripts in your /source/java/resources/tools/patternengine/ folder. The initial script is 'main.xml' which calls the related 'execute*.xml' scripts. An example set of this scripts can be found in the sample application.


File: index.html, Last Modified: Tue Jul 1 2003 at 3:52:50pm. This site has been built using PPWIZARD