org.exolab.castor.dtx

Class DTXEngine

public class DTXEngine extends 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: 5951 $ $Date: 2006-04-08 05:10:21 -0600 (Sat, 08 Apr 2006) $

Author: Evan Prodromou

Field Summary
protected HashMap_classMappings
protected Connection_conn
protected Database_database
protected String_databaseURL
protected PersistenceFactory_factory
protected DocumentHandler_handler
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
ClassMappinggetClassMapping(String className)
ConnectiongetConnection()
DatabasegetDatabase()
PersistenceFactorygetFactory()
SchemagetSchema()
DTXQueryprepareQuery(String oql)
Prepare a new DTXQuery object, given an OQL string.
voidsetDatabase(String databaseURL)
Sets the database options from a JDO database mapping file.
voidsetDocumentHandler(DocumentHandler handler)
Sets the default SAX document handler for this DTX engine.
voidsetSchema(String schemaURL)
Sets the XML Schema to use.

Field Detail

_classMappings

protected HashMap _classMappings

_conn

protected Connection _conn

_database

protected Database _database

_databaseURL

protected String _databaseURL

_factory

protected PersistenceFactory _factory

_handler

protected DocumentHandler _handler

_schema

protected Schema _schema

_schemaURL

protected String _schemaURL

Constructor Detail

DTXEngine

public DTXEngine()
Default constructor.

DTXEngine

public DTXEngine(String databaseURL, String schemaURL)
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 Detail

getClassMapping

ClassMapping getClassMapping(String className)

getConnection

Connection getConnection()

getDatabase

Database getDatabase()

getFactory

PersistenceFactory getFactory()

getSchema

Schema getSchema()

prepareQuery

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

setSchema

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

Parameters: schemaURL URL string for XML Schema file.

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