Search code examples
javaodataolingo

OData Olingo (API-) wrapper for different systems


Introduction

I want to set up a Olingo oData service (2.0, Java). The service has a fixed model defintion in its own package. I also have an User management in Java. When the user sends a request to the Service, the result metadata stays the same (model), but the data can come from from different systems.

That means:

  • User "John" receives data from System1
  • User "Adam" receives data from System2

Problem

What is the best practice to archieve such a system of "API-Wrapper" for different services? There can be a system (System1) that can also work with OData, so we only "forward" the request? On the other system (System2) there is a "special API" I must build with raw GET parameters, handle filters, and and and.

Is this possbile with Olingo? Is it possible to forward batch requests to System1? And System2 has its own implementation of batch requests?

More infos: I am working with SAP HANA Cloud Platform and want to work with different backend systems.


Solution

  • I see no problem with this scenario. You will just have to send requests from your Java app to your different systems based on the logged in user, then parse the data and send it back to the user.

    It shouldn't be an issue to forward your OData requests to System1, and create a specific GET request for calls to System2, either.

    You will have to do quite a this manually (there's no magic method for forwarding an incoming request to another OData service), but it should be very much doable.

    I am in fact doing something similar on HCP as well (my OData service has two datasources, one being a database, the other a remote system with which I communicate using web services).

    Update: you will probably need to expose your OData service with JDBC for flexibility. JPA is very much bound to the database objects.