Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Olingo Wiki" for change 
notification.

The "Documentation/AnnotationProcessor" page has been changed by MichaelBolz:
https://wiki.apache.org/Olingo/Documentation/AnnotationProcessor?action=diff&rev1=3&rev2=4

  Based on these annotation then the {{{edmx}}} document ({{{$metadata}}}) can 
be generated as well as a generic {{{Processor}}} ({{{ODataSingleProcessor}}}) 
for e.g. {{{JSON}}} can be written.
  This feature will fill the gap between the currently existing JPA processor 
extension (which allows easy connection to a database with JPA annotations) and 
the need to do a full implementation of an Processor (ODataSingleProcessor).
  
- As initial contribution and starting point for discussions about this feature 
on the issue [OLINGO-32|https://issues.apache.org/jira/browse/OLINGO-32] was 
created and a feature branch with name {{{PocEdmAnnotationsExtension}}} 
([link|https://git-wip-us.apache.org/repos/asf?p=incubator-olingo-odata2.git;a=shortlog;h=refs/heads/PocEdmAnnotationsExtension]
 and commit id: {{{ae0d7d14161d4da7ff05492566bec7e66425c168}}}) was created 
with a basic _Proof of Concept_.
+ As initial contribution and starting point for discussions about this feature 
on the issue [OLINGO-32|https://issues.apache.org/jira/browse/OLINGO-32] was 
created and a feature branch with name {{{PocEdmAnnotationsExtension}}} 
([link|https://git-wip-us.apache.org/repos/asf?p=incubator-olingo-odata2.git;a=shortlog;h=refs/heads/PocEdmAnnotationsExtension]
 and commit id: {{{ae0d7d14161d4da7ff05492566bec7e66425c168}}}) was created 
with a basic ''Proof of Concept''.
  
  = Concept =
  
- Following submodules were created within the Apache Olingo project for 
realization of this _PoC_:
+ Following submodules were created within the Apache Olingo project for 
realization of this ''PoC'':
   * {{{annotation-processor-api}}}: API/Interfaces
   * {{{annotation-processor-core}}}: Implementation
   * {{{annotation-processor-ref}}}: Reference Scenario/Integration Tests
@@ -32, +32 @@

    * {{{EdmComplexType}}}: for definition of a complex entity class which can 
be used as complex property.
     * {{{String  name() default ""}}}: optional name for entity type. If not 
set class name is used.
     * {{{String  namespace() default ""}}}: 
-   * {{{EdmKey}}}: marker annotation for property which is used as 
_KeyProperty_
+   * {{{EdmKey}}}: marker annotation for property which is used as 
''KeyProperty''
    * {{{EdmProperty}}}: for definition of a property within an entity class
     * {{{String name() default ""}}}: 
     * {{{EdmType type() default EdmType.Null}}}: type of the property. If not 
set the type is guessed based on field type.
     * {{{EdmFacets facets() default @EdmFacets}}}: 
    * {{{EdmNavigationProperty}}}: 
-    * {{{String name() default ""}}}: used property name for _Navigation 
property_
+    * {{{String name() default ""}}}: used property name for ''Navigation 
property''
-    * {{{String association() default ""}}}: used association name for 
_Navigation property_
+    * {{{String association() default ""}}}: used association name for 
''Navigation property''
     * {{{String toRole() default ""}}}: target role name of this navigation
     * {{{String toType() default Object.class;}}}: class which provides an 
entity type (name) as target of this navigation
     * {{{Multiplicity toMultiplicity() default Multiplicity.ONE;}}}: 
multiplicity to target of this navigation
-   * {{{EdmType}}}: The EdmTypes which can be used for property definition in 
the EDM. The available values are based on {{{EdmSimpleTypeKind}}} values as 
defined in _OData_ with the additional type {{{COMPLEX}}} which can be used to 
explicit define a EdmProperty as complex.
+   * {{{EdmType}}}: The EdmTypes which can be used for property definition in 
the EDM. The available values are based on {{{EdmSimpleTypeKind}}} values as 
defined in ''OData'' with the additional type {{{COMPLEX}}} which can be used 
to explicit define a EdmProperty as complex.
-   * {{{EdmMediaResourceContent}}}: Annotation for definition of an 
{{{EdmProperty}}} as _media resource content_ for the according 
{{{EntityType}}} which contains the {{{EdmProperty}}}. Additionally an 
{{{EdmEntityType}}} will be flagged in the EDM as _hasStream == true_ if an 
{{{EdmProperty}}} in conjunction with the {{{EdmMediaResourceContent}}} 
annotation is defined.
+   * {{{EdmMediaResourceContent}}}: Annotation for definition of an 
{{{EdmProperty}}} as ''media resource content'' for the according 
{{{EntityType}}} which contains the {{{EdmProperty}}}. Additionally an 
{{{EdmEntityType}}} will be flagged in the EDM as ''hasStream == true'' if an 
{{{EdmProperty}}} in conjunction with the {{{EdmMediaResourceContent}}} 
annotation is defined.
-   * {{{EdmMediaResourceMimeType}}}: Annotation for definition of an 
{{{EdmProperty}}} as _mime type for the media resource_ of the 
{{{EdmEntityType}}} which contains the {{{EdmProperty}}}. The value of the 
{{{EdmMediaResourceMimeType}}} annotated field will be used as _Content-Type_ 
of the media content response (of an OData _$value_ request).
+   * {{{EdmMediaResourceMimeType}}}: Annotation for definition of an 
{{{EdmProperty}}} as ''mime type for the media resource'' of the 
{{{EdmEntityType}}} which contains the {{{EdmProperty}}}. The value of the 
{{{EdmMediaResourceMimeType}}} annotated field will be used as ''Content-Type'' 
of the media content response (of an OData ''$value'' request).
-   * {{{EdmMediaResourceSource}}}: Annotation for definition of an 
{{{EdmProperty}}} as _media resource source_ for the {{{EdmEntityType}}} which 
contains the {{{EdmProperty}}}. 
+   * {{{EdmMediaResourceSource}}}: Annotation for definition of an 
{{{EdmProperty}}} as ''media resource source'' for the {{{EdmEntityType}}} 
which contains the {{{EdmProperty}}}. 
    * {{{EdmFunctionImport}}}: Annotation for definition of an method as an 
{{{EdmFunctionImport}}} call/endpoint
     * {{{String name() default "";}}}: 
     * {{{String entitySet() default "";}}}: 
@@ -94, +94 @@

  
  === DataSourceProcessor ===
  
- {{{
+ {{{#!java
  /**
   * Abstract class for implementation of the centralized parts of OData 
processing,
   * allowing to use the simplified {@link DataSource} and {@link ValueAccess} 
for the
@@ -125, +125 @@

  
  === DataSource ===
  
- {{{
+ {{{#!java
  public interface DataSource {
  
    /**
@@ -258, +258 @@

  
  === ValueAccess ===
  
- {{{
+ {{{#!java
  /**
   * This interface is intended to access values in a Java object.
   */
@@ -319, +319 @@

  
  ===== Model POJOs =====
  ====== Base Entity: ======
- {{{
+ {{{#!java
  /**
   *
   */
@@ -350, +350 @@

  }}}
  
  ====== Team Entity: ======
- {{{
+ {{{#!java
  @EdmEntityType(name = "Team")
  @EdmEntitySet(name = "Teams")
  public class Team extends RefBase {
@@ -395, +395 @@

  
  
  ====== Building Entity: ======
- {{{
+ {{{#!java
  @EdmEntityType(name = "Building")
  @EdmEntitySet(name = "Buildings")
  public class Building {
@@ -459, +459 @@

  ====== AnnotationInMemoryDs (implements DataSource) ======
  
  Code snippet for read data access:
+ {{{#!java
- 
- {{{
  public class AnnotationInMemoryDs implements DataSource {
  
    private static final AnnotationHelper ANNOTATION_HELPER = new 
AnnotationHelper();
@@ -549, +548 @@

  ====== Generic DataStore ======
  
  Code snippet for generic {{{DataStore}}} (important public method parts)
- {{{
+ {{{#!java
  public class DataStore<T> {
  
    private static final AnnotationHelper ANNOTATION_HELPER = new 
AnnotationHelper();
@@ -662, +661 @@

  
  Code snippet of {{{createService}}} method implementation in which the 
{{{AnnotationServiceFactory.createAnnotationService(String modelPackage)}}} is 
used. In this sample the resulting {{{ODataService}}} is hold as a static 
instance (singleton) to get an persistent service between several calls.
  
- {{{
+ {{{#!java
  public class AnnotationSampleServiceFactory extends ODataServiceFactory {
  
    /**
@@ -691, +690 @@

    }
  }}}
  
- Code snippet of {{{createAnnotationService}}} method implementation in which 
the combination of {{{EdmProvider}}} and {{{ODataSingleProcessor}}} are created 
for the _Annotation_ with the {{{AnnotationEdmProvider}}} and the 
{{{ListsProcessor}}} which uses the {{{AnnotationInMemoryDs}}} and 
{{{AnnotationValueAccess}}} via the 
{{{RuntimeDelegate.createODataSingleProcessorService(...)}}} method.
+ Code snippet of {{{createAnnotationService}}} method implementation in which 
the combination of {{{EdmProvider}}} and {{{ODataSingleProcessor}}} are created 
for the ''Annotation'' with the {{{AnnotationEdmProvider}}} and the 
{{{ListsProcessor}}} which uses the {{{AnnotationInMemoryDs}}} and 
{{{AnnotationValueAccess}}} via the 
{{{RuntimeDelegate.createODataSingleProcessorService(...)}}} method.
  
- {{{
+ {{{#!java
    public ODataService createAnnotationService(String modelPackage) throws 
ODataException {
      AnnotationEdmProvider edmProvider = new 
AnnotationEdmProvider(modelPackage);
      AnnotationInMemoryDs dataSource = new AnnotationInMemoryDs(modelPackage);
@@ -708, +707 @@

  
  ====== AnnotationPocServiceFactory as ODataServiceFactory implementation 
======
  
- Code snippet of {{{createService}}} method implementation in which the 
combination of {{{EdmProvider}}} and {{{ODataSingleProcessor}}} are created for 
the _Annotation_ with the {{{AnnotationEdmProvider}}} and the 
{{{ListsProcessor}}} which uses the {{{AnnotationInMemoryDs}}} and 
{{{AnnotationValueAccess}}}.
+ Code snippet of {{{createService}}} method implementation in which the 
combination of {{{EdmProvider}}} and {{{ODataSingleProcessor}}} are created for 
the ''Annotation'' with the {{{AnnotationEdmProvider}}} and the 
{{{ListsProcessor}}} which uses the {{{AnnotationInMemoryDs}}} and 
{{{AnnotationValueAccess}}}.
  
+ {{{#!java
- {{{
-   @Override
    public ODataService createService(final ODataContext context) throws 
ODataException {
  
      String modelPackage = "org.apache.olingo.odata2.ref.annotation.model";
@@ -731, +729 @@

  }}}
  
  == Sample project via Maven Archetype ==
- With release of _Apache Olingo 1.1.0_ a Maven Archetype will be available to 
generate a sample project with a model and a {{{ODataServiceFactory}}} 
implementation which uses the {{{AnnotationServiceFactory}}} for creation of 
the {{{ODataService}}} with annotation support.
+ With release of ''Apache Olingo 1.1.0'' a Maven Archetype will be available 
to generate a sample project with a model and a {{{ODataServiceFactory}}} 
implementation which uses the {{{AnnotationServiceFactory}}} for creation of 
the {{{ODataService}}} with annotation support.
  
  To generate this sample project run maven with:
  {{{
@@ -753, +751 @@

  == Basic tutorial ==
  
  As basic tutorial the current recommendation is to take a look into the 
{{{Apache Olingo}}} project in the sub module 
{{{olingo-odata2-edm-annotation-webref}}} in package 
{{{org.apache.olingo.odata2.ref.annotation}}} and below.
- In the package {{{org.apache.olingo.odata2.ref.annotation.model}}} and below 
is the _model_ defined and in package 
{{{org.apache.olingo.odata2.ref.annotation.processor}}} and below is the 
_service factory_.
+ In the package {{{org.apache.olingo.odata2.ref.annotation.model}}} and below 
is the ''model'' defined and in package 
{{{org.apache.olingo.odata2.ref.annotation.processor}}} and below is the 
''service factory''.
  All around is mainly necessary to package all into a deployable {{{WAR}}} 
file.
  

Reply via email to