<html>
<head>
<base href="https://docs.jboss.org/author">
<link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&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/Object+Translator">Object Translator</a></h2>
<h4>Page <b>edited</b> by <a href="https://docs.jboss.org/author/display/~shawkins">Steven Hawkins</a>
</h4>
<br/>
<h4>Changes (23)</h4>
<div id="page-diffs">
<table class="diff" cellpadding="0" cellspacing="0">
<tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">h1. {color:#000000}{*}Object Translator{*}{color} <br></td></tr>
<tr><td class="diff-added-lines" style="background-color: #dfd;">h1. {*}Object Translator{*} <br></td></tr>
<tr><td class="diff-unchanged" > <br></td></tr>
<tr><td class="diff-changed-lines" ><span class="diff-changed-words"><span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}</span>The</span> Object translator is a bridge for reading java objects from external sources (i.e., Infinispan Cache or Map cache) and delivering them to the engine for processing. &nbsp;And to assist in providing that bridge, the <span class="diff-changed-words"><span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span>[OBJECTTABLE]&nbsp;function</span> must be used to transform the java object into rows and columns. &nbsp;&nbsp; <br></td></tr>
<tr><td class="diff-unchanged" > <br></td></tr>
<tr><td class="diff-changed-lines" ><span class="diff-changed-words"><span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}</span>The</span> following are the translator types and their respective supported data <span class="diff-changed-words">source:<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span></span> <br></td></tr>
<tr><td class="diff-unchanged" >* _infinispan-cache_&nbsp;\- supports Infinispan cache and using either Key searching (for non-annotated objects) or Hibernate/Lucene searching <br>* _map-cache_&nbsp;\- supports a local cache that is of type Map and using Key searching <br> <br></td></tr>
<tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}{*}Execution Properties&nbsp;\- infinispan-cache{*}{color} <br>|| {color:#000000}Name{color} || {color:#000000}Description{color} || {color:#333333}Required{color} || {color:#000000}Default{color} || <br></td></tr>
<tr><td class="diff-added-lines" style="background-color: #dfd;">{*}Execution Properties&nbsp;\- infinispan-cache{*} <br>|| Name || Description || Required || Default || <br></td></tr>
<tr><td class="diff-changed-lines" >| <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}SupportsLuceneSearching{color}</span> <span class="diff-added-words"style="background-color: #dfd;">SupportsLuceneSearching</span> | <span class="diff-changed-words"><span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}</span>Setting</span> to true assumes your objects are annotated and Hibernate/Lucene will be used to search the <span class="diff-changed-words">cache<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span></span> | <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}N{color}</span> <span class="diff-added-words"style="background-color: #dfd;">N</span> | <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}false{color}</span> <span class="diff-added-words"style="background-color: #dfd;">false</span> | <br></td></tr>
<tr><td class="diff-unchanged" > <br></td></tr>
<tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">h3. {color:#000000}{*}Supported Capabilities{*}{color} <br></td></tr>
<tr><td class="diff-added-lines" style="background-color: #dfd;">h3. {*}Supported Capabilities{*} <br></td></tr>
<tr><td class="diff-unchanged" > <br></td></tr>
<tr><td class="diff-changed-lines" ><span class="diff-changed-words"><span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}</span>The</span> following are the connector capabilities when Key Searching is <span class="diff-changed-words">used:<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span></span> <br></td></tr>
<tr><td class="diff-unchanged" >* SELECT command <br>* CompareCriteria - only EQ <br>* InCriteria <br> <br></td></tr>
<tr><td class="diff-changed-lines" ><span class="diff-changed-words"><span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}</span>The</span> following are the connector capabilities when Hibernate/Lucene Searching is <span class="diff-changed-words">enabled:<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span></span> <br></td></tr>
<tr><td class="diff-unchanged" >* SELECT command <br>* CompareCriteria - EQ, NE, LT, GT, etc. <br></td></tr>
<tr><td class="diff-snipped" >...<br></td></tr>
<tr><td class="diff-unchanged" >* OrCriteria <br> <br></td></tr>
<tr><td class="diff-changed-lines" >h3. <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#000000}{*}Usage{*}{color}</span> <span class="diff-added-words"style="background-color: #dfd;">{*}Usage{*}</span> <br></td></tr>
<tr><td class="diff-unchanged" > <br></td></tr>
<tr><td class="diff-changed-lines" ><span class="diff-changed-words"><span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}</span>Retrieve</span> objects from a cache and transform into rows and <span class="diff-changed-words">columns.<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span></span> <br></td></tr>
<tr><td class="diff-unchanged" >* The primary object returned by the cache should have a name in source of 'this'.&nbsp; All other columns will have their name in source (which defaults to the column name) interpreted as the path to the column value from the primary object. <br>* All columns that are not the primary key nor covered by a lucene index should be marked as SEARCHABLE 'Unsearchable'. <br></td></tr>
<tr><td class="diff-added-lines" style="background-color: #dfd;">* Dynamic VDBs using metadata import will automatically determine a phsyical table for each root object and will have each top level member represented as a column. <br></td></tr>
<tr><td class="diff-unchanged" > <br></td></tr>
<tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}The following is an example of a key search. It uses a dynamic vdb to define the physical source and views using DDL. &nbsp; It uses a TeamObject class, shown below, with a teamName field that is used as its cache key and a String list of players.&nbsp;{color} <br></td></tr>
<tr><td class="diff-added-lines" style="background-color: #dfd;">The following is an example of a key search and a view that associated player names with their team. It uses a dynamic vdb to define the physical source and views using DDL. &nbsp; It uses a TeamObject class, shown below, with a teamName field that is used as its cache key and a String list of players.&nbsp; <br></td></tr>
<tr><td class="diff-unchanged" >{code:java} <br>public class TeamObject { <br></td></tr>
<tr><td class="diff-snipped" >...<br></td></tr>
<tr><td class="diff-unchanged" >} <br>{code} <br></td></tr>
<tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}Notice the use of the {color}{color:#005e8f}\[{color}{color:#005e8f}OBJECTABLE{color}\|TEIID:OBJECTABLE\]&nbsp;function to parse the object from Team and transform into rows and column. This metadata could also be defined by using Teiid Designer.&nbsp;&nbsp; <br></td></tr>
<tr><td class="diff-added-lines" style="background-color: #dfd;"> <br>Note that by just using a dynamic vdb native import logic will provide you with a TeamObject physical table. An equivalent Team table is shown here for demonstration purposes. <br> <br></td></tr>
<tr><td class="diff-unchanged" >{code:xml} <br><vdb name="team" version="1"> <br></td></tr>
<tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;"> </span> <property name="UseConnectorMetadata" value="cached" /> <br></td></tr>
<tr><td class="diff-unchanged" > <model name="Team" visible="false"> <br> <source name="objsource" translator-name="infinispan1" connection-jndi-name="java:infinispan-jndi"/> <br></td></tr>
<tr><td class="diff-snipped" >...<br></td></tr>
<tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
<tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">h3. {color:#000000}{*}JCA Resource Adapter{*}{color} <br></td></tr>
<tr><td class="diff-added-lines" style="background-color: #dfd;">Notice the use of the [OBJECTABLE|TEIID:OBJECTABLE]&nbsp;function to parse the object from Team and transform into rows and column. This metadata could also be defined by using Teiid Designer.&nbsp; <br></td></tr>
<tr><td class="diff-unchanged" > <br></td></tr>
<tr><td class="diff-added-lines" style="background-color: #dfd;">h3. {*}JCA Resource Adapter{*} <br> <br></td></tr>
<tr><td class="diff-changed-lines" ><span class="diff-changed-words"><span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color:#333333}</span>See</span> the Infinispan resource adapter for this translator. &nbsp; It can be configured to lookup the cache container via JNDI or created (i.e., ConfigurationFileName or <span class="diff-changed-words">RemoteServerList).&nbsp;<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">{color}</span></span> <br></td></tr>
</table>
</div> <h4>Full Content</h4>
<div class="notificationGreySide">
<h1><a name="ObjectTranslator-%7B%7DObjectTranslator%7B%7D"></a><b>Object Translator</b></h1>
<p>The Object translator is a bridge for reading java objects from external sources (i.e., Infinispan Cache or Map cache) and delivering them to the engine for processing. And to assist in providing that bridge, the <a href="/author/display/TEIID/OBJECTTABLE" title="OBJECTTABLE">OBJECTTABLE</a> function must be used to transform the java object into rows and columns. </p>
<p>The following are the translator types and their respective supported data source:</p>
<ul>
        <li><em>infinispan-cache</em> - supports Infinispan cache and using either Key searching (for non-annotated objects) or Hibernate/Lucene searching</li>
        <li><em>map-cache</em> - supports a local cache that is of type Map and using Key searching</li>
</ul>
<p><b>Execution Properties - infinispan-cache</b></p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Description </th>
<th class='confluenceTh'> Required </th>
<th class='confluenceTh'> Default </th>
</tr>
<tr>
<td class='confluenceTd'> SupportsLuceneSearching </td>
<td class='confluenceTd'> Setting to true assumes your objects are annotated and Hibernate/Lucene will be used to search the cache </td>
<td class='confluenceTd'> N </td>
<td class='confluenceTd'> false </td>
</tr>
</tbody></table>
</div>
<h3><a name="ObjectTranslator-%7B%7DSupportedCapabilities%7B%7D"></a><b>Supported Capabilities</b></h3>
<p>The following are the connector capabilities when Key Searching is used:</p>
<ul>
        <li>SELECT command</li>
        <li>CompareCriteria - only EQ</li>
        <li>InCriteria</li>
</ul>
<p>The following are the connector capabilities when Hibernate/Lucene Searching is enabled:</p>
<ul>
        <li>SELECT command</li>
        <li>CompareCriteria - EQ, NE, LT, GT, etc.</li>
        <li>InCriteria</li>
        <li>OrCriteria</li>
</ul>
<h3><a name="ObjectTranslator-%7B%7DUsage%7B%7D"></a><b>Usage</b></h3>
<p>Retrieve objects from a cache and transform into rows and columns.</p>
<ul>
        <li>The primary object returned by the cache should have a name in source of 'this'. All other columns will have their name in source (which defaults to the column name) interpreted as the path to the column value from the primary object.</li>
        <li>All columns that are not the primary key nor covered by a lucene index should be marked as SEARCHABLE 'Unsearchable'.</li>
        <li>Dynamic VDBs using metadata import will automatically determine a phsyical table for each root object and will have each top level member represented as a column.</li>
</ul>
<p>The following is an example of a key search and a view that associated player names with their team. It uses a dynamic vdb to define the physical source and views using DDL. It uses a TeamObject class, shown below, with a teamName field that is used as its cache key and a String list of players. </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;">
public class TeamObject {
private String teamName;
private List<String> players = new ArrayList<String>();
public String getTeamName() {
return teamName;
}
public void setTeamName(String teamName) {
         this.teamName = teamName;
}
public List<String> getPlayers() {
         return players;
}
}
</pre>
</div></div>
<p>Note that by just using a dynamic vdb native import logic will provide you with a TeamObject physical table. An equivalent Team table is shown here for demonstration purposes.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: xml; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
<vdb name="team" version="1">
<property name="UseConnectorMetadata" value="cached" />
<model name="Team" visible="false">
<source name="objsource" translator-name="infinispan1" connection-jndi-name="java:infinispan-jndi"/>
<metadata type="DDL"><![CDATA[
CREATE FOREIGN TABLE Team (
TeamObject Object OPTIONS (NAMEINSOURCE 'this', SEARCHABLE 'Unsearchable'),
teamName varchar(255) PRIMARY KEY)
OPTIONS (NAMEINSOURCE 'teams');
]]> </metadata>
</model>
<model name="TeamView" type="VIRTUAL">
<metadata type="DDL"><![CDATA[
CREATE VIEW Players (
TeamName varchar(255) PRIMARY KEY,
PlayerName varchar(255)
)
AS
SELECT t.TeamName, y.Name FROM Team as T,
OBJECTTABLE('m.players' PASSING T.TeamObject as m COLUMNS Name string 'teiid_row') as y;
]]> </metadata>
</model>
<translator name="infinispan1" type="infinispan-cache">
<property name="SupportsLuceneSearching" value="true"/>
</translator>
</vdb>
</pre>
</div></div>
<p>Notice the use of the <a href="/author/pages/createpage.action?spaceKey=TEIID&title=OBJECTABLE&linkCreation=true&fromPageId=55477048" class="createlink">OBJECTABLE</a> function to parse the object from Team and transform into rows and column. This metadata could also be defined by using Teiid Designer. </p>
<h3><a name="ObjectTranslator-%7B%7DJCAResourceAdapter%7B%7D"></a><b>JCA Resource Adapter</b></h3>
<p>See the Infinispan resource adapter for this translator. It can be configured to lookup the cache container via JNDI or created (i.e., ConfigurationFileName or RemoteServerList). </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/Object+Translator">View Online</a>
|
<a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=55477048&revisedVersion=4&originalVersion=3">View Changes</a>
|
<a href="https://docs.jboss.org/author/display/TEIID/Object+Translator?showComments=true&showCommentArea=true#addcomment">Add Comment</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>