One way to start developing a custom translator is to create a project using the Teiid archetype template. When the project is created from the template, it will contain the essential classes (i.e., ExecutionFactory) 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. |
To create your custom translator project, you can run the following from the command line: |
To create your custom translator project, you can use the following template: |
{code} |
... |
-DarchetypeGroupId=org.jboss.teiid.arche-types \ -DarchetypeArtifactId=translator-archetype \ |
-DarchetypeVersion=8.6.0 -DarchetypeVersion=1.0.0 \ |
-DgroupId=${groupId} \ -DartifactId=translator-${translator-name} \ -Dpackage=org.teiid.translator.${translator-name} \ |
-Dversion=8.7.0.Alpha2-SNAPSHOT -Dversion=${teiid-version} \ |
-Dtranslator-name=${translator-name} {code} |
... |
-DartifactId - (user defined) artifact ID for the new translator 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 translator project pom.xml to depend on |
-Dtranslator-name - (user defined) the name (type) of the new translator project, used to create the java class names {code} |
The following is an example: |
The following is an example to execute: |
{code} |
... |
-DarchetypeGroupId=org.jboss.teiid.arche-types \ -DarchetypeArtifactId=translator-archetype \ |
-DarchetypeVersion=8.6.0 -DarchetypeVersion=1.0.0 \ |
-DgroupId=org.jboss.teiid.connector \ -DartifactId=translator-myType \ -Dpackage=org.teiid.translator.myType \ |
-Dversion=8.7.0.Alpha2-SNAPSHOT \ -Dversion=8.7.0.Final \ |
-Dtranslator-name=MyType {code} |
... |
groupId: org.jboss.teiid.connector artifactId: translator-myType |
version: 8.7.0.Alpha2-SNAPSHOT 8.7.0.Final |
package: org.teiid.translator.myType translator-name: MyType |
... |
One way to start developing a custom translator is to create a project using the Teiid archetype template. When the project is created from the template, it will contain the essential classes (i.e., ExecutionFactory) 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.
To create your custom translator project, you can use the following template:
mvn archetype:generate \ -DarchetypeGroupId=org.jboss.teiid.arche-types \ -DarchetypeArtifactId=translator-archetype \ -DarchetypeVersion=1.0.0 \ -DgroupId=${groupId} \ -DartifactId=translator-${translator-name} \ -Dpackage=org.teiid.translator.${translator-name} \ -Dversion=${teiid-version} \ -Dtranslator-name=${translator-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 translator project pom.xml -DartifactId - (user defined) artifact ID for the new translator project pom.xml -Dpackage - (user defined) the package structure where the java and resource files will be created -Dversion - the Teiid version for the new translator project pom.xml to depend on -Dtranslator-name - (user defined) the name (type) of the new translator project, used to create the java class names
The following is an example to execute:
mvn archetype:generate \ -DarchetypeGroupId=org.jboss.teiid.arche-types \ -DarchetypeArtifactId=translator-archetype \ -DarchetypeVersion=1.0.0 \ -DgroupId=org.jboss.teiid.connector \ -DartifactId=translator-myType \ -Dpackage=org.teiid.translator.myType \ -Dversion=8.7.0.Final \ -Dtranslator-name=MyType
When executed, you will be asked to confirm the properties
Confirm properties configuration: groupId: org.jboss.teiid.connector artifactId: translator-myType version: 8.7.0.Final package: org.teiid.translator.myType translator-name: MyType Y: :
type Y (yes) and press enter, and the creation of the translator project will be done
Upon creation, a directory based on the artifactId will be created, that will contain the project. 'cd' into that directory and execute a test build to confirm the project was created correctly:
mvn clean install
This should build successfully, and now you are ready to start adding your custom code.