Tapestry template application

Created: 04-Mar-2004

Tool purpose: an utility to startup projects in a simple
way avoiding all the copy-paste operations and initial frustration.
This can also be used to begin a project that requires new tehnologies,
allowing anyone to start with a working project that only requries
modifications instead of trying to put everything together.

Basic description: this is a very simple tool, it requires
one jar file containing the project template, a property file and
based on them it generates the project structure into the destination
dir. The project template jar contains template files that will be
parsed and translated with Velocity into the destination directory.

Usage:

  1. download the pbase.zip archive into
    a pbase directory. Note: if you experience download problems (I have a rather limited bandwidth) you should try the pbase_nojars.zip (20k) instead. You will need to add the velocity-dep-1.3.1.jar into the lib directory to run the tool and the jars in the lib/jars file for the Tapestry example.
  2. modify the build.properties, build.xml and pbase.properties
    with your particular configuration according to the documentation
    bellow.
  3. run ant pbasegen.
  4. go to the destination directory and perform project specific
    work.

Example project: currently the template that comes with pbase
tool is a Jakarta Tapestry base project with Hibernate support
ready to be deployed in a Jakarta Tomcat container:

  • Edit the build.properties file: ``` #destination dir full path. This is where the new project will be created

    pbase.dest.dir = /home/len/projects/test





    #application package directory without leading “/”, it will be relative to the src directory.

    #This directory is the base package for the new project, it will be created in src as base

    #package, it will contain the files from the src/package template archive dir.

    pbase.base.package.dir = ro/nit/medlab





    #pbase.properties files

    pbase.properties = pbase.properties
  • Edit the pbase.properties file. This file contains properties
    that will be used for the template project generation. For the
    Tapestry template provided the following variables are included: ``` #app specific

    #app name

    app.name=MedLab

    #package

    package=ro.nit.medlab

    #servlet name and Tomcat context

    servlet.name=medlab



    #these will go the the hibernate.cfg.xml

    hibernate.dialect=net.sf.hibernate.dialect.OracleDialect

    hibernate.driver=oracle.jdbc.driver.OracleDriver

    hibernate.url=jdbc:oracle:thin:@10.0.0.8:1521:ORC

    hibernate.user=scott

    hibernate.pass=tiger



    #pbase specific, same as for build.properties configuration file

    pbase.dest.dir=/home/len/projects/mediclim/medlab

    pbase.base.package.dir=ro/nit/medlab

    #file extensions to exclude. These files are not going to be considered

    #template files, but only binary resources for the new projects

    pbase.excludes=jar class

  • Run ant pbasegen.
  • Change to the directory where everything was generated.
  • Modify build.properties with the tomcat destination directory.
  • Run ant, this will compile and deploy the project to
    the ${tomcat.dir}/webapps/${app.name.toLowerCase()}
  • Access your application at http://your_ip:tomcat_port/${app.name.toLowerCase()}

Create new or modify the template files: pbase will add all
x.y properties to the velocity context as the x_y variable
so you can use this mechanism for basic operations. For more complex
operations take a look at the ro.nit.pbase package in the src directory.
It is rather simple :)

Warning: this is in very alpha
stage so use this at your own risk. Please take a look on the sources
or in the template archive to understand in detail how everything
is working.