Type: New Feature
Affects Version/s: 3.0-HEAD
Fix Version/s: None
Number of attachments :
Copied from a mail fro Dylan Etkin [email@example.com] to firstname.lastname@example.org on 12.05.2003.
I am a developer at the CSIR in South Africa. A small group of us have been given funding to produce an opensource code generator that will do what middlegen does except for a Torque, Turbine, Velocity solution. We would like to use middlegen to do this so that our plugins can inter-operate with other existing plugins (such as your ejb, hibernate, struts, etc).
After examining the source and the dev list we saw that at the moment the Action Layer plugins (struts) are written to directly depend on a persistence layer plugin (ejb in this case). I have seen some discussion as to a solution on the dev list but have seen no activity in the cvs repository. We have put together a solution that we would like comment on so that together we can solve this issue and thus maximize the benefits of each plugin.
Our solution is to create a plugin that acts as the "glue" between the action and persistence layer plugins, this we are calling the Adapter. This adapter knows which action and persistence plugin it is generating for. The end result is a generated delegate class that performs all the persistence layer specific CRUD activities. In this way we can abstract all the persistence specific syntax so the action plugin can run with all back-end plugins.
Currently to configure the adapter plugin you must create a set of velocity templates for each back-end plugin you want to support. These files include the implementation of persistence methods such as create, delete, edit, findAll, etc... We thought that this would make it easy for someone who is creating a new persistence plugin to just create these few file and have their plugin fit with all the action layer plugins that already exist, instead of having to generate some java class which isn't needed.
I am attaching the AdapterPlugin.java file which has javadocs that should show what we are currently doing at a technical level. We have refactored the struts plugin to use the cmp20 plugin through this mechanism and it works fine. I have seen some activity on the dev list regarding commits for value object support in cmp20 which is great, our impl does not yet use this but it would be easy to change.
As of yet this does not yet provide a generic way for the action plugin to get the related objects from the vo it is working with but I think this is a fairly easy extension one could do through the delegate. I would like to have this be driven by need which we hope to see very soon from our Turbine plugin.
This plugin relies on a patch to KindFileResourceLoader I submitted that will allow the plugin to load files from the classpath.
|Status||Open [ 1 ]||Closed [ 6 ]|
|Resolution||Duplicate [ 3 ]|