<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/OData+Support">OData Support</a></h2>
<h4>Page <b>added</b> by <a href="https://docs.jboss.org/author/display/~rareddy">Ramesh Reddy</a>
</h4>
<br/>
<div class="notificationGreySide">
<h2><a name="ODataSupport-WhatisOData"></a>What is OData</h2>
<p>The Open Data Protocol (OData) is a Web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today. OData does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON to provide access to information from a variety of applications, services, and stores. The protocol emerged from experiences implementing AtomPub clients and servers in a variety of products over the past several years. OData is being used to expose and access information from a variety of sources including, but not limited to, relational databases, file systems, content management systems and traditional Web sites.</p>
<p>OData is consistent with the way the Web works - it makes a deep commitment to URIs for resource identification and commits to an HTTP-based, uniform interface for interacting with those resources (just like the Web). This commitment to core Web principles allows OData to enable a new level of data integration and interoperability across a broad range of clients, servers, services, and tools.</p>
<p>copied from <a href="http://odata.org" class="external-link" rel="nofollow">http://odata.org</a></p>
<h2><a name="ODataSupport-TeiidSupportforOData"></a>Teiid Support for OData</h2>
<p>When a user successfully deploys a VDB into a Teiid Server, similar JDBC and ODBC protocol support, the OData protocol support is implicitly provided by the Teiid server without any further configuration. OData is support is currently not available in the Teiid Embedded. Teiid makes use of JBoss AS and its already configured <a href="http://www.jboss.org/resteasy" class="external-link" rel="nofollow">RestEasy</a> libraries, and <a href="http://code.google.com/p/odata4j" class="external-link" rel="nofollow">OData4J</a> libraries to provide a Rest based access to the VDB. The access would be similar to accessing to any web resources deployed on JBoss AS. For example, if you have a vdb by name <em>northwind</em> deployed and that vdb has a table <em>customers</em> then you can access that table as </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;">
http://localhost:8080/odata/northwind.1/customers
</pre>
</div></div>
<p>this would be akin to, making a JDBC/ODBC connection and issuing a SQL call as</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT * FROM customers
</pre>
</div></div>
<p>the returned results from OData query can be in Atom/AtomPub xml format or JSON format. By default AtomPub based XML result is returned.</p>
<p>For detail protocol access you can read the specification at <a href="http://odata.org" class="external-link" rel="nofollow">http://odata.org</a>. You can also read this very useful web resource <a href="http://msdn.microsoft.com/en-us/library/ff478141.aspx" class="external-link" rel="nofollow">for an example</a> access of a OData server.</p>
<h3><a name="ODataSupport-Security"></a>Security</h3>
<p>Currently by default the OData access is secured using the HTTPBasic, and user will be authenticated against the Teiid's default security domain "teiid-security" and makes use of the security role <b>odata</b>. However, if you wish to change the security domain, manually edit the <em>web.xml</em> file WAR file in <em><modules>/org/jboss/teiid/main/deployments</em> directory. In future versions more WS-Security based configurations will be provided.</p>
<h3><a name="ODataSupport-Limitations"></a>Limitations</h3>
<p>The following feature limitations currently apply.</p>
<ul>
        <li>Currently the Teiid implements OData V2 specification along with many V3 features, however not completely OData V3 supported.</li>
        <li>Blob support for media types are currently not supported.</li>
        <li>"$value" construct to retrieve individual column value is not supported</li>
        <li>create/update/delete $links is not supported</li>
        <li>$expand is not supported</li>
</ul>
<h2><a name="ODataSupport-ClientToolsforAccess"></a>Client Tools for Access</h2>
<p>OData access is really where the user comes in, depending upon your programming model and needs there are various ways you write your access layer into OData. The following are some suggestions</p>
<ul>
        <li>Your Browser: The OData Explorer is an online tool for browsing an OData data service.</li>
        <li>Microsoft .NET Framework 3.51: the WCF Data Services framework is available as a separate download for .NET 3.x.</li>
        <li>Microsoft .NET Framework 4.0: the WCF Data Services framework built into .NET 4.0 (in release candidate as of this writing).</li>
        <li>Silverlight 3: the Data Services client library for Silverlight is available for download.</li>
        <li>Java: the Restlet 2.0 library for Java (including Java on your Android phone) supports the OData protocol.</li>
        <li>Java: Use a library like OData4J for Java based access, or any Rest based framework</li>
        <li>JavaScript: the XMLHttpRequest object is standard in modern browsers or you can use jQuery, which comes out of the box with .NET 4.0 or is available for download.</li>
        <li>PHP: the Toolkit for PHPprovides OData support for PHP clients.</li>
        <li>AJAX: if you're using AJAX for ASP.NET, Microsoft provides the ASP.NET Ajax Library for getting to OData.</li>
        <li>Excel 2010 PowerPivot: PowerPivot comes with OData support built right in.</li>
        <li>Windows Desktop: LINQPad is a wonderful tool for building OData queries interactively.</li>
        <li>Shell Scripts: use CURL tool</li>
</ul>
<h2><a name="ODataSupport-HowTeiidexposesschemaforOData"></a>How Teiid exposes schema for OData</h2>
<p>OData defines its schema using Conceptual Schema Definition Language (CSDL). Every VDB, that is deployed in an ACTIVE state in Teiid server exposes its metadata in CSDL format. For example if you want retrieve metadata for your vdb <em>northwind</em>, you need to issue a query like</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;">
http://localhost:8080/odata/northwind/$metadata
</pre>
</div></div>
<p>Since OData schema model is not a relational schema model, Teiid uses the following semantics to map its relational schema model to OData schema model.</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Relational Entity</th>
<th class='confluenceTh'> Mapped OData Entity</th>
</tr>
<tr>
<td class='confluenceTd'>Model Name </td>
<td class='confluenceTd'>Schema Namespace, EntityContainer Name</td>
</tr>
<tr>
<td class='confluenceTd'>Table/View</td>
<td class='confluenceTd'>EntityType, EntitySet</td>
</tr>
<tr>
<td class='confluenceTd'>Table Columns</td>
<td class='confluenceTd'>EntityType's Properties</td>
</tr>
<tr>
<td class='confluenceTd'>Primary Key</td>
<td class='confluenceTd'>EntityType's Key Properties</td>
</tr>
<tr>
<td class='confluenceTd'>Foreign Key</td>
<td class='confluenceTd'>Navigation Property on EntityType, Association, AssosiationSet</td>
</tr>
<tr>
<td class='confluenceTd'>Procedure</td>
<td class='confluenceTd'>FunctionImport</td>
</tr>
<tr>
<td class='confluenceTd'>Procedure's Table Return</td>
<td class='confluenceTd'>ComplexType</td>
</tr>
</tbody></table>
</div>
<p>Teiid by design does not define any "embedeed" ComplexType in the EnitityType</p>
<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Teiid does not define any one EntityContainer that resulted from different vdb models as a default container, so all entities must be accessed using full path to them.</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/OData+Support">View Online</a>
|
<a href="https://docs.jboss.org/author/display/TEIID/OData+Support?showComments=true&showCommentArea=true#addcomment">Add Comment</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>