JBoss Community Archive (Read Only)

Teiid 8.12

Archetype Template Translator Project

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.

The project will be created as an independent project and has no parent maven dependencies. It's designed to be built independent of building Teiid.

You have 2 options for creating a translator project; in Eclipse by creating a new maven project from the arche type or by using the command line to generate the project.

Create Project in Eclipse

To create a Java project in Eclipse from an arche type, perform the following:

  • Open the JAVA perspective

  • From the menu select File --> New ---> Other

  • In the tree, expand Maven and select Maven Project, press Next

  • On the "Select project name and Location" window, you can accept the defaults, press Next

  • On the "Select an Archetype" window, select Configure button

  • Add the remote catalog: https://repository.jboss.org/nexus/content/repositories/releases/ then click OK to return

  • Enter "teiid" in the filter to see the Teiid arche types.

  • Select the translator-archetype v8.7.1, then press Next

  • Enter all the information (i.e., Group ID, Artifact ID, etc.) needed to generate the project, then click Finish

The project will be created and name according to the ArtifactID.

Create Project using Command Line

To create a custom translator project from the command line, you can use the following template command:

mvn archetype:generate                                 \
  -DarchethypeRepository=https://repository.jboss.org/nexus/content/repositories/releases/   \
  -DarchetypeGroupId=org.jboss.teiid.arche-types               \
  -DarchetypeArtifactId=translator-archetype          \
  -DarchetypeVersion=8.12.0               \
  -DgroupId=${groupId}   				\
  -DartifactId=translator-${translator-type}	\
  -Dpackage=org.teiid.translator.${translator-type}    \
  -Dversion=${version}    \
  -Dtranslator-type=${translator-type}   \
  -Dtranslator-name=${transaltor-name}  \


  -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		-  (user defined) the version that the new connector project pom.xml will be
  -Dtranslator-type	-  (user defined) the translator type that's used by Teiid when mapping the physical source to the translator to use 
  -Dtranslator-name	-  (user defined) the translator name thats used for prefixing the java class names
  -Dteiid-version       -  the Teiid version the translator will depend upon

The following is an example to execute:

mvn archetype:generate                                  \
  -DarchethypeRepository=https://repository.jboss.org/nexus/content/repositories/releases/   \
  -DarchetypeGroupId=org.jboss.teiid.arche-types               \
  -DarchetypeArtifactId=translator-archetype          \
  -DarchetypeVersion=8.12.0   	\
  -DgroupId=org.jboss.teiid.connector  	\
  -DartifactId=translator-myType	\
  -Dpackage=org.teiid.translator.myType    \
  -Dversion=0.0.1-SNAPSHOT	\
  -Dtranslator-type=mytype  \
  -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: 0.0.1-SNAPSHOT
package: org.teiid.translator.myType
teiid-version: 8.12.0.Final
translator-type: 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.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 12:25:38 UTC, last content change 2015-11-23 21:43:11 UTC.