olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r1676515 - /olingo/site/trunk/content/doc/odata4/tutorials/read/tutorial_read.mdtext
Date Tue, 28 Apr 2015 12:36:02 GMT
Author: mibo
Date: Tue Apr 28 12:36:01 2015
New Revision: 1676515

URL: http://svn.apache.org/r1676515
Log:
CMS commit to olingo by mibo

Modified:
    olingo/site/trunk/content/doc/odata4/tutorials/read/tutorial_read.mdtext

Modified: olingo/site/trunk/content/doc/odata4/tutorials/read/tutorial_read.mdtext
URL: http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/odata4/tutorials/read/tutorial_read.mdtext?rev=1676515&r1=1676514&r2=1676515&view=diff
==============================================================================
--- olingo/site/trunk/content/doc/odata4/tutorials/read/tutorial_read.mdtext (original)
+++ olingo/site/trunk/content/doc/odata4/tutorials/read/tutorial_read.mdtext Tue Apr 28 12:36:01
2015
@@ -297,9 +297,8 @@ Here, the user can see which Entity Coll
 
 The service document can be invoked via the following URI:
 
-```html
- <serviceroot>/
-```
+    :::html
+    <serviceroot>/
 
 The information that is given by these 2 URIs, has to be implemented in the service code.
 Olingo provides API for it and we’ll use it in the implementation of our *EdmProvider.*
@@ -357,6 +356,7 @@ Let’s have a closer look at the met
 
 First, we need to declare some constants, to be used in below code
 
+    :::java
     // Service Namespace
     public static final String NAMESPACE = "com.example.model";
 
@@ -386,6 +386,7 @@ The properties: name and type and additi
 Which of the properties is the “key” property: a reference to the “ID”
property.  
 
 
+    :::java
     @Override
     public EntityType getEntityType(FullQualifiedName entityTypeName) throws ODataException
{
 
@@ -420,12 +421,13 @@ The procedure for declaring the _EntityS
 An _EntitySet_ is a crucial resource, when an OData service is used to request data.
 In our example, we’ll invoke the following URL, which we expect to provide us a list
of products:
 
+    :::html
     http://localhost:8080/DemoService/DemoServlet.svc/Products
 
 When declaring an _EntitySet_, we need to define the type of entries which are contained
in the list. Such type is an _EntityType_.
 In our example, we set our previously created _EntityType_, which is referred by a _FullQualifiedName_.
 
-
+    :::java
     @Override
     public EntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName)
throws ODataException {
 
@@ -450,6 +452,7 @@ In order to provide data, our OData serv
 In our example, we have only one _EntitySet_, so we create one _EntityContainer_ and set
our _EntitySet_.
 
 
+    :::java
     @Override
     public EntityContainer getEntityContainer() throws ODataException {
 
@@ -476,6 +479,7 @@ The schema is configured with a _Namespa
 Then our elements are added to the Schema.
 
 
+    :::java
     @Override
     public List<Schema> getSchemas() throws ODataException {
 
@@ -502,6 +506,7 @@ Then our elements are added to the Schem
 **_getEntityContainerInfo()_**
 
 
+    :::java
     @Override
     public EntityContainerInfo getEntityContainerInfo(FullQualifiedName entityContainerName)
throws ODataException {
 
@@ -524,10 +529,10 @@ At runtime of an OData service, such met
 
 In our example:
 
+    :::xml
     http://localhost:8080/DemoService/DemoService.svc/$metadata
 
-
-
+    :::xml
     <?xml version='1.0' encoding='UTF-8'?>
     <edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
       <edmx:DataServices>
@@ -550,10 +555,11 @@ In our example:
 
 The Service Document can be invoked to view the Entity Sets, like in our example at
 
+    :::html
     http://localhost:8080/DemoService/DemoService.svc/
 
 
-
+    :::json
     {
       "@odata.context" : "http://localhost:8080/DemoService/DemoService.svc/$metadata",
       "value" : [
@@ -636,6 +642,7 @@ According to the Javadoc, this object is
 We’ll need it later, so we store it as member variable.
 
 
+    :::java
     public void init(OData odata, ServiceMetadata serviceMetadata) {
     	this.odata = odata;
     }
@@ -643,7 +650,7 @@ We’ll need it later, so we store it
 
 Don’t forget to declare the member variable
 
-
+    :::java
     private OData odata;
 
 **_readEntityCollection()_**
@@ -711,6 +718,7 @@ The steps for implementating the method
   And finally we have to set the content type.
 
 
+    :::java
     public void readEntityCollection(ODataRequest request, ODataResponse response, UriInfo
uriInfo, ContentType responseFormat)
                          throws ODataApplicationException, SerializerException {
 
@@ -750,6 +758,7 @@ Since we’re supposed to deliver the
 We create the entities and their properties according to what we declared in our _ExampleEdmProvider_
class. So we have to take care to provide the correct names to the new property objects.
 
 
+    :::java
     private EntitySet getData(EdmEntitySet edmEntitySet){
 
     	EntitySet entitySet = new EntitySetImpl();
@@ -804,6 +813,7 @@ Furthermore, the _ODataHttpHandler_ need
 As such, here’s the location where our 2 implemented classes come together, the metadata
declaration and the data provisioning.
 
 
+    :::java
     // This class represents a standard HttpServlet implementation.
     // It is used as main entry point for the web application that carries the OData service.
     // The implementation of this HttpServlet simply delegates the user requests to the ODataHttpHandler
@@ -841,7 +851,7 @@ Furthermore, we need to specify the _url
 Open the _src/main/webapp/WEB-INF/web.xml_ file and paste the following content into it:
 
 
-
+    :::xml
     <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
@@ -898,11 +908,13 @@ Try the following URLs:
 
 **Service Document**
 
+    :::html
     http://localhost:8080/DemoService/DemoService.svc/
 
 The expected result is the service document which displays our _EntityContainerInfo_:
 
 
+    :::json
     {
       "@odata.context" : "http://localhost:8080/DemoService/DemoService.svc/$metadata",
       "value" : [
@@ -915,12 +927,13 @@ The expected result is the service docum
 
 **Metadata Document**
 
-
+    :::html
     http://localhost:8080/ExampleService1/ExampleService1.svc/$metadata
 
 The expected result is the metadata document that displays our _Schema_, _EntityType_, _EntityContainer_
and _EntitySet_.
 
 
+    :::xml
     <?xml version='1.0' encoding='UTF-8'?>
     <edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
       <edmx:DataServices>
@@ -943,12 +956,13 @@ The expected result is the metadata docu
 
 **Query / EntitySet**
 
-
+    :::gtml
     http://localhost:8080/DemoService/DemoService.svc/Products
 
 The expected result is the hardcoded list of product entries, which we have coded in our
processor implementation:
 
 
+    :::json
     {
       "@odata.context":"$metadata#Products","
       value":[



Mime
View raw message