velosurf.sql
Class ConfigLoader

java.lang.Object
  extended by velosurf.sql.ConfigLoader

public class ConfigLoader
extends java.lang.Object

A configuration loader for the Database object

Author:
Claude Brisson

Field Summary
private  Database _database
           
private  boolean _needObfuscator
           
private  XIncludeResolver _xincludeResolver
           
private static java.util.regex.Pattern attributeResultSyntax
           
 
Constructor Summary
ConfigLoader(Database db)
           
ConfigLoader(Database db, XIncludeResolver xincludeResolver)
           
 
Method Summary
private  java.lang.String adaptCase(java.lang.String str)
           
private  boolean checkSyntax(java.lang.String paramName, java.lang.String paramValue, java.lang.String[] possibleValues)
          check the syntax of a parameter in the config file
private  void defineActions(org.jdom.Element parent, Entity entity)
           
private  void defineAttributes(org.jdom.Element parent, Entity entity)
           
private  void defineConstraints(org.jdom.Element element, Entity entity)
           
private  void defineEntities(org.jdom.Element database)
           
private  void defineForeignKeys(org.jdom.Element parent, Entity entity)
           
static boolean isTransaction(org.jdom.Element element)
          checks whether the action defined by this XML tree is a simple action or a transaction
 void loadConfig(java.io.InputStream config)
           
private static int parseCaching(java.lang.String caching)
          parse a caching value
private  void setDatabaseAttributes(org.jdom.Element database)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_database

private Database _database

_xincludeResolver

private XIncludeResolver _xincludeResolver

_needObfuscator

private boolean _needObfuscator

attributeResultSyntax

private static final java.util.regex.Pattern attributeResultSyntax
Constructor Detail

ConfigLoader

public ConfigLoader(Database db)

ConfigLoader

public ConfigLoader(Database db,
                    XIncludeResolver xincludeResolver)
Method Detail

loadConfig

public void loadConfig(java.io.InputStream config)
                throws java.lang.Exception
Throws:
java.lang.Exception

adaptCase

private java.lang.String adaptCase(java.lang.String str)

setDatabaseAttributes

private void setDatabaseAttributes(org.jdom.Element database)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

defineAttributes

private void defineAttributes(org.jdom.Element parent,
                              Entity entity)
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

defineForeignKeys

private void defineForeignKeys(org.jdom.Element parent,
                               Entity entity)

defineActions

private void defineActions(org.jdom.Element parent,
                           Entity entity)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException

defineEntities

private void defineEntities(org.jdom.Element database)
                     throws java.lang.Exception
Throws:
java.lang.Exception

defineConstraints

private void defineConstraints(org.jdom.Element element,
                               Entity entity)
                        throws java.lang.Exception
Throws:
java.lang.Exception

checkSyntax

private boolean checkSyntax(java.lang.String paramName,
                            java.lang.String paramValue,
                            java.lang.String[] possibleValues)
check the syntax of a parameter in the config file

Parameters:
paramName - name of the parameter
paramValue - value of the parameter
possibleValues - possible values for the parameter
Returns:
whether the syntax is correct

parseCaching

private static int parseCaching(java.lang.String caching)
parse a caching value

Parameters:
caching - string describing the type of caching
Returns:
type of caching

isTransaction

public static boolean isTransaction(org.jdom.Element element)
checks whether the action defined by this XML tree is a simple action or a transaction

Parameters:
element - XML tree defining an action
Returns:
true if the action is a transaction


~ooOoo~