samedi 31 décembre 2016

best design for retrieving os dependent beans

I'm developing a module to configure network interfaces (changing ip and hostname). Because the operations are OS dependent, there are os dependent beans for this purpose (like NetworkConfigLinuxImpl) and a factory which based on the OS creates the proper bean.These beans should execute some Commands on operating system with a processDao which (again) has implementation for every Operating System ( like processDaoLinuxIml) and again a factory to create the proper dao (which would be called in NetworkConfig Bean that already the OS type been evaluated to instantiate that). This does not seem to be a good design and has redundancy: Two factories (ProcessDaoFactory, NetworkConfigFactory) are creating os dependent beans based on a same logic. Any better idea?

Aucun commentaire:

Enregistrer un commentaire