This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Architectural Interface to support dynamic Data source(s) (Java)

 
Ranch Hand
Posts: 88
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All. Need you brilliant suggestion(s)/design model(s) on this following problem statement please:

Suppose there are various data sources such as internal DB(s) as well as outside/3rd party corporations such as Google, Facebook, Amazon etc. Each of these Data sources may or may not have any common way to publish their data to the vendor(s). And what I ment by that is, may be the vendor needs to consume RESTful services to fetch/collect the data from those sources and/or may have to run SQL Query to get the required data set/resultset at the same time.

Moreover, these list of internal and external data sources (DB instances, Google, Facebook, Amazon etc) also may change (add or delete) in future as needed.

Now, I am working on the Vendor side My task is to propose an API (sort of) which will communicate all those various sources (as needed) and make the date available in such a way that Middle layer (business layer)/UI developers will not have to worry about various Data sources/Data type at any given time (means let's say, in all cases they will just receive data in JSON format, and that all for them to play with).

Please advise me about the available/best technology or the best design architecture which I should follow to create such a dynamic layer (sort of DAO layer) to support this above problem statement.

I will really appreciate your thoughts and suggestions. And Thank you so much.
 
Saloon Keeper
Posts: 14079
319
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm a big fan of creating repository interfaces. You create an interface that's responsible for CRUD operations for some type of object. For instance, a repository of employees:

Any dependent classes in your business layer then just request an instance of a repository through their constructor:

An example application could instantiate concrete repository implementations and passes them to the classes that need them:

The neatest option is to use some kind of dependency injection framework to handle the life-cycle of your dependencies. Instead of a main class that creates concrete instances of your dependencies, you configure the framework to inject them when needed. An example of such a framework is Spring Framework.
 
Faisal Fuad
Ranch Hand
Posts: 88
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much Stephan!
reply
    Bookmark Topic Watch Topic
  • New Topic