info.fingo.db
Class DBTool

java.lang.Object
  extended by info.fingo.db.DBTool

public class DBTool
extends java.lang.Object

The simply object-relational mapping tool. This tool is desined to generate entities and collection on the oracle database schema base. Besides support for entities attributes it generates some helper functionality to service database relations. It generates two levels of classes: base classes - overwritten on each generation run, which have all the generated code, and extensions - initialy just empty classes, which shouldn't be overwritten, so here you may pyt all the additional logic you need. The next refactoring should change the generation process to use some external templates instead of direct printing to the result output stream.

See Also:
BaseEntity, BaseCollection

Field Summary
static java.lang.String PROPERTY_BASE_SUFFIX
          The configuration propery: the base-level classes name sufix = 'base.suffix'
static java.lang.String PROPERTY_COLLECTION_PACKAGE_NAME
          The configuration propery: the name of the package for collections = 'collection.package.name'
static java.lang.String PROPERTY_COLLECTION_SOURCE_FOLDER
          The configuration propery: the folder to generate collections = 'collection.source.folder'
static java.lang.String PROPERTY_COLLECTION_SUFFIX
          The configuration propery: the collections names suffix = 'collection.suffix'
static java.lang.String PROPERTY_DB_DRIVER
          The configuration propery: database driver class name = 'db.driver'
static java.lang.String PROPERTY_DB_PASSWORD
          The configuration propery: database driver class name = 'db.driver'
static java.lang.String PROPERTY_DB_URL
          The configuration propery: database url class name = 'db.url'
static java.lang.String PROPERTY_DB_USER
          The configuration propery: database user class name = 'db.user'
static java.lang.String PROPERTY_ENTITY_PACKAGE_NAME
          The configuration propery: the name of the package for entities = 'entity.package.name'
static java.lang.String PROPERTY_ENTITY_SOURCE_FOLDER
          The configuration propery: the folder to generate entities = 'entity.source.folder'
static java.lang.String PROPERTY_ENTITY_SUFFIX
          The configuration propery: the entities names suffix = 'entity.suffix'
static java.lang.String PROPERTY_REGENERATE_ALL
          The configuration propery: IMPORTANT!!!
static java.lang.String PROPERTY_TABLE_NAME_PATTERN
          The configuration propery: the pattern for tables to generate entities and collections = 'table.name.pattern'
static java.lang.String PROPERTY_TABLE_PREFIX_CUT
          The configuration propery: the count of first characters of entities/collections names to cut = 'table.prefix.cut'
 
Constructor Summary
DBTool(java.util.Properties props)
          Creates new instance with given configuration.
 
Method Summary
 void generate()
          Performs the entities and collections generation.
static void main(java.lang.String[] args)
          The generation start.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_DB_DRIVER

public static final java.lang.String PROPERTY_DB_DRIVER
The configuration propery: database driver class name = 'db.driver'

See Also:
Constant Field Values

PROPERTY_DB_URL

public static final java.lang.String PROPERTY_DB_URL
The configuration propery: database url class name = 'db.url'

See Also:
Constant Field Values

PROPERTY_DB_USER

public static final java.lang.String PROPERTY_DB_USER
The configuration propery: database user class name = 'db.user'

See Also:
Constant Field Values

PROPERTY_DB_PASSWORD

public static final java.lang.String PROPERTY_DB_PASSWORD
The configuration propery: database driver class name = 'db.driver'

See Also:
Constant Field Values

PROPERTY_TABLE_NAME_PATTERN

public static final java.lang.String PROPERTY_TABLE_NAME_PATTERN
The configuration propery: the pattern for tables to generate entities and collections = 'table.name.pattern'

See Also:
Constant Field Values

PROPERTY_TABLE_PREFIX_CUT

public static final java.lang.String PROPERTY_TABLE_PREFIX_CUT
The configuration propery: the count of first characters of entities/collections names to cut = 'table.prefix.cut'

See Also:
Constant Field Values

PROPERTY_ENTITY_SUFFIX

public static final java.lang.String PROPERTY_ENTITY_SUFFIX
The configuration propery: the entities names suffix = 'entity.suffix'

See Also:
Constant Field Values

PROPERTY_ENTITY_SOURCE_FOLDER

public static final java.lang.String PROPERTY_ENTITY_SOURCE_FOLDER
The configuration propery: the folder to generate entities = 'entity.source.folder'

See Also:
Constant Field Values

PROPERTY_ENTITY_PACKAGE_NAME

public static final java.lang.String PROPERTY_ENTITY_PACKAGE_NAME
The configuration propery: the name of the package for entities = 'entity.package.name'

See Also:
Constant Field Values

PROPERTY_COLLECTION_SUFFIX

public static final java.lang.String PROPERTY_COLLECTION_SUFFIX
The configuration propery: the collections names suffix = 'collection.suffix'

See Also:
Constant Field Values

PROPERTY_COLLECTION_SOURCE_FOLDER

public static final java.lang.String PROPERTY_COLLECTION_SOURCE_FOLDER
The configuration propery: the folder to generate collections = 'collection.source.folder'

See Also:
Constant Field Values

PROPERTY_COLLECTION_PACKAGE_NAME

public static final java.lang.String PROPERTY_COLLECTION_PACKAGE_NAME
The configuration propery: the name of the package for collections = 'collection.package.name'

See Also:
Constant Field Values

PROPERTY_BASE_SUFFIX

public static final java.lang.String PROPERTY_BASE_SUFFIX
The configuration propery: the base-level classes name sufix = 'base.suffix'

See Also:
Constant Field Values

PROPERTY_REGENERATE_ALL

public static final java.lang.String PROPERTY_REGENERATE_ALL
The configuration propery: IMPORTANT!!! Use this property carefully. When true all sources, including your changes in extended level, will be overwritten.

See Also:
Constant Field Values
Constructor Detail

DBTool

public DBTool(java.util.Properties props)
Creates new instance with given configuration. Supported properties are defined by the PROPERTY_XXX constants.

Parameters:
props - the configuration properties
Method Detail

main

public static void main(java.lang.String[] args)
The generation start. Each argument is considered to have key=value form. The supported keys for the arguments are PROPERTY_XXX constants.

Parameters:
args - the parameter of generation process.

generate

public void generate()
              throws java.lang.Exception
Performs the entities and collections generation.

Throws:
java.lang.Exception