Dan,
I’ll talk about the ORM side in a minute.
With your Module I would take a little more interest in the on/un load of a module, I mention this because I have interceptors that are for the module only. And use something like this.
Function onLoad() {
controller.getInterceptorService().registerInterceptor(interceptorClass=interceptorClass, interceptorName=interceptorName);
}
This way you can add your interceptors, and of course use the unregister in the onload to remove them. I am sure that the addRoutes can also be done this way too.
I have also been thinking about the ORM side with modules as well, especially on the side of being portable and plug and play. The only catch is that no matter what the application has to be stopped and restarted for the ORM to take a hold of the changes, which got me thinking in a lot of different scenarios.
I try to keep eveything that is related together as much as possible, so if I can load a module up I would also like to try to keep the domains / entities in the module as well. Keeping in mind that I thought one could then copy the files around on unload/unregister, but I thought that would not be as efficent as it could be.
And this is still something that I am thinking about as well, and I think the best solution I can think of is something like this – psuedo code following.
onLoad() {
Register(ORMLocation);
}
onUnload() {
deRegister(ORMLocation);
}
These two methods could then create a file that can be loaded as xml, json or whatever tickles your fancy, that could also be used in the Application.cfc itself.
So you could say do something like this in the Application.cfc :
this.ormsettings.cfclocation = getORMLocations();
The idea is that the modules could then add/remove themselves from here, and these locations could then be loaded and used when the application has been restarted.
Now the only problem I had with this was that I wanted one model/service to handle the Module side, as well as the application.cfc side of things. Which is the bit I am trying to sortout now, but for now loading the object and calling the method could surfice. Just means if you move the file that you need to make sure you make this change in the Application.cfc
That was what I was thinking so far.
Regards,
Andrew Scott
http://www.andyscott.id.au/