org.exolab.castor.dtx
Class DTXEngine

java.lang.Object
  extended by org.exolab.castor.dtx.DTXEngine

public class DTXEngine
extends java.lang.Object

An OQL query engine for hitting JDO data sources and generating SAX events. It skips the intermediate Java class step used by e.g. Castor JDO. The engine uses the SQL and XML descriptions in an XML Schema file and a Castor JDO mapping file to determine how to map results of the query into SAX events.

Version:
$Revision: 1.2 $ $Date: 2004/10/02 11:29:39 $
Author:
Evan Prodromou

Field Summary
protected  java.util.HashMap _classMappings
           
protected  java.sql.Connection _conn
           
protected  Database _database
           
protected  java.lang.String _databaseURL
           
protected  PersistenceFactory _factory
           
protected  org.xml.sax.DocumentHandler _handler
           
protected  java.io.PrintWriter _logWriter
           
protected  Schema _schema
           
protected  java.lang.String _schemaURL
           
 
Constructor Summary
DTXEngine()
          Default constructor.
DTXEngine(java.lang.String databaseURL, java.lang.String schemaURL)
          Construct a DTXEngine for the given JDO mapping file and XML schema.
 
Method Summary
(package private)  ClassMapping getClassMapping(java.lang.String className)
           
(package private)  java.sql.Connection getConnection()
           
(package private)  Database getDatabase()
           
(package private)  PersistenceFactory getFactory()
           
(package private)  Schema getSchema()
           
 DTXQuery prepareQuery(java.lang.String oql)
          Prepare a new DTXQuery object, given an OQL string.
 void setDatabase(java.lang.String databaseURL)
          Sets the database options from a JDO database mapping file.
 void setDocumentHandler(org.xml.sax.DocumentHandler handler)
          Sets the default SAX document handler for this DTX engine.
 void setLogWriter(java.io.PrintWriter logWriter)
          Sets the log writer for this DTX engine.
 void setSchema(java.lang.String schemaURL)
          Sets the XML Schema to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_handler

protected org.xml.sax.DocumentHandler _handler

_databaseURL

protected java.lang.String _databaseURL

_logWriter

protected java.io.PrintWriter _logWriter

_database

protected Database _database

_schemaURL

protected java.lang.String _schemaURL

_schema

protected Schema _schema

_classMappings

protected java.util.HashMap _classMappings

_conn

protected java.sql.Connection _conn

_factory

protected PersistenceFactory _factory
Constructor Detail

DTXEngine

public DTXEngine()
Default constructor.


DTXEngine

public DTXEngine(java.lang.String databaseURL,
                 java.lang.String schemaURL)
          throws DTXException
Construct a DTXEngine for the given JDO mapping file and XML schema.

Parameters:
databaseURL - URL string for JDO mapping file.
schemaURL - URL string for XML Schema file.
Throws:
DTXException
Method Detail

setSchema

public void setSchema(java.lang.String schemaURL)
               throws DTXException
Sets the XML Schema to use. Parses and prepares the Schema.

Parameters:
schemaURL - URL string for XML Schema file.
Throws:
DTXException

setDatabase

public void setDatabase(java.lang.String databaseURL)
                 throws DTXException
Sets the database options from a JDO database mapping file.

Parameters:
databaseURL - URL string for JDO database mapping file.
Throws:
DTXException

setLogWriter

public void setLogWriter(java.io.PrintWriter logWriter)
Sets the log writer for this DTX engine. Individual queries will use this writer by default, but it can be overwritten on a per-query basis.

Parameters:
logWriter - A PrintWriter to use for logging.

setDocumentHandler

public void setDocumentHandler(org.xml.sax.DocumentHandler handler)
Sets the default SAX document handler for this DTX engine. Individual queries will use this handler by default, but it can be overwritten on a per-query basis.

Parameters:
handler - A DocumentHandler to receive query results as SAX events.

prepareQuery

public DTXQuery prepareQuery(java.lang.String oql)
                      throws DTXException
Prepare a new DTXQuery object, given an OQL string. The syntax is currently limited only to SELECT statements that return a single object type (although multiple results will appear as multiple documents to the DocumentHandler).

Parameters:
oql - OQL string for the query.
Throws:
DTXException

getDatabase

Database getDatabase()

getSchema

Schema getSchema()

getFactory

PersistenceFactory getFactory()

getConnection

java.sql.Connection getConnection()
                            throws DTXException
Throws:
DTXException

getClassMapping

ClassMapping getClassMapping(java.lang.String className)


Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com