One way to start developing a custom translator or connector is to create a project using the Teiid archetype template. The source of the archetypes can be found in github at: teiid/teiid-tools When you create a project from the template, it will contain the essential classes and resources for you to begin adding your custom logic. Additionally, the maven dependencies are defined in the pom.xml so that you can begin compiling the classes.
First will describe the translator-archetype, and below you will find the connector-archetype.
Translator-archetype
To create your custom translator project, you can run the following from the command line:
mvn archetype:generate \
-DarchetypeGroupId=org.jboss.teiid.teiid-tools.arche-types \
-DarchetypeArtifactId=translator-archetype \
-DarchetypeVersion=1
.0
.
0
\
-DgroupId=${groupId} \
-DartifactId=translator-${translator-name} \
-Dpackage=org.teiid.translator.${translator-name} \
-Dteiid-version=
8.4.0-Final
\
-Dtranslator-name=${translator-name}
Where
|
Example:
mvn archetype:generate \
-DarchetypeGroupId=org.jboss.teiid.teiid-tools.arche-types \
-DarchetypeArtifactId=translator-archetype \
-DarchetypeVersion=1
.0
.
0
\
-DgroupId=org.jboss.teiid.connectors \
-DartifactId=translator-myType \
-Dpackage=org.teiid.translator.myType \
-Dteiid-version=
8.4
.
0-Final
\
-Dtranslator-name=MyType
when executed will produce the following directory structure:
- translator-${translator-name}
| - | pom.xml | ||||||
| - | src | ||||||
|- | main | ||||||
|- | java | ||||||
|- | ${package} | ||||||
|- | ${translator-name}Execution.java | ||||||
|- | ${translator-name}ExecutionFactory.java | ||||||
|- | ${translator-name}Plugin.java | ||||||
|- | resources | ||||||
|- | ${package} | ||||||
|- | i18n.properties | ||||||
|- | META-INF | ||||||
|- | services | ||||||
|- | org.teiid.translator.ExecutionFactory | ||||||
kits |
Connector-archetype
to create your custom connector project, you can run the following from the command line:
mvn archetype:generate \
-DarchetypeGroupId=org.jboss.teiid.teiid-tools.arche-types \
-DarchetypeArtifactId=connector-archetype \
-DarchetypeVersion=
1.0
.
0
\
-DgroupId=${groupId} \
-DartifactId=connector-${connector-name} \
-Dpackage=org.teiid.resource.adapter.${connector-name} \
-Dteiid-version=
8.4
.
0-
Final \
-Dconnector-name=${connector-name} \
-Dvendor-name=${vendor-name}
Where
-DarchetypeGroupId - is the group ID
for
the arche type to use to generate
-DarchetypeArtifactId - is the artifact ID
for
the arche type to use to generate
-DarchetypeVersion - is the version
for
the arche type to use to generate
-DgroupId - (user defined) group ID
for
the
new
connector project pom.xml
-DartifactId - (user defined) artifact ID
for
the
new
connector project pom.xml
-Dpackage - (user defined) the
package
structure where the java and resource files will be created
-Dversion - (user defined) the Teiid version
for
the
new
connector project pom.xml
-Dconnector-name - (user defined) the name (type) of the
new
connector project, used to create the java
class
names and rar
-Dvendor-name - name of the Vendor
for
the data source, updates the rar
Example:
mvn archetype:generate \
-DarchetypeGroupId=org.jboss.teiid.teiid-tools.arche-types \
-DarchetypeArtifactId=connector-archetype \
-DarchetypeVersion=1
.0
.
0
\
-DgroupId=org.jboss.teiid.connectors \
-Dpackage=org.teiid.resource.adapter.myType \
-DartifactId=connector-myType \
-Dteiid-version=
8.4
.
0-Final
\
-Dconnector-name=MyType \
-Dvendor-name=MyVendor
When executed will produce the following directory structure:
- connector-${connector-name}
| - | pom.xml | ||||||
| - | src | ||||||
|- | main | ||||||
|- | java | ||||||
|- | ${package} | ||||||
|- | ${connector-name}ConnectionImpl.java | ||||||
|- | ${connector-name}ManagedConnectionFactory.java | ||||||
|- | ${connector-name}Plugin.java | ||||||
|- | rar | ||||||
|- | META-INF | ||||||
|- | ra.xml | ||||||
|- | resources | ||||||
|- | ${package} | ||||||
|- | i18n.properties | ||||||
kits |
Notes:
In this version of 8.6.0 connector-archetype, it will package the .rar- In the upcoming 8.7.0 version of the translator archetype, it will include the ability to package a zip that contains the module and translator jar that can be used to deploy (by unzipping).
This article was generated from the following discussion: Using Teiid's Translator and Connector Archetypes
Comments