Re: Methods to EventForwardingFactory

Srinivas Yermal <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
I completely agree. Instead of eating up the exceptions we should just 
throw them up, so that the ApplicationAssembler handles it and I think 
there shouldnt be any problem doing that.

What I am trying to achieve here is this -
    <event-interest event="com.encover.portal.events.GetCompanyList"
        
factory="org.enhydra.barracuda.core.event.helper.EventForwardingFactory">
        <set-property name="forwardEvent">
            com.encover.portal.events.RenderCompanyList
        </set-property>
    </event-interest>

I dont want to specify a new variable and a factory definition in my 
gateway (or elsewhere for that matter) everytime I have a forwarding 
event. As far as the registration goes, the application assembler does a 
wonderful job. The problem with having a method like 
setForwardEvent(BaseEvent bevent) is that the assembler cannot handle it 
(setMethod method in DefaultApplicationAssembler handles only primitive 
types). I might be barking at the wrong tree to start with, if so please 
correct me.

Hope this helps.
Thanks,
Srini.

Jeremy L Rosenberger wrote:

>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);
>>>        }
>>>    }
>>>      
>>>
>
>  
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.