org.sourceforge.ifx.tools
Class CodeGenerator

java.lang.Object
  extended byorg.sourceforge.ifx.tools.CodeGenerator

public class CodeGenerator
extends java.lang.Object

CodeGenerator uses JDOM to parse the IFX Schema file and build the source code for the IFX beans under the given directory.

Version:
$Revision: 1.8 $
Author:
Sujit Pal (spal@users.sourceforge.net)

Constructor Summary
CodeGenerator()
          Default constructor.
 
Method Summary
 void buildBaseNameMap(org.jdom.Document doc, java.lang.String packageRoot)
          Builds a Map of bean names to fully qualified class names and populates a class global Map object.
static void main(java.lang.String[] argv)
          This is how we are called.
 void parseDocument(org.jdom.Document doc, java.lang.String packageRoot)
          Parses the Document object and generates the source for each of the elements in teh Document object.
 void run()
          Parses the xsd file and hands off the generation of source files to the generateSource() method.
 void setInputFileName(java.lang.String filename)
          Sets the name of the xsd file to be read to generate the beans.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeGenerator

public CodeGenerator()
Default constructor. Sets up some global variables.

Method Detail

setInputFileName

public void setInputFileName(java.lang.String filename)
Sets the name of the xsd file to be read to generate the beans. The file name should be specified relative to the current calling directory.

Parameters:
filename - the name of the xsd file to read.

run

public void run()
         throws java.lang.Exception
Parses the xsd file and hands off the generation of source files to the generateSource() method.

Throws:
java.lang.Exception - if any is thrown.

buildBaseNameMap

public void buildBaseNameMap(org.jdom.Document doc,
                             java.lang.String packageRoot)
                      throws java.lang.Exception
Builds a Map of bean names to fully qualified class names and populates a class global Map object.

Parameters:
packageRoot - the package root for this Document. This is the same as the default package root for the main document, but is offset by the namespace for the imported Document objects.
Throws:
java.lang.Exception

parseDocument

public void parseDocument(org.jdom.Document doc,
                          java.lang.String packageRoot)
                   throws java.lang.Exception
Parses the Document object and generates the source for each of the elements in teh Document object.

Parameters:
doc - the Document object to parse.
packageRoot - the package root.
Throws:
java.lang.Exception - if one is thrown.

main

public static void main(java.lang.String[] argv)
This is how we are called.

Parameters:
argv - an array of arguments, only one is needed, its the xsd file to read.