• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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: 15510
363
  • 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!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic