Jostraca is Sponsored By:






 
    The Jostraca Code Generator

  BuildResource 01
 

This design note is also available as a PDF and a Star/OpenOffice document.

PDF WRITER, Job 2
Jostraca Design Note:
BuildResource
Version:
1
Author:
Richard Rodger
To improve performance, templates should only be recompiled when necessary. The
template should be recompiled only if any of the files used to construct the template
CodeWriter have changed. It also includes the case where the CodeWriter must itself be
compiled. In this case the compiled CodeWriter could be independently out of date with
respect to the CodeWriter source, so that the CodeWriter needs recompiling.
The execution of the CodeWriter is a different matter, depending on whether template
specific data model files have changed. This is not addressed here. Suggestion: each
generation event has a set of actions (compile template, execute template, other?), each
of which has a BuildResource.
A BuildResource describes an external resource, such as a file, which has the boolean
property "Uptodate". If any resource is not uptodate, the compile event is triggered. How
the value of uptodate is determined is left to the type of resource. BuildResources will
however need additional data to function. For example, to check the CodeWriter source
code last modified date against the template last modified date. This data (or how to get it
using File objects) is provided to the BuildResource when it is created.
BuildResources can be composed into trees. A BuildResource is thus uptodate when all of
its children are uptodate, and it itself is uptodate. The set of dependencies for an action be
be constructed from a root BuildResource which contains all the actual BuildResources or
sets of BuildResources needed to perform the action.
A BuildResource has the following interface:
public boolean uptodate();
public void add( BuildResource );
public void toString();
(the toString is required for debugging)
Example: FileBuildResource has two File fields: earlier and later. If earlier and later
are not in the correct relation (earlier should have an earlier modification
date than later), then uptodate is false. In the case where either of the files do
not exist, then at user option, uptodate is false
UML:
BuildResource
FileBuildResource

home |  download |  documentation |  resources  |  contact |  SourceForge Logo  |  Copyright © 2000-2002 Richard Rodger. Site License.