<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/Infinispan+DSL+Translator">Infinispan DSL Translator</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://docs.jboss.org/author/display/~van.halbert">Van Halbert</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <h1><a name="InfinispanDSLTranslator-%7B%7DInfinispanDSLTranslator%7B%7D"></a><b>Infinispan DSL Translator</b></h1>

<p>The Infinispan DSL Translator, known by the type <b>infinispan-cache-dsl</b>m, can read the java objects from a remote Infinispan Cache via the Hot Rod client using the Google Protobuf for serialization.  The objects will be reversed into a relational model, which can then be joined with other integrated data sources.  The benefit of this JDG design is it will enable Teiid to query the cache using DSL, which is similar to doing Lucene searching on a local cache.   </p>

<p><b>Properties</b></p>

<p>The Infinispan DSL Translator currently has no import or execution properties.  See the JCA resource adapter section below as to how to configure the cache to be queried. </p>

<h2><a name="InfinispanDSLTranslator-%7B%7DSupportedCapabilities%7B%7D"></a><b>Supported Capabilities</b></h2>

<p>The following are the connector capabilities:</p>
<ul>
        <li>Compare Criteria - EQ, NE, LT, GT, LE, GE.</li>
        <li>And/Or Criteria</li>
        <li>In Criteria</li>
        <li>Like Criteria</li>
        <li>IsNull</li>
        <li>INSERT, UPDATE, DELETE (non-transactional)<br/>
Limitations:</li>
        <li>1-to-Many, currently only supports Collection or Array, not Map's'</li>
        <li>Write transactions not supported by JDG when using Hot Rod client<br/>
To be done:</li>
        <li>support deleting containing class(s) (i.e., person --&gt; phones, delete a phone)</li>
        <li>support updating containing class(s)</li>
</ul>


<h2><a name="InfinispanDSLTranslator-%7B%7DUsage%7B%7D"></a><b>Usage</b></h2>

<p>Retrieve objects from a cache and transform into rows and columns.</p>
<ul>
        <li>Each google registered class in the cache will have a corresponding table created.</li>
        <li>The table for the root class, must have a primary key defined, which must map to an attribute in the class.</li>
        <li>The table "name in source" (NIS) will be the name of the JDG cache this table/class is stored</li>
        <li>The table columns will be created from the google protobuf definition, that corresponds to a registered class.</li>
        <li>Attributes defined as repeatable (i.e., collections, arrays, etc.) or a container class, will be supported as 1-to-* relationships, and will have corresponding registered class (if they are to be searched).</li>
        <li>A 1-to-* relationship class must have a foreign key to map to the root class/table, where the name in source for the foreign key is the name of the root class method to access those child objects.  Note, this is the class method, not a reference in the google protobuf definition.</li>
        <li>A container/child class will have attributes where the NIS contain a period.  Example:  phone.number<br/>
   This is because this maps to to google protobuf definition and what is expected to be used in the DSL query.</li>
</ul>



<p>Note that by just using a dynamic vdb, the metadata import logic will provide you with the physical table(s) that can be queried.  An example is shown here for demonstration purposes.  This also shows a container class, PhoneNumber, as an example of the foreign key that's defines the relationship.</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;">
&lt;vdb name="PeopleVDB" version="1"&gt;
    &lt;model name="People" visible="true"&gt;
        &lt;property name="importer.useFullSchemaName" value="false"/&gt;
       
        &lt;source name="infinispan-cache-dsl-connector" translator-name="infinispan-cache-dsl" connection-jndi-name="java:/infinispanRemote" /&gt;

        &lt;metadata type="DDL"&gt;&lt;![CDATA[

 CREATE FOREIGN TABLE Person (
        PersonObject object OPTIONS (NAMEINSOURCE 'this', UPDATABLE FALSE, SEARCHABLE 'Unsearchable', NATIVE_TYPE 'java.lang.Object'),
        id integer NOT NULL OPTIONS (SEARCHABLE 'Searchable', NATIVE_TYPE 'int'),
        name string OPTIONS (SEARCHABLE 'Searchable', NATIVE_TYPE 'java.lang.String'),
        email string OPTIONS (SEARCHABLE 'Searchable', NATIVE_TYPE 'java.lang.String'),
        CONSTRAINT PK_ID PRIMARY KEY(id)
) OPTIONS (NAMEINSOURCE 'PersonsCache', UPDATABLE TRUE);

CREATE FOREIGN TABLE PhoneNumber (
        number string OPTIONS (NAMEINSOURCE 'phone.number', SEARCHABLE 'Searchable', NATIVE_TYPE 'java.lang.String'),
        type string OPTIONS (NAMEINSOURCE 'phone.type', SEARCHABLE 'Searchable', NATIVE_TYPE 'java.lang.String'),
        id integer NOT NULL OPTIONS (SELECTABLE FALSE, UPDATABLE FALSE, SEARCHABLE 'Searchable', NATIVE_TYPE 'int'),
        CONSTRAINT FK_PERSON FOREIGN KEY(id) REFERENCES Person (id) OPTIONS (NAMEINSOURCE 'phones')
) OPTIONS (NAMEINSOURCE 'PersonsCache', UPDATABLE TRUE);

         ]]&gt; &lt;/metadata&gt;
    &lt;/model&gt;

&lt;/vdb&gt;
</pre>
</div></div>


<h2><a name="InfinispanDSLTranslator-%7B%7DJCAResourceAdapter%7B%7D"></a><b>JCA Resource Adapter</b></h2>

<p>See the Infinispan-DSL resource adapter for this translator. &nbsp; It can be configured to lookup the cache container via JNDI, server list, or hot rod properties..&nbsp;</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/Infinispan+DSL+Translator">View Online</a>
              |
       <a href="https://docs.jboss.org/author/display/TEIID/Infinispan+DSL+Translator?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>