olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r922392 [11/23] - in /websites/staging/olingo/trunk/content: ./ doc/ doc/javascript/ doc/odata2/ doc/odata2/tutorials/ doc/odata4/ doc/odata4/tutorials/ doc/tutorials/
Date Tue, 16 Sep 2014 12:34:20 GMT
Added: websites/staging/olingo/trunk/content/doc/odata2/tutorials/read_media-resource.html
==============================================================================
--- websites/staging/olingo/trunk/content/doc/odata2/tutorials/read_media-resource.html (added)
+++ websites/staging/olingo/trunk/content/doc/odata2/tutorials/read_media-resource.html Tue Sep 16 12:34:18 2014
@@ -0,0 +1,481 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html lang="en">
+  <head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <meta name="description" content="Apache Olingo provides libraries which enable developers to implement OData producers and OData consumers. The available OData Java library implements OData version 2.0. In future on goal is to provide an OData 4.0 compliant library once the OData standard is published at OASIS. The focus within the community is currently on the Java technology but it is up to the community to discuss if other environments find interest.">
+    <meta name="author" content="">
+    <link rel="icon" href="/favicon.ico">
+    <title>
+      Apache Olingo
+    </title><!-- Bootstrap core CSS -->
+    <link href="/css/bootstrap.css" rel="stylesheet" type="text/css"><!-- Custom styles for this template -->
+    <link href="/css/navbar.css" rel="stylesheet" type="text/css"><!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
+    <link href="/css/offcanvas.css" rel="stylesheet" type="text/css"><!-- Custom styles for this template -->
+    <link rel="stylesheet" href="/css/main.css">
+    <!--[if lt IE 9]><script src="/js/ie8-responsive-file-warning.js"></script><![endif]-->
+
+    <script src="/js/ie-emulation-modes-warning.js" type="text/javascript">
+</script><!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
+
+    <script src="/js/ie10-viewport-bug-workaround.js" type="text/javascript">
+</script><!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+    <!--[if lt IE 9]>
+      <script src="/js/html5shiv.min.js"></script>
+      <script src="/js/respond.min.js"></script>
+    <![endif]-->
+  </head>
+
+  <body>
+    <div class="container">
+      <!-- Static navbar -->
+      <div class="navbar navbar-default" role="navigation">
+        <div class="container-fluid">
+          <div class="navbar-header">
+            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+              <span class="sr-only">Toggle navigation</span>
+             <span class="icon-bar"></span>
+             <span class="icon-bar"></span>
+             <span class="icon-bar"></span>
+            </button>
+              <img class="navbar-brand" src="/img/OlingoOrangeTM.png" style="width:62px;" >
+              <a class="navbar-brand" href="#">Apache Olingo™</a>
+          </div>
+          <div class="navbar-collapse collapse">
+            <ul class="nav navbar-nav">
+
+              <li><a href="/">Home</a></li>
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">ASF <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                      <li><a href="http://www.apache.org/foundation/">ASF Home</a></li>
+                      <li><a href="http://projects.apache.org/">Projects</a></li>
+                      <li><a href="http://people.apache.org/">People</a></li>
+                      <li><a href="http://www.apache.org/foundation/getinvolved.html">Get Involved</a></li>
+                      <li><a href="http://www.apache.org/dyn/closer.cgi">Download</a></li>
+                      <li><a href="http://www.apache.org/security/">Security</a></li>
+                      <li><a href="http://www.apache.org/foundation/sponsorship.html">Support Apache</a></li>
+                  </ul>
+              </li>
+
+              <li><a href="http://www.apache.org/licenses/">License</a></li>
+
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Download <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                      <li><a href="/doc/odata2/download.html">Download OData 2.0 Java</a></li>
+                      <li><a href="/doc/javascript/download.html">Download OData 4.0 JavaScript</a></li>
+                  </ul>
+              </li>
+
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                    <li><a href="/doc/odata2/index.html">Documentation OData 2.0 Java</a></li>
+                    <li><a href="/doc/javascript/index.html">Documentation OData 4.0 JavaScript</a></li>
+                  </ul>
+              </li>
+              <li><a href="/support.html">Support</a></li>
+
+            </ul>
+
+			  <img class="navbar-right" height="50px" src="/img/asf-logo.gif">
+
+			</div><!--/.nav-collapse -->
+        </div><!--/.container-fluid -->
+      </div><!-- Main component for a primary marketing message or call to action --><h1 id="media-resources">Media Resources</h1>
+<hr />
+<h3 id="how-to-guide-extend-read-scenario-with-support-for-media-resources">How To Guide - Extend read scenario with support for media resources</h3>
+<p>This How To Guide shows how to extend the read scenario (with <code>$expand</code> extension) with support for Media Link Entries and Media Resources.</p>
+<p>The tutorial introduces a new resource (Driver), shows how to extend the according <code>readEntitySet(...)</code> and <code>readEntity(...)</code> and introduces the new method <code>readEntityMedia(uriInfo:GetMediaResourceUriInfo, contentType:String):ODataResponse</code> within the <code>MyODataSingleProcessor</code>.</p>
+<h3 id="prerequisites">Prerequisites</h3>
+<p>Setup of <a href="read_expand">Read Scenario with <code>$expand</code></a> extension
+(which has as prerequisite Setup of <a href="basicread">Basic Read Scenario</a>)</p>
+<h3 id="shortcut">Shortcut</h3>
+<p>If you like to directly experiment with the results of the extented basic read scenario, you can use this shortcut: </p>
+<ul>
+<li>Download and unzip the <a href="apache-olingo-tutorial-adv_read_mediaresource.zip">Olingo Tutorial 'Basic Read with Media Resource extension' Project</a> to your local drive which is your OData Tutorial project folder (referenced as <code>$ODATA_PROJECT_HOME</code> in the turorial).</li>
+<li>Start the command line tool and run maven in the folder <code>$ODATA_PROJECT_HOME</code> to build the war file which then can be deployed. </li>
+<li>Deploy the resulting war to your favorite application server. <ul>
+<li>For a Tomcat application server copy the war into the <em>$TOMCAT_HOME/webapps</em> folder and start the server via <code>$TOMCAT_HOME/bin/startup.sh</code> (at Windows via <code>$TOMCAT_HOME/bin/startup.bat</code>). </li>
+</ul>
+</li>
+<li>Optional: To import the sample project into Eclipse run the following steps:<ul>
+<li>Start the command line tool and run <code>mvn eclipse:eclipse clean install</code> in the folder <code>$ODATA_PROJECT_HOME</code> to generate the Eclipse project settings and do an initial build. </li>
+<li>Go into Eclipse and import the project into your workspace by...</li>
+<li>Menue "File" -&gt; "Import..."</li>
+<li>"Existing projects into workspace" then choose the olingo.odata2.sample folder</li>
+<li>Select both projects olingo.odata2.sample.service and olingo.odata2.sample.web and press "Finish"</li>
+</ul>
+</li>
+</ul>
+<h3 id="hints">Hints</h3>
+<ul>
+<li>Sometimes a code extension needs one or more new/additional imports. These are not shown in the examples because it would blow up the source code examples and normally the IDE should support an auto fix of missing imports during typing of the code or after an insert of copied code. </li>
+</ul>
+<h3 id="extend-read-scenario">Extend Read Scenario</h3>
+<p>The steps to extend the read scenario (already with <code>$expand</code> support) with support for a Driver which is a media link entry with an associated media resource and therefore contains an image as media is to override and implement the <code>readEntityMedia(uriInfo:GetMediaResourceUriInfo, contentType:String):ODataResponse</code> method within the <code>MyODataSingleProcessor</code>.</p>
+<p>All $value requests - where $value is the next segment to an entity type instance identified by an EntitySet with key predicate or a navigation property (to one relation or key predicate for to many relation) - to the service are delegated to this method which then handles the creation of the according response. </p>
+<h3 id="extend-myedmprovider-and-myodatasingleprocessor">Extend MyEdmProvider and MyODataSingleProcessor</h3>
+<h4 id="small-sample-code-prerequisites">Small sample code Prerequisites</h4>
+<p>Not directly related to the OData Library parts but necessary for the sample project is the extension of the DataStore with methods to access the new Driver and the binary data for the media resource of the Driver.
+Because this extension is more boilerplate code with no direct OData impact it is recommended to simply copy the DataStore.java into the project.
+As conclusion following methods are added which are accessed from the <code>MyODataSingleProcessor</code>:</p>
+<ul>
+<li><code>readDriverImage(entitySet:EdmEntitySet, id:int):byte[]</code> </li>
+<li><code>getDriverFor(carId:int):Map&lt;String, Object&gt;</code></li>
+<li><code>getCarFor(driverKey:int):Map&lt;String, Object&gt;</code> </li>
+<li><code>getDriver(id:int):Map&lt;String, Object&gt;</code></li>
+<li><code>getDrivers():List&lt;Map&lt;String, Object&gt;&gt;</code> </li>
+</ul>
+<p>Additional and in conclusion with the <code>DataStore</code> three images (png) are added to the sample project. These images are located in <em>/sample-service/src/main/resources/</em> and are named Driver_'x'.png were 'x' is replaced by a number.
+To really get an image for a media resource request it is necessary to copy these images (or create own PNG files which follows the naming schema).
+If nothing is copied/created the sample will still work but does not show an image for a media resource request (instead a HTTP Response 404 - Entity not found is shown). </p>
+<p><strong> Extend MyEdmProvider with Driver data model </strong><br></p>
+<p>First the new Driver is added in the EDM. 
+The Driver gets a Key (Id) and some properties (Name, Surname, Nickname, Updates). For simplification currently we do not add any associations to another entities.</p>
+<p>To mark the Driver as a media link entry with an associated media resource extension it is mandatory to set the stream property to true via the <code>setHasStream(true)</code> method when creating the <code>EntityType</code>.</p>
+<p>As conclusion the <code>getEntityType(…)</code> method is extended as follows:</p>
+<h5 id="sample-code">Sample Code</h5>
+<div class="codehilite"><pre><span class="err">…</span>
+  <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_TYPE_1_3</span><span class="o">.</span><span class="na">getName</span><span class="o">().</span><span class="na">equals</span><span class="o">(</span><span class="n">edmFQName</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+    <span class="n">List</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;</span> <span class="n">properties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">Property</span><span class="o">&gt;();</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Id&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">Int32</span><span class="o">).</span><span class="na">setFacets</span><span class="o">(</span><span class="k">new</span> <span class="n">Facets</span><span class="o">().</span><span class="na">setNullable</span><span class="o">(</span><span class="kc">false</span><span class="o">)));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Name&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">String</span><span class="o">).</span><span class="na">setFacets</span><span class="o">(</span><span class="k">new</span> <span class="n">Facets</span><span class="o">().</span><span class="na">setNullable</span><span class="o">(</span><span class="kc">false</span><span class="o">).</span><span class="na">setMaxLength</span><span class="o">(</span><span class="mi">50</span><span class="o">)));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Surname&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">String</span><span class="o">).</span><span class="na">setFacets</span><span class="o">(</span><span class="k">new</span> <span class="n">Facets</span><span class="o">().</span><span class="na">setNullable</span><span class="o">(</span><span class="kc">false</span><span class="o">).</span><span class="na">setMaxLength</span><span class="o">(</span><span class="mi">80</span><span class="o">))</span>
+                    <span class="o">.</span><span class="na">setCustomizableFeedMappings</span><span class="o">(</span><span class="k">new</span> <span class="n">CustomizableFeedMappings</span><span class="o">().</span><span class="na">setFcTargetPath</span><span class="o">(</span><span class="n">EdmTargetPath</span><span class="o">.</span><span class="na">SYNDICATION_TITLE</span><span class="o">)));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Nickname&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">String</span><span class="o">).</span><span class="na">setFacets</span><span class="o">(</span><span class="k">new</span> <span class="n">Facets</span><span class="o">().</span><span class="na">setNullable</span><span class="o">(</span><span class="kc">true</span><span class="o">).</span><span class="na">setMaxLength</span><span class="o">(</span><span class="mi">50</span><span class="o">)));</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Updated&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">DateTime</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setFacets</span><span class="o">(</span><span class="k">new</span> <span class="n">Facets</span><span class="o">().</span><span class="na">setNullable</span><span class="o">(</span><span class="kc">false</span><span class="o">).</span><span class="na">setConcurrencyMode</span><span class="o">(</span><span class="n">EdmConcurrencyMode</span><span class="o">.</span><span class="na">Fixed</span><span class="o">))</span>
+        <span class="o">.</span><span class="na">setCustomizableFeedMappings</span><span class="o">(</span><span class="k">new</span> <span class="n">CustomizableFeedMappings</span><span class="o">().</span><span class="na">setFcTargetPath</span><span class="o">(</span><span class="n">EdmTargetPath</span><span class="o">.</span><span class="na">SYNDICATION_UPDATED</span><span class="o">)));</span>
+
+    <span class="c1">// Navigation properties</span>
+    <span class="n">List</span><span class="o">&lt;</span><span class="n">NavigationProperty</span><span class="o">&gt;</span> <span class="n">navigationProperties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">NavigationProperty</span><span class="o">&gt;();</span>
+
+    <span class="c1">// Key</span>
+    <span class="n">List</span><span class="o">&lt;</span><span class="n">PropertyRef</span><span class="o">&gt;</span> <span class="n">keyProperties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="o">&lt;</span><span class="n">PropertyRef</span><span class="o">&gt;();</span>
+    <span class="n">keyProperties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">PropertyRef</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Id&quot;</span><span class="o">));</span>
+    <span class="n">Key</span> <span class="n">key</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Key</span><span class="o">().</span><span class="na">setKeys</span><span class="o">(</span><span class="n">keyProperties</span><span class="o">);</span>
+
+    <span class="c1">// finish</span>
+    <span class="k">return</span> <span class="k">new</span> <span class="nf">EntityType</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_3</span><span class="o">.</span><span class="na">getName</span><span class="o">())</span>
+        <span class="o">.</span><span class="na">setProperties</span><span class="o">(</span><span class="n">properties</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setHasStream</span><span class="o">(</span><span class="kc">true</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setKey</span><span class="o">(</span><span class="n">key</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setNavigationProperties</span><span class="o">(</span><span class="n">navigationProperties</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setMapping</span><span class="o">(</span><span class="k">new</span> <span class="n">Mapping</span><span class="o">().</span><span class="na">setMimeType</span><span class="o">(</span><span class="s">&quot;image/png&quot;</span><span class="o">));</span>
+<span class="o">}</span>
+<span class="o">...</span>
+</pre></div>
+
+
+<p>In addition it is necessary to extend the <code>getSchemas(…)</code> method with the according <code>EntityType</code> and <code>EntitySet</code> of the new Driver.</p>
+<div class="codehilite"><pre><span class="n">entityTypes</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getEntityType</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_3</span><span class="o">));</span>
+<span class="n">entitySets</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">getEntitySet</span><span class="o">(</span><span class="n">ENTITY_CONTAINER</span><span class="o">,</span> <span class="n">ENTITY_SET_NAME_DRIVERS</span><span class="o">));</span>
+</pre></div>
+
+
+<p>And at last following constants are added to the <code>MyEdmProvider</code> for cleaner code.</p>
+<div class="codehilite"><pre>  <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ENTITY_SET_NAME_DRIVERS</span> <span class="o">=</span> <span class="s">&quot;Drivers&quot;</span><span class="o">;</span>
+  <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ENTITY_NAME_DRIVER</span> <span class="o">=</span> <span class="s">&quot;Driver&quot;</span><span class="o">;</span>
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">FullQualifiedName</span> <span class="n">ENTITY_TYPE_1_3</span> <span class="o">=</span> <span class="k">new</span> <span class="n">FullQualifiedName</span><span class="o">(</span><span class="n">NAMESPACE</span><span class="o">,</span> <span class="n">ENTITY_NAME_DRIVER</span><span class="o">);</span>
+</pre></div>
+
+
+<p><strong>Extend <code>MyODataSingleProcessor</code> with <code>readEntityMedia(uriInfo:GetMediaResourceUriInfo, contentType:String):ODataResponse</code> method</strong><br>
+All requests for media resources are done via the specified $value property in the URL (e.g. <em>.../MyODataSample.svc/Drivers(1)/$value</em>). Such a request will be dispatched to an <code>EntityMediaProcessor</code> which is in our case the <code>MyODataSingleProcessor</code> (inherited from <code>ODataSingleProcessor</code>).
+To handle now such read requests for our media resources we override and implement the <code>readEntityMedia(uriInfo:GetMediaResourceUriInfo, contentType:String):ODataResponse</code> method.
+For our scenario we simply have to validate the correct requested target <code>EntitySet</code>, get the key for requesting the data from our <code>DataStore</code> (which contains the binary data of our media resource), use the <code>EntityProvider</code> to write the data and at last build the <code>ODataResponse</code>.
+Seems a lot but in code this are only these few lines:</p>
+<div class="codehilite"><pre><span class="nd">@Override</span>
+<span class="kd">public</span> <span class="n">ODataResponse</span> <span class="nf">readEntityMedia</span><span class="o">(</span><span class="kd">final</span> <span class="n">GetMediaResourceUriInfo</span> <span class="n">uriInfo</span><span class="o">,</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">contentType</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">ODataException</span> <span class="o">{</span>
+
+  <span class="kd">final</span> <span class="n">EdmEntitySet</span> <span class="n">entitySet</span> <span class="o">=</span> <span class="n">uriInfo</span><span class="o">.</span><span class="na">getTargetEntitySet</span><span class="o">();</span>
+  <span class="k">if</span><span class="o">(</span><span class="n">ENTITY_SET_NAME_DRIVERS</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">entitySet</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+    <span class="kt">int</span> <span class="n">id</span> <span class="o">=</span> <span class="n">getKeyValue</span><span class="o">(</span><span class="n">uriInfo</span><span class="o">.</span><span class="na">getKeyPredicates</span><span class="o">().</span><span class="na">get</span><span class="o">(</span><span class="mi">0</span><span class="o">));</span>
+    <span class="kt">byte</span><span class="o">[]</span> <span class="n">image</span> <span class="o">=</span> <span class="n">dataStore</span><span class="o">.</span><span class="na">readDriverImage</span><span class="o">(</span><span class="n">entitySet</span><span class="o">,</span> <span class="n">id</span><span class="o">);</span>
+    <span class="k">if</span> <span class="o">(</span><span class="n">image</span> <span class="o">==</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
+      <span class="k">throw</span> <span class="k">new</span> <span class="nf">ODataNotFoundException</span><span class="o">(</span><span class="n">ODataNotFoundException</span><span class="o">.</span><span class="na">ENTITY</span><span class="o">);</span>
+    <span class="o">}</span>
+
+    <span class="n">String</span> <span class="n">mimeType</span> <span class="o">=</span> <span class="s">&quot;image/png&quot;</span><span class="o">;</span>
+    <span class="k">return</span> <span class="n">ODataResponse</span><span class="o">.</span><span class="na">fromResponse</span><span class="o">(</span><span class="n">EntityProvider</span><span class="o">.</span><span class="na">writeBinary</span><span class="o">(</span><span class="n">mimeType</span><span class="o">,</span> <span class="n">image</span><span class="o">)).</span><span class="na">build</span><span class="o">();</span>
+  <span class="o">}</span>
+
+  <span class="k">throw</span> <span class="k">new</span> <span class="nf">ODataNotImplementedException</span><span class="o">();</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>With these extension it is possible to read the media resource, but for access to the Driver <code>EntitySet</code> and <code>Entity</code> the according read methods have to be extended.</p>
+<p><strong> Extend existing <code>readEntitySet(...)</code> and <code>readEntity(...)</code> methods in <code>MyODataSingleProcessor</code> methods </strong><br>
+For access to the Driver as <code>Entity</code> and as <code>EntitySet</code> the according <code>readreadEntitySet(...)</code> and <code>readEntity(...)</code> methods have to be extended.</p>
+<p>But its quite the same procedure as in the basic read. Validate the requested Entity, get the key for requesting the <code>DataStore</code> and write the result data via the <code>EntityProvider</code>.</p>
+<p>The resulting extension for <code>readEntity(…)</code>:</p>
+<div class="codehilite"><pre>  <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_SET_NAME_DRIVERS</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">entitySet</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+    <span class="kt">int</span> <span class="n">id</span> <span class="o">=</span> <span class="n">getKeyValue</span><span class="o">(</span><span class="n">uriInfo</span><span class="o">.</span><span class="na">getKeyPredicates</span><span class="o">().</span><span class="na">get</span><span class="o">(</span><span class="mi">0</span><span class="o">));</span>
+    <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">data</span> <span class="o">=</span> <span class="n">dataStore</span><span class="o">.</span><span class="na">getDriver</span><span class="o">(</span><span class="n">id</span><span class="o">);</span>
+
+    <span class="k">if</span> <span class="o">(</span><span class="n">data</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
+      <span class="n">URI</span> <span class="n">serviceRoot</span> <span class="o">=</span> <span class="n">getContext</span><span class="o">().</span><span class="na">getPathInfo</span><span class="o">().</span><span class="na">getServiceRoot</span><span class="o">();</span>
+      <span class="n">ODataEntityProviderPropertiesBuilder</span> <span class="n">propertiesBuilder</span> <span class="o">=</span> <span class="n">EntityProviderWriteProperties</span><span class="o">.</span><span class="na">serviceRoot</span><span class="o">(</span><span class="n">serviceRoot</span><span class="o">);</span>
+
+      <span class="k">return</span> <span class="n">EntityProvider</span><span class="o">.</span><span class="na">writeEntry</span><span class="o">(</span><span class="n">contentType</span><span class="o">,</span> <span class="n">entitySet</span><span class="o">,</span> <span class="n">data</span><span class="o">,</span> <span class="n">propertiesBuilder</span><span class="o">.</span><span class="na">build</span><span class="o">());</span>
+    <span class="o">}</span>
+</pre></div>
+
+
+<p>and <code>readEntitySet(…)</code>:</p>
+<div class="codehilite"><pre>  <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">ENTITY_SET_NAME_DRIVERS</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">entitySet</span><span class="p">.</span><span class="n">getName</span><span class="p">()))</span> <span class="p">{</span>
+    <span class="k">return</span> <span class="n">EntityProvider</span><span class="p">.</span><span class="n">writeFeed</span><span class="p">(</span><span class="n">contentType</span><span class="p">,</span> <span class="n">entitySet</span><span class="p">,</span> <span class="n">dataStore</span><span class="p">.</span><span class="n">getDrivers</span><span class="p">(),</span>     <span class="n">EntityProviderWriteProperties</span><span class="p">.</span><span class="n">serviceRoot</span><span class="p">(</span><span class="n">getContext</span><span class="p">().</span><span class="n">getPathInfo</span><span class="p">().</span><span class="n">getServiceRoot</span><span class="p">()).</span><span class="n">build</span><span class="p">());</span>
+</pre></div>
+
+
+<p><strong>Conclusion for media resource extension</strong><br>
+After finishing all steps above the project can be built and deployed containing a Driver type which is a media link entry with associated media resource. <em>Congratulations.</em></p>
+<p>For a more interesting sample and to update before learned knowledge about associations and <code>$expand</code> it is recommended to finish this HowTo with the creation of an association between a Driver and his Car with supported <code>$expand</code>.</p>
+<p><strong>Extend Driver with association to Car</strong><br>
+For a more interesting sample we now create an association between a Driver and his Car.</p>
+<p><strong>Extend Driver and Car in MyEdmProvider with a navigation property</strong><br>
+At first we introduce the necessary constants:</p>
+<div class="codehilite"><pre>  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">FullQualifiedName</span> <span class="n">ASSOCIATION_DRIVER_CAR</span> <span class="o">=</span> <span class="k">new</span> <span class="n">FullQualifiedName</span><span class="o">(</span><span class="n">NAMESPACE</span><span class="o">,</span> <span class="s">&quot;Driver_Car-Car_Driver&quot;</span><span class="o">);</span>
+
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ROLE_1_3</span> <span class="o">=</span> <span class="s">&quot;Car_Driver&quot;</span><span class="o">;</span>
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ROLE_3_1</span> <span class="o">=</span> <span class="s">&quot;Driver_Car&quot;</span><span class="o">;</span>
+
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ASSOCIATION_SET</span> <span class="o">=</span> <span class="s">&quot;Cars_Manufacturers&quot;</span><span class="o">;</span>
+  <span class="kd">private</span> <span class="kd">static</span> <span class="kd">final</span> <span class="n">String</span> <span class="n">ASSOCIATION_SET_CARS_DRIVERS</span> <span class="o">=</span> <span class="s">&quot;Cars_Drivers&quot;</span><span class="o">;</span>
+</pre></div>
+
+
+<p>Then the <code>getSchemas()</code> in <code>MyEdmProvider</code> is extended with the new association:</p>
+<div class="codehilite"><pre><span class="n">associations</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getAssociation</span><span class="p">(</span><span class="n">ASSOCIATION_DRIVER_CAR</span><span class="p">));</span>
+<span class="p">...</span>
+<span class="n">associationSets</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="n">getAssociationSet</span><span class="p">(</span><span class="n">ENTITY_CONTAINER</span><span class="p">,</span> <span class="n">ASSOCIATION_DRIVER_CAR</span><span class="p">,</span> <span class="n">ENTITY_SET_NAME_DRIVERS</span><span class="p">,</span> <span class="n">ROLE_3_1</span><span class="p">));</span>
+</pre></div>
+
+
+<p>Next step is the extension of the entity types in <code>getEntityType()</code> in <code>MyEdmProvider</code>.</p>
+<p>For the Car:</p>
+<div class="codehilite"><pre>  <span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="o">.</span><span class="na">getName</span><span class="o">().</span><span class="na">equals</span><span class="o">(</span><span class="n">edmFQName</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+<span class="o">...</span>
+    <span class="n">navigationProperties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">NavigationProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Driver&quot;</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setRelationship</span><span class="o">(</span><span class="n">ASSOCIATION_DRIVER_CAR</span><span class="o">).</span><span class="na">setFromRole</span><span class="o">(</span><span class="n">ROLE_1_3</span><span class="o">).</span><span class="na">setToRole</span><span class="o">(</span><span class="n">ROLE_3_1</span><span class="o">));</span>
+<span class="err">…</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>And the Driver:</p>
+<div class="codehilite"><pre>  <span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_TYPE_1_3</span><span class="o">.</span><span class="na">getName</span><span class="o">().</span><span class="na">equals</span><span class="o">(</span><span class="n">edmFQName</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+<span class="o">...</span>
+    <span class="n">properties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">SimpleProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;CarId&quot;</span><span class="o">).</span><span class="na">setType</span><span class="o">(</span><span class="n">EdmSimpleTypeKind</span><span class="o">.</span><span class="na">Int32</span><span class="o">));</span>
+<span class="o">...</span>
+    <span class="n">navigationProperties</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="k">new</span> <span class="n">NavigationProperty</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="s">&quot;Car&quot;</span><span class="o">).</span><span class="na">setRelationship</span><span class="o">(</span><span class="n">ASSOCIATION_DRIVER_CAR</span><span class="o">).</span><span class="na">setFromRole</span><span class="o">(</span><span class="n">ROLE_3_1</span><span class="o">).</span><span class="na">setToRole</span><span class="o">(</span><span class="n">ROLE_1_3</span><span class="o">));</span>
+<span class="o">...</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>At last the <code>getAssociation(…)</code> and <code>getAssociationSet(...)</code> has also to be extended and has to look like:</p>
+<div class="codehilite"><pre><span class="nd">@Override</span>
+<span class="kd">public</span> <span class="n">Association</span> <span class="nf">getAssociation</span><span class="o">(</span><span class="n">FullQualifiedName</span> <span class="n">edmFQName</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">ODataException</span> <span class="o">{</span>
+  <span class="k">if</span> <span class="o">(</span><span class="n">NAMESPACE</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">edmFQName</span><span class="o">.</span><span class="na">getNamespace</span><span class="o">()))</span> <span class="o">{</span>
+    <span class="k">if</span> <span class="o">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="o">.</span><span class="na">getName</span><span class="o">().</span><span class="na">equals</span><span class="o">(</span><span class="n">edmFQName</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+      <span class="k">return</span> <span class="k">new</span> <span class="nf">Association</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="o">.</span><span class="na">getName</span><span class="o">())</span>
+        <span class="o">.</span><span class="na">setEnd1</span><span class="o">(</span><span class="k">new</span> <span class="n">AssociationEnd</span><span class="o">().</span><span class="na">setType</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="o">).</span><span class="na">setRole</span><span class="o">(</span><span class="n">ROLE_1_1</span><span class="o">).</span><span class="na">setMultiplicity</span><span class="o">(</span><span class="n">EdmMultiplicity</span><span class="o">.</span><span class="na">MANY</span><span class="o">))</span>
+        <span class="o">.</span><span class="na">setEnd2</span><span class="o">(</span><span class="k">new</span> <span class="n">AssociationEnd</span><span class="o">().</span><span class="na">setType</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_2</span><span class="o">).</span><span class="na">setRole</span><span class="o">(</span><span class="n">ROLE_1_2</span><span class="o">).</span><span class="na">setMultiplicity</span><span class="o">(</span><span class="n">EdmMultiplicity</span><span class="o">.</span><span class="na">ONE</span><span class="o">));</span>
+    <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="n">ASSOCIATION_DRIVER_CAR</span><span class="o">.</span><span class="na">getName</span><span class="o">().</span><span class="na">equals</span><span class="o">(</span><span class="n">edmFQName</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+    <span class="k">return</span> <span class="k">new</span> <span class="nf">Association</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="n">ASSOCIATION_DRIVER_CAR</span><span class="o">.</span><span class="na">getName</span><span class="o">())</span>
+        <span class="o">.</span><span class="na">setEnd1</span><span class="o">(</span><span class="k">new</span> <span class="n">AssociationEnd</span><span class="o">().</span><span class="na">setType</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_1</span><span class="o">).</span><span class="na">setRole</span><span class="o">(</span><span class="n">ROLE_1_3</span><span class="o">).</span><span class="na">setMultiplicity</span><span class="o">(</span><span class="n">EdmMultiplicity</span><span class="o">.</span><span class="na">ONE</span><span class="o">))</span>
+        <span class="o">.</span><span class="na">setEnd2</span><span class="o">(</span><span class="k">new</span> <span class="n">AssociationEnd</span><span class="o">().</span><span class="na">setType</span><span class="o">(</span><span class="n">ENTITY_TYPE_1_3</span><span class="o">).</span><span class="na">setRole</span><span class="o">(</span><span class="n">ROLE_3_1</span><span class="o">).</span><span class="na">setMultiplicity</span><span class="o">(</span><span class="n">EdmMultiplicity</span><span class="o">.</span><span class="na">ONE</span><span class="o">));</span>
+    <span class="o">}</span>
+  <span class="o">}</span>
+  <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
+<span class="o">}</span>
+
+
+
+<span class="nd">@Override</span>
+<span class="kd">public</span> <span class="n">AssociationSet</span> <span class="nf">getAssociationSet</span><span class="o">(</span><span class="n">String</span> <span class="n">entityContainer</span><span class="o">,</span> <span class="n">FullQualifiedName</span> <span class="n">association</span><span class="o">,</span> <span class="n">String</span> <span class="n">sourceEntitySetName</span><span class="o">,</span> <span class="n">String</span> <span class="n">sourceEntitySetRole</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">ODataException</span> <span class="o">{</span>
+  <span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_CONTAINER</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">entityContainer</span><span class="o">))</span> <span class="o">{</span>
+    <span class="k">if</span> <span class="o">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">association</span><span class="o">))</span> <span class="o">{</span>
+      <span class="k">return</span> <span class="k">new</span> <span class="nf">AssociationSet</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="n">ASSOCIATION_SET</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setAssociation</span><span class="o">(</span><span class="n">ASSOCIATION_CAR_MANUFACTURER</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setEnd1</span><span class="o">(</span><span class="k">new</span> <span class="n">AssociationSetEnd</span><span class="o">().</span><span class="na">setRole</span><span class="o">(</span><span class="n">ROLE_1_2</span><span class="o">).</span><span class="na">setEntitySet</span><span class="o">(</span><span class="n">ENTITY_SET_NAME_MANUFACTURERS</span><span class="o">))</span>
+        <span class="o">.</span><span class="na">setEnd2</span><span class="o">(</span><span class="k">new</span> <span class="n">AssociationSetEnd</span><span class="o">().</span><span class="na">setRole</span><span class="o">(</span><span class="n">ROLE_1_1</span><span class="o">).</span><span class="na">setEntitySet</span><span class="o">(</span><span class="n">ENTITY_SET_NAME_CARS</span><span class="o">));</span>
+    <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="n">ASSOCIATION_DRIVER_CAR</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">association</span><span class="o">))</span> <span class="o">{</span>
+      <span class="k">return</span> <span class="k">new</span> <span class="nf">AssociationSet</span><span class="o">().</span><span class="na">setName</span><span class="o">(</span><span class="n">ASSOCIATION_SET_CARS_DRIVERS</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setAssociation</span><span class="o">(</span><span class="n">ASSOCIATION_DRIVER_CAR</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setEnd1</span><span class="o">(</span><span class="k">new</span> <span class="n">AssociationSetEnd</span><span class="o">().</span><span class="na">setRole</span><span class="o">(</span><span class="n">ROLE_3_1</span><span class="o">).</span><span class="na">setEntitySet</span><span class="o">(</span><span class="n">ENTITY_SET_NAME_DRIVERS</span><span class="o">))</span>
+        <span class="o">.</span><span class="na">setEnd2</span><span class="o">(</span><span class="k">new</span> <span class="n">AssociationSetEnd</span><span class="o">().</span><span class="na">setRole</span><span class="o">(</span><span class="n">ROLE_1_3</span><span class="o">).</span><span class="na">setEntitySet</span><span class="o">(</span><span class="n">ENTITY_SET_NAME_CARS</span><span class="o">));</span>
+    <span class="o">}</span>
+  <span class="o">}</span>
+  <span class="k">return</span> <span class="kc">null</span><span class="o">;</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p><strong>Extend existing <code>readreadEntitySet(...)</code> and <code>readEntity(...)</code> methods in <code>MyODataSingleProcessor</code></strong><br>
+For cleaner code we introduce at first following method in the <code>MyODataSingleProcessor</code> which validate if the uri contains the expected association.</p>
+<div class="codehilite"><pre><span class="kd">private</span> <span class="kt">boolean</span> <span class="nf">isAssociation</span><span class="o">(</span><span class="n">GetEntityUriInfo</span> <span class="n">uriInfo</span><span class="o">,</span> <span class="n">String</span> <span class="n">startName</span><span class="o">,</span> <span class="n">String</span> <span class="n">targetName</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">EdmException</span> <span class="o">{</span>
+  <span class="k">if</span><span class="o">(</span><span class="n">startName</span> <span class="o">==</span> <span class="kc">null</span> <span class="o">||</span> <span class="n">targetName</span> <span class="o">==</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
+  <span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
+  <span class="o">}</span>
+  <span class="n">EdmEntitySet</span> <span class="n">startEntitySet</span> <span class="o">=</span> <span class="n">uriInfo</span><span class="o">.</span><span class="na">getStartEntitySet</span><span class="o">();</span>
+  <span class="n">EdmEntitySet</span> <span class="n">targetEntitySet</span> <span class="o">=</span> <span class="n">uriInfo</span><span class="o">.</span><span class="na">getTargetEntitySet</span><span class="o">();</span>
+
+  <span class="k">return</span> <span class="n">startName</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">startEntitySet</span><span class="o">.</span><span class="na">getName</span><span class="o">())</span> <span class="o">&amp;&amp;</span> <span class="n">targetName</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">targetEntitySet</span><span class="o">.</span><span class="na">getName</span><span class="o">());</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>The procedure should be already familiar. At first it is checked for the correct association of the requested Entity, then the key for requesting the DataStore is get as well as the data and then result data is written via the <code>EntityProvider</code>.</p>
+<div class="codehilite"><pre><span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="n">uriInfo</span><span class="o">.</span><span class="na">getNavigationSegments</span><span class="o">().</span><span class="na">size</span><span class="o">()</span> <span class="o">==</span> <span class="mi">1</span><span class="o">)</span> <span class="o">{</span>
+  <span class="c1">//navigation first level, simplified example for illustration purposes only</span>
+  <span class="n">EdmEntitySet</span> <span class="n">entitySet</span> <span class="o">=</span> <span class="n">uriInfo</span><span class="o">.</span><span class="na">getTargetEntitySet</span><span class="o">();</span>
+
+  <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">data</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
+
+  <span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_SET_NAME_MANUFACTURERS</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">entitySet</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+    <span class="kt">int</span> <span class="n">carKey</span> <span class="o">=</span> <span class="n">getKeyValue</span><span class="o">(</span><span class="n">uriInfo</span><span class="o">.</span><span class="na">getKeyPredicates</span><span class="o">().</span><span class="na">get</span><span class="o">(</span><span class="mi">0</span><span class="o">));</span>
+    <span class="n">data</span> <span class="o">=</span> <span class="n">dataStore</span><span class="o">.</span><span class="na">getManufacturerFor</span><span class="o">(</span><span class="n">carKey</span><span class="o">);</span>
+  <span class="o">}</span> <span class="k">else</span> <span class="k">if</span><span class="o">(</span><span class="n">isAssociation</span><span class="o">(</span><span class="n">uriInfo</span><span class="o">,</span> <span class="n">ENTITY_SET_NAME_CARS</span><span class="o">,</span> <span class="n">ENTITY_SET_NAME_DRIVERS</span><span class="o">))</span> <span class="o">{</span>
+    <span class="kt">int</span> <span class="n">carKey</span> <span class="o">=</span> <span class="n">getKeyValue</span><span class="o">(</span><span class="n">uriInfo</span><span class="o">.</span><span class="na">getKeyPredicates</span><span class="o">().</span><span class="na">get</span><span class="o">(</span><span class="mi">0</span><span class="o">));</span>
+    <span class="n">data</span> <span class="o">=</span> <span class="n">dataStore</span><span class="o">.</span><span class="na">getDriverFor</span><span class="o">(</span><span class="n">carKey</span><span class="o">);</span>
+  <span class="o">}</span> <span class="k">else</span> <span class="k">if</span><span class="o">(</span><span class="n">isAssociation</span><span class="o">(</span><span class="n">uriInfo</span><span class="o">,</span> <span class="n">ENTITY_SET_NAME_DRIVERS</span><span class="o">,</span> <span class="n">ENTITY_SET_NAME_CARS</span><span class="o">))</span> <span class="o">{</span>
+    <span class="kt">int</span> <span class="n">driverKey</span> <span class="o">=</span> <span class="n">getKeyValue</span><span class="o">(</span><span class="n">uriInfo</span><span class="o">.</span><span class="na">getKeyPredicates</span><span class="o">().</span><span class="na">get</span><span class="o">(</span><span class="mi">0</span><span class="o">));</span>
+    <span class="n">data</span> <span class="o">=</span> <span class="n">dataStore</span><span class="o">.</span><span class="na">getCarFor</span><span class="o">(</span><span class="n">driverKey</span><span class="o">);</span>
+  <span class="o">}</span>
+
+  <span class="k">if</span><span class="o">(</span><span class="n">data</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
+    <span class="k">return</span> <span class="n">EntityProvider</span><span class="o">.</span><span class="na">writeEntry</span><span class="o">(</span><span class="n">contentType</span><span class="o">,</span> <span class="n">uriInfo</span><span class="o">.</span><span class="na">getTargetEntitySet</span><span class="o">(),</span> 
+        <span class="n">data</span><span class="o">,</span> <span class="n">EntityProviderWriteProperties</span><span class="o">.</span><span class="na">serviceRoot</span><span class="o">(</span><span class="n">getContext</span><span class="o">().</span><span class="na">getPathInfo</span><span class="o">().</span><span class="na">getServiceRoot</span><span class="o">()).</span><span class="na">build</span><span class="o">());</span>
+  <span class="o">}</span>
+
+  <span class="k">throw</span> <span class="k">new</span> <span class="nf">ODataNotFoundException</span><span class="o">(</span><span class="n">ODataNotFoundException</span><span class="o">.</span><span class="na">ENTITY</span><span class="o">);</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p><strong>Add $expand support for Driver to/from Car association</strong><br>
+The last missing step is to add the <code>$expand</code> support for the new Driver to/from Car association.</p>
+<p><strong>Extend MyCallback for Driver and Car association</strong><br>
+Add first the extension in the MyCallback for each entity is done in the <code>retrieveEntryResult()</code> method.
+The procedure is similar to the Cars - Manufacturers association. At first it is checked for the correct association of the requested Entity, then the key for requesting the DataStore is get as well as the data and then result data is attached to the <code>WriteEntryCallbackResult</code>.</p>
+<p>The resulting method extension is:</p>
+<div class="codehilite"><pre><span class="o">...</span>
+  <span class="k">if</span><span class="o">(</span><span class="n">isNavigationFromTo</span><span class="o">(</span><span class="n">context</span><span class="o">,</span> <span class="n">ENTITY_SET_NAME_CARS</span><span class="o">,</span> <span class="n">ENTITY_NAME_DRIVER</span><span class="o">))</span> <span class="o">{</span>
+    <span class="n">EntityProviderWriteProperties</span> <span class="n">inlineProperties</span> <span class="o">=</span> <span class="n">EntityProviderWriteProperties</span><span class="o">.</span><span class="na">serviceRoot</span><span class="o">(</span><span class="n">serviceRoot</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">expandSelectTree</span><span class="o">(</span><span class="n">context</span><span class="o">.</span><span class="na">getCurrentExpandSelectTreeNode</span><span class="o">())</span>
+        <span class="o">.</span><span class="na">build</span><span class="o">();</span>
+
+    <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">keys</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="na">extractKeyFromEntryData</span><span class="o">();</span>
+    <span class="n">Integer</span> <span class="n">carId</span> <span class="o">=</span> <span class="o">(</span><span class="n">Integer</span><span class="o">)</span> <span class="n">keys</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="s">&quot;Id&quot;</span><span class="o">);</span>
+    <span class="n">result</span><span class="o">.</span><span class="na">setEntryData</span><span class="o">(</span><span class="n">dataStore</span><span class="o">.</span><span class="na">getDriverFor</span><span class="o">(</span><span class="n">carId</span><span class="o">));</span>
+    <span class="n">result</span><span class="o">.</span><span class="na">setInlineProperties</span><span class="o">(</span><span class="n">inlineProperties</span><span class="o">);</span>
+
+  <span class="o">}</span> <span class="k">else</span> <span class="k">if</span><span class="o">(</span><span class="n">isNavigationFromTo</span><span class="o">(</span><span class="n">context</span><span class="o">,</span> <span class="n">ENTITY_SET_NAME_DRIVERS</span><span class="o">,</span> <span class="n">ENTITY_NAME_CAR</span><span class="o">))</span> <span class="o">{</span>
+    <span class="n">EntityProviderWriteProperties</span> <span class="n">inlineProperties</span> <span class="o">=</span> <span class="n">EntityProviderWriteProperties</span><span class="o">.</span><span class="na">serviceRoot</span><span class="o">(</span><span class="n">serviceRoot</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">expandSelectTree</span><span class="o">(</span><span class="n">context</span><span class="o">.</span><span class="na">getCurrentExpandSelectTreeNode</span><span class="o">())</span>
+        <span class="o">.</span><span class="na">build</span><span class="o">();</span>
+
+    <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">keys</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="na">extractKeyFromEntryData</span><span class="o">();</span>
+    <span class="n">Integer</span> <span class="n">driverId</span> <span class="o">=</span> <span class="o">(</span><span class="n">Integer</span><span class="o">)</span> <span class="n">keys</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="s">&quot;Id&quot;</span><span class="o">);</span>
+    <span class="n">result</span><span class="o">.</span><span class="na">setEntryData</span><span class="o">(</span><span class="n">dataStore</span><span class="o">.</span><span class="na">getCarFor</span><span class="o">(</span><span class="n">driverId</span><span class="o">));</span>
+    <span class="n">result</span><span class="o">.</span><span class="na">setInlineProperties</span><span class="o">(</span><span class="n">inlineProperties</span><span class="o">);</span>        
+  <span class="o">}</span>
+<span class="o">...</span>
+</pre></div>
+
+
+<p><strong>Add registration of MyCallback for Driver and Car association</strong><br>
+After extension of <code>MyCallback</code> it is necessary to register a callback within the <code>readEntity()</code> in the <code>MyODataSingleProcessor</code>.</p>
+<p>For the Driver we add the complete callback registration (code between the comments) which results in final code for the complete Driver Entity handling:</p>
+<div class="codehilite"><pre><span class="o">...</span>
+   <span class="o">}</span> <span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_SET_NAME_DRIVERS</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">entitySet</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+    <span class="kt">int</span> <span class="n">id</span> <span class="o">=</span> <span class="n">getKeyValue</span><span class="o">(</span><span class="n">uriInfo</span><span class="o">.</span><span class="na">getKeyPredicates</span><span class="o">().</span><span class="na">get</span><span class="o">(</span><span class="mi">0</span><span class="o">));</span>
+    <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">data</span> <span class="o">=</span> <span class="n">dataStore</span><span class="o">.</span><span class="na">getDriver</span><span class="o">(</span><span class="n">id</span><span class="o">);</span>
+
+    <span class="k">if</span> <span class="o">(</span><span class="n">data</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
+      <span class="n">URI</span> <span class="n">serviceRoot</span> <span class="o">=</span> <span class="n">getContext</span><span class="o">().</span><span class="na">getPathInfo</span><span class="o">().</span><span class="na">getServiceRoot</span><span class="o">();</span>
+      <span class="n">ODataEntityProviderPropertiesBuilder</span> <span class="n">propertiesBuilder</span> <span class="o">=</span> <span class="n">EntityProviderWriteProperties</span><span class="o">.</span><span class="na">serviceRoot</span><span class="o">(</span><span class="n">serviceRoot</span><span class="o">);</span>
+
+      <span class="c1">// create and register callback</span>
+      <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">ODataCallback</span><span class="o">&gt;</span> <span class="n">callbacks</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="o">,</span> <span class="n">ODataCallback</span><span class="o">&gt;();</span>
+      <span class="n">callbacks</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="n">ENTITY_NAME_CAR</span><span class="o">,</span> <span class="k">new</span> <span class="n">MyCallback</span><span class="o">(</span><span class="n">dataStore</span><span class="o">,</span> <span class="n">serviceRoot</span><span class="o">));</span>
+      <span class="n">ExpandSelectTreeNode</span> <span class="n">expandSelectTreeNode</span> <span class="o">=</span> <span class="n">UriParser</span><span class="o">.</span><span class="na">createExpandSelectTree</span><span class="o">(</span><span class="n">uriInfo</span><span class="o">.</span><span class="na">getSelect</span><span class="o">(),</span> <span class="n">uriInfo</span><span class="o">.</span><span class="na">getExpand</span><span class="o">());</span>
+      <span class="n">propertiesBuilder</span><span class="o">.</span><span class="na">expandSelectTree</span><span class="o">(</span><span class="n">expandSelectTreeNode</span><span class="o">).</span><span class="na">callbacks</span><span class="o">(</span><span class="n">callbacks</span><span class="o">);</span>
+      <span class="c1">// end callback handling</span>
+
+      <span class="k">return</span> <span class="n">EntityProvider</span><span class="o">.</span><span class="na">writeEntry</span><span class="o">(</span><span class="n">contentType</span><span class="o">,</span> <span class="n">entitySet</span><span class="o">,</span> <span class="n">data</span><span class="o">,</span> <span class="n">propertiesBuilder</span><span class="o">.</span><span class="na">build</span><span class="o">());</span>
+    <span class="o">}</span>
+  <span class="o">}</span>
+<span class="o">...</span>
+</pre></div>
+
+
+<p>For the Car it is only necessary to add the single code line below to register the additional callback and enable the <code>$expand</code>:</p>
+<div class="codehilite"><pre>  <span class="k">if</span> <span class="o">(</span><span class="n">ENTITY_SET_NAME_CARS</span><span class="o">.</span><span class="na">equals</span><span class="o">(</span><span class="n">entitySet</span><span class="o">.</span><span class="na">getName</span><span class="o">()))</span> <span class="o">{</span>
+<span class="o">...</span>
+      <span class="n">callbacks</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="n">ENTITY_NAME_DRIVER</span><span class="o">,</span> <span class="k">new</span> <span class="n">MyCallback</span><span class="o">(</span><span class="n">dataStore</span><span class="o">,</span> <span class="n">serviceRoot</span><span class="o">));</span>
+<span class="o">...</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>Deploy, run and test
+Like in the basic read scenario follow these steps:</p>
+<ul>
+<li>Build your project mvn clean install </li>
+<li>Deploy in Web Application server. When using within Eclipse simply run the Web Application via Run As -&gt; Run on Server </li>
+<li>After successful server start and deployment the following uris from the read scenario work as before: <ul>
+<li>Show the Manufacturers: <a href="http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Manufacturers">http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Manufacturers</a> </li>
+<li>Show one Manufacturer: <a href="http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Manufacturers(1)">http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Manufacturers(1)</a> </li>
+<li>Show the Cars: <a href="http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Cars">http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Cars</a> </li>
+<li>Show one Car: <a href="http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Cars(2)">http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Cars(2)</a> </li>
+<li>Show the related Manufacturer of a Car: <a href="http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Cars(2)/Manufacturer">http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Cars(2)/Manufacturer</a> </li>
+<li>Show the related Cars of a Manufacturer: <a href="http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Manufacturers(1)/Cars">http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Manufacturers(1)/Cars </a></li>
+<li>Show Car with its Manufacturer: <a href="http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Cars(2)?$expand=Manufacturer">http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Cars(2)?$expand=Manufacturer </a></li>
+<li>Show Manufacturer with its Cars: <a href="http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Manufacturers(1)?$expand=Cars">http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Manufacturers(1)?$expand=Cars </a></li>
+</ul>
+</li>
+<li>And in addition we now can access the drivers with their media resource ($value) and the association to their car. <ul>
+<li>Show one Driver: <a href="http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Drivers(3)">http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Drivers(3)</a> </li>
+<li>Show Media Resource of Driver: <a href="http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Drivers(3)/$value">http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Drivers(3)/$value</a> </li>
+<li>Show Car of the Driver: <a href="http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Drivers(3)/Car">http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Drivers(3)/Car</a> </li>
+</ul>
+</li>
+<li>Show Driver with expanded Car: <a href="http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Drivers(3)?$expand=Car">http://localhost:8080/olingo.odata2.sample.cars.web/MyODataSample.svc/Drivers(3)?$expand=Car </a></li>
+</ul>
+<h3 id="conclusion">Conclusion</h3>
+<p>After finishing all steps of this tutorial your project contains three different entities with relations between them and one of them with media link entry and media resource support.</p>
+<p>If something does not compile or run it is recommended to compare to the complete sample project source code in the <a href="apache-olingo-tutorial-adv_read_mediaresource">Olingo Tutorial 'Basic Read with Media Resource extension' Project</a>. 
+For more details about how to use/setup the project in the zip see section <strong><em>Shortcut</em></strong>.</p><div align="center">
+<p>Copyright © 2013-2014, The Apache Software Foundation<br>
+				                Apache Olingo, Olingo, Apache, the Apache feather, and
+				the Apache Olingo project logo are trademarks of the Apache Software
+				Foundation.</p>
+        <small><a href="/doc/odata2/privacy.html">Privacy</a></small>
+      </div>
+    </div><!-- /container -->
+    <!-- Bootstrap core JavaScript
+    ================================================== -->
+    <!-- Placed at the end of the document so the pages load faster -->
+    <script src="/js/jquery.js" type="text/javascript">
+</script>
+	  <script src="/js/bootstrap.js" type="text/javascript">
+	  <script src="/js/offcanvas.js" type="text/javascript">
+</script>
+        <!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
+        <script>
+            (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
+            function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
+            e=o.createElement(i);r=o.getElementsByTagName(i)[0];
+            e.src='//www.google-analytics.com/analytics.js';
+            r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
+            ga('create','UA-44963757-1');ga('send','pageview');
+        </script>
+  </body>
+</html>

Added: websites/staging/olingo/trunk/content/doc/odata2/tutorials/servlet.html
==============================================================================
--- websites/staging/olingo/trunk/content/doc/odata2/tutorials/servlet.html (added)
+++ websites/staging/olingo/trunk/content/doc/odata2/tutorials/servlet.html Tue Sep 16 12:34:18 2014
@@ -0,0 +1,161 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html lang="en">
+  <head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <meta name="description" content="Apache Olingo provides libraries which enable developers to implement OData producers and OData consumers. The available OData Java library implements OData version 2.0. In future on goal is to provide an OData 4.0 compliant library once the OData standard is published at OASIS. The focus within the community is currently on the Java technology but it is up to the community to discuss if other environments find interest.">
+    <meta name="author" content="">
+    <link rel="icon" href="/favicon.ico">
+    <title>
+      Apache Olingo
+    </title><!-- Bootstrap core CSS -->
+    <link href="/css/bootstrap.css" rel="stylesheet" type="text/css"><!-- Custom styles for this template -->
+    <link href="/css/navbar.css" rel="stylesheet" type="text/css"><!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
+    <link href="/css/offcanvas.css" rel="stylesheet" type="text/css"><!-- Custom styles for this template -->
+    <link rel="stylesheet" href="/css/main.css">
+    <!--[if lt IE 9]><script src="/js/ie8-responsive-file-warning.js"></script><![endif]-->
+
+    <script src="/js/ie-emulation-modes-warning.js" type="text/javascript">
+</script><!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
+
+    <script src="/js/ie10-viewport-bug-workaround.js" type="text/javascript">
+</script><!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+    <!--[if lt IE 9]>
+      <script src="/js/html5shiv.min.js"></script>
+      <script src="/js/respond.min.js"></script>
+    <![endif]-->
+  </head>
+
+  <body>
+    <div class="container">
+      <!-- Static navbar -->
+      <div class="navbar navbar-default" role="navigation">
+        <div class="container-fluid">
+          <div class="navbar-header">
+            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+              <span class="sr-only">Toggle navigation</span>
+             <span class="icon-bar"></span>
+             <span class="icon-bar"></span>
+             <span class="icon-bar"></span>
+            </button>
+              <img class="navbar-brand" src="/img/OlingoOrangeTM.png" style="width:62px;" >
+              <a class="navbar-brand" href="#">Apache Olingo™</a>
+          </div>
+          <div class="navbar-collapse collapse">
+            <ul class="nav navbar-nav">
+
+              <li><a href="/">Home</a></li>
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">ASF <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                      <li><a href="http://www.apache.org/foundation/">ASF Home</a></li>
+                      <li><a href="http://projects.apache.org/">Projects</a></li>
+                      <li><a href="http://people.apache.org/">People</a></li>
+                      <li><a href="http://www.apache.org/foundation/getinvolved.html">Get Involved</a></li>
+                      <li><a href="http://www.apache.org/dyn/closer.cgi">Download</a></li>
+                      <li><a href="http://www.apache.org/security/">Security</a></li>
+                      <li><a href="http://www.apache.org/foundation/sponsorship.html">Support Apache</a></li>
+                  </ul>
+              </li>
+
+              <li><a href="http://www.apache.org/licenses/">License</a></li>
+
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Download <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                      <li><a href="/doc/odata2/download.html">Download OData 2.0 Java</a></li>
+                      <li><a href="/doc/javascript/download.html">Download OData 4.0 JavaScript</a></li>
+                  </ul>
+              </li>
+
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                    <li><a href="/doc/odata2/index.html">Documentation OData 2.0 Java</a></li>
+                    <li><a href="/doc/javascript/index.html">Documentation OData 4.0 JavaScript</a></li>
+                  </ul>
+              </li>
+              <li><a href="/support.html">Support</a></li>
+
+            </ul>
+
+			  <img class="navbar-right" height="50px" src="/img/asf-logo.gif">
+
+			</div><!--/.nav-collapse -->
+        </div><!--/.container-fluid -->
+      </div><!-- Main component for a primary marketing message or call to action --><h1 id="servlet-support">Servlet Support</h1>
+<p>Originally the Olingo OData 2.0 server library has been implemented 
+based on JAX-RS to take advantage of the REST based CXF features.</p>
+<p>With the development of Olingo URI parser it was possible now also 
+to offer a purely servlet-based approach. This has some advantages 
+on restricted runtime environments and reduces the amount of 
+required dependencies. Disadvantage is that some REST features
+which are out of the box are not available.</p>
+<p>Both solutions JAX-RS and Non-JAX-RS are supported.</p>
+<p>For testing the feature it is recommended to start with the 
+<a href="http://olingo.incubator.apache.org/doc/odata2/sample-setup.html">sample setup</a> using the Olingo archetype and do the following 
+modifications.</p>
+<h3 id="maven-dependencies">Maven Dependencies</h3>
+<p>For a plain servlet based approach it is possible to exclude JAX-RS 
+dependencies. A simple way is to exclude them with Maven:</p>
+<div class="codehilite"><pre><span class="nt">&lt;dependency&gt;</span>
+  <span class="nt">&lt;groupId&gt;</span>org.apache.olingo:olingo<span class="nt">&lt;/groupId&gt;</span>
+  <span class="nt">&lt;artifactId&gt;</span>odata2-core-incubating<span class="nt">&lt;/artifactId&gt;</span>
+  <span class="nt">&lt;version&gt;</span>1.2.0<span class="nt">&lt;/version&gt;</span>
+  <span class="nt">&lt;exclusions&gt;</span>
+    <span class="nt">&lt;exclusion&gt;</span>  
+      <span class="nt">&lt;groupId&gt;</span>javax.ws.rs<span class="nt">&lt;/groupId&gt;</span>
+      <span class="nt">&lt;artifactId&gt;</span>javax.ws.rs-api<span class="nt">&lt;/artifactId&gt;</span>
+    <span class="nt">&lt;/exclusion&gt;</span>
+  <span class="nt">&lt;/exclusions&gt;</span> 
+<span class="nt">&lt;/dependency&gt;</span>
+</pre></div>
+
+
+<p>A JAX-RS implementation dependency like Apache CXF is not required 
+for runtime.</p>
+<h3 id="adopt-webxml">Adopt web.xml</h3>
+<p>For using the servlet based approach only a new Servlet must be 
+configured in web.xml file:</p>
+<div class="codehilite"><pre><span class="nt">&lt;servlet&gt;</span>
+    <span class="nt">&lt;servlet-name&gt;</span>NonJaxRSReferenceScenarioServlet<span class="nt">&lt;/servlet-name&gt;</span>
+    <span class="nt">&lt;servlet-class&gt;</span>org.apache.olingo.odata2.core.servlet.ODataServlet<span class="nt">&lt;/servlet-class&gt;</span>
+    <span class="nt">&lt;init-param&gt;</span>
+        <span class="nt">&lt;param-name&gt;</span>org.apache.olingo.odata2.service.factory<span class="nt">&lt;/param-name&gt;</span>
+        <span class="nt">&lt;param-value&gt;</span>org.apache.olingo.odata2.ref.processor.ScenarioServiceFactory<span class="nt">&lt;/param-value&gt;</span>
+    <span class="nt">&lt;/init-param&gt;</span>
+    <span class="nt">&lt;load-on-startup&gt;</span>1<span class="nt">&lt;/load-on-startup&gt;</span>
+<span class="nt">&lt;/servlet&gt;</span>
+</pre></div>
+
+
+<p>Ensure that all runtime dependencies to Apache CXF are removed from 
+the sample project.</p>
+<p>After this modification the service should work like before.</p><div align="center">
+<p>Copyright © 2013-2014, The Apache Software Foundation<br>
+				                Apache Olingo, Olingo, Apache, the Apache feather, and
+				the Apache Olingo project logo are trademarks of the Apache Software
+				Foundation.</p>
+        <small><a href="/doc/odata2/privacy.html">Privacy</a></small>
+      </div>
+    </div><!-- /container -->
+    <!-- Bootstrap core JavaScript
+    ================================================== -->
+    <!-- Placed at the end of the document so the pages load faster -->
+    <script src="/js/jquery.js" type="text/javascript">
+</script>
+	  <script src="/js/bootstrap.js" type="text/javascript">
+	  <script src="/js/offcanvas.js" type="text/javascript">
+</script>
+        <!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
+        <script>
+            (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
+            function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
+            e=o.createElement(i);r=o.getElementsByTagName(i)[0];
+            e.src='//www.google-analytics.com/analytics.js';
+            r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
+            ga('create','UA-44963757-1');ga('send','pageview');
+        </script>
+  </body>
+</html>

Added: websites/staging/olingo/trunk/content/doc/odata4/dependencies.html
==============================================================================
--- websites/staging/olingo/trunk/content/doc/odata4/dependencies.html (added)
+++ websites/staging/olingo/trunk/content/doc/odata4/dependencies.html Tue Sep 16 12:34:18 2014
@@ -0,0 +1,163 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html lang="en">
+  <head>
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <meta name="description" content="Apache Olingo provides libraries which enable developers to implement OData producers and OData consumers. The available OData Java library implements OData version 2.0. In future on goal is to provide an OData 4.0 compliant library once the OData standard is published at OASIS. The focus within the community is currently on the Java technology but it is up to the community to discuss if other environments find interest.">
+    <meta name="author" content="">
+    <link rel="icon" href="/favicon.ico">
+    <title>
+      Apache Olingo
+    </title><!-- Bootstrap core CSS -->
+    <link href="/css/bootstrap.css" rel="stylesheet" type="text/css"><!-- Custom styles for this template -->
+    <link href="/css/navbar.css" rel="stylesheet" type="text/css"><!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
+    <link href="/css/offcanvas.css" rel="stylesheet" type="text/css"><!-- Custom styles for this template -->
+    <link rel="stylesheet" href="/css/main.css">
+    <!--[if lt IE 9]><script src="/js/ie8-responsive-file-warning.js"></script><![endif]-->
+
+    <script src="/js/ie-emulation-modes-warning.js" type="text/javascript">
+</script><!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
+
+    <script src="/js/ie10-viewport-bug-workaround.js" type="text/javascript">
+</script><!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
+    <!--[if lt IE 9]>
+      <script src="/js/html5shiv.min.js"></script>
+      <script src="/js/respond.min.js"></script>
+    <![endif]-->
+  </head>
+
+  <body>
+    <div class="container">
+      <!-- Static navbar -->
+      <div class="navbar navbar-default" role="navigation">
+        <div class="container-fluid">
+          <div class="navbar-header">
+            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
+              <span class="sr-only">Toggle navigation</span>
+             <span class="icon-bar"></span>
+             <span class="icon-bar"></span>
+             <span class="icon-bar"></span>
+            </button>
+              <img class="navbar-brand" src="/img/OlingoOrangeTM.png" style="width:62px;" >
+              <a class="navbar-brand" href="#">Apache Olingo™</a>
+          </div>
+          <div class="navbar-collapse collapse">
+            <ul class="nav navbar-nav">
+
+              <li><a href="/">Home</a></li>
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">ASF <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                      <li><a href="http://www.apache.org/foundation/">ASF Home</a></li>
+                      <li><a href="http://projects.apache.org/">Projects</a></li>
+                      <li><a href="http://people.apache.org/">People</a></li>
+                      <li><a href="http://www.apache.org/foundation/getinvolved.html">Get Involved</a></li>
+                      <li><a href="http://www.apache.org/dyn/closer.cgi">Download</a></li>
+                      <li><a href="http://www.apache.org/security/">Security</a></li>
+                      <li><a href="http://www.apache.org/foundation/sponsorship.html">Support Apache</a></li>
+                  </ul>
+              </li>
+
+              <li><a href="http://www.apache.org/licenses/">License</a></li>
+
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Download <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                      <li><a href="/doc/odata2/download.html">Download OData 2.0 Java</a></li>
+                      <li><a href="/doc/javascript/download.html">Download OData 4.0 JavaScript</a></li>
+                  </ul>
+              </li>
+
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                    <li><a href="/doc/odata2/index.html">Documentation OData 2.0 Java</a></li>
+                    <li><a href="/doc/javascript/index.html">Documentation OData 4.0 JavaScript</a></li>
+                  </ul>
+              </li>
+              <li><a href="/support.html">Support</a></li>
+
+            </ul>
+
+			  <img class="navbar-right" height="50px" src="/img/asf-logo.gif">
+
+			</div><!--/.nav-collapse -->
+        </div><!--/.container-fluid -->
+      </div><!-- Main component for a primary marketing message or call to action --><h1 id="maven-dependencies">Maven Dependencies</h1>
+<h3 id="consuming-olingo-odata-40-library">Consuming Olingo OData 4.0 Library</h3>
+<h5 id="common-dependencies">Common Dependencies</h5>
+<p>The following common dependencies needs to be added to the pom.xml of the consuming project:</p>
+<p><code>xml
+&lt;dependency&gt;
+  &lt;groupId&gt;org.apache.olingo&lt;/groupId&gt;
+  &lt;artifactId&gt;odata-commons-api&lt;/artifactId&gt;
+  &lt;version&gt;${project.version}&lt;/version&gt;
+&lt;/dependency&gt;
+&lt;dependency&gt;
+  &lt;groupId&gt;org.apache.olingo&lt;/groupId&gt;
+  &lt;artifactId&gt;odata-commons-core&lt;/artifactId&gt;
+  &lt;version&gt;${project.version}&lt;/version&gt;
+&lt;/dependency&gt;</code></p>
+<h5 id="odata-client-dependencies">OData Client Dependencies</h5>
+<p>For realization of <em>OData-Client</em> projects additional dependencies are necessary:</p>
+<p><code>xml
+&lt;dependency&gt;
+  &lt;groupId&gt;org.apache.olingo&lt;/groupId&gt;
+  &lt;artifactId&gt;odata-server-api&lt;/artifactId&gt;
+  &lt;version&gt;${olingo.version}&lt;/version&gt;
+  &lt;scope&gt;compile&lt;/scope&gt;
+&lt;/dependency&gt;
+&lt;dependency&gt;
+  &lt;groupId&gt;org.apache.olingo&lt;/groupId&gt;
+  &lt;artifactId&gt;odata-server-core&lt;/artifactId&gt;
+  &lt;version&gt;${olingo.version}&lt;/version&gt;
+  &lt;scope&gt;runtime&lt;/scope&gt;
+&lt;/dependency&gt;</code></p>
+<h5 id="odata-client-dependencies_1">OData Client Dependencies</h5>
+<p>For realization of <em>OData-Server</em> projects additional dependencies are necessary:</p>
+<p><code>xml
+&lt;dependency&gt;
+ &lt;groupId&gt;org.apache.olingo&lt;/groupId&gt;
+ &lt;artifactId&gt;odata-server-api&lt;/artifactId&gt;
+ &lt;version&gt;${olingo.version}&lt;/version&gt;
+ &lt;scope&gt;compile&lt;/scope&gt;
+&lt;/dependency&gt;
+&lt;dependency&gt;
+ &lt;groupId&gt;org.apache.olingo&lt;/groupId&gt;
+ &lt;artifactId&gt;odata-server-core&lt;/artifactId&gt;
+ &lt;version&gt;${olingo.version}&lt;/version&gt;
+ &lt;scope&gt;runtime&lt;/scope&gt;
+&lt;/dependency&gt;</code></p>
+<p>Whereas the variable <code>${olingo.version}</code> has to be replaced with the concrete version of the library.<br />
+See also:</p>
+<ul>
+<li><a href="/doc/odata4/download.html">Download Page</a></li>
+<li><a href="http://search.maven.org/#search|ga|1|org.apache.olingo">Maven Central</a></li>
+</ul><div align="center">
+<p>Copyright © 2013-2014, The Apache Software Foundation<br>
+				                Apache Olingo, Olingo, Apache, the Apache feather, and
+				the Apache Olingo project logo are trademarks of the Apache Software
+				Foundation.</p>
+        <small><a href="/doc/odata2/privacy.html">Privacy</a></small>
+      </div>
+    </div><!-- /container -->
+    <!-- Bootstrap core JavaScript
+    ================================================== -->
+    <!-- Placed at the end of the document so the pages load faster -->
+    <script src="/js/jquery.js" type="text/javascript">
+</script>
+	  <script src="/js/bootstrap.js" type="text/javascript">
+	  <script src="/js/offcanvas.js" type="text/javascript">
+</script>
+        <!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
+        <script>
+            (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
+            function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
+            e=o.createElement(i);r=o.getElementsByTagName(i)[0];
+            e.src='//www.google-analytics.com/analytics.js';
+            r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
+            ga('create','UA-44963757-1');ga('send','pageview');
+        </script>
+  </body>
+</html>



Mime
View raw message