I´ve been thinking about the following issue for some time and I would like to share/discuss it with anyone interested on it. Here it goes:
Besides having reusable components, we also want to be able to have reusable modules (a module being something like a security related set of components that offers user admin, audit info, etc).
Such a module could be used many times, like in a credit card processing application, a CRM system, etc). We could always wire the components of the modules in the final application, but it would be nice if we could wire the application starting from the modules themselves. So, what if we could ‘reuse’ of the modules configuration files, in the following way:
Every software module, composed of a series of components, would have the following bean configuration files, that will be loaded by the BeanFactory:
- Server.cfg.xml: this is the module core definition file. The file wires the business objects with its DAOs, resource bundles, transaction proxies, and wherever is required for running the application, without referring to external resources;
- Resource.cfg.xml: this file will define the external resources, like the database to use and the transactional managener
- Bind.cfg: this file would expose only the beans required by client applications: depending on the deployment configuration, this would be the only required configuration file to be sent with client applications (the other ones would be on the application server side, for example.)
When building the applications, we would want to merge the various server.cfg.xml and bind.cfg files from the modules and define only the resource.cfg.xml files for a given application. This way, only the external resources would have to be rewritten, and we could avoid duplicating the wiring code every time the component is deployed with a new application.
Is somebody trying any approach like this? Would anyone suggest something better or a way to enhance this?