Currently, the architecture of my application is as follows:
View β Host β Some asynchronous executor β DAOFactory β DAO (interface) β DAO (Impl)
Such an architecture is currently operating; mainly because at the moment I need only one kind of DAO. But as this requirement grows, I need to expand to several DAOs, each of which has its own implementation on how to obtain data.
Here is an illustration of my case:

The main headache comes from FooCloudDao , which loads data from the API. This API requires a kind of authentication method - a string character that was saved during login (say, a Session object - yes, this one also has its own DAO).
It's mysteriously simple to pass an instance of Session through FooDaoFactory , just in case there is no connection, but it seems hacky and counter-intuitive. The next thing I could imagine was to access the SessionDAOFactory from FooDaoFactory to get an instance of Session (and then pass this when I need an instance of FooCloudDao ).
But, as I said, I'm not sure if I can do something like this - well, maybe I could, but is this really the right way to do this?
source share