You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2014/02/12 09:53:27 UTC
svn commit: r1567568 -
/incubator/olingo/site/trunk/content/doc/tutorials/OlingoV2BasicClientSample.mdtext
Author: mibo
Date: Wed Feb 12 08:53:27 2014
New Revision: 1567568
URL: http://svn.apache.org/r1567568
Log:
Minor restructure
Modified:
incubator/olingo/site/trunk/content/doc/tutorials/OlingoV2BasicClientSample.mdtext
Modified: incubator/olingo/site/trunk/content/doc/tutorials/OlingoV2BasicClientSample.mdtext
URL: http://svn.apache.org/viewvc/incubator/olingo/site/trunk/content/doc/tutorials/OlingoV2BasicClientSample.mdtext?rev=1567568&r1=1567567&r2=1567568&view=diff
==============================================================================
--- incubator/olingo/site/trunk/content/doc/tutorials/OlingoV2BasicClientSample.mdtext (original)
+++ incubator/olingo/site/trunk/content/doc/tutorials/OlingoV2BasicClientSample.mdtext Wed Feb 12 08:53:27 2014
@@ -23,10 +23,11 @@ Therefore it contains the main sections:
* [Client Quickstart Guide](#quickstart): Get a running sample client and server within a few minutes (Requirements at least *Java 7 Runtime* and *Maven 3*)
* [Explaining the Client](#start): The actual *How To* with explanation and sample code for following use cases:
- * [Read the Metadata](#readmetadata), [Read the Data](#readdata), [Create more Data](#createdata), [Update the Data](#updatedata) and [Delete the Data](#deletedata)
- * [Run the Client](#run)
- * [Put the parts together](#together): A explanation and sample how before build client can be used (Requirements at least *Java 7 Runtime* and *Maven 3*)
- * [Copy and Paste](#copypaste): Contains the complete sample code as *copy/paste* template (to build a Maven Project)
+ * [Read the Metadata](#readmetadata), [Read the Data](#readdata), [Create more Data](#createdata), [Update the Data](#updatedata) and [Delete the Data](#deletedata)
+ * [Run the Client](#run): After the *How To* the sample code from all samples can be put together and be executed against a Sample Service.
+ * [Put the parts together](#together): A explanation and sample how before build client can be used
+ * [Run Sample Client](#runsample): Show how to run the Sample Client against a Sample Service (Requirements at least *Java 7 Runtime* and *Maven 3*)
+ * [Copy and Paste](#copypaste): Contains the complete sample code as *copy/paste* template (to build a Maven Project)
<a name="quickstart"></a>
### Client Quickstart Guide
@@ -35,21 +36,21 @@ Therefore it just requires an installed
1. Start in some folder (e.g. `Quickstart`) which is called our `$ROOT` in the steps below.
1. Create sample Client project ([more details](#projectstructure))
- 2. Create project folder `ClientSample` (in `$ROOT`) and within create following folder structure: `./src/main/java/org/apache/olingo/sample/client` (e.g. `mkdir -p src/main/java/org/apache/olingo/sample/client/`).
- 3. In project folder (`ClientSample`) create file `pom.xml` and copy [this sample pom into](#pom).
- 4. In folder `./src/main/java/org/apache/olingo/sample/client` create file `OlingoSampleApp.java` and copy [the whole sample client into](#sampleclient).
- 5. In project folder `ClientSample` run `mvn` to build the project.
+ 2. Create project folder `ClientSample` (in `$ROOT`) and within create following folder structure: `./src/main/java/org/apache/olingo/sample/client` (e.g. `mkdir -p src/main/java/org/apache/olingo/sample/client/`).
+ 3. In project folder (`ClientSample`) create file `pom.xml` and copy [this sample pom into](#pom).
+ 4. In folder `./src/main/java/org/apache/olingo/sample/client` create file `OlingoSampleApp.java` and copy [the whole sample client into](#sampleclient).
+ 5. In project folder `ClientSample` run `mvn` to build the project.
1. Create and start sample Service ([more details](#sampleservice))
- 1. Go to `$ROOT` and create service project from archetype via
- `mvn archetype:generate \
- -DinteractiveMode=false \
- -Dversion=1.0.0-SNAPSHOT \
- -DgroupId=com.sample \
- -DartifactId=my-car-service \
- -DarchetypeGroupId=org.apache.olingo \
- -DarchetypeArtifactId=olingo-odata2-sample-cars-annotation-archetype-incubating \
+ 1. Go to `$ROOT` and create service project from archetype via
+ `mvn archetype:generate
+ -DinteractiveMode=false
+ -Dversion=1.0.0-SNAPSHOT
+ -DgroupId=com.sample
+ -DartifactId=my-car-service
+ -DarchetypeGroupId=org.apache.olingo
+ -DarchetypeArtifactId=olingo-odata2-sample-cars-annotation-archetype-incubating
-DarchetypeVersion=1.1.0`
- 3. Go into from archetype created folder `my-car-service` and just run `mvn` to start server.
+ 3. Go into from archetype created folder `my-car-service` and just run `mvn` to start server.
4. Run `OlingoSampleApp` against sample Service ([more details](#runsample))
1. Go into sample project folder (`ClientSample`) and execute sample client via `java -cp target/OlingoSampleClient.jar org.apache.olingo.sample.client.OlingoSampleApp`. This starts a *Jetty Web Server* at [http://localhost:8080](http://localhost:8080).
2. Now the result of the *read metadata*, *read/create/update/delete data* calls is printed as well as the corresponding *JSON* requests and response body. Within the following section [Explaining the Client](#start) the therefore implemented client methods are shown and explained.
@@ -440,6 +441,9 @@ The `logRawContent(...)` (in combination
<a name="run"></a>
### Run the sample
+To show a sample how a client can look like and how it than can be used the code samples can be copied into an `OlingoSampleApp` class.
+And to show an use case the `main` method below can be added which calls this `OlingoSampleApp` to *read* the *EDM*, *read* a *ODataFeed* and existing *ODataEntry*, *create* a new *ODataEntry*, *update* this *ODataEntry* and at last *delete* the *ODataEntry*.
+Between the interaction with the `OlingoSampleApp` the results are printend via the `print(...)` and `prettyPrint(...)`' methods.
<a name="together"></a>
##### Put the parts together
@@ -448,8 +452,6 @@ The `logRawContent(...)` (in combination
Instead of copy and paste all code samples from above and the main sample method below in section [Copy and Paste](#copypaste) is the whole sample code as `OlingoSampleApp.java` available ([here](#sampleclient)) as well as a `pom.xml` ([here](#pom)) to set up a maven project which all necessary build information. Only requirements are an installed *Java 7 Runtime* and *Maven 3* environment.
-**Missing methods**
-
**Main sample method**
:::java
@@ -557,11 +559,7 @@ The `print` methods are only for simplif
<a name="sampleservice"></a>
##### Sample Service
-To show a sample how a client can look like and how it than can be used the code samples can be copied into an `OlingoSampleApp` class.
-And to show an use case the below `main` method can be added which calls this `OlingoSampleApp` to *read* the *EDM*, *read* a *ODataFeed* and existing *ODataEntry*, *create* a new *ODataEntry*, *update* this *ODataEntry* and at last *delete* the *ODataEntry*.
-Between the interaction with the `OlingoSampleApp` the results are printend via the `print(...)` and `prettyPrint(...)`' methods.
-
-That this sample `main` method work it is necessary that an OData Service with corresponding *Data Model (EDM)* is available at the `service url` defined in the `main` method (which is in the sample `http://localhost:8080/MyFormula.svc`).
+That the sample Clients `main` method generates real output it is necessary that an OData Service with corresponding *Data Model (EDM)* is available at the `service url` defined in the `main` method (which is in the sample `http://localhost:8080/MyFormula.svc`).
This can easily achieved if the Apache Olingo archetype (with id: `olingo-odata2-sample-cars-annotation-archetype-incubating`) is used.
To use the archtype and create this sample project Maven must be called as shown below:
@@ -578,6 +576,14 @@ In the generated sample project you now
For more detailed documentation on how to use this archetype take a look into the documentation about Archetypes in Olingo in the [sample setup](/doc/sample-setup) section.
+<a name="runsample"></a>
+##### Run command
+
+Must be run from project root directory after build with Maven (`mvn`).
+
+ java -cp target/OlingoSampleClient.jar org.apache.olingo.sample.client.OlingoSampleApp
+
+
<a name="projectstructure"></a>
##### Project structure
@@ -592,13 +598,6 @@ Then run `mvn` to build the project.
After successfull build the sample client (i.e. its `main`) can be executed via `java -cp target/OlingoSampleClient.jar org.apache.olingo.sample.client.OlingoSampleApp`.
If the corresponding OData Service based on the *archetypeArtifactId=olingo-odata2-sample-cars-annotation-archetype-incubating* (see Olingo Annotation Archetype) is running on [http://localhost:8080/MyFormula.svc](http://localhost:8080/MyFormula.svc) the sample work and log some information to the console.
-<a name="runsample"></a>
-##### Run command
-
-Must be run from project root directory after build with Maven (`mvn`).
-
- java -cp target/OlingoSampleClient.jar org.apache.olingo.sample.client.OlingoSampleApp
-
<a name="copypaste"></a>
##### Copy and Paste