<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+Data+Sources">Infinispan Data Sources</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 (5)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >|| Cache Type || Obtain Cache By || <br>| Local Cache | using JNDI | <br></td></tr>
            <tr><td class="diff-changed-lines" >| Local Cache | using configuration file <span class="diff-added-words"style="background-color: #dfd;">(deprecated)</span> | <br></td></tr>
            <tr><td class="diff-unchanged" >| Remote Cache | using JNDI | <br>| Remote Cache | specify 1 or more host:port&#39;s | <br>| Remote Cache | specify HotRod client properties file | <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;"> <br>{note:titleRemote Cache Searching} <br>The use of this resource adapter only provides Key Search capabilities on remote caches.  If your Infinispan/JDG remote cache has configured using Protobuffers, then it is recommended that you use the [Infinispan-DSL Data Sources] resource adapter when accessing an Infinispan/JDG remote cache. That will enable the DSL searching capabilities. <br>{note} <br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" >The following are the configuration properties that can be configured for this connector: <br>|| *Property Name* || *Req.* || *Property Template* || *Description* || <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">| CacheTypeMap | Y | cacheName:className\[;pkFieldName\]  \\ <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">\[,cacheName:className\[;pkFieldName\]..\]</span> | <span class="diff-added-words"style="background-color: #dfd;">CacheTypeMap | Y | cacheName:className\[;pkFieldName[:cacheKeyJavaType\]\]  |</span> Map the root Java Object class name to the cache, and identify which attribute is the primary key to the cache. <span class="diff-added-words"style="background-color: #dfd;"> Provide the cacheKeyJavaType when the key type is different than the pkFieldName attribute type</span> | <br></td></tr>
            <tr><td class="diff-unchanged" >| module | N | | Specify the JBoss AS module that contains the cache classes that were defined in CacheTypeMap | <br>| CacheJndiName | N | | JNDI name to fine the CacheContainer | <br>| RemoteServerList | N | host:port\[;host:port….\] | Specify the host and ports that will be clustered together to access the caches defined in CacheTypeMap | <br></td></tr>
            <tr><td class="diff-changed-lines" >| ConfigurationFileNameForLocalCache | N | | <span class="diff-added-words"style="background-color: #dfd;">(Deprecated)</span> The Infinispan Configuration xml file for configuring a local cache | <br></td></tr>
            <tr><td class="diff-unchanged" >| HotRodClientPropertiesFile | N | | The HotRod properties file for configuring a connection to a remote cache | <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="InfinispanDataSources-InfinispanDataSources"></a><b>Infinispan Data Sources</b></h1>

<p>Infinispan data sources use a Teiid specific JCA connector that is deployed into AS 7.5 (EAP 6.4 Alpha) during installation.  This connector can be configured to support the following modes of Infinispan caches:</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Cache Type </th>
<th class='confluenceTh'> Obtain Cache By </th>
</tr>
<tr>
<td class='confluenceTd'> Local Cache </td>
<td class='confluenceTd'> using JNDI </td>
</tr>
<tr>
<td class='confluenceTd'> Local Cache </td>
<td class='confluenceTd'> using configuration file (deprecated) </td>
</tr>
<tr>
<td class='confluenceTd'> Remote Cache </td>
<td class='confluenceTd'> using JNDI </td>
</tr>
<tr>
<td class='confluenceTd'> Remote Cache </td>
<td class='confluenceTd'> specify 1 or more host:port's </td>
</tr>
<tr>
<td class='confluenceTd'> Remote Cache </td>
<td class='confluenceTd'> specify HotRod client properties file </td>
</tr>
</tbody></table>
</div>



<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>The use of this resource adapter only provides Key Search capabilities on remote caches.  If your Infinispan/JDG remote cache has configured using Protobuffers, then it is recommended that you use the <a href="/author/display/TEIID/Infinispan-DSL+Data+Sources" title="Infinispan-DSL Data Sources">Infinispan&#45;DSL Data Sources</a> resource adapter when accessing an Infinispan/JDG remote cache. That will enable the DSL searching capabilities.</td></tr></table></div>


<p>The following are the configuration properties that can be configured for this connector:</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> <b>Property Name</b> </th>
<th class='confluenceTh'> <b>Req.</b> </th>
<th class='confluenceTh'> <b>Property Template</b> </th>
<th class='confluenceTh'> <b>Description</b> </th>
</tr>
<tr>
<td class='confluenceTd'> CacheTypeMap </td>
<td class='confluenceTd'> Y </td>
<td class='confluenceTd'> cacheName:className[;pkFieldName[:cacheKeyJavaType]]  </td>
<td class='confluenceTd'> Map the root Java Object class name to the cache, and identify which attribute is the primary key to the cache.  Provide the cacheKeyJavaType when the key type is different than the pkFieldName attribute type </td>
</tr>
<tr>
<td class='confluenceTd'> module </td>
<td class='confluenceTd'> N </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> Specify the JBoss AS module that contains the cache classes that were defined in CacheTypeMap </td>
</tr>
<tr>
<td class='confluenceTd'> CacheJndiName </td>
<td class='confluenceTd'> N </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> JNDI name to fine the CacheContainer </td>
</tr>
<tr>
<td class='confluenceTd'> RemoteServerList </td>
<td class='confluenceTd'> N </td>
<td class='confluenceTd'> host:port[;host:port….] </td>
<td class='confluenceTd'> Specify the host and ports that will be clustered together to access the caches defined in CacheTypeMap </td>
</tr>
<tr>
<td class='confluenceTd'> ConfigurationFileNameForLocalCache </td>
<td class='confluenceTd'> N </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> (Deprecated) The Infinispan Configuration xml file for configuring a local cache </td>
</tr>
<tr>
<td class='confluenceTd'> HotRodClientPropertiesFile </td>
<td class='confluenceTd'> N </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> The HotRod properties file for configuring a connection to a remote cache </td>
</tr>
</tbody></table>
</div>



<p>There are many ways to create the data source, using CLI, <a href="/author/display/TEIID/AdminShell" title="AdminShell">AdminShell</a>, admin-console etc. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes.</p>

<p>Execute following command using <a href="/author/display/AS72/Admin+Guide#AdminGuide-RunningtheCLI">CLI</a> once you connected to the Server. Make sure you provide the correct directory name and other properties below. Add any additional properties required by the connector by duplicating the "connection-definitions" command below. Edit the JNDI name to match the JNDI name you used in VDB.</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;">batch
/subsystem=resource-adapters/resource-adapter=infinispan/connection-definitions=infinispanDS:add(jndi-name=java:/infinispanDS, class-name=org.teiid.resource.adapter.infinispan.InfinispanManagedConnectionFactory, enabled=true, use-java-context=true)
/subsystem=resource-adapters/resource-adapter=infinispan/connection-definitions=infinispanDS/config-properties=CacheTypeMap:add(value=trades:org.somewhere.Trade;tradeId)
/subsystem=resource-adapters/resource-adapter=infinispan/connection-definitions=infinispanDS/config-properties=Module:add(value=org.somewhere)
/subsystem=resource-adapters/resource-adapter=infinispan/connection-definitions=infinispanDS/config-properties=CacheJndiName:add(value=java:/myCache)
runbatch
</pre>
</div></div>
<p><br class="atl-forced-newline" /></p>
<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>To find out all the properties that are supported by this Infinispan Connector execute the following command in the CLI.
<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;">
/subsystem=teiid:read-rar-description(rar-name=infinispan)
</pre>
</div></div></td></tr></table></div>


<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Developer's Tip</b><br />If the JBoss AS 7.5 (EAP 6.4 Alpha) is running in standalone mode, you can also manually edit the "&lt;jboss-install&gt;/standalone/configuration/standalone-teiid.xml" file and add the XML configuration defined in "&lt;jboss-install&gt;/docs/teiid/datasources/infinispan" directory under "resource-adapters" subsystem. Shutdown the server before you edit this file, and restart after the modifications are done.</td></tr></table></div>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Avoid Classloading Issues:</b> If you are using a servlet or other type of web application to create the DefaultCacheManager for the cache, be sure not to include the Infinispan jar dependencies in the application, but add their module dependencies.</td></tr></table></div>
    </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+Data+Sources">View Online</a>
        |
        <a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=55476963&revisedVersion=13&originalVersion=12">View Changes</a>
                |
        <a href="https://docs.jboss.org/author/display/TEIID/Infinispan+Data+Sources?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>