Getting Started with the Pattern Generator |
This document explains the steps involved in generating an Object Finder and an Object Viewer.
It explains the setting up of the directory structure and all the required files. It will end
with the generation of a Part Finder and a Part Viewer.
Contents
- Getting Started
- IDE Setup
- Code Generation Setup
- Sample Domain Meta
- Generate Domain Classes
- Generate Object Finder and Object Viewer
- Execute
|
Getting Started |
- Create the suggested directory structure. Note: For the purpose of this exercise, ignore the 'unittest' and 'httpunittest' folders
- Create the file source/java/jdbcengine/init.xml using the sample init.xml, providing the appropriate database hostname, databasename, user, password information. Note: For the purpose of this exercise, remove the elements defined within the 'preload' element
- Create the file source/java/log4j-config.xml using the sample log4j-config.xml
- Create the file source/html/WEB-INF/web.xml using the sample web.xml
- Create the file source/html/WEB-INF/struts-config.xml using sample the struts-config.xml
- Create the file source/html/config/components.xml using the sample components.xml
- Extract jaffa-html.zip into source/html
- Copy the lib/*.jar from jaffa-src.zip into the lib folder
- Copy the deliverables jaffa.jar, jaffa-tools.jar, jaffa-html.zip into the lib folder
- Copy an appropriate jdbc implementation jar (oracle12.zip - if using the Oracle database) into the lib folder
- Copy any other supporting jars into the lib folder
- Create build/build.xml using the sample build.xml
- Create build/MyApp.ant.properties using the sample MyApp.ant.properties
|
IDE Setup |
- Mount the directory 'source/java'
- And then mount the jar files from 'lib', including jaffa-tools.jar & webmacro.jar (for code generation)
|
Code Generation Setup |
- Copy the source/java/patterns/PatternGenerator.properties from jaffa-src.zip into the source/java/patterns folder.
- Modify the value of the property 'ProjectRootDirectory' in PatternGenerator.properties to 'C:\\Sandbox\\MyProject\\source'
- Copy the source/java/patterns/WebMacro.properties from jaffa-src.zip into the source/java/patterns folder.
- Create the folders 'C:\PatternGenerator\TempMetaData' and 'C:\PatternGenerator\Logs' to support the properties in PatternGenerator.properties and WebMacro.properties
- Create the folder source/java/resources/tools/patternengine/domain_creator_1_0
- Create the folder source/java/resources/tools/patternengine/object_finder_1_0
- Create the folder source/java/resources/tools/patternengine/object_viewer_1_0
- Copy the ant scripts source/java/resources/tools/patternengine/*.xml from jaffa-src.zip into the corresponding folder
|
Sample Domain Meta |
Create the meta file source/java/resources/tools/patternengine/domain_creator_1_0/Part.xml
using the sample meta file.
This meta file is used to generate domain classes, as explained in the next section
|
Generate Domain Classes |
- Execute the ant script source/java/resources/tools/patternengine/executeDomainCreator_1_0.xml.
- Part.java, PartMeta.java and PartResources.properties will be generated in the source/java/com/example/applications/myapp/modules/catalog/domain folder
- Part.xml (mapping file) and Part.sql (create-table script) will be generated in the source/java/jdbcengine folder
Note: If using Netbeans/Forte you might see an error related to '.nbattrs'. Ignore it
|
Generate Object Finder and Object Viewer |
Steps for creating Object Finder and Object Viewer for the Part Domain object
- Create source/java/resources/tools/patternengine/object_finder_1_0/PartFinder.xml using the sample finder meta
- Create source/java/resources/tools/patternengine/object_viewer_1_0/PartViewer.xml using the sample viewer meta
- Execute the ant script source/java/resources/tools/patternengine/executeObjectFinder_1_0.xml.
- Execute the ant script source/java/resources/tools/patternengine/executeObjectViewer_1_0.xml.
- Loads of files will be generated in source/java/com/example/applications/myapp/modules/catalog/components
- Create source/java/ApplicationResource.properties using the sample ApplicationResources.properties
Note: If using Netbeans/Forte you might see an error related to '.nbattrs'. Ignore it
|
Execute |
- Create the Part table in the database using the sql script source/java/jdbcengine/Part.sql, and pre-populate it with some data
- Create source/html/index.htm using the sample index.html
- Execute the 'deploy-Tomcat4' task of the ant script build/build.xml
- Go to the URL http://localhost:8080/MyApp and click on the PartFinder... Use the logon guest/guest
Note: This assumes a Tomcat4 server running on localhost:8080. Modify the build script in case you have a different environment
|