This guide contains information for developers creating custom solutions with Teiid. It covers creating JEE JCA connectors with the Teiid framework, Teiid Translators, Teiid User Defined Functions (UDFs) as well as related topics.
Integrating data from a Enterprise Information System (EIS) into Teiid, is separated into two parts.
A Translator, which is required.
An optional Resource Adapter, which will typically be a JCA Resource Adapter (also called a JEE Connector)
A Translator is used to:
Translate a Teiid-specific command into a native command
Execute the command
Return batches of results translated to expected Teiid types.
A Resource Adapter is used to:
Handles all communications with individual enterprise information system (EIS), which can include databases, data feeds, flat files, etc.
Can be a JCA Connector or any other custom connection provider. The reason Teiid recommends and uses JCA is this specification defines how one can write, package, and configure access to EIS system in consistent manner. There are also various commercial/open source software vendors already providing JCA Connectors to access a variety of back-end systems.
Refer to http://java.sun.com/j2ee/connector/.
Abstracts Translators from many common concerns, such as connection information, resource pooling, or authentication.
Given a combination of a Translator + Resource Adapter, one can connect any EIS system to Teiid for their data integration needs.
Teiid provides several translators for common enterprise information system types. If you can use one of these enterprise information systems, you do not need to develop a custom one.
Teiid offers numerous built-in translators, including:
JDBC Translator
Works with many relational databases. The JDBC translator is validated against the following database systems: Oracle, Microsoft SQL Server, IBM DB2, MySQL, Postgres, Derby, Sybase, H2, and HSQL. In addition, the JDBC Translator can often be used with other 3rd-party drivers and provides a wide range of extensibility options to specialize behavior against those drivers.
File Translator
Provides a procedural way to access the file system to handle text files.
WS Translator
Provides procedural access to XML content using Web Services.
LDAP Translator
Accesses to LDAP directory services.
Salesforce Translator
Works with Salesforce interfaces.
Below are the high-level steps for creating custom Translators. This guide covers how to do each of these steps in detail. It also provides additional information for advanced topics, such as streaming large objects.
For sample Translator code, refer to the Teiid source code at http://anonsvn.jboss.org/repos/teiid/trunk/connectors/.
Create a new or reuse an existing Resource Adapter for the EIS system, to be used with this Translator.
Refer to Custom Resource Adapters.
Implement the required classes defined by the Translator API.
Create an ExecutionFactory – Extend the org.teiid.translator.ExecutionFactory class
Create relevant Executions (and sub-interfaces) – specifies how to execute each type of command
Refer to Translator Development.
Define the template for exposing configuration properties. Refer to Packaging.
Deploy your Translator. Refer to Deployment.
Deploy a Virtual Database (VDB) that uses your Translator.
Execute queries via Teiid.
As mentioned above, for every Translator that needs to gather data from external source systems, it requires a resource adapter.
The following resource adapters are available to Teiid.
DataSource: This is provided by the JBoss AS container. This is used by the JDBC Translator.
File: Provides a JEE JCA based Connector to access defined directory on the file system. This is used by the File Translator
WS: Provides JEE JCA Connector to invoke Web Services using JBoss Web services stack. This is used by the WS Translator
LDAP: Provides JEE JCA connector to access LDAP; Used by the LDAP Translator.
Salesforce: Provides JEE JCA connector to access Salesforce by invoking their Web Service interface. Used by the SalesForce Translator.
High-level Resource Adapter development procedure:
Understand the JEE Connector specification to have basic idea about what JCA connectors are how they are developed and packaged.
Refer to http://java.sun.com/j2ee/connector/.
Gather all necessary information about your Enterprise Information System (EIS). You will need to know:
API for accessing the system
Configuration and connection information for the system
Expectation for incoming queries/metadata
The processing constructs, or capabilities, supported by information system.
Required properties for the connection, such as URL, user name, etc.
Base classes for all of the required supporting JCA SPI classes are provided by the Teiid API. The JCA CCI support is not provided from Teiid, since Teiid uses the Translator API as it's common client interface. You will want to extend:
BasicConnectionFactory – Defines the Connection Factory
BasicConnection – represents a connection to the source.
BasicResourceAdapter – Specifies the resource adapter class
Package your resource adapter. Refer to Build and Package the Adapter.
Deploy your resource adapter. Refer to Build and Package the Adapter.
This guide covers how to do each of these steps in detail. It also provides additional information for advanced topics, such as transactions. For sample resource adapter code refer to the Teiid Source code at http://anonsvn.jboss.org/repos/teiid/trunk/connectors/.
Teiid is highly extensible in other ways:
You may add User Defined Functions. Refer to User Defined Functions.
You may adapt logging to your needs, which is especially useful for custom audit or command logging. Refer to Custom Logging.
You may change the subsystem for custom authentication and authorization. Refer to Login Modules#Custom Login Modules.