Peter Donald wrote: > > On Thu, 5 Jul 2001 09:03, Berin Loritsch wrote: > > > That depends on the component. If your component > > > requires deferred or > > > non-critical exception handling, try/catch isn't > > > good enough. That's why > > > Mr Megginson came up with org.xml.sax.ErrorHandler. > > yep ;) Basically I see ErrorHandler as a strategy for dealing with the > exception aspect. Damn useful it is but I am a loss at how to integrate it > generically.
You'd be surprised at how closely the semantics of Error Handling in this manner are closely tied to the semantics of the contracts for a particular system. IOW, Each EventHandler strategy pretty much needs their own ErrorHandler. There are different types and classes of errors that will only work for certain systems. Also, you have to realize (using the venerable SAX API as an example) that SAX is a PITA to use if you are going to do complex transformations on the fly. It is easier to transform a DOM than SAX. I am not saying it can't be done (just look at Xalan 2), I am saying that there are always different approaches to solving a problem space. You have to evaluate which tool is the right one for the job. > > Component creation and lifecycle management are not > > cleanly served by that approach. > > Depends on what you call "lifecycle management" ;) I have found it useful in > two places. One is in containers to implement different exception handling > strategies and one is in the "service" part of an "active" component. ie Each > time you call the relevent service method you pass in relevent handler. I call lifecycle management the process of calling the lifecycle methods: comp.setLogger(logger) comp.contextualize(context) comp.configure(conf) comp.parameterize(params) comp.compose(manager) comp.initialize() comp.start() etc. This can be done in a number of ways--so if you have a particular method in Phoenix which would benefit from an ErrorHandler of sorts. The thing is that if an exception is thrown at any time during the initialization phase, the Component cannot be guaranteed to be in a sane state--so the only safe assumption is that we cannot use the component that threw exceptions during initialization.
smime.p7s
Description: S/MIME Cryptographic Signature
