What's a Pentaho Metadata Dialect?
A dialect defines how Pentaho Metadata should generate SQL for a given database type.
Pentaho Metadata's Dialect Plugin System
Introduced in release 3.7 Pentaho Metadata supports additional dialects through it's Service Provider Interface (SPI): SQLDialectInterface
. A Pentaho Metadata Dialect Plugin is a jar file that consists of a dialect implementation and some configuration. The SPI enables developers to develop new database dialects which Pentaho Metadata will automatically detect and register.
Implementing SQLDialectInterface
TODO
Declaring your Dialect as a Service Provider
Pentaho Metdata utilizes the Java Service Loader API to dynamically look up dialect implementations. The ServiceLoader API requires you list all Service Provider implementations in a file named after the interface of the service they provide in the META-INF/services
directory of the jar file:
META-INF/services/org.pentaho.pms.mql.dialect.SQLDialectInterface: org.pentaho.pms.mql.dialect.SampleDBDialect
Where org.pentaho.pms.mql.dialect.SampleDialect
is the implementation of SQLDialectInterface
for our ficticious database type: SampleDB.
For more information see Jar Service Provider Packaging Notes from Oracle.
Using your dialect
All that is required is the jar file to be in the classpath. In most applications this is a /lib
directory within the application's installation directory.
Further Reading
For more general information about Java's ServiceLoader API see these links:
http://download.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html
http://java.sun.com/developer/technicalArticles/javase/extensible/index.html