net.xoetrope.optional.data
Class XOptionalDataSource

java.lang.Object
  extended by net.xoetrope.data.XDataSource
      extended by net.xoetrope.optional.data.XOptionalDataSource

public class XOptionalDataSource
extends XDataSource

An extended datasource for handling databses, services and routing

Copyright: Copyright Xoetrope Ltd. (c) 2003

$Revision: 2.15 $ License: see license.txt


Nested Class Summary
static interface XOptionalDataSource.XDataReflectionConstructor
           
 
Field Summary
protected  XOptionalDataSource.XDataReflectionConstructor reflectionConstr
           
protected  XRouteManager routeMgr
           
 
Fields inherited from class net.xoetrope.data.XDataSource
currentProject
 
Constructor Summary
XOptionalDataSource(XProject project)
           
 
Method Summary
static java.lang.String checkLocalHsqldb(java.lang.ClassLoader cl, java.lang.String dbDriver, java.lang.String dbUrl)
          Check for a local database url.
protected  java.lang.String checkLocalHsqldb(java.lang.String dbDriver, java.lang.String dbUrl)
          Check for a local database url.
 java.lang.String getModelXML(XModel mdl)
          Output the model to a String and return it
 XOptionalDataSource.XDataReflectionConstructor getReflectionConstr()
          Gets the object being used to construct data sources via reflection
 void loadDatabase(XmlElement source, XModel model)
          Recursively load the model data
 void loadRoutes(XmlElement source, XModel model)
          Load the routing information
 void loadService(XmlElement source, XModel model)
          Recursively load the model data
 void read(java.io.Reader r)
          Read a model from the Reader
 void registerDatabaseNode(XmlElement source)
          Register a database source element found within the datasets.xml file
 void registerDataSource(XmlElement source)
          Register the datasource files found within the datasets.xml file
 void setReflectionConstr(XOptionalDataSource.XDataReflectionConstructor rc)
          Sets the object that is used to construct data sources via relfection.
protected  void showVisualisation()
          If the ShowVisualiser property is set to true then show the visualiser for debugging
 
Methods inherited from class net.xoetrope.data.XDataSource
loadTable, outputModel, outputModel, outputModel, read, readDataSource, setUseValueAsId, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

routeMgr

protected XRouteManager routeMgr

reflectionConstr

protected XOptionalDataSource.XDataReflectionConstructor reflectionConstr
Constructor Detail

XOptionalDataSource

public XOptionalDataSource(XProject project)
Parameters:
project - the owner project
Method Detail

getReflectionConstr

public XOptionalDataSource.XDataReflectionConstructor getReflectionConstr()
Gets the object being used to construct data sources via reflection

Returns:
XDataRelfectionConstructor object

setReflectionConstr

public void setReflectionConstr(XOptionalDataSource.XDataReflectionConstructor rc)
Sets the object that is used to construct data sources via relfection.

Parameters:
rc - the XDataRelfectionConstructor object

showVisualisation

protected void showVisualisation()
If the ShowVisualiser property is set to true then show the visualiser for debugging


read

public void read(java.io.Reader r)
Read a model from the Reader

Overrides:
read in class XDataSource
Parameters:
r - the Reader

registerDataSource

public void registerDataSource(XmlElement source)
Register the datasource files found within the datasets.xml file

Parameters:
source - The path to the discovered file

registerDatabaseNode

public void registerDatabaseNode(XmlElement source)
Register a database source element found within the datasets.xml file

Parameters:
source - The path to the database file

loadDatabase

public void loadDatabase(XmlElement source,
                         XModel model)
Recursively load the model data

Parameters:
source - the source element
model - the model for the source element

checkLocalHsqldb

protected java.lang.String checkLocalHsqldb(java.lang.String dbDriver,
                                            java.lang.String dbUrl)
Check for a local database url. For hsqldb this extracts the db files to a local directory and returns the modiefied URL

Parameters:
dbDriver - the database drivr class
dbUrl - the database url

checkLocalHsqldb

public static java.lang.String checkLocalHsqldb(java.lang.ClassLoader cl,
                                                java.lang.String dbDriver,
                                                java.lang.String dbUrl)
Check for a local database url. For hsqldb this extracts the db files to a local directory and returns the modiefied URL

Parameters:
cl - teh classloader used to try and find the database files
dbDriver - the database drivr class
dbUrl - the database url

loadService

public void loadService(XmlElement source,
                        XModel model)
Recursively load the model data

Parameters:
source - the source element
model - the model for the source element

loadRoutes

public void loadRoutes(XmlElement source,
                       XModel model)
Load the routing information

Parameters:
source - the source element
model - the model for the source element

getModelXML

public java.lang.String getModelXML(XModel mdl)
Output the model to a String and return it

Parameters:
mdl - the model to bt output
Returns:
the String representation of the model