org.wurbelizer
Class SourceWurbler

java.lang.Object
  extended by org.wurbelizer.AbstractWurbler
      extended by org.wurbelizer.SourceWurbler
All Implemented Interfaces:
Wurbler

public class SourceWurbler
extends AbstractWurbler

A wurblet container. Reads a source file, scans for @wurblets and sub elements and applies them. The SourceWurbler usually is invoked from within the AntWurbler but may also be invoked from the command line (for testing purposes).


Field Summary
static String WURBPROP_CLASSNAME
          property holding the java classname of the source file
static String WURBPROP_DIRNAME
          property holding the directory of the source file
static String WURBPROP_FILENAME
          property holding the absolute pathname of the source file
static String WURBPROP_GUARDNAME
          property holding the guardname of the wurblet anchor (wurblet tag)
static String WURBPROP_PACKAGENAME
          property holding the package name of the class
static String WURBPROP_WURBLETNAME
          property holding the name of the wurblet
static String WURBPROP_WURBNAME
          property holding the pathname of the *.wurb-file (additional properties), null if none
 
Fields inherited from interface org.wurbelizer.Wurbler
FILE_SOURCE_EXTENSION, PROPSPACE_ENV, PROPSPACE_EXTRA, PROPSPACE_WURBLET
 
Constructor Summary
SourceWurbler(String filename, String[] srcDirs, String[] wurbletPath, String infoDir, Logger logger, boolean verbose)
          Creates a SourceWurbler.
 
Method Summary
 File getInfoFile(String name)
          Gets an information file.
 int getInvocationCount()
          Gets the invocation count.
 void logMessage(String msg)
          Log some message.
static void main(String[] args)
           
 int wurbelize()
          Processes the source file, create here-docs and replace wurblet-guarded sections.
 
Methods inherited from class org.wurbelizer.AbstractWurbler
getArgs, getPrintStream, getProperties, getProperty, getSource, getWurblet, isFixedArgs, loadWurblet, run, setArgs, setFixedArgs, setPrintStream, setSource, setWurblet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WURBPROP_FILENAME

public static final String WURBPROP_FILENAME
property holding the absolute pathname of the source file

See Also:
Constant Field Values

WURBPROP_CLASSNAME

public static final String WURBPROP_CLASSNAME
property holding the java classname of the source file

See Also:
Constant Field Values

WURBPROP_WURBNAME

public static final String WURBPROP_WURBNAME
property holding the pathname of the *.wurb-file (additional properties), null if none

See Also:
Constant Field Values

WURBPROP_DIRNAME

public static final String WURBPROP_DIRNAME
property holding the directory of the source file

See Also:
Constant Field Values

WURBPROP_PACKAGENAME

public static final String WURBPROP_PACKAGENAME
property holding the package name of the class

See Also:
Constant Field Values

WURBPROP_GUARDNAME

public static final String WURBPROP_GUARDNAME
property holding the guardname of the wurblet anchor (wurblet tag)

See Also:
Constant Field Values

WURBPROP_WURBLETNAME

public static final String WURBPROP_WURBLETNAME
property holding the name of the wurblet

See Also:
Constant Field Values
Constructor Detail

SourceWurbler

public SourceWurbler(String filename,
                     String[] srcDirs,
                     String[] wurbletPath,
                     String infoDir,
                     Logger logger,
                     boolean verbose)
              throws IOException
Creates a SourceWurbler.

Parameters:
filename - the full pathname of the java-file
srcDirs - the source-directories (to compute the classname from filename) null if filename is in srcDirs
wurbletPath - the list of package names to load wurblets from (if wurblet name is not absolute)
infoDir - the list of directories wurblets load extra information from (usually from apt-runs)
verbose - if true logs the invocation of each wurblet an its args
logger - the logger (can also be used by the wurblets)
Throws:
IOException - if processing the file failed
Method Detail

getInvocationCount

public int getInvocationCount()
Gets the invocation count. Wurblets are invoked as long as the data changes. Some wurblets need to know how often (i.e. to allocate HeapFiles only once)

Returns:
the invocation count, starting at 1

getInfoFile

public File getInfoFile(String name)
Gets an information file. Some wurblets need extra information which is provided in files in the so-called infodir (example in ant: infodir=${apt})

Parameters:
name - the filename relative to the infodir.
Returns:
the file

logMessage

public void logMessage(String msg)
Log some message.

Parameters:
msg - the message

wurbelize

public int wurbelize()
              throws FileNotFoundException,
                     IOException,
                     SourceException
Processes the source file, create here-docs and replace wurblet-guarded sections.

Returns:
number of errors, -1 = new file written without errors, 0 = no change
Throws:
FileNotFoundException
IOException
SourceException

main

public static void main(String[] args)
Parameters:
args - the command line arguments


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de