My problem is quite complex to explain and my English is not excellent, so I hope you can understand my question.
In a service oriented architecture there are some modules that own data used by all the others applications end these modules expose the data via Remote Method Invocation and Web Services.
We the developers of the module have seen that the code that invokes these modules is repeated in all the other modules, so we decided to put in common the code and created a new module named Common Delegates. The responsabilities of this new module are:
- keep informations about the hostname, port and JNDI and/or web service names;
- instantiate and use the service locator;
- instantiate and call the stubs to the remote modules.
But the methods exposed by the Common Delegates modules use the same Request and Response classes that are defined in the called modules. This means that this module does not act as a layer of decoupling.
In some cases this module created problems of circular dependencies during maven builds.
Is it a good thing to split the Common Delegates module into many different Maven artifacts to avoid circular dependencies, one for the called module? For example if I need to call via RMI the module A, I will have to use the Module A delegate.
Is it a good thing to make this delegates to be also a decoupling layer, meaning that they will expose their own Request and Response beans and transform them into the beans used by the called methods?