JPlate
Framework/Template Engine
Objective
The JPlate Framework is a framework/toolkit
designed to
make building
solutions in Java easier. Ideally it will provide the
"plumbing" by which constructing solutions (for instance applications)
will be simplified. To facilitate this simplicity, a template
engine has been included that allows one to write java code without
consideration for data/object types being used at that time (think of
this as defining the algorithm now, providing the types later).
Framework Source Code
This section describes the source code,
its structure and how to build.
Download Source
To work with the JPlate framework
source the following is required:
- Download the JPlate framework source -
preferably the latest version.
- Copy the JPlate framework source bz2 file to the "home" directory
where the JPlate framework source will "live."
- bunzip2 <JPlate framework source file>.tar.bz2
- tar xvf <JPlate framework source file>.tar
The next section describes the directory
structure.
Top
Directory Structure
The following represents the core
directory structure:
- jplate/framework:
the "home" directory of the framework.
- jplate/framework/src:
contains all the source code.
- jplate/framework/bin:
contains any executable functionality - for instance the Ant build
script.
During building/compilation, the
following directory structure is
generated:
- jplate/framework/build:
generated by the build script and is the "home" location for all builds.
- jplate/framework/build/generated:
"home" location for generating classes, javacc, etc.
- jplate/framework/build/generated/classes:
compiled java source (class files)
- jplate/framework/build/generated/javacc:
generated javacc source
- jplate/framework/build/generated/javadoc:
generated java documentation
- jplate/framework/build/generated/jplate:
generated JPlate files.
- jplate/framework/build/deploy:
jar, and tar/bzip2 files usable for deployment of the framework.
Building
The build script (jplate/framework/bin/build.xml) supports the
following targets:
- all: generates
source, compile, build documentation and create deployment files.
- clean: removes the
directory jplate/framework/build.
- compile: generates
source and compiles.
- doc: generates
source, compiles and generated documentation.
- generate-javacc:
generates java source from javacc files.
- generate-src:
generates all source.
- help: displays help.
- jar: generates java
source, compiles and jars class files.
- java-doc: generates
source, compiles and generates java documentation.
- print-env: dumps
the variables used by the build script.
- tar: generates
source, compiles, generates java documentation, and tar/bzip2
documentation/source.
- tar-java-doc:
generates source, compiles, generates java documentation and tar/bzip2
documentation.
- tar-src: tar/bzip2
the source.
Please
note: to
build the framework,
Ant
and
Javacc
are required.
Top
Required Properties
There are two required properties depending upon how one builds:
- JAVACC_HOME: this
is mandatory regardless of build. It must point to the "home"
location where Javacc is
installed.
- JPLATE_FRAMEWORK_VERSION:
if using the default (all target), this property is mandatory.
The
value of this property will be used when building deployment
files.
Assuming the aforementioned property has the value 1.1, the bz2 file
name generated for the framework source will be jplate-framework-1.1-src.tar.bz2.
Property File
As a convenience, the build script looks for the property file jplate-framework.properties in the
user's home directory in a directory named .jplate (as in "dot jplate").
This file can be used to define the aforementioned properties as well
as set additional properties that affect the build. For instance,
one can define the java compiler that should be used.
The following example illustrates the
contents of a
jplate-framework.properties
file:
build.compiler
= jikes
JAVACC_HOME
= /home/tools/javacc/LATEST
JPLATE_FRAMEWORK_VERSION = 1.1
Template Engine
Miscellaneous
Online Java Documentation
The following links provide online
copies of the JPlate Framework java documentation:
VIM
Editing JPlate Template Files
The editor used to build the framework
is
VIM (Vi IMproved) (
please note that this editor is
not required).
As the
JPlate template files contain java code, the following represents the
contents of
filetype.vim
that will enable java
syntax highlighting (assuming syntax is on):
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
au! BufRead,BufNewFile
*.jp setfiletype java
augroup END
Please note: filetype.vim needs to be located
in the user's home directory in a directory named .vim (as in "dot
vim").
Top
Links
Source Forge
Project
Source
tree
