Hi,
I've had a sniff of coldspring over the last year, and I'm afraid it's gone to my head J
I was trying to customise my installation of reactor, to make a few minor improvements. Nothing major, in this case I just wanted to pass some extra attributes in the reactor.xml and have them added to the generated metadata files.
I managed to do this quite easily by editing the core files, but I feel uneasy about doing this. Putting my coldspring hat on, I thought it would be cleaner to sub-class the CFCs I wanted changed, and over-ride the methods.
This has turned out to be a lot more complicated than I thought it would be. I started off by managing the singleton objects such as reactorFactory.cfc with coldspring, but I hadn't realised how many transient objects are created all over the place. I've had to sub-class a lot of objects so far, and over-riding some of the longer methods just to change a createObject() call doesn't seem right.
I wondered whether it would make sense, to move all the generation of these transient objects to the reactorFactory. That way, people like me can customise their reactor installation just by sub-classing the reactor factory and the individual objects they are interested in.
As an example, I wanted to change the working of the objectTranslator.generateObject() method.
To do this currently, I sub-class objectTranslator and over-ride the generateObject() method.
To create the sub-classed objectTranslator instead of the usual one, I need to sub-class objectfFactory and over-ride the create() method. The create() function has over 100 lines of code, but I just need to change one line:
<cfset ObjectTranslator = CreateObject("Component", "reactor.core.objectTranslator").init(getConfig(), DbObject, this) />
to
<cfset ObjectTranslator = CreateObject("Component", "myProject.myObjectTranslator").init(getConfig(), DbObject, this) />
I also need to get my version of ObjectFactory.cfc used instead of the default one, and so on down the chain. All-in-all, it's a lot of customisation just to change a single function.
Now if the line:
<cfset ObjectTranslator = CreateObject("Component", "reactor.core.objectTranslator").init(getConfig(), DbObject, this) />
had instead been:
<cfset ObjectTranslator = getReactorFactory().createObjectTranslator(getConfig(), DbObject, this) />
things would be a whole lot easier.
All I would have needed to do is sub-class the reactorFactory, and over-ride the createObjectTranslator() method to generate my sub-classed ObjectTranslator.
Now obviously this would be quite a lot of work, to add this feature to reactor, but it would make it a lot more flexible. I'd like to know what people think. I'm still relatively new to coldspring, factories etc, so I'm expecting to be shot down in flames J
Thanks,
Gareth
****************************************************
This email is sent for and on behalf of Halliwells LLP.
Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office together with a list of those non members who are referred to as partners. We use the word ?partner? to refer to a member of the LLP, or an employee or consultant with equivalent standing and qualifications. Regulated by the Solicitors Regulation Authority.
CONFIDENTIALITY
This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500.
For more information about Halliwells LLP visit www.Halliwells.com.
****************************************************
This email is sent for and on behalf of Halliwells LLP.
Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office together with a list of those non members who are referred to as partners. We use the word “partner” to refer to a member of the LLP, or an employee or consultant with equivalent standing and qualifications. Regulated by the Solicitors Regulation Authority.
CONFIDENTIALITY
This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500.
For more information about Halliwells LLP visit