RE: Methods to EventForwardingFactory
"Christian Cryder" <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
I agree, that's definitely the downside of having a String reference to a first class Event object. The other issue that I wonder about is the whole event registration thing - right now, when you specify an event factory, you have to also tell the event broker that you are interested in it (or at least, whatever consumes it does). Srinivas, can you give us more information on exactly what you are trying to accomplish here? That way maybe we can think of alternative approaches, if they might be more applicable. Christian ---------------------------------------------- Christian Cryder Internet Architect, ATMReports.com Project Chair, BarracudaMVC - http://barracudamvc.org ---------------------------------------------- "Coffee? I could quit anytime, just not today" > -----Original Message----- > From: [email protected] > [mailto:[email protected]]On Behalf Of Jeremy L > Rosenberger > Sent: Tuesday, September 30, 2003 3:57 PM > To: [email protected] > Subject: RE: [Barracuda] Methods to EventForwardingFactory > > > A method like this, in its current form, is asking for trouble. It > "eats" exceptions that the application would probably want to know about > sooner (by having the opportunity to catch them) rather than later (by > noticing a problem with the application, going back through the logs, > and happening to notice a ClassCastException or something like that). > > That's my opinion, anyway. > > Cheers, > Jeremy > > On Tue, 2003-09-30 at 19:33, Christian Cryder wrote: > > > Hmmm...interesting idea. Anyone have any obj > > > > > public void setForwardEvent(String eventClass) { > > > if (null == eventClass) return; > > > try { > > > Class c = Class.forName(eventClass); > > > fevent = (BaseEvent)c.newInstance(); > > > } catch (ClassNotFoundException nfe) { > > > logger.error("Event class " + eventClass + " not > found", nfe); > > > } catch (InstantiationException ie) { > > > logger.error("Error instantiating " + eventClass, ie); > > > } catch (IllegalAccessException iae) { > > > logger.error("Error instantiating " + eventClass, iae); > > > } catch (ClassCastException ce) { > > > logger.error("The class " + eventClass + " should be a > > > BaseEvent", ce); > > > } > > > } > > -- > > Jeremy L. Rosenberger * [email protected] > http://www.frii.com/~jeremy/ > > _______________________________________________ > Barracuda mailing list > [email protected] > http://barracudamvc.org/lists/listinfo/barracuda