Hi,
Can I override existing service by creating service with same name? Or is there any other way to reimplement/extend existing service with custom code without affecting code of original service or rest of ofbiz? My problem is same as this http://www.mail-archive.com/user@.../msg17613.html but this thread is unanswered. Thanks in advance ya |
Not override but replace.
you can comment out the orginal service then put in your own, for your system. you can put this in a different service_01.xml and put in the ofbiz-component.xml so it gets loaded. Ján Valkovič sent the following on 6/22/2009 9:55 AM: > Hi, > Can I override existing service by creating service with same name? Or > is there any other way to reimplement/extend existing service with > custom code without affecting code of original service or rest of ofbiz? > My problem is same as this > http://www.mail-archive.com/user@.../msg17613.html but this > thread is unanswered. > > Thanks in advance > ya > > > -- BJ Freeman http://www.businessesnetwork.com/automation http://bjfreeman.elance.com http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro Systems Integrator. |
In reply to this post by Ján Valkovič
From what I have experienced, you can create a service with the same name and as long as it is "deeper in the service path" it will override. What we experienced is that we could override service implementations from our hot-deploy allocations (they would override what was defined in application or framework).
The spot that we got into some difficulties is where the service interface (its definition) had changed. Hence, you would potentially be plugging in a service with different requirements which may be used throughout Ofbiz. As a result, the standard we came up with is that if you truly want to replace the functionality do _not_ change the service definition. If you are changing the intentions of the service, you would have a new service def with a uniquely named service. We were going to make a recommendation that Ofbiz would produce a start-up exception if someone had overridden a service "badly". That is to say they have overridden but they have made changes to the service's definition. Anyone have any thoughts on this?
|
Yes, that would be a good thing to do. Overriding a service and removing attributes or changing their data type, or in some cases even changing the option flag and such, is likely to cause problems. -David On Jun 22, 2009, at 11:37 AM, Bob Morley wrote: > > From what I have experienced, you can create a service with the same > name and > as long as it is "deeper in the service path" it will override. > What we > experienced is that we could override service implementations from our > hot-deploy allocations (they would override what was defined in > application > or framework). > > The spot that we got into some difficulties is where the service > interface > (its definition) had changed. Hence, you would potentially be > plugging in a > service with different requirements which may be used throughout > Ofbiz. As > a result, the standard we came up with is that if you truly want to > replace > the functionality do _not_ change the service definition. If you are > changing the intentions of the service, you would have a new service > def > with a uniquely named service. > > We were going to make a recommendation that Ofbiz would produce a > start-up > exception if someone had overridden a service "badly". That is to > say they > have overridden but they have made changes to the service's > definition. > Anyone have any thoughts on this? > > > yanick wrote: >> >> Hi, >> Can I override existing service by creating service with same name? >> Or >> is there any other way to reimplement/extend existing service with >> custom code without affecting code of original service or rest of >> ofbiz? >> My problem is same as this >> http://www.mail-archive.com/user@.../msg17613.html but >> this >> thread is unanswered. >> >> Thanks in advance >> ya >> >> >> >> > > -- > View this message in context: http://www.nabble.com/Overriding-service-non-invasively-tp24151335p24152019.html > Sent from the OFBiz - User mailing list archive at Nabble.com. > |
Free forum by Nabble | Edit this page |