org.exolab.castor.dtx

Class 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.1.1.1 $ $Date: 2003/03/03 07:08:05 $
Author:
Evan Prodromou

Field Summary

protected HashMap
_classMappings
protected Connection
_conn
protected Database
_database
protected String
_databaseURL
protected PersistenceFactory
_factory
protected DocumentHandler
_handler
protected PrintWriter
_logWriter
protected Schema
_schema
protected String
_schemaURL

Constructor Summary

DTXEngine()
Default constructor.
DTXEngine(String databaseURL, String schemaURL)
Construct a DTXEngine for the given JDO mapping file and XML schema.

Method Summary

(package private) ClassMapping
getClassMapping(String className)
(package private) Connection
getConnection()
(package private) Database
getDatabase()
(package private) PersistenceFactory
getFactory()
(package private) Schema
getSchema()
DTXQuery
prepareQuery(String oql)
Prepare a new DTXQuery object, given an OQL string.
void
setDatabase(String databaseURL)
Sets the database options from a JDO database mapping file.
void
setDocumentHandler(DocumentHandler handler)
Sets the default SAX document handler for this DTX engine.
void
setLogWriter(PrintWriter logWriter)
Sets the log writer for this DTX engine.
void
setSchema(String schemaURL)
Sets the XML Schema to use.

Field Details

_classMappings

protected HashMap _classMappings

_conn

protected Connection _conn

_database

protected Database _database

_databaseURL

protected String _databaseURL

_factory

protected PersistenceFactory _factory

_handler

protected DocumentHandler _handler

_logWriter

protected PrintWriter _logWriter

_schema

protected Schema _schema

_schemaURL

protected String _schemaURL

Constructor Details

DTXEngine

public DTXEngine()
Default constructor.

DTXEngine

public DTXEngine(String databaseURL,
                 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.

Method Details

getClassMapping

(package private)  ClassMapping getClassMapping(String className)

getConnection

(package private)  Connection getConnection()
            throws DTXException

getDatabase

(package private)  Database getDatabase()

getFactory

(package private)  PersistenceFactory getFactory()

getSchema

(package private)  Schema getSchema()

prepareQuery

public DTXQuery prepareQuery(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.

setDatabase

public void setDatabase(String databaseURL)
            throws DTXException
Sets the database options from a JDO database mapping file.
Parameters:
databaseURL - URL string for JDO database mapping file.

setDocumentHandler

public void setDocumentHandler(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.

setLogWriter

public void setLogWriter(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.

setSchema

public void setSchema(String schemaURL)
            throws DTXException
Sets the XML Schema to use. Parses and prepares the Schema.
Parameters:
schemaURL - URL string for XML Schema file.

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