org.ephman.abra.tools
Class MapToJava

java.lang.Object
  |
  +--org.ephman.abra.tools.XmlProcessor
        |
        +--org.ephman.abra.tools.MapToJava

public class MapToJava
extends XmlProcessor

read an XML file representing a Java to SQL mapping for then generate classes in the current directory (or use -outdir) ! make sure to give fully qualified class name ie com.foo.bar.database.User in the map file.. default output is current directory or use -outdir switch to turn off schema or class generation use the switch -no...

Version:
0.0.2
Author:
Paul M. Bethe

Field Summary
(package private)  java.lang.String CLASS_GENERATOR_TAG
           
(package private)  java.lang.String CLASS_IMPLEMENTS_TAG
           
protected  java.util.HashMap classTree
           
protected  java.lang.String commonMapFile
           
protected  JClass currentClass
           
protected  JField currentField
           
protected static java.lang.String facImp
           
static java.lang.String fileSeperator
           
(package private)  java.lang.String GENERATOR_TAG
           
(package private)  java.util.HashSet ignoreTags
           
protected  boolean makeClasses
           
static boolean makeFactories
           
protected  boolean makeSchema
           
static java.lang.String outdir
           
protected static java.lang.String outSchema
           
(package private)  java.lang.String PROPERTY_TAG
           
static PropertyTable propertyTable
           
protected static java.lang.String rootString
           
protected  java.lang.String toImplement
           
protected  boolean useProcs
           
static java.lang.String VERSION_STRING
           
protected static java.lang.String windowsRootString
           
 
Fields inherited from class org.ephman.abra.tools.XmlProcessor
useAbraParser
 
Constructor Summary
MapToJava(java.lang.String odir, boolean schema, boolean classes, boolean factories, boolean useAbraParser)
           
MapToJava(java.lang.String odir, boolean schema, boolean classes, boolean factories, boolean procs, boolean useAbraParser)
           
 
Method Summary
(package private)  void addGenerator(org.ephman.xml.XmlNode n, java.lang.String mapFile)
           
(package private)  void addGenerators(java.util.Vector gens, java.lang.String mapFile)
           
 void addMapFile(java.lang.String filePath)
           
protected  void applyRules(org.ephman.xml.XmlNode thisNode, java.lang.String mapName)
           
 void generateAll()
           
protected  java.lang.String getAttribute(org.ephman.xml.XmlNode thisNode, java.lang.String attrName)
           
 java.util.HashMap getClassTree()
           
 org.ephman.xml.XmlNode getOneNode(org.ephman.xml.XmlNode thisNode, java.lang.String tagToGet, java.lang.String mapName)
           
protected static boolean isTopLevelDirectory(java.lang.String fname)
           
static void main(java.lang.String[] argv)
           
static void printHelp()
           
 
Methods inherited from class org.ephman.abra.tools.XmlProcessor
mapXMLFile, mapXMLFile, mapXMLFile, mapXMLFile, recurseOnChildList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_STRING

public static final java.lang.String VERSION_STRING
See Also:
Constant Field Values

fileSeperator

public static java.lang.String fileSeperator

rootString

protected static java.lang.String rootString

windowsRootString

protected static java.lang.String windowsRootString

makeSchema

protected boolean makeSchema

makeClasses

protected boolean makeClasses

makeFactories

public static boolean makeFactories

useProcs

protected boolean useProcs

toImplement

protected java.lang.String toImplement

commonMapFile

protected java.lang.String commonMapFile

outdir

public static java.lang.String outdir

outSchema

protected static java.lang.String outSchema

facImp

protected static java.lang.String facImp

currentClass

protected JClass currentClass

currentField

protected JField currentField

classTree

protected java.util.HashMap classTree

propertyTable

public static PropertyTable propertyTable

PROPERTY_TAG

java.lang.String PROPERTY_TAG

GENERATOR_TAG

java.lang.String GENERATOR_TAG

CLASS_IMPLEMENTS_TAG

java.lang.String CLASS_IMPLEMENTS_TAG

CLASS_GENERATOR_TAG

java.lang.String CLASS_GENERATOR_TAG

ignoreTags

java.util.HashSet ignoreTags
Constructor Detail

MapToJava

public MapToJava(java.lang.String odir,
                 boolean schema,
                 boolean classes,
                 boolean factories,
                 boolean procs,
                 boolean useAbraParser)

MapToJava

public MapToJava(java.lang.String odir,
                 boolean schema,
                 boolean classes,
                 boolean factories,
                 boolean useAbraParser)
Method Detail

isTopLevelDirectory

protected static boolean isTopLevelDirectory(java.lang.String fname)

printHelp

public static void printHelp()

main

public static void main(java.lang.String[] argv)

getClassTree

public java.util.HashMap getClassTree()

addMapFile

public void addMapFile(java.lang.String filePath)
                throws java.lang.Exception
java.lang.Exception

addGenerators

void addGenerators(java.util.Vector gens,
                   java.lang.String mapFile)
             throws SchemaException
SchemaException

addGenerator

void addGenerator(org.ephman.xml.XmlNode n,
                  java.lang.String mapFile)
            throws SchemaException
SchemaException

getAttribute

protected java.lang.String getAttribute(org.ephman.xml.XmlNode thisNode,
                                        java.lang.String attrName)

applyRules

protected void applyRules(org.ephman.xml.XmlNode thisNode,
                          java.lang.String mapName)
                   throws org.ephman.xml.XmlException,
                          java.io.IOException,
                          SchemaException
Specified by:
applyRules in class XmlProcessor
org.ephman.xml.XmlException
java.io.IOException
SchemaException

generateAll

public void generateAll()
                 throws java.io.IOException,
                        SchemaException
java.io.IOException
SchemaException

getOneNode

public org.ephman.xml.XmlNode getOneNode(org.ephman.xml.XmlNode thisNode,
                                         java.lang.String tagToGet,
                                         java.lang.String mapName)
                                  throws SchemaException
SchemaException