<html>
<head>
    <base href="https://docs.jboss.org/author">
            <link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://docs.jboss.org/author/display/TEIID/Archetype+Template+Translator+Project">Archetype Template Translator Project</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://docs.jboss.org/author/display/~van.halbert">Van Halbert</a>
    </h4>
        <br/>
                         <h4>Changes (10)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-unchanged" >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.   <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">To create your custom translator project, you can run the following from the command line: <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">To create your custom translator project, you can use the following template: <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >  -DarchetypeGroupId=org.jboss.teiid.arche-types               \ <br>  -DarchetypeArtifactId=translator-archetype          \ <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-DarchetypeVersion=8.6.0</span> <span class="diff-added-words"style="background-color: #dfd;">-DarchetypeVersion=1.0.0</span>               \ <br></td></tr>
            <tr><td class="diff-unchanged" >  -DgroupId=${groupId}                                   \ <br>  -DartifactId=translator-${translator-name}        \ <br>  -Dpackage=org.teiid.translator.${translator-name}    \ <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-Dversion=8.7.0.Alpha2-SNAPSHOT</span> <span class="diff-added-words"style="background-color: #dfd;">-Dversion=${teiid-version}</span>    \ <br></td></tr>
            <tr><td class="diff-unchanged" >  -Dtranslator-name=${translator-name}    <br>{code} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >  -DartifactId                -  (user defined) artifact ID for the new translator project pom.xml <br>  -Dpackage                    -  (user defined) the package structure where the java and resource files will be created <br></td></tr>
            <tr><td class="diff-changed-lines" >-Dversion                    -  <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">(user defined)</span> the <span class="diff-added-words"style="background-color: #dfd;">Teiid</span> version for the new translator project pom.xml <span class="diff-added-words"style="background-color: #dfd;">to depend on</span> <br></td></tr>
            <tr><td class="diff-unchanged" >  -Dtranslator-name        -  (user defined) the name (type) of the new translator project, used to create the java class names <br>{code} <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">The following is an example: <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">The following is an example to execute: <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >  -DarchetypeGroupId=org.jboss.teiid.arche-types               \ <br>  -DarchetypeArtifactId=translator-archetype          \ <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-DarchetypeVersion=8.6.0</span> <span class="diff-added-words"style="background-color: #dfd;">-DarchetypeVersion=1.0.0</span>           \ <br></td></tr>
            <tr><td class="diff-unchanged" >  -DgroupId=org.jboss.teiid.connector          \ <br>  -DartifactId=translator-myType        \ <br>  -Dpackage=org.teiid.translator.myType    \ <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">-Dversion=8.7.0.Alpha2-SNAPSHOT        \</span> <span class="diff-added-words"style="background-color: #dfd;">-Dversion=8.7.0.Final        \</span> <br></td></tr>
            <tr><td class="diff-unchanged" >  -Dtranslator-name=MyType   <br>{code} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >groupId: org.jboss.teiid.connector <br>artifactId: translator-myType <br></td></tr>
            <tr><td class="diff-changed-lines" >version: <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">8.7.0.Alpha2-SNAPSHOT</span> <span class="diff-added-words"style="background-color: #dfd;">8.7.0.Final</span> <br></td></tr>
            <tr><td class="diff-unchanged" >package: org.teiid.translator.myType <br>translator-name: MyType <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>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.  </p>

<p>To create your custom translator project, you can use the following template:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
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}   
</pre>
</div></div>

<p>where:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
  -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
</pre>
</div></div>

<p>The following is an example to execute:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
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  
</pre>
</div></div>

<p>When executed, you will be asked to confirm the properties</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
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: : 
</pre>
</div></div>

<p>type Y (yes) and press enter, and the creation of the translator project will be done</p>

<p>Upon creation, a directory based on the <em><b>artifactId</b></em> will be created, that will contain the project.  'cd' into that directory and execute a test build to confirm the project was created correctly:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;"> mvn clean install</pre>
</div></div>

<p>This should build successfully, and now you are ready to start adding your custom code.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://docs.jboss.org/author/users/removespacenotification.action?spaceKey=TEIID">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://docs.jboss.org/author/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://docs.jboss.org/author/display/TEIID/Archetype+Template+Translator+Project">View Online</a>
        |
        <a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=77234286&revisedVersion=3&originalVersion=2">View Changes</a>
                |
        <a href="https://docs.jboss.org/author/display/TEIID/Archetype+Template+Translator+Project?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>