samedi 21 mai 2016

OOP Design for a system for reading data from different sources and send it to different destinations

I am working on programming a java software that will be like a middleware for gathering data from different sources then process the data and send it to different destinations.

The data sources and destinations includes: files, database, TCP, HTTP.

The user will be able to create a channels, each channel will have one data source (file reader, database reader, tcp listener) and one or many data destinations (file writer, database writer, tcp sender).

channel diagram

The application will work as following:

  1. Read Channels from database.
  2. For each channel create the data source and its destinations.
  3. Start the data sources to read data.

What comes in my mind is:

  • Sources and destinations are represented as following: enter image description here
  • The channel is a container which will be injected by a source and a list of destinations. So the channel is like a facade pattern
  • The data processor in the channel will be connected to the destinations using observer pattern
  • At run time, when the application will load the channel list from the database, i will use the factory pattern to create the sources and destinations.

So, is this the best way to represents the channels, sources and destinations? I think sources and destinations have a similarities, for example, FileReader and FileWriter classes will be the same except that one will be for reading and the other for writing, is it good to represent each of them as a separate class?

Aucun commentaire:

Enregistrer un commentaire