You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by bu...@apache.org on 2014/01/22 14:22:50 UTC

svn commit: r895096 - in /websites/staging/olingo/trunk/content: ./ doc/tutorials/AnnotationProcessorExtension.html

Author: buildbot
Date: Wed Jan 22 13:22:50 2014
New Revision: 895096

Log:
Staging update by buildbot for olingo

Modified:
    websites/staging/olingo/trunk/content/   (props changed)
    websites/staging/olingo/trunk/content/doc/tutorials/AnnotationProcessorExtension.html

Propchange: websites/staging/olingo/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Jan 22 13:22:50 2014
@@ -1 +1 @@
-1560345
+1560346

Modified: websites/staging/olingo/trunk/content/doc/tutorials/AnnotationProcessorExtension.html
==============================================================================
--- websites/staging/olingo/trunk/content/doc/tutorials/AnnotationProcessorExtension.html (original)
+++ websites/staging/olingo/trunk/content/doc/tutorials/AnnotationProcessorExtension.html Wed Jan 22 13:22:50 2014
@@ -73,26 +73,26 @@
             
             
             <h1 id="creating-a-web-application-with-the-annotation-processor-extension">Creating a Web Application with the Annotation Processor Extension</h1>
-<h2 id="shortcut-creation-via-archetype">Shortcut: Creation via Archetype</h2>
+<h3 id="shortcut-creation-via-archetype">Shortcut: Creation via Archetype</h3>
 <p>As a shortcut it is possible to create a sample project which use the Annotation Processor Extension via a Maven Archetype. 
 Therefore Maven must be called as shown below:</p>
-<div class="codehilite"><pre><span class="n">mvn</span> <span class="n">archetype</span><span class="p">:</span><span class="n">generate</span> 
-  <span class="o">-</span><span class="n">DinteractiveMode</span><span class="p">=</span><span class="n">false</span>
-  <span class="o">-</span><span class="n">Dversion</span><span class="p">=</span>1<span class="p">.</span>0<span class="p">.</span>0<span class="o">-</span><span class="n">SNAPSHOT</span> 
-  <span class="o">-</span><span class="n">DgroupId</span><span class="p">=</span><span class="n">com</span><span class="p">.</span><span class="n">sample</span>
-  <span class="o">-</span><span class="n">DartifactId</span><span class="p">=</span><span class="n">my</span><span class="o">-</span><span class="n">car</span><span class="o">-</span><span class="n">service</span> 
-  <span class="o">-</span><span class="n">DarchetypeGroupId</span><span class="p">=</span><span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span> 
-  <span class="o">-</span><span class="n">DarchetypeArtifactId</span><span class="p">=</span><span class="n">olingo</span><span class="o">-</span><span class="n">odata2</span><span class="o">-</span><span class="n">sample</span><span class="o">-</span><span class="n">cars</span><span class="o">-</span><span class="n">annotation</span><span class="o">-</span><span class="n">archetype</span><span class="o">-</span><span class="n">incubating</span> 
+<div class="codehilite"><pre><span class="n">mvn</span> <span class="n">archetype</span><span class="p">:</span><span class="n">generate</span> <span class="o">\</span>
+  <span class="o">-</span><span class="n">DinteractiveMode</span><span class="p">=</span><span class="n">false</span> <span class="o">\</span>
+  <span class="o">-</span><span class="n">Dversion</span><span class="p">=</span>1<span class="p">.</span>0<span class="p">.</span>0<span class="o">-</span><span class="n">SNAPSHOT</span> <span class="o">\</span>
+  <span class="o">-</span><span class="n">DgroupId</span><span class="p">=</span><span class="n">com</span><span class="p">.</span><span class="n">sample</span> <span class="o">\</span>
+  <span class="o">-</span><span class="n">DartifactId</span><span class="p">=</span><span class="n">my</span><span class="o">-</span><span class="n">car</span><span class="o">-</span><span class="n">service</span> <span class="o">\</span>
+  <span class="o">-</span><span class="n">DarchetypeGroupId</span><span class="p">=</span><span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">olingo</span> <span class="o">\</span>
+  <span class="o">-</span><span class="n">DarchetypeArtifactId</span><span class="p">=</span><span class="n">olingo</span><span class="o">-</span><span class="n">odata2</span><span class="o">-</span><span class="n">sample</span><span class="o">-</span><span class="n">cars</span><span class="o">-</span><span class="n">annotation</span><span class="o">-</span><span class="n">archetype</span><span class="o">-</span><span class="n">incubating</span> <span class="o">\</span>
   <span class="o">-</span><span class="n">DarchetypeVersion</span><span class="p">=</span>1<span class="p">.</span>1<span class="p">.</span>0
 </pre></div>
 
 
 <p>In the generated sample project you now can simply run Maven with the default goal (run <code>mvn</code> in the shell) which compiles the sources and starts an Jetty web server at <code>http://localhost:8080</code>.</p>
 <p>For more detailed documentation about Archetypes in Olingo take a look into the <a href="/doc/sample-setup">sample setup</a> section.</p>
-<h2 id="creation-from-scratch">Creation from Scratch</h2>
+<h3 id="creation-from-scratch">Creation from Scratch</h3>
 <p>A project which use the Annotation Processor Extension consists mainly of the model beans, the <code>ODataServiceFactory</code> implementation and the web resources (e.g. <code>web.xml</code>). 
 In addition we use Maven so that it is necessary to create a <code>pom.xml</code> for project build information and dependency resolution.</p>
-<h3 id="creation-of-module">Creation of Module</h3>
+<h5 id="create-maven-project-structure">Create Maven Project structure</h5>
 <p>To start a folder is created (e.g. <em>annotation-from-scratch</em>) which contains the Maven project.
 Within this the default Maven project structure is used, which looks like:</p>
 <div class="codehilite"><pre><span class="o">./</span><span class="n">src</span><span class="o">/</span><span class="n">main</span><span class="o">/</span><span class="n">java</span> 
@@ -101,7 +101,7 @@ Within this the default Maven project st
 </pre></div>
 
 
-<h3 id="create-pomxml">Create pom.xml</h3>
+<h5 id="create-maven-pomxml">Create  Maven pom.xml</h5>
 <p>After creation of the project structure the default <code>pom.xml</code> for building of an <code>WAR-File</code> have to be created.
 In addition we need the dependency to all necessary <em>Apache Olingo artifacts</em> and to the used <code>JAX-RS</code> implementation which in this sample is <code>Apache CXF</code>.</p>
 <p>The resulting <code>pom.xml</code> then looks like:</p>
@@ -181,12 +181,12 @@ In addition we need the dependency to al
 </pre></div>
 
 
-<h3 id="create-model">Create Model</h3>
+<h5 id="create-sample-entity-model">Create Sample (Entity) Model</h5>
 <p>For this sample a simple model with the two entities <em>Manufacturer</em> and <em>Car</em> is created.</p>
 <p>The <em>Manufacturer</em> consists of an <code>Id</code>, <code>Name</code>, <code>Founded</code> and a relation to a list of its <code>Cars</code>.<br />
 The <em>Car</em> consists of an <code>Id</code>, <code>Model</code>, <code>ProductionYear</code>, <code>Price</code> and a relation to its <code>Manufacturer</code>.</p>
-<h4 id="create-java-beans-for-entities">Create Java Beans for Entities</h4>
-<p>For each of both entities first a java bean (<em>POJO</em>) is created in the package <code>org.apache.olingo.sample.annotation.model</code> (which results in a created folder <code>src/main/java/org/apache/olingo/sample/annotation/model/</code>) which looks like:</p>
+<p><strong>Create Java Beans for Entities</strong>
+For each of both entities first a java bean (<em>POJO</em>) is created in the package <code>org.apache.olingo.sample.annotation.model</code> (which results in a created folder <code>src/main/java/org/apache/olingo/sample/annotation/model/</code>) which looks like:</p>
 <div class="codehilite"><pre><span class="kn">package</span> <span class="n">org</span><span class="o">.</span><span class="na">apache</span><span class="o">.</span><span class="na">olingo</span><span class="o">.</span><span class="na">sample</span><span class="o">.</span><span class="na">annotation</span><span class="o">.</span><span class="na">model</span><span class="o">;</span>
 
 <span class="cm">/** required Imports */</span>
@@ -219,8 +219,8 @@ The <em>Car</em> consists of an <code>Id
 </pre></div>
 
 
-<h4 id="annotated-created-java-beans">Annotated created Java Beans</h4>
-<p>Now those beans have to be annotated with the annotations of the <em>Annotation Processor Extension</em>.</p>
+<p><strong>Annotated created Java Beans</strong>
+Now those beans have to be annotated with the annotations of the <em>Annotation Processor Extension</em>.</p>
 <p>Both beans needs at first the <code>@EdmEntityType</code> and <code>@EdmEntitySet</code> annotation to define that they represent an OData Entity. These annotation must be added at the bean class which as example for the <em>Manufacturer</em> then look like:</p>
 <div class="codehilite"><pre><span class="nd">@EdmEntityType</span>
 <span class="nd">@EdmEntitySet</span>
@@ -311,7 +311,7 @@ The <em>Car</em> consists of an <code>Id
 
 
 <p>The next step is to create the <code>ODataService</code>.</p>
-<h3 id="create-odataservice">Create ODataService</h3>
+<h5 id="create-odataservice">Create ODataService</h5>
 <p>The <code>ODataService</code> is created via an <code>ODataServiceFactory</code> implementation.
 For the sample a <code>AnnotationSampleServiceFactory</code> in the package <code>org.apache.olingo.sample.annotation.processor</code> (which results in a created folder <code>src/main/java/org/apache/olingo/sample/annotation/processor/</code>) is created which  extends the <code>ODataServiceFactory</code>. The resulting code look like:</p>
 <div class="codehilite"><pre><span class="kn">package</span> <span class="n">org</span><span class="o">.</span><span class="na">apache</span><span class="o">.</span><span class="na">olingo</span><span class="o">.</span><span class="na">sample</span><span class="o">.</span><span class="na">annotation</span><span class="o">.</span><span class="na">processor</span><span class="o">;</span>
@@ -368,7 +368,7 @@ The <em>Annotation Processor Extension</
 
 <p>Now the model as well as the service creation is done.
 The next step is to provide the necessary resources to run the application within an application server. </p>
-<h3 id="create-web-application-resources">Create Web Application resources</h3>
+<h5 id="create-web-application-resources">Create Web Application resources</h5>
 <p>To deploy and run the application on an application server it is necessary to provide a <code>web.xml</code> which defines the <code>JAX-RS</code> entry point which then calls the sample application.</p>
 <p>For this sample <code>Apache CXF</code> is used (see <code>&lt;servlet-class&gt;org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet&lt;/servlet-class&gt;</code>) which need as parameter the <code>javax.ws.rs.Application</code> and the <code>org.apache.olingo.odata2.service.factory</code>.</p>
 <p>Therefore the <code>web.xml</code> is created in the <code>src/main/webapp/WEB-INF</code> folder with following content:</p>
@@ -399,7 +399,7 @@ The next step is to provide the necessar
 </pre></div>
 
 
-<h3 id="deploy-and-run">Deploy and Run</h3>
+<h5 id="deploy-and-run">Deploy and Run</h5>
 <p>Build the project with maven via <code>mvm clean package</code> and copy the resulting <code>WAR-File</code> from the projects <code>target</code> folder in the <code>deploy</code> folder of the web application server (e.g. a <a href="http://tomcat.apache.org/">Tomcat</a>).
 As example for a default Tomcat 7.x installation <code>cp $PROJECT_HOME/target/cars-annotations-sample.war $TOMCAT_HOME/webapps</code>.</p>
 <p>After starting the web application server it is possible to request e.g.
@@ -408,7 +408,7 @@ As example for a default Tomcat 7.x inst
   * the <em>Cars</em> EntitySet via the URL: <code>http://localhost:8080/cars-annotations-sample/AnnotationSample.svc/CarSet</code>
   * the <em>Manufacturer</em> EntitySet via the URL: <code>http://localhost:8080/cars-annotations-sample/AnnotationSample.svc/ManufacturerSet</code></p>
 <p>Also it is possible to create <em>Car</em> and <em>Manufacturer</em> Entities via <code>HTTP POST</code> requests.</p>
-<h2 id="more-detailed-look">More detailed look</h2>
+<h3 id="more-detailed-look">More detailed look</h3>
 <p>A more detailed look into the Annotation Processor Extension can be found in the <a href="https://wiki.apache.org/Olingo/Documentation/AnnotationProcessor">wiki</a>.</p>